//Begin Disable right mouse click
var message = "Function Disabled!";

function clickIE()
{
	if(document.all) 
	{
		alert(message);
		return false;
	}
}

function clickNS(e) 
{
	if(document.layers||(document.getElementById&&!document.all)) 
	{
		if (e.which==2||e.which==3) 
		{
			//alert(message);
			//return false;
		}
	}
}

if(document.layers) 
{
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = clickNS;
}
else
{
	document.onmouseup = clickNS;
	document.oncontextmenu = clickIE;
}
	 
document.oncontextmenu=new Function("return false")

//End Disable right mouse click


//Hide status bar msg II script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus


//Removes Leading and Trailing spaces.
function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 


// Replaces text with by in string
function replace(string, text, by) 
{
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) 	return string;
		
    var i = string.indexOf(text);
    if ((!i)&&(text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);
  
    return newstr;
}

function ReplaceQueryStringParameterBy(queryString, newQueryStringParameterName, newQueryStringParameterValue)
{
	var patt1 = "^ignore[\\s]*=[\\s]*1\&?";
	var patt2 = "\&?ignore[\\s]*=[\\s]*1";
	var patt = eval("/(" + patt1 + ")|(" + patt2 + ")/ig");

	queryString = queryString.replace(patt, "");
	
	var pattern = eval("/" + newQueryStringParameterName + "[\\s]*=[\\s]*[^\&]*/i");
	var pos = queryString.search(pattern);
	var newParameter = newQueryStringParameterName + "=" + newQueryStringParameterValue;
	if(pos >= 0)
	{
		queryString = queryString.replace(pattern, newParameter);
	}
	else
	{
		queryString = queryString + (queryString==""?"":"&") + newParameter;
	}
	return queryString;
}

function AddParameterToURL(url, parameter)
{
	var pos = url.indexOf("?");
	if(pos == -1)
	{
		url = url + "?" + parameter;
	}
	else
	{
		url = url + "&" + parameter;
	}
	return url;
}


function Right(str, n)
/***
        IN: str - the string we are RIGHTing
            n - the number of characters we want to return

        RETVAL: n characters from the right side of the string
***/
{
        if (n <= 0)     // Invalid bound, return blank string
           return "";
        else if (n > String(str).length)   // Invalid bound, return
           return str;                     // entire string
        else { // Valid bound, return appropriate substring
           var iLen = String(str).length;
           return String(str).substring(iLen, iLen - n);
        }
}

function ExportMe(param)
{
var iwin= window.open('print_resume_frame.asp?eParam=' + param,'mypop','height=640,width=820,resizable=0,scrollbars=0');
}

function print_request(param)
{
	window.open('print_request_frame.asp?eParam='+param,'print_req','height=640,width=820,resizable=0,scrollbars=0');
}

function print_template(id)
{
	window.open('print_template_frame.asp?eParam=' + id,'print_template','height=640,width=820,resizable=0,scrollbars=0');
}


function ShowStatusLegend()
{
window.open('MS_Display_Status_Legend.asp','Status_Legend','height=300,width=450,resizable=0,scrollbars=0');
}


function ValidateUserEntry(frmControl,ctrlName)
	{
		// Get the value of the UserName text box
		var strUserName = String(eval('document.' + frmControl + '.value'));
		var strCurrentChar;
		
		// This variable will determine if our string is valid
		var bolValidChar = true;
		
		// Step through the UserName one character at a time...
		for (var iLoop=0; iLoop < strUserName.length; iLoop++)
		{
			// Check to see if the current character is valid
			strCurrentChar = strUserName.substring(iLoop,iLoop+1);
			
			if (
				// if A-Z...
				(strCurrentChar >= 'A' && strCurrentChar <= 'Z')
				// or if a-z...
				|| (strCurrentChar >= 'a' && strCurrentChar <= 'z')
				// or if 0-9...
				|| (strCurrentChar >= '0' && strCurrentChar <= '9')
				// or if dash or underscore
				|| strCurrentChar == '-' || strCurrentChar == '_' || strCurrentChar == '+'  || strCurrentChar == '#' || strCurrentChar == '.' || strCurrentChar == ',' || strCurrentChar == '*' || strCurrentChar == '/' || strCurrentChar == ' '
			   );
			   
			   // We have a valid string... do nothing.
			  else
			   // We have an invalid string, set the flag
			   bolValidChar = false;
		}
		
		// If we have an invalid UserName, alert the user
		if (!bolValidChar)
		{
			var strError = "You have entered invalid characters in the " + ctrlName + " field.";
			strError += "\nYour entry can only contain the following characters:";
			strError += "\n\tA-z\n\ta-z\n\t0-9\n\t- (dash/minus)\n\t_ (underscore)\n\t+ (plus)\n\t# (pound/hash)\n\t. (dot)\n\t, (comma)\n\t* (asterik)\n\t\/ (slash)\n\t (space)";
			strError += "\nPlease correct your entry and retry"			
			alert(strError);
			eval('document.' + frmControl + '.focus()');
		}
		
		return bolValidChar;
	}
