<!--//
var clickCnt=0;

function selectApprove(fChecked){
	var fmName=document.forms[0];
	for(cntType=1; cntType!=(fmName.length - 1);cntType++){	
		if(fmName.elements[cntType].value=='E')
			fmName.elements[cntType].checked = fChecked;
	}
}

function setIncPast(val) {
	window.location = 'default.asp?subpage=Enter_Time_Sheet&incpast=' + val
}
function attachDoc() {
	var t, l, w, h;
	w = 575;
	h = 310;
	l = (screen.width - w) / 2;
	t = (screen.height - h) / 2; 
	window.open('attach.asp','Resume','scrollbars=yes,left=' + l + ',top=' + t + ',width=' + w + ',height=' + h);
}

function validate() {
	if ( document.postResume.ATTACHED_RESUME.value == '' )
		alert('You must attach your resume in order to proceed.');
	else
		document.postResume.submit();
	return;
}
function keyDump() { 
clickCnt++;
//alert(clickCnt);
	if(clickCnt > 1){
		alert('Processing');
		return false;
	}
	return true;
} 


function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function findObj(objname) {
	var n, i;
	
	for ( n = 0; n < document.forms.length; n++ ) {
		for ( i = 0; i < document.forms[n].elements.length; i++ ) {
			if ( document.forms[n].elements[i].name == objname ) {
				return document.forms[n].elements[i];			
			}
		}	
	}
	return null;
}

function showCal(objname, wloc,event) {
	var date = (objname);
	var nFile = "include/Calendar.asp?date=" + date + "&objname=" + objname, win, props;	
	var width = 300, height = 167;
	var xPos=event.screenX;
	var yPos=event.screenY;
	//incase they are using netscape
	if (xPos == "undefined" || xPos == null){
		xPos=(eventObj.screenX);
		yPos=(eventObj.screenY);
	}
	var left = xPos, top = yPos - (height + 50);
	if ( top < 20 )	top = 20;		
	if ( (left + width) > screen.width ) left = screen.width - (width + 10);
	if ( wloc == undefined )
		wloc = '';
	else if ( wloc != '' ) {
		wloc = wloc + '/';
	}
	props = 'status=no,titlebar=no,resizable=no,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height
	win = window.open(wloc + nFile, 'calendar', props);
	return false;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function showCalALL(objname, wloc,event) {
//alert(objname)
	var date = (objname);
	var nFile = "include/CalendarALL.asp?date=" + date + "&objname=" + objname;	
	var width = 300, height = 167;
	var xPos=event.screenX;
	var yPos=event.screenY;
	//incase they are using netscape
	if (xPos == "undefined" || xPos == null){
		xPos=(eventObj.screenX);
		yPos=(eventObj.screenY);
	}
	var left = xPos, top = yPos - (height + 50);
	if ( top < 20 )	top = 20;		
	if ( (left + width) > screen.width ) left = screen.width - (width + 10);
	if ( wloc == undefined )
		wloc = '';
	else if ( wloc != '' ) {
		wloc = wloc + '/';
	}
	props = 'status=no,titlebar=no,resizable=no,left=' + left + ',top=' + top + ',width=' + width + ',height=' + height
	win = window.open(wloc + nFile, 'calendar', props);
	return false;
}

function valWeek(fmName){
var fmObject=document[fmName];
var wValue=fmObject.weekend.value;
var wExp = /^\d{1,2}\/\d{1,2}\/\d{2}$/;
var mssg="Your weekending date\nmust be in M/D/YY format";
	if(wExp.test(wValue)==false){
		alert(mssg);
		return false;
	}
	else{
		var StringVal = wValue.indexOf("/");
		var comNum = parseInt(wValue.substring(0,StringVal));
			if ((comNum > 12) || (comNum <= 0)){
				alert(mssg);
				return false;
			}
		var midVal = wValue.lastIndexOf("/");
		var midNum = parseInt(wValue.substring((StringVal+1),midVal));
			if ((midNum > 31) || (midNum <= 0)){
				alert(mssg);
				return false;
			}
			else{
				return true;
			}
	}
}
function runEmail(email){
	var fmName=document.forms[0];
	var atSym=email.lastIndexOf("@")
	if(atSym==-1){
		alert('You must use a valid email address')
		return false;
	}
	if(atSym < 20){
		fmName['UserName'].value=email.substring(0,atSym)
		return false;
	}else{
		fmName['UserName'].value=email.substring(0,20)
	}
}



function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;  
  var checkOther = false;//flag to check validation on otherSource field
  
  for (i=0; i<(args.length-2); i+=3) 
  { 
  		test=args[i+2]; 
		val=MM_findObj(args[i]);
    	if (val)
		{ 
			nm=val.name; 
			if ((val=val.value)!="") 
			{
			  //changes made here April 19, 2006 - BCC- made to validation of source	
	  		  //need to figure out of source == 'O'
			  if(nm == 'Source')
			  {
				  if (val == 'O')
				  {
					 checkOther = true;
				  }
			  }
    		  if (test.indexOf('isEmail')!=-1) 
			  { 
			  	p=val.indexOf('@');
        		if (p<1 || p==(val.length-1)) 
					errors+='- '+nm+' must contain an e-mail address.\n';
      			} 
				else if (test!='R') 
				{
        			if (isNaN(val)) 
						errors+='- '+nm+' must contain a number.\n';
        			if (test.indexOf('inRange') != -1) 
					{ 
						p=test.indexOf(':');
        	  			min=test.substring(8,p); 
						max=test.substring(p+1);
        	  			if (val<min || max<val) 
							errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    				} 
				}
			} 
			//checks for Source to see if it is null
			else if (test.charAt(0) == 'R' && checkOther == false)
			{
				if(nm !='otherSource')
					errors += '- '+nm+' is required.\n'; 
			}
			//checks for otherSource to see if it is null
			else if (test.charAt(0) == 'R' && checkOther == true)
			{
				if(nm !='Source')
					errors += '- '+nm+' is required.\n';
			}
		}
  	} 
  	if (errors) 
  		alert('The following error(s) occurred:\n'+errors);
  		document.MM_returnValue = (errors == '');
	}


function clearSearchBox(searchFrmName){
	var fmObject=document.forms[searchFrmName];
	if ((fmObject != null)&&(fmObject != 'undefined')){
		fmObject.Location.value='';
		fmObject.JobClass.value='';
	}
}

//-->
