function y2k(number) { return (number < 1000) ? number + 1900 : number; }function isDate (day,month,year) {// checks if date passed is valid// will accept dates in following format:// isDate(dd,mm,ccyy), or// isDate(dd,mm) - which defaults to the current year, or// isDate(dd) - which defaults to the current month and year.// Note, if passed the month must be between 1 and 12, and the// year in ccyy format.	var today = new Date();    year = ((!year) ? y2k(today.getYear()):year);    month = ((!month) ? today.getMonth():month-1);    if (!day) return false    var test = new Date(year,month,day);    if ( (y2k(test.getYear()) == year) &&         (month == test.getMonth()) &&         (day == test.getDate()) )        return true;    else        return false}function isblank(s) {   for(var i = 0; i < s.value.length; i++) {      var c = s.value.charAt(i);      if ((c != ' ') && (c != '\n') && (c != '\t')) return false;   }   return true;}  function IsNumeric(passedVal) {    if (((passedVal / passedVal ) != 1) && (passedVal != 0))	  return false;	else      return true;} function IsInteger(string) {    var Chars = "0123456789";    for (var i = 0; i < string.length; i++) {       if (Chars.indexOf(string.charAt(i)) == -1)          return false;    }    return true;} function wordcount(string) {	var a = string.value.split(/\s+/g); // split the sentence into an array of words	return a.length;}function OpenWindow(Form,File){	var WinWidth = 450, WinHeight = 160, w,h;	if (window.screen) {    	w = Math.floor(screen.availWidth/2 - WinWidth/2);    	h = Math.floor(screen.availHeight/2 - WinHeight/2);	}	NEW = window.open('/sql/insert.asp?File='+File+'&Form='+Form,'popup','scrollbars=yes,width='+WinWidth+',height='+WinHeight+',top='+h+' ,left='+w);}function OpenWindowJob(Form,File,JobID){	var WinWidth = 450, WinHeight = 160, w,h;	if (window.screen) {    	w = Math.floor(screen.availWidth/2 - WinWidth/2);    	h = Math.floor(screen.availHeight/2 - WinHeight/2);	}	NEW = window.open('/sql/insert.asp?File='+File+'&Form='+Form+'&JobID='+JobID,'popup','scrollbars=yes,width='+WinWidth+',height='+WinHeight+',top='+h+' ,left='+w);}function OpenWindowPrint(){	var WinWidth = 600, WinHeight = 500, w,h;	if (window.screen) {    	w = Math.floor(screen.availWidth/2 - WinWidth/2);    	h = Math.floor(screen.availHeight/2 - WinHeight/2);	}	NEW = window.open('summaryreport_print.asp','popup','scrollbars=yes,width='+WinWidth+',height='+WinHeight );//+',top='+h+' ,left='+w);}function AdminOWindow(Form,File,obj){	var WinWidth = 450, WinHeight = 160, w,h;	if (window.screen){	  w = Math.floor(screen.availWidth/2 - WinWidth/2);	  h = Math.floor(screen.availHeight/2 - WinHeight/2);	}	NEW = window.open('/sql/insert.asp?File='+File+'&Form='+Form,'popup','scrollbars=yes,width='+WinWidth+',height='+WinHeight+',top='+h+' ,left='+w);}function AdminOWindowValidate(Form,File,obj){	var WinWidth = 450, WinHeight = 160, w,h;		if (obj.cboCompany.selectedIndex == 0)	{		alert("Please select company");		obj.cboCompany.focus();	}	else	{	  var UserID = obj.cboCompany.value;      if (window.screen) {        w = Math.floor(screen.availWidth/2 - WinWidth/2);    	 h = Math.floor(screen.availHeight/2 - WinHeight/2);	   }	   NEW = window.open('/mysql/fileupload.asp?File='+File+'&Form='+Form+'&UserID='+UserID,'popup','scrollbars=yes,width='+WinWidth+',height='+WinHeight+',top='+h+' ,left='+w);	}}function CheckEmail(strEmail) {	     if (strEmail != "")  {    valid = true	// Initially set valid to true  	var atcount = 0;	var email = strEmail;	var email_length = strEmail.length;				for (index=0; index<email_length; index++)	{	  if ((email.substring(index,index+1) == ":") || (email.substring(index,index+1) == ",") || (email.substring(index,index+1) == "'") || (email.substring(index,index+1) == " ") )	  {	  valid = false;	  }	}				for (i=0; i<email_length; i++)	{	  if (email.substring(i,i+1) == "@")	  {	  ++atcount;	  if (email.substring(i-1,i) == ".")	  valid = false;	  if (email.substring(i+1,i+2) == ".")	  valid = false;	  }	}	if (email.substring(email_length-1,email_length) == "@") valid = false;	if (email.substring(email_length-1,email_length) == ".") valid = false;	if (email.substring(0,1) == "@") valid = false;	if (email.substring(0,1) == ".") valid = false;	if (email.indexOf(".") == -1) valid = false;	if (atcount > 1 || atcount == 0) valid = false;	if (!valid) 	  return false;	else	  return true;			  }}		function round(n) {// rounds number to X decimal places, defaults to 2//    X = (!X ? 2 : X);//    return Math.round(number*Math.pow(10,X))/Math.pow(10,X);	var s = "" + Math.round(n * 100) / 100	var i = s.indexOf('.')	if (i < 0) return s + ".00"	var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3)	if (i + 2 == s.length) t += "0"	return t}// get selected value from the dropdown listfunction selectDropDownIndex(objList, strValue) {  for (var i=0, j=objList.length; i<j; i++) {    if(eval('objList.options[' + i + '].value == strValue')){	  eval('objList.selectedIndex='+i);    }  }}// get selected value from the dropdown listfunction selectMultipleListIndex(objList, strValue) {  for (var i=0, j=objList.length; i<j; i++) {    if(eval('objList.options[' + i + '].value == strValue')){	  eval('objList.options[' + i + '].selected  = true');    }  }}// check the input if it is blank, if so return false, else return error messagefunction checkInputObject(objInput, strError) {  if(isblank(objInput)) {    alert(strError);	objInput.focus();	return false;  }  return true;}// check list, radio object. If valid then return true, else return error messgefunction checkListObject(objList, strError) {  if(objList.options[objList.selectedIndex].value == "") {    alert(strError);	objList.focus();	return false;  }  return true;}// get selected value from the checkboxfunction selectCheckboxIndex(objRadio, strValue) {  for (var i=0, j=objRadio.length; i<j; i++) {    if(eval('objRadio[' + i + '].value == strValue')){	  eval('objRadio[' + i + '].checked='+'true');    }  }}//replace text in textareafunction replaceTextArea(objArea, strValue) {  if(navigator.appName != "Microsoft Internet Explorer" )  	objArea.innerHTML = strValue;  else    objArea.value = strValue;}