//............................................................................................
function newBareWindow(dest, w, h) {
	var win;
	var x = (window.screen.width-w)/2;
	var y = (window.screen.height-h)/2;
	var offset = "screenX=" + x + ",screenY=" + y + ",left=" + x + ",top=" + y + ",width=" + w + ",height=" + h + ",";
	win = window.open (dest, "", offset + "scrollbars=0,resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0");
	//win = window.showModalDialog (dest);
}	//newWindow

//............................................................................................
function newWindow(dest, w, h) {
	var win;
	var x = (window.screen.width-w)/2;
	var y = (window.screen.height-h)/2;
	var offset = "screenX=" + x + ",screenY=" + y + ",left=" + x + ",top=" + y + ",width=" + w + ",height=" + h + ",";
	win = window.open (dest, "", offset + "scrollbars=1,resizable=1,toolbar=0,location=0,directories=0,status=1,menubar=1");
}	//newWindow


//............................................................................................
// Used on the PostJob page to schedule a time to automatically save the form
// so the recruiter does not time out while posting a job.
function postjobTimer(m,c) {
	var mins = 60 * 1000 * m;
	var cmd = "postJob('" + c + "');";
	setTimeout(cmd,mins);
}
//............................................................................................
// Called by postjobTimer function above. Simulates a click on the 'Save' button
// on the PostJob form.
function postJob(c) {
	var f = document.forms[0];
	f[c].click();
}
//............................................................................................
function setTimer(m,root) {
	var mins = 60 * 1000 * m;
	var cmd = "timerWarning('" + root + "');";
	setTimeout(cmd,mins);
}
//............................................................................................
function timerWarning(root) {
	//This is called after a certain period of inactivity and
	//displays a warning to the user that they are about to timeout.
	//If they click the OK button, their session will be touched and renewed.
	//If they do nothing then after x-minutes (3), the timerOut function will be called
	newBareWindow(root + "/Util/Timeout_Warning.aspx",500,150);
}
//............................................................................................
function setTimer2(root) {
	//Called in the <body> tag of the WARNING dialog. Called this way because
	//of issues with all the quote characters in the html page
	var mins = 60 * 1000 * 3;	//set to 3 minutes
	var cmd = "timerLogoff('" + root + "');";
	setTimeout(cmd,mins);
}
//............................................................................................
function timerLogoff(root) {
	//set this window to a new page
	this.location = root + "/Util/Timeout_Logoff.aspx";
	//set the base page back to home
	opener.location = root + "/main.aspx";
	//close this window
	//window.close();
}
//............................................................................................
function fxnParseIt(query) {
	var sInputString = 'asp and database';

	sText = query;
	sText = sText.replace(/"/g,"");
	if (sText.search(/(formsof|near|isabout)/i) == -1) {
		sText = sText.replace(/ (and not|and) /gi,'" $1 "');
		sText = sText.replace(/ (or not|or) /gi,'" $1 "');
		sText = '"' + sText + '"';
	}

	return sText;
}