     
    //******************************************************************************************
	//Module level variables
	//******************************************************************************************
	var mobjProcess;    	


	//******************************************************************************************
	//It closes the window
	//******************************************************************************************		
    function fnCloseWindow()
	{
		window.close();		
		return false;
	}
			
	//****************************************************************************************
	// changes the mouse cursor to hand 
	//****************************************************************************************			
	function fnChangeCursor(pstrCursortype)
	{
		var pstrCursortype = pstrCursortype.toUpperCase()	
		
		switch(pstrCursortype)
		{
			case 'DEFAULT':
			document.body.style.cursor='default';		
			break;
			case 'WAIT':
			document.body.style.cursor='wait';
			break;
		}
	}
		
	/********************************************************************	
	// change the cursor from pointer to hand
	/********************************************************************/	

	function f_ChangeMouseIcon()
	{
		window.event.srcElement.style.cursor="hand";
		return;
	}

	//****************************************************************************
	// function used to close a modal window on closing parent window
	//****************************************************************************
	function fnCloseChild()
	{ 
		if (mobjProcess)
		{
			if (!mobjProcess.closed)
			{
				mobjProcess.close();
			}
		}	
			
	}

	//****************************************************************************
	// function used to open a modal window.
	//****************************************************************************
	function fnValidateChildProcess() 
	{					
		if (mobjProcess)
		{
			if (!mobjProcess.closed)
			{
				if (window.focus)
				{ 
					mobjProcess.focus();									
					return false;
				}							
			}
			else
			{				
				//After the child window closes and the control returns to the Parent screen								
				mobjProcess=null;					
			}
		}
	} 
	
	//****************************************************************************
	// function used to set the focus on the control
	//****************************************************************************
	function fnSetFocus(pstrCtrlId)
	{	
		document.getElementById(pstrCtrlId).focus();
		document.getElementById(pstrCtrlId).select();
		return;
	}

	/*****************************************************************
    'Name    : fnCheckNumOnKeyPress()
    'Purpose : Allow only Numeric characters
	'Inputs  : None
    'Returns : True if Key Pressed is Numeric
    '*****************************************************************/
    function fnCheckNumOnKeyPress()
	{
		var keycode;
		if(event.keyCode)
		{
			keycode = window.event.keyCode
		}
		if((keycode > 47)&&(keycode < 58))
		{
			return true;
		}
		else
		{
			return false;
		}
	}	
		
	/*************************************************************************************
	This function disables the right click of the mouse icon.
	*************************************************************************************/
	function document.oncontextmenu()
	{
		event.returnValue = false; 
		event.cancelBubble = true; 
		return false; 
	}

	/*************************************************************************************
	Will disable the press of pipe (|) symbol in the page
	*************************************************************************************/
	function document.onkeypress()
	{
		if (event.keyCode==124)
		{
			return false;	
		}
	}
	
	function MM_swapImgRestore() { //v3.0
		var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_swapImage() { //v3.0
		var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	
	function MM_findObj(n, d) { //v3.0
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
	}
	
	//**********************************************************************************
	//This function validates the  Date field
	//**********************************************************************************
	function fnDateValidation(lstrDate)
	{								
		if (document.getElementById(lstrDate).value != '')
		{
			//Check Run date													
			if (isValidDate(document.getElementById(lstrDate).value))			
			{							
				return true;
			}	
			else													
				document.getElementById(lstrDate).focus();
				return false;							 
		}
		else
		{
			document.getElementById(lstrDate).focus();
			return false;	
		}					
	}
	
	function isValidDate(dateStr) 
	{
		// Date validation function courtesty of 
		// Checks for the following valid date formats:
		// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY

		var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year

		var matchArray = dateStr.match(datePat); // is the format ok?
		if (matchArray == null) {
		alert(dateStr + " Date is not in a valid format.")
		return false;
		}
		month = matchArray[1]; // parse date into variables
		day = matchArray[3];
		year = matchArray[4];
		if (month < 1 || month > 12) { // check month range
		alert("Month must be between 1 and 12.");
		return false;
		}
		if (day < 1 || day > 31) {
		alert("Day must be between 1 and 31.");
		return false;
		}
		if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Month "+month+" doesn't have 31 days!")
		return false;
		}
		if (month == 2) { // check for february 29th
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
			if (day>29 || (day==29 && !isleap)) {
			alert("February " + year + " doesn't have " + day + " days!");
			return false;
			}
		}
		return true;
	}
