/* 08.12.2003 tps Added PopupCalendarWindow function as alternative to GetDate
		for forms that do not use DataLists.
	 04.19.2007 tps Fixed PM time formatting bug in GetTime().
	 10.01.2008 tps Fix for creating URLs for lookup popups on Blue Hill hosting.
									Added method GetWebAppRoot & modified SenderTest.
*/

function isDirty() {
            return _isDirty;
}

var _isDirty = false;

function checkDirty() {
	if (_isDirty) 
	{
		return confirm("do you want to do this?");
    }
}

function markDirty() {
	ctl = document.getElementById(GetRunTimeID('txttest'));
	ctl.value = "0"
	
	ctl2 = document.getElementById(GetRunTimeID('LblDirty'));
	ctl2.innerHTML = "Unsaved Changes! Remember to save before leaving the page.";
	document.getElementById('dirtyFeedback').className = "SysMessageChanged";
	//ctl2.style.backgroundColor= "Red";
	//document.getElementById('LblDirty').innerHTML = "Unsaved Data! Remember to save before leaving the page.";
	_isDirty = true;
}

function txttestCheck() {
	ctl = document.getElementById(GetRunTimeID('txttest'));
	ctl.value = "0"
	//alert(ctl.value);
	document.getElementById('dirtyFeedback').innerHTML = "Unsaved Change Found";
	document.getElementById('dirtyFeedback').className = "SysMessageChanged";
	_isDirty = true;
}

/////////////////////Maxlength function used to textpox that have texmode=multiline as generic maxlength does not work.
 function checkMaxLength(e,el) {
 switch(e.keyCode) {
 case 37: // left
 return true;
 case 38: // up
 return true;
 case 39: // right
 return true;
 case 40: // down
 return true;
 case 8: // backspace
 return true;
 case 46: // delete
 return true;
 case 27: // escape
 el.value='';
 return true;
 }
 return (el.value.length<el.getAttribute("TAMaxLength"));
 }

/////////////////////Used by Emp_Finder.ascx --being
function testHRMS_Scripts()
{ alert('HRMS_Scripts found!');
}
function doHourglass()
{
  document.body.style.cursor = 'wait';
}

var ChildWin = null;
function TimeOutWarning(sIncativityMinutes, sWarningDuration, sTimeOutURL)
{
	MyCtrl = GetRunTimeID('BtnSavePerf');	//For Quinn. They want the save click to happen before logout
		
	if(MyCtrl != null)						//For Quinn.
	{
		HitEnter(GetRunTimeID('BtnSavePerf'));
		DoTimeOutMsg(sIncativityMinutes, sWarningDuration, sTimeOutURL);
		//DoTimeOutMsg(sIncativityMinutes, sWarningDuration, sTimeOutURL);
	}	
	else									//Everyone Else
	{
		DoTimeOutMsg(sIncativityMinutes, sWarningDuration, sTimeOutURL);
	}
}

function DoTimeOutMsg(sIncativityMinutes, sWarningDuration, sTimeOutURL)
{
	var iTimeToTimeOut = sWarningDuration
	var sTimeToTimeOut = iTimeToTimeOut.toString();
	var sTimeTimeOut = GetTime(iTimeToTimeOut);	

	windowprops = "left=150,top=160,width=600,height=180,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"; 
	
	if (ChildWin)
		return false;
 
	ChildWin = window.open('HRMS_Modules/General/HR_PopPup/HRMS_TimeOutMsg.aspx?Im='+ sIncativityMinutes + '&Tto=' + sTimeTimeOut+ '&Wd=' + sWarningDuration + '&URL=' + sTimeOutURL, "ChildWin", windowprops);
	
	setTimeout("SendToURL('" + sTimeOutURL + "')", sWarningDuration*60000);
}

function SendToURL(sTimeOutURL)
{
	//alert('redirecting...');
	var Path = SenderTest(sTimeOutURL);
	
	
	window.location.href = Path;
	//window.location.href = sTimeOutURL;
}


function GetTime(AddMinutes)
{
	// AddMinutes is a string representation of the number of
	// minutes before the page times out.

	// Calculate when the page times out.
	var currentTime = new Date();
	var msToExpiration = parseInt(AddMinutes) * 60 * 1000;
	var expirationTime = new Date(currentTime.getTime() + msToExpiration);

  // Display the time in 12-hour clock format "hh:mm AM|PM"
  var hours = expirationTime.getHours();
	var minutes = expirationTime.getMinutes();

	// Pad the minutes with leading zeros, if required
	var displayMinutes = ( minutes < 10 ? "0" : "" ) + minutes;

  // Convert the hours component to 12-hour format if needed
  var displayHours = ( hours > 12 ) ? hours - 12 : hours;

  // Convert an hours component of "0" to "12"
  displayHours = ( displayHours == 0 ) ? 12 : displayHours;

	// Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( hours < 12 ) ? "AM" : "PM";

  return displayHours + ":" + displayMinutes + " " + timeOfDay;
}

//TIMER POSTBACK
var secs
var timerID = null
var timerRunning = false
var delay = 1000
//function DoPostback()
function DoPostback(osecs)
{
    // Set the length of the timer, in seconds
    secs = osecs//10
    StopTheClock()
    StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        document.location.reload();

        //alert("You have just wasted 10 seconds of your life.")
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}


//////////////////////////////////

   function FocusMe(ctlID)
   {
		ctl = document.getElementById(GetRunTimeID(ctlID));
		
		if(ctl != null)
			if(!ctl.disabled)
				ctl.focus();
   }
   
  function GetRunTimeID(CtrID)
   {
   		ctl = document.getElementById(CtrID);

		if(document.getElementById(CtrID) == null)//If controld cannot be found find controld ending with CtrID
		{
			//htmlColl = document.getElementsByTagName("*");
		
			//if(document.all)all_obj=document.all;
			//	htmlColl = document.all;
			//else if(document.getElementsByTagName && !document.all)
			//	htmlColl = document.getElementsByTagName("*");	// all_obj=document.getElementsByTagName("*");

			if(document.getElementsByTagName("*").length != 0)
				htmlColl = document.getElementsByTagName("*");
			else if(document.all.length != 0)
				htmlColl = document.all;
			else
				alert('GetRunTimeID Error')

		
			//htmlColl = document.all;
			
			for(nIdx = 0; nIdx < htmlColl.length; nIdx++)
			{
				ctl = htmlColl[nIdx];
				if(typeof(ctl.id) != "undefined")
				{
					nPos = ctl.id.indexOf(CtrID);
					if(nPos != -1 && ctl.id.substr(nPos) == CtrID)
					{
						return(ctl.id)
						break;
					}
				}
				else
					ctl = null;
			}
		}
		else 
			return (CtrID)
	}
	
function FormatPhone(ctlID, template)
   {
		var phone = document.getElementById(GetRunTimeID(ctlID));
    	var digits = phone.value.replace(/[^0-9]/ig, ''); 
    	var templatedigits = template.replace(/[^0-9]/ig, ''); 
		//var template = "(999) 999-9999";
		
		if(phone.value.indexOf('x') == -1)	//if they entre x or ext. don't validate
		{		
			//If they added 1 or 0 in front of phone number
			if(digits.length == 11)
				if(digits.substring(0,1) == 0 || digits.substring(0,1) == 1)
					digits = digits.substring(1,11);
			
			//alert(digits.length);
			

			if(digits.length == templatedigits.length)
			{
				var FormattedVal = '';		
				var NineCounter = 0;	
				
				for (i=0;i<template.length;i++)
				{
					if(template.substring(i, i+1) == 9)
					{
						FormattedVal += digits.substring(NineCounter, NineCounter+1)
						NineCounter = NineCounter + 1;
					}
					else
					{
						FormattedVal += template.substring(i, i+1)
					}
				}
					//alert('hit');
					phone.value = FormattedVal;
					//alert(FormattedVal);
				}      			
			//	else
			//		alert(digits.length + ':' + templatedigits.length);
		}
		
   }
   
   function FormatZIP(ctlID, template)
   {
		var phone = document.getElementById(GetRunTimeID(ctlID));
    	var digits = phone.value.replace(/[^0-9]/ig, ''); 
    	var templatedigits = template.replace(/[^0-9]/ig, ''); 
		//var template = "99999";
		
		if(digits.length == templatedigits.length)
		{
			var FormattedVal = '';		
			var NineCounter = 0;	
			
			for (i=0;i<template.length;i++)
			{
				if(template.substring(i, i+1) == 9)
				{
					FormattedVal += digits.substring(NineCounter, NineCounter+1)
					NineCounter = NineCounter + 1;
				}
				else
				{
					FormattedVal += template.substring(i, i+1)
				}
			}
			phone.value = FormattedVal;
		}      			
		//else
		//	alert(digits.length + ':' + templatedigits.length);
		
   }
   
function FormatSSNO(ctlID, template)
   {
		var phone = document.getElementById(GetRunTimeID(ctlID));
    	var digits = phone.value.replace(/[^0-9]/ig, ''); 
    	var templatedigits = template.replace(/[^0-9]/ig, ''); 
		//var template = "(999) 999-9999";
		
		if(digits.length == templatedigits.length)
		{
			var FormattedVal = '';		
			var NineCounter = 0;	
			
			for (i=0;i<template.length;i++)
			{
				if(template.substring(i, i+1) == 9)
				{
					FormattedVal += digits.substring(NineCounter, NineCounter+1)
					NineCounter = NineCounter + 1;
				}
				else
				{
					FormattedVal += template.substring(i, i+1)
				}
			}
			//alert('hit');
			phone.value = FormattedVal;
			
			//alert(FormattedVal);
		}      			
	//	else
	//		alert(digits.length + ':' + templatedigits.length);
		
   }
	
//FORCE TEXTBOX VALUES TO UPPER CASE
	function convertUpperCase(keyItem)  
	{     setTimeout('ConvertKey("' +GetRunTimeID(keyItem)+ '")', 1);	}
	
	function ConvertKey(selObj)  
	{    document.getElementById(selObj).value = document.getElementById(selObj).value.toUpperCase();	}
//FORCE TEXTBOX VALUES TO UPPER CASE
    
    
    function HitEnterOLD(btnID)
    {
		btn = document.getElementById(btnID);
		btn.click();
    }
    
    function PreFillMe(CtrlToFill, CtrlReadFrom)
	{
		MyCtrl = GetRunTimeID(CtrlToFill);
		SrcCtrl = GetRunTimeID(CtrlReadFrom);
		
		var OrigVal = document.forms[document.forms[0].name].elements[MyCtrl].value;
		OrigVal = trim(OrigVal);
		
		if(OrigVal == "")
		{
			var NewVal = document.forms[document.forms[0].name].elements[SrcCtrl].value;
			document.forms[document.forms[0].name].elements[MyCtrl].value = NewVal;
		}	
	}
	
	function ReturnValueToParent(Idcode, strFormName, strClient_ID, strDL_ID, strCtrl_ID, DoPostback, DoClose)
	{
		if(Idcode == "&nbsp;")
			Idcode = "";

		window.opener.document.forms[strFormName].elements[strClient_ID + "_" + strDL_ID + "__ctl0_" + strCtrl_ID].value = Idcode;

		if(DoPostback == true)
			window.opener.__doPostBack('_ctl0$' + strDL_ID + '$_ctl0$lb_PostBack','');
		
		if(DoClose == true)
			Close()
	}
	
	function Close()
	{	window.close();	}
	
	function FillMe(CtrlToFill, sValue)
	{
		MyCtrl = GetRunTimeID(CtrlToFill);
		//SrcCtrl = GetRunTimeID(CtrlReadFrom);
		
		//var OrigVal = document.forms[document.forms[0].name].elements[MyCtrl].value;
		sValue = trim(sValue);
		
		alert(sValue);
		alert(MyCtrl);
		//if(sValue != "")
		//{
			//var NewVal = document.forms[document.forms[0].name].elements[SrcCtrl].value;
			document.forms[document.forms[0].name].elements[MyCtrl].value = sValue;
		//}	
	}
	

	function trim(s) 
	{
   		// Remove leading spaces and carriage returns
   		while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
   		{ s = s.substring(1,s.length); }
	     
   		// Remove trailing spaces and carriage returns
	while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
   		{ s = s.substring(0,s.length-1); }
	     
   		return s;
	}

//Validation Functions Validation is based on the preference table values. Number of Numbers used to compare with preference's number of numbers.
	function ValidateFor5_9(source, arguments)//For Zip 5_9 --> 99999|99999-9999
    {   ValidateForMulipleNumber(source, arguments, '5_9');	    }

	function ValidateFor5(source, arguments)//For Zip 5  --> 99999
    {    ValidateForNumber(source, arguments, 5);	}

	function ValidateFor6(source, arguments)
    {    ValidateForNumber(source, arguments, 6);	}

	function ValidateFor7(source, arguments)
    {    ValidateForNumber(source, arguments, 7);	}

	function ValidateFor8(source, arguments)
    {    ValidateForNumber(source, arguments, 8);	}
    
	function ValidateFor9(source, arguments)
    {    ValidateForNumber(source, arguments, 9);	}
    
    function ValidateFor10(source, arguments)
    {    ValidateForNumber(source, arguments, 10);	}
	    
    function ValidateFor11(source, arguments)
    {    ValidateForNumber(source, arguments, 11);	}
    
    function ValidateFor12(source, arguments)
    {    ValidateForNumber(source, arguments, 12);	}

	function ValidateForNumber(source, arguments, Digits)
	{
		var cc = arguments.Value;
		var digits, total;

		var digits = cc.replace(/[^0-9]/ig, ''); 
		var Asterix = cc.replace(/[^*]/ig, '');		//KN 09/05/06 Due to SSNO MASKING MUST AT * TO COUNT

		//if(digits.length == Digits)
		if(digits.length + Asterix.length == Digits)
		{
			arguments.IsValid = true;
			return; 
		}
		else
		{
			arguments.IsValid = false;
			return; 
		}
	}
	
	//For Zip 5_9 --> 99999|99999-9999
	function ValidateForMulipleNumber(source, arguments, AllowedDigits)
	{
			var IsValid = false;
			var digits = arguments.Value.replace(/[^0-9]/ig, '').length; //Textbox digit lenght
			var IncompleteNumber = '';	//var CompleteNumber = '';
							
			for (i=0;i<=AllowedDigits.length;i++)
			{
				if(i == AllowedDigits.length)	 //Last Index
				{
					if(IncompleteNumber == digits)
						IsValid = true;
	
					IncompleteNumber = '';
				}
				else if(AllowedDigits.substring(i,i+1) == "_")	//'_' found
				{					
					if(IncompleteNumber == digits)
						IsValid = true;

					IncompleteNumber = '';
				}
				else
					IncompleteNumber = IncompleteNumber + AllowedDigits.substring(i,i+1);
			}
			//alert(IsValid);
			arguments.IsValid = IsValid;
			return; 
	}
	    
    function KeyDownHandler(MyEvent, btnID)
    {
        // process only the Enter key
        if (MyEvent.keyCode == 13)
        {
			if(IsIE())// cancel the default submit. Fire this only if IE browser used
			{
				event.returnValue=false;
				event.cancel = true;
			}
			//alert(IsIE());
            HitEnter(GetRunTimeID(btnID));
        }
    }
    
   // function whichKey(MyEvent, btnID)
   // {
   // alert(GetRunTimeID(btnID));
   //  alert(MyEvent.keyCode);
   // //  if (event.keyCode == 13)
   //   //  {
//			// cancel the default submit
  //        //  event.returnValue=false;
    //       // event.cancel = true;
      //      alert(btnID);
   //         HitEnter(GetRunTimeID(btnID));
   //  //   }
   // }
    
    function HitEnter(btnID)
    {
		btn = document.getElementById(btnID);
		//alert('hit'+btnID);
		btn.click();
    }
    
	function IsIE()
	{
		var browserName=navigator.appName; 
		if(browserName=="Microsoft Internet Explorer")
			return true;
		else
			return false;
	}
    
    //Changes Enter Key press event to tab key press event
	function EnterGoNext()
	{
		if (event.keyCode == 13)
		event.keyCode = 9;
	}
    
/*function HLR(RowIndex)
{
  var nRows;
  var iCouter;
  var table;
 
	if(document.getElementById("_ctl0__ctl2") != null)
   { table = document.getElementById("_ctl0__ctl2");   }
   else if (document.getElementById("_ctl3__ctl0__ctl2") != null)
   { table = document.getElementById("_ctl3__ctl0__ctl2");   }
   else if (document.getElementById("_ctl1__ctl0__ctl2") != null)
   { table = document.getElementById("_ctl1__ctl0__ctl2");   }
   
   if(table != null)
   {
		table.style.backgroundColor="#C8D9E0";
		nRows = table.rows.length;
		for (iCouter=0; iCouter<nRows; iCouter++)
		{
		if(iCouter == RowIndex)
		{
		 table.rows(iCouter).style.backgroundColor="#C8D9E0";
		}
		else 
		{table.rows(iCouter).style.backgroundColor="white";	}
	  }
  }

}
 */
///Capture Single/Double Click Events
 var dcTime=250;    // doubleclick time
 var dcDelay=100;   // no clicks after doubleclick
 var dcAt=0;        // time of doubleclick
 var savEvent=null; // save Event for handling doClick().
 var savEvtTime=0;  // save time of click event.
 var savTO=null;    // handle of click setTimeOut
 
 function handleWisely_(which) {
    switch (which) {
     case "click": 
       savEvent = which;
       d = new Date();
       savEvtTime = d.getTime();
       savTO = setTimeout("doClick(savEvent)", dcTime);
       break;
     case "dblclick":
       doDoubleClick(which);
       break;
     default:
   }
 }

  function IsDouble(which) {
    switch (which) {
     case "click": 
       savEvent = which;
       d = new Date();
       savEvtTime = d.getTime();
       savTO = setTimeout("doClick(savEvent)", dcTime);
       break;
     case "dblclick":
       doDoubleClick(which);
       break;
     default:
   }
 }
 
 function doClick(which) {
   // preempt if DC occurred after original click.
   if (savEvtTime - dcAt <= 0) 
      return false;
   
// alert('SINGLE');
 // return false;
 }
 
 function doDoubleClick(which) {
   var d = new Date();
   dcAt = d.getTime();
   if (savTO != null) {
     clearTimeout( savTO );          // Clear pending Click  
     savTO = null;
   }
  //alert('DOUBLE');
  //return true;
 }


////////////////////////////////////////////////////////////////////////
//Onclick and Ondouble click events are not permitted withing the same table row or table cell.
//handleWisely performs a test based on the timing of the clicks. Once test is concluded IsDbl 
//a timed function (greater than 250) is called afterwards trigger the specified onclick/ondoubleclick funtions

var dcTime=250;    // doubleclick time
var dcDelay=100;   // no clicks after doubleclick
var dcAt=0;        // time of doubleclick
var savEvent=null; // save Event for handling doClick().
var savEvtTime=0;  // save time of click event.
var savTO=null;    // handle of click setTimeOut
var savTO2=null; 
var Dbl_test=0;  
 
 function hadDoubleClick() {
   var d = new Date();
   var now = d.getTime();
   if ((now - dcAt) < dcDelay)
   {return true; }
    return false;
 }
 
 function handleWisely(which) {
   switch (which) {
     case "click": 
       // If we've just had a doubleclick then ignore it
       if (hadDoubleClick()) return false;
         
       // Otherwise set timer to act.  It may be preempted by a doubleclick.
       savEvent = which;
       d = new Date();
       savEvtTime = d.getTime();
       savTO = setTimeout("doClick(savEvent)", dcTime);
       
       break;
     case "dblclick":
       doDoubleClick(which);
       break;
     default:
   }
   return savTO2;
 }
 
 function doClick(which) {
   // preempt if DC occurred after original click.
   if (savEvtTime - dcAt <= 0) {
     return false;
   }
	Dbl_test = 1;
 }
 
 function doDoubleClick(which) {
   var d = new Date();
   dcAt = d.getTime();
   if (savTO != null) {
     clearTimeout( savTO );          // Clear pending Click  
     savTO = null;
   }
  Dbl_test = 2;
 }

 function IsDbl(Person_Key, SingFuncName, DubFuncName)
 {
	if(Dbl_test == 1)
		SingFuncName(Person_Key);	//Single click function
	else
	{
		DubFuncName(Person_Key);	//Double click function
		clearTimeout( savTO2 );    
	}
 }

function IsDblClick(Person_Key, thisEvent, SingFuncName, DubFuncName)//Applicant Wizard only
{
	handleWisely(thisEvent);
	savTO2 = setTimeout("IsDbl('" + Person_Key + "'," + SingFuncName + "," + DubFuncName + ")", 251)
}

//////////////////////////////////////////////////////////////////////////////////////
function RedirectToDetailKey(TreeKey, ParamKey)//Single click used to highlight row and define Primary Key
{//NOT WORKING RIGHT
	var q = location.search;
	var otk = GetParameter(q, "tk");
	TreeKey = '0000000022';
	//alert(TreeKey);
	//alert("http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&tk=" + TreeKey);
	//if(GetParameter(q, "tk") != "0000000000")
	//if(otk != "" && otk != "0000000000")
	//	window.location.href = "http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&tk=" + TreeKey + "&pk=" + ParamKey;
	//else
	//	window.location.href = "http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&pk=" + Person_Key;
	
	//window.location.href = "http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&tk=" + TreeKey;
	window.location.href = "http://ganges/EntreWebPod/DesktopDefault.aspx?tabindex=5&tabid=20&tk=0000000022";
}

////////////////////////////////////////////////
var keybYN = new keybEdit('yn','Valid values are \'Y\' or \'N\'.');
var keybNumeric = new keybEdit('01234567890','Numeric input only.');
var keybAlpha = new keybEdit('abcdefghijklmnopqurstuvwxy ','Alpha input only.');
var keybAlphaNumeric = new keybEdit('abcdefghijklmnopqurstuvwxy01234567890 ','Alpha-numeric input only.');
var keybDecimal = new keybEdit('01234567890.','Decimal input only.');
var keybDecimalNM = new keybEdit('01234567890.-');
var keybDate =  new keybEdit('01234567890/');
var keybPhone =  new keybEdit('01234567890()/\-.,');
var keybYNNM = new keybEdit('yn');
var keybNumericNM = new keybEdit('01234567890');
var keybAlphaNM = new keybEdit('abcdefghijklmnopqurstuvwxy');
var keybAlphaNumericNM = new keybEdit('abcdefghijklmnopqurstuvwxy01234567890');
var keybDateNM = new keybEdit('01234567890/');
var keybSalary =  new keybEdit('01234567890.,$');
var keybPercentage =  new keybEdit('01234567890.%');

function keybEdit(strValid, strMsg) {
	//	Variables
	var reWork = new RegExp('[a-z]','gi');		//	Regular expression\

	//	Properties
	if(reWork.test(strValid))
		this.valid = strValid.toLowerCase() + strValid.toUpperCase();
	else
		this.valid = strValid;

	if((strMsg == null) || (typeof(strMsg) == 'undefined'))
		this.message = '';
	else
		this.message = strMsg;

	//	Methods
	this.getValid = keybEditGetValid;
	this.getMessage = keybEditGetMessage;
	
	function keybEditGetValid() {
		return this.valid.toString();
	}
	
	function keybEditGetMessage() {
		return this.message;
	}
}

void function editKeyBoard(objForm, objKeyb) {
	strWork = objKeyb.getValid();
	strMsg = '';							// Error message
	blnValidChar = false;					// Valid character flag

	// Part 1: Validate input
	if(!blnValidChar)
		for(i=0;i < strWork.length;i++)
			if(window.event.keyCode == strWork.charCodeAt(i)) {
				blnValidChar = true;

				break;
			}

	// Part 2: Build error message
	if(!blnValidChar) {
		if(objKeyb.getMessage().toString().length != 0)
			alert('Error: ' + objKeyb.getMessage());

		window.event.returnValue = false;		// Clear invalid character
		objForm.focus();						// Set focus
	}
}

//FORCE TEXTBOX VALUES TO UPPER CASE
	function ClearMe(keyItem, oVal)
	{   
		setTimeout('ClearMe2("' + GetRunTimeID(keyItem) + '","' +  oVal + '")', 1);	
	}
	
	function ClearMe2(selObj, oVal)  
	{
		sValue = document.getElementById(selObj).value;
		sValue = sValue.replace("$","");
		sValue = sValue.replace("%","");
		sValue = sValue.replace(",","");
		sValue = sValue.replace(" ","");

		Pos = sValue.indexOf(oVal);   
	
		if(sValue == 0 || oVal == 'All' || Pos == 0)
			document.getElementById(selObj).value = ""
	}

//////////////////////////////////////////////////
//function DoPostBack()
//{
////alert(window.location);
//window.location.href = "http:" + window.location;
//}

function DoRefresh()
{
	window.location.href = window.location;
}


function Use_Emp_Link(Person_Key, thisEvent)//Single click used to highlight row and define Primary Key
{
	var q = location.search;
	var otk = GetParameter(q, "tk");

	//if(GetParameter(q, "tk") != "0000000000")
	if(otk != "" && otk != "0000000000")
		//window.location.href = "http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&tk=" + GetParameter(q, "tk") + "&mepk=" + Person_Key;
		window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&tk=" + GetParameter(q, "tk") + "&mepk=" + Person_Key;
	else
		window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&pk=" + Person_Key;
}

function DblClick_Use_NewEmp_Link(Person_Key)//For Employee_Hire_Wizard Wizard only
{
	var q = location.search;

	window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + GetParameter(q, "tabid") + "&mepk=" + Person_Key;
}

function Use_NewEmp_Link(Person_Key)//For Employee_Hire_Wizard Wizard only
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&mepk=" + Person_Key;
}


function Use_NewPer_Link(Person_Key)///For HR_personsm_New.ascx
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + GetParameter(q, "tabid") + "&tk=" + GetParameter(q, "tk") + "&n=t&npk=" + Person_Key;
}

function DblClick_Use_NewPer_Link(Person_Key)//For HR_personsm_New.ascx
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + GetParameter(q, "tabid") + "&tk=" + GetParameter(q, "tk") + "&n=t&npk=" + Person_Key + "&s=t";

}

//function DblClick_NewPerson_Link(Person_Key)//For Person Finder only
//{
//	var q = location.search;
//	window.location.href = "http:" + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&pk=" + Person_Key+ "&s=t";
//}


function Use_App_Link(Person_Key)//Applicant Wizard only
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?pk=" + Person_Key;
}

function Use_NewApp_Link(Person_Key)//For Applicant Wizard only
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?pk=" + Person_Key + "&s=t";
}

function Use_NewPerson_Link(Person_Key)//For Person Finder
{
	var q = location.search;
	window.location.href = window.location.protocol + window.location.pathname + "?tabindex=" + GetParameter(q, "tabindex") + "&tabid=" + + GetParameter(q, "tabid") + "&pk=" + Person_Key;
}


function GetParameter(Parameters, Name)  {    
  
    var Pos, TmpStr;
    Name = Name + "=";    
    Pos = Parameters.indexOf(Name);    
    if (Pos < 0) return("");   
    TmpStr = Parameters.substring(Pos + Name.length);    
     Pos = TmpStr.indexOf("&");    
    
    if (Pos >= 0) TmpStr = TmpStr.substring(0, Pos);    
		return TmpStr; 

  }

///Tooltip
function showtip(current,e,text){
//alert("hello");
if (document.all||document.getElementById){
thetitle=text.split('<br>')
if (thetitle.length>1){
thetitles=''
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i]
current.title=thetitles
}
else
current.title=text
}

else if (document.layers){
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
document.tooltip.document.close()
document.tooltip.left=e.pageX+5
document.tooltip.top=e.pageY+5
document.tooltip.visibility="show"
}
}

function hidetip(){
if (document.layers)
document.tooltip.visibility="hidden"
}

//Determines if Page (aspx) sending the javascript request is DesktopDefault.aspx
//It is important to implement this test as it will determing if the window.open( request
//will use a custom built url or the direct url. This has been proven necessary as 
//all javascript requests from pages (aspx) not on the root directory seem to add thier
//own paths into the window.open call. I've been unable to open the pop up windows as I
//cannot get their url to input correcly. If test fails ie. -1 I build the url using the 
//GetAppName() function and window.location.host to build the url.
function IsDesktopDefault()

{	
	var AspxLocation = window.location.pathname;
	var Exist = AspxLocation.indexOf('DesktopDefault.aspx');
	return Exist;
}

function GetAppName()//Returns application name ie. Entreweb
{
	var PathName = window.location.pathname;	
	var First = PathName.indexOf("/");
	First = First+1;
	var Second = PathName.indexOf("/", First);
		
	var ApplicationName = PathName.substring(First, Second);
	return ApplicationName;
}

function BuildPath()//Builds first part of URL to pop up
{
	var AppName = GetAppName();	//Entreweb on generic system
	var First_Part_of_URL = '//'+ window.location.host+ '/' + AppName + '/'
	return First_Part_of_URL;
}

// 10.01.2008 tps
// Find root path for the Web app.
// The previous GetAppName method fails if the application is in the root of the Web server,
// as it is in the Blue Hill hosting environment.
// This method of finding the root for the Web app depends upon knowing that this JavaScript file
// gets imported from a known folder within the Web app. It searches the DOM of the current
// page to find the <script> tag used to import the JavaScript file. The link tag is expected
// to look like this:
//		<script language='javascript' src='/EntreWebPod/Javascript/HRMS_Scripts.js'>
// or like this:
//		<script language='javascript' src='/Javascript/HRMS_Scripts.js'>
// The important feature of the src attribute is that is relative to the root of the Web server.
// By subtracting the string "JavaScript/HRMS_Scripts.js", we get the root path to the Web app.
// The Web app may be in the root of the server itself if it is accessed on Blue Hill hosting
// with this style of URL: http://Fehrandpeers.myhradvocate.com/

function GetWebAppRoot() {
  // Find out what the Web application path is by looking for the import path of
  // this JavaScript file relative to the root of the Web server.
  var rootPath = "";
	var scriptTags = document.getElementsByTagName("script");
	var s = "";
	for (var i = 0; i < scriptTags.length; ++i) {
    var scriptPath = scriptTags[i].getAttribute("src");
	  if (scriptPath) {
	  
	    // Find script tags that have src attributes like this:
	    //   /Javascript/HRMS_Scripts.js
	    //   /EntreWebPod/Javascript/HRMS_Scripts.js
	    
	    var result = scriptPath.match(/^(\/.*)Javascript\/HRMS_Scripts\.js$/);
	    if (result) {
	      rootPath = result[1];
	      break;
	    }
		}    
	}
  return rootPath;
  // Return value is expected to look like either "\" or "\EntreWeb\".
}

function SenderTest(Path)//Performs IsDesktopDefault and alters Path if necessary
{
	if(IsDesktopDefault() == -1)
		Path = GetWebAppRoot() + Path;	// 10.01.2008 tps Replace logic used to find Web app root for Blue Hill hosting
		//Path = BuildPath() + Path;
		
	return Path;
}

///////////////////////Used by Any module using HRMS_PopUpCalendar.aspx --start
  
 function GetDate(Ctrl_ID, ClientID, DL_ID, ShowTime)   //CalendarPopUp
{ 
	MyCtrl = GetRunTimeID(Ctrl_ID);
	var Date = document.forms[document.forms[0].name].elements[MyCtrl].value;
	
	if(ShowTime == "true" || ShowTime == "True")
	{
		if(typeof(MyCtrl) == "undefined")
			var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpTimeCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Date=' + Date);
		else
			var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpTimeCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + "" + '&Ctrl_ID=' + "" + '&DL_ID=' + "" + '&FullID=' + MyCtrl + '&Orig_Date=' + Date);

		//ChildWindow = window.open(Path, "PopUpTimeCalendar", "width=500,height=340,top=100,left=100,toolbars=yes,scrollbars=yes,titlebar=yes,location=yes,status=yes,resizable=yes");  
		ChildWindow = window.open(Path, "PopUpTimeCalendar", "width=240,height=295,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
	}
	else
	{ 
		if(typeof(MyCtrl) == "undefined")
			var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Date=' + Date);
		else
			var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + "" + '&Ctrl_ID=' + "" + '&DL_ID=' + "" + '&FullID=' + MyCtrl + '&Orig_Date=' + Date);
	
		ChildWindow = window.open(Path, "HRMSPopUp", "width=240,height=265,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
	}
}
  
function GetDatePostBack(Ctrl_ID, ClientID, DL_ID, IsPB)   //CalendarPopUp
{ 
	MyCtrl = GetRunTimeID(Ctrl_ID);
	var Date = document.forms[document.forms[0].name].elements[MyCtrl].value;

	if(typeof(MyCtrl) == "undefined")
		var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Date=' + Date + '&IsPB=' + IsPB);
	else
		var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpCalendar.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&FullID=' + MyCtrl + '&DL_ID=' + DL_ID + '&Orig_Date=' + Date + '&IsPB=' + IsPB);
	
	ChildWindow = window.open(Path, "HRMSPopUp", "width=240,height=260,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

/* 08.11.2003 tps Version of GetDate for forms that do not use datalists.
		This function passes emtpy strings to the popup window for parameters
		that are not required.
		dateControl - control ID of form input control which is populated by calendar popup window.
*/
function PopupCalendarWindow(dateControl)
{ 
	var Date = document.all[dateControl].value;
	var Path = SenderTest('HRMS_Modules/General/Calendar/HRMS_PopUpCalendar.aspx?FormName=&Client_ID=&DL_ID=&Ctrl_ID=' + dateControl + '&Orig_Date=' + Date);
	window.open(Path, "HRMSPopUp", "width=270,height=280,top=100,left=100,toolbars=yes,scrollbars=no,titlebar=yes,location=yes,status=yes,resizable=yes");
}

//Displays Person's Contact Information in new browswer window
function GetContactInfo(HeaderText, Perkey)   
{ //New browser textbox PopUp
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_ContactInfo.aspx?Header=' + HeaderText + '&PK=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=500,height=300,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=yes");   
}

//function GetPerfAlloc()  
function GetPerfAlloc(Rating, Compa)      
{ 
var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_PerfAllocation.aspx');

	if(typeof(Rating) != "undefined" && typeof(Compa) != "undefined")
		Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_PerfAllocation.aspx?Rating=' + Rating + '&Compa=' + Compa);

	ChildWindow = window.open(Path, "HRMSPopUp", "width=700,height=240,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=yes,status=no,resizable=yes");   
}

function GetViewer(HeaderText)		//Displays TextBox in New Broswer Window
{ //New browser textbox PopUp
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Viewer.aspx?Header=' + HeaderText);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=500,height=300,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=yes");   
}

function GetLookup(Ctrl_ID, LOOKUP, ClientID, DL_ID)   //LOOKUP POP UP WINDOW
{ 

	var OrigValue = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;		
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Lookup.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&LOOKUP=' + LOOKUP + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + OrigValue);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=475,height=200,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

//PayBasis PopUp
function GetLookupPostBack(Ctrl_ID, LOOKUP, ClientID, DL_ID)  
{ 	//Original perkey value
	var OrigValue = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;		
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Lookup_PostBack.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&LOOKUP=' + LOOKUP + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + OrigValue);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=475,height=200,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}
//function OpenFile(sPath)
//{
//alert("hitthree");
////alert(sPath);
//}

//File Upload PopUp
function GetUploadFile(Ctrl_ID, LOOKUP, ClientID, DL_ID)  
{ 	//Original perkey value
	var OrigValue = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;		
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_FileUploader.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&LOOKUP=' + LOOKUP + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&OrigValue=' + OrigValue);
	//alert(OrigValue);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=370,height=150,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
	//ChildWindow = window.open(Path, "HRMSPopUp", "width=475,height=200,top=300,left=300,toolbars=yes,scrollbars=yes,titlebar=yes,location=yes,status=yes,resizable=yes");  
}

//PayBasis PopUp
function GetLookupLocation(Ctrl_ID, postback, ClientID, DL_ID)  
{ 	//Original perkey value
	var OrigValue = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;		
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Location.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&postback=' + postback + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Val=' + OrigValue);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=315,height=230,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

function GetEmail(Email, Subject, Body, CC, From)   
{
	//var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Email.aspx?Email=' + Email + '&Subject=' + Subject + '&Body=' + Body + '&From=' + From + '&CC=' + CC);
	//ChildWindow = window.open(Path, "HRMSPopUp", "width=500,height=350,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=yes"); 
}

//PersonPopUp
function GetPerson(Perkey_Ctrl_ID, Empno_Ctrl_ID, Name_Ctrl_ID, ClientID, DL_ID)   
{ 	//Original perkey value
	//var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Perkey_Ctrl_ID].value;
	ctl = document.getElementById(GetRunTimeID(Perkey_Ctrl_ID));
	var Perkey = ctl.value;
	
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Person.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Perkey_Ctrl_ID + '&Ctrl_ID2=' + Empno_Ctrl_ID + '&Ctrl_ID3=' + Name_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}

//PersonPopUp//Only returns perkey //will replace GetPerson with GetPerson2
function GetPerson2(Perkey_Ctrl_ID, ClientID, DL_ID)   

{ 	//Original perkey value
	
	//kn 04/12/07 Function broke for Quinn Add req page. Used GetRunTimeID instead
	//var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Perkey_Ctrl_ID].value;
	ctl = document.getElementById(GetRunTimeID(Perkey_Ctrl_ID));
	var Perkey = ctl.value;

	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Person2.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Perkey_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}


//PersonPopUp, with additional filter
function GetPersonWithFilter(Perkey_Ctrl_ID, Empno_Ctrl_ID, Name_Ctrl_ID, ClientID, DL_ID, FilterText)   
{ 	//Original perkey value
	var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Perkey_Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Person_w_Filter.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Perkey_Ctrl_ID + '&Ctrl_ID2=' + Empno_Ctrl_ID + '&Ctrl_ID3=' + Name_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey + '&FilterText=' + FilterText);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}


//Position PopUp
function GetPosition(Poskey_Ctrl_ID, Posno_Ctrl_ID, PosTitle_Ctrl_ID, ClientID, DL_ID)   
{ 	//Original perkey value
	var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Poskey_Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Position.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Poskey_Ctrl_ID + '&Ctrl_ID2=' + Posno_Ctrl_ID + '&Ctrl_ID3=' + PosTitle_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}

//Position PopUp
function GetRequisitions(Poskey_Ctrl_ID, Posno_Ctrl_ID, PosTitle_Ctrl_ID, ClientID, DL_ID)   
{ 	//Original perkey value
	var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Poskey_Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Requisition.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Poskey_Ctrl_ID + '&Ctrl_ID2=' + Posno_Ctrl_ID + '&Ctrl_ID3=' + PosTitle_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}

//Job Class (JCL) PopUp
function GetJCL(Poskey_Ctrl_ID, Posno_Ctrl_ID, PosTitle_Ctrl_ID, ClientID, DL_ID)   
{ 	//Original perkey value
	var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Poskey_Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_JCL.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Poskey_Ctrl_ID + '&Ctrl_ID2=' + Posno_Ctrl_ID + '&Ctrl_ID3=' + PosTitle_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=550,height=200,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}
function ApplicantReportPrintEmpty(sPerkey, sReqKey)   
{ 	//Original perkey value
	//var Perkey = Poskey_Ctrl_ID;
	var Path = SenderTest('HRMS_Modules/MSS/ManagerTools/MSS_AppReportPrint.aspx?PK=' + sPerkey + '&RK=' + sReqKey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=680,height=600,top=100,left=100,menubar=yes,toolbars=yes,scrollbars=yes,titlebar=yes,location=no,status=yes,resizable=yes"); 
}

function ApplicantReport(sPerkey, sReqKey)   
{ 	//Original perkey value
	//var Perkey = Poskey_Ctrl_ID;
	var Path = SenderTest('HRMS_Modules/MSS/ManagerTools/MSS_AppReport.aspx?PK=' + sPerkey + '&RK=' + sReqKey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=680,height=600,top=100,left=100,menubar=yes,toolbars=yes,scrollbars=yes,titlebar=yes,location=no,status=yes,resizable=yes"); 
}

function ApplicantReportNatexis(sPerkey, sReqKey, sStyle)   
{ 	//Original perkey value
	//var Perkey = Poskey_Ctrl_ID;
	var Path = SenderTest('Client_Natexis/MSS/ManagerTools/MSS_AppReportNatexis.aspx?PK=' + sPerkey + '&RK=' + sReqKey + '&St=' + sStyle);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=680,height=600,top=100,left=100,menubar=yes,toolbars=yes,scrollbars=yes,titlebar=yes,location=no,status=yes,resizable=yes"); 
}

function ApplicantReportCellGenesys(sPerkey, sReqKey, sStyle)   
{ 	//Original perkey value
	//var Perkey = Poskey_Ctrl_ID;
	var Path = SenderTest('Client_CellGenesys/MSS/ManagerTools/MSS_AppReportCellGenesys.aspx?PK=' + sPerkey + '&RK=' + sReqKey + '&St=' + sStyle);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=680,height=600,top=100,left=100,menubar=yes,toolbars=yes,scrollbars=yes,titlebar=yes,location=no,status=yes,resizable=yes"); 
}

function GetFORMULA(Poskey_Ctrl_ID, FormualName, PosTitle_Ctrl_ID, ClientID, DL_ID)   
{ 	//Original perkey value
	var Perkey = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Poskey_Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_FORMULA.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Poskey_Ctrl_ID + '&FN=' + FormualName + '&Ctrl_ID3=' + PosTitle_Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Perkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=357,height=300,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no"); 
}

//function GetOrg(Ctrl_ID, ClientID, DL_ID)   //OrganizationPopUp
//{ 
//	var Orgno = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;
//	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_Organization.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Orgno);
//	ChildWindow = window.open(Path, "HRMSPopUp", "width=370,height=300,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
//}

function GetOrgNoPostBack(Ctrl_ID, ClientID, DL_ID)   //OrganizationPopUp
{ 
	var Orgno = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_OrgNo_PostBack.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Orgno);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=470,height=195,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

function GetParType(Ctrl_ID, ClientID, DL_ID)   //Benefit Participant Type PopUp
{ 
	var Orgno = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;
	var Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_ParticipantType.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Orgno);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=370,height=300,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

//function GetBenTerm(Ctrl_ID, ClientID, DL_ID)   //Benefit Termination PopUp
//{ 
//	var Orgno = document.forms[document.forms[0].name].elements[ClientID+ "_" + DL_ID +"__ctl0_"+Ctrl_ID].value;
//	Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_BenTermReason.aspx?FormName=' + document.forms[0].name + '&Client_ID=' + ClientID + '&Ctrl_ID=' + Ctrl_ID + '&DL_ID=' + DL_ID + '&Orig_Org=' + Orgno);
//	ChildWindow = window.open(Path, "HRMSPopUp", "width=370,height=300,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
//}

function AddCarrRtrn(s)//Replace cartn with \n
{
	//var Result = s.replace("cartn","\n");
	var Result = s.replace(/cartn/g,"\n");
	return Result;	
}


function GetOEInfo(Benkey)   //Benefit Information PopUp
{ 
	Path = SenderTest('HRMS_Modules/General/HR_PopPup/HRMS_OEInfo.aspx?Bkey=' + Benkey);
	ChildWindow = window.open(Path, "HRMSPopUp", "width=370,height=180,top=100,left=100,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=no");   
}

function OpenNewWindow(sPath)
{
	var Path = SenderTest(sPath);
	Path = Path.replace("~/","");	//alert(Path);
	
	ChildWindow = window.open(Path, "Reports", "width=800,height=600,top=300,left=300,toolbars=yes,scrollbars=yes,titlebar=no,location=no,status=no,resizable=yes");   
}

//function OpenNewBrowser(sPath)
//{
//	//	var Path = SenderTest(sPath);
//	//	Path = Path.replace("~/","");	//alert(Path);
//	//	ChildWindow = window.open(Path, "Reports", "width=800,height=600,top=300,left=300,toolbars=yes,scrollbars=yes,titlebar=no,location=no,status=no,resizable=yes");   
//}

function OpenWord()
{
	var Path = SenderTest('/Word.aspx');
	ChildWindow = window.open(Path, "Word", "width=160,height=40,top=300,left=300,toolbars=no,scrollbars=no,titlebar=no,location=no,status=no,resizable=yes");   
}

