 /*
 We moved the following four functions to header.jsp and headerForAll.jsp
  function currDay(){
    dayName = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    today = new Date
    return dayName[today.getDay()]
  }
  function currMon(){
    monName = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
    today = new Date
    return monName[today.getMonth()];
  
  }
  function currYear(){
    today = new Date
    var year = today.getYear()
    if ((navigator.appName == "Microsoft Internet Explorer") && (year < 2000))
      year = "19"+year;
    if (navigator.appName == "Netscape")
      year = 1900+year;
    return year; 
  }

  function dayMsg(){
    var msg, time
    now = new Date()
    time = now.getHours()
    if (time < 12) 
    {
      msg = "Good Morning"
    }
    else if (time < 18) 
    {
      msg = "Good Afternoon"
    }
    else
    {
      msg = "Good Evening"  
    }
    return msg;
  }

*/
<!-- Left Menu -->
   document.WM = new Object();

   document.WM.hirelist = new Object();

   document.WM.hirelist.expandos = new Array();

   document.WM.hirelist.heights = new Array();

   document.WM.hirelist.names = new Array();

   function WM_toggle(id) {

     if (document.all){

       if(document.all[id].style.display == 'none'){

         document.all[id].style.display = '';

       } else {

         document.all[id].style.display = 'none';

       }

     } else if (document.getElementById){

       if(document.getElementById(id).style.display == 'none'){

         document.getElementById(id).style.display = 'block';

       } else {

         document.getElementById(id).style.display = 'none';

       }

     } else if(document.layers) {
      
         if(parseInt(id + 1)){

   	  ditem = id + 1;

         } else {

   	  ditem = document.WM.hirelist.names[id];

         }

         if(document.WM.hirelist.expandos[ditem].clip.bottom == 0) {

   	     document.WM.hirelist.expandos[ditem].clip.bottom = document.WM.hirelist.heights[ditem];

         } else {

   	  document.WM.hirelist.expandos[ditem].clip.bottom = 0;

         }

         WM_align();

     }

   }

   function WM_align() {

       var i,j,stupid_netscape_array_infinate_loop_error;

       stupid_netscape_array_infinate_loop_error = document.WM.hirelist.expandos.length;

       for(i=0; i<stupid_netscape_array_infinate_loop_error; i++) {

   		j = i + 1;

   		if(document.WM.hirelist.expandos[j]){

   	    	if(document.layers) {

   				document.WM.hirelist.expandos[j].top = document.WM.hirelist.expandos[i].top + document.WM.hirelist.expandos[i].clip.bottom;

   	   		}

   		}

       }

   }

   function WM_initialize_toolbar(){
	 if(document.layers) {
			
   		for(i=0; i<document.layers['container'].document.layers.length; i++){
		
   	    	document.WM.hirelist.expandos[i] = document.layers['container'].document.layers[i];

   	    	document.WM.hirelist.names[document.layers['container'].document.layers[i].name] = i;

   	    	document.WM.hirelist.heights[i] = document.WM.hirelist.expandos[i].clip.bottom;

   		}

   		for (p=0;p<document.WM.hirelist.expandos.length;p=p+2){

   	    	WM_toggle(p);

   		}

   		document.layers['container'].visibility = 'visible';

          } else if (document.all){
		
   		for(i = 0; i < document.all('container').all.length; i++){

   		    document.all('container').all[i].style.position = 'relative';

   		    if(document.all('container').all[i].className == 'menu'){

   			document.all('container').all[i].style.display = 'none';

   		    }

   		}

   		document.all('container').style.visibility = 'visible';	

       } else if (document.getElementsByTagName && document.getElementById){
		
   		var contained = document.getElementById('container').getElementsByTagName('div');

   		for(i = 0; i < contained.length; i++){

   		    contained[i].style.position = 'relative';

   		    if(contained[i].getAttribute('class') == 'menu'){

   			contained[i].style.display = 'none';

   		    }

   		}

   		document.getElementById('container').style.visibility = 'visible';

       }

   }
    
// ************ COMMON FUNCTIONS ******************

//To check if the field is empty
  function emptyField(valIn) { 
   //to check if the field is not empty
   //var newText = strip(text+""," "); 
   var isBlank = true;
   if ( (valIn != "") && (valIn != null) )
    isBlank = false;
    return isBlank;
//   return true;
// else
//  return false; 
  }

//To check if the field has text
  function hasText(text) { 
    var newText = strip(text + "", " "); 
    //return (newText != ""); 
    //FIX: 
    if((newText != "") && (newText != null))  
      return(true); 
    else 
      return(false); 
  } 

//Check for numbers
  function isNumeric(number) { 
    number = number + ""; 
    return ((number.length > 0) && isComposedOfChars("0123456789", number)); 
  } 

//Check for decimal
  function isDecimal(number) { 
    number = number + ""; 
    return ((number.length > 0) && isComposedOfChars(".0123456789", number)); 
  }
  
 //Check for decimal that may be negative
  function isNDecimal(number) { 
    number = number + ""; 
    return ( (number.length > 0) && isComposedOfChars("-.0123456789", number) ); 
  } 

  //check if the form field is -ve number
  function isNegativeNumber(valIn) {
    if (valIn.length == 0){
      return(false);
    }
    else if (valIn.charAt(0) == '-'){
      return(true);
    }
    return(false);
  }


//Check for number, comma, space (" ")
  function isNumberCommSpace(number) { 
    number = number + ""; 
    return ((number.length > 0) && isComposedOfChars(",0123456789", number)); 
  } 

  function isComposedOfChars(validChars, inString) { 
    return (indexOfFirstNotIn(validChars, inString) == -1); 
  } 

  function strip(string, sChar) { 
    if ((string == null) || (string == "")) { 
      return "";	 
    } 
 
    var startIndex = indexOfFirstNotIn(sChar, string); 
    var endIndex = indexOfLastNotIn(sChar, string); 
 
  // Confirm that we have at least one non-stripped character. 
    if (startIndex == -1) { 
      return ""; 
    } 
 
    return string.substring(startIndex, endIndex + 1); 
  } 

// Return the index into inString of the first character in inString 
// that is not found in okayChars. 
  function indexOfFirstNotIn(okayChars, inString) { 
    var i; 
    for (i=0; i < inString.length; i++) { 
      var charm = inString.charAt(i); 
      if (okayChars.indexOf(charm) == -1) { 
        return i; 
      } 
    } 
    return -1; 
  } 

// Return the index into inString of the last character in inString 
// that is not found in okayChars. 
  function indexOfLastNotIn(okayChars, inString) { 
    var i; 
    for (i = inString.length - 1; i >= 0; i--) { 
      var charm=inString.charAt(i); 
      if (okayChars.indexOf(charm) == -1) {   // return this char     
        return i; 
      } 
    } 
    return -1; 
  } 


//to check letter
  function isLetter(aChar) {
    return ((aChar >= 'a') && (aChar <= 'z')) ||
           ((aChar >= 'A') && (aChar <= 'Z'));
  }

//Check for digit
  function isDigit(aChar) {
    return ((aChar >= '0') && (aChar <= '9'));
  }

//Show msg
  function showMsg(msgIn, fieldToFocus) {
    alert(msgIn);
    fieldToFocus.focus();
  }

//===***** check email validity *****===

  function validEmail(email){
    invalidChars = " /:,;"
    var badChar;
  
    if(email == ""){
      return false;
    }
    for(i=0; i<invalidChars.length; i++){
      badChar = invalidChars.charAt(i);
      if(email.indexOf(badChar,0) > -1){
        return false;
      }
    }
    atPos = email.indexOf("@",1)
    if(atPos == -1){
      return false;
    }
    if(email.indexOf("@",atPos+1) > -1){
      return false;
    }
    periodPos = email.indexOf(".",atPos);
    if(periodPos == -1){
      return false;
    }
    if(periodPos+3 > email.length){
      return false;
    }
    return true;
  }

//=============Start Radio Option ============
  function optionVal(valueIn){
    /*To send back the # of radio option 
      which is checked, or -1 of none is checked.
    */
    var option = -1;
    for (i=0; i<valueIn.length; i++){
      if(valueIn[i].checked){
        option = i+1;
      }
    }
    return option;   
  }

  function checkOptionVal(valueIn){
   //return false if none of the radio option is checked.
    if (optionVal(valueIn) == -1){
      return false;
    }
    return true;
  }

  function decimalWithOneDigit(numToCheck) {  
// **********************************************************
//  function to check the position of decimal(.).
//  True for followings:
//   0.5 
//   .5
//   10.5
//   10.0
//  True: if it is on the first place from the right, False otherwise.
// **********************************************************

	var reNumberPattern = /^\d*.\d{1}$/;

	if(reNumberPattern.test(numToCheck)) {
		return true;
	}
	return false;
  }

  
  function decimalWithTwoDigits(numToCheck) {  
// ****************************************************
// MI -------------------
//  function to check the position of decimal(.).
//  True for followings:
//   0.55 
//   .55
//   10.55
//   10.50
//  True: if it is on the 2nd place from the right, False otherwise.
// *****************************************************

	var reNumberPattern = /^\d*.\d{2}$/;

	if(reNumberPattern.test(numToCheck)) {
		return true;
	}
	return false;
  }

<!-- Calendar Functions -->
function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
var today;
var day;
var month;
var year;
var abc;
var xyz;
function openCal(formName, textName, textValue) {
if(textValue == "") {  
  today = new Date();
  day   = today.getDate();
  month = today.getMonth();
  year  = y2k(today.getYear());
  abc = formName;
  xyz = textName;
} else if(textValue=="Missing"){
  today = new Date();
  day   = today.getDate();
  month = today.getMonth();
  year  = y2k(today.getYear());
  abc = formName;
  xyz = textName;
}else{
  today = new Date(textValue);
  day = today.getDay();
  month = today.getMonth();
  year = y2k(today.getYear());
  abc = formName;
  xyz = textName;
}
 return newWindow(formName, textName);  
}
function padout(number) { return (number < 10) ? '0' + number : number; }

function restart(formName, textName) {
    abc = document.getElementById(formName);
    xyz = document.getElementById(textName);
    xyz.value = '' + padout(month - 0 + 1) + '/' + padout(day) + '/' + year;
    
}

function newWindow(formName, textName) {
    mywindow = window.open('/common/calendar.jsp','myname','resizable=no,width=300,height=210');
    mywindow.location.href = '/common/calendar.jsp';
    if (mywindow.opener == null) mywindow.opener = self;
}

function compareDates (value1, value2, separator) {
	//0 if the dates are same 
	//-1 if the first one is an earlier date 
	//1 if the first one is a later date 

	var date1, date2;
	var month1, month2;
   	var year1, year2;

   	month1 = value1.substring (0, value1.indexOf (separator));
   	date1 = value1.substring (value1.indexOf (separator)+1, value1.lastIndexOf (separator));
   	year1 = value1.substring (value1.lastIndexOf (separator)+1, value1.length);

   	month2 = value2.substring (0, value2.indexOf (separator));
   	date2 = value2.substring (value2.indexOf (separator)+1, value2.lastIndexOf (separator));
   	year2 = value2.substring (value2.lastIndexOf (separator)+1, value2.length);

   	if (parseInt(year1,10) > parseInt(year2,10)) return 1;
   	else if (parseInt(year1,10) < parseInt(year2,10)) return -1;
  	else if (parseInt(month1,10) > parseInt(month2,10)) return 1;
   	else if (parseInt(month1,10) < parseInt(month2,10)) return -1;
   	else if (parseInt(date1,10) > parseInt(date2,10)) return 1;
   	else if (parseInt(date1,10) < parseInt(date2,10)) return -1;
   	else return 0;
} 

<!-- End Calendar Functions -->

<!-- Start Select Multiple Option List -->

function checkSelected(mlist){
  for (i=0; i<mlist.length; i++) { 
    if(mlist.options[i].selected == true) {
	return true;
    }
  }
  return false;
} 

function doSelectAll(mlist){
  for (i=0; i<mlist.length; i++) { 
    mlist.options[i].selected = true
  }
} 

<!-- Start Select Multiple Option List -->

<!--- isAvalidate start ---->
function isAvalidate(strDate){
 if( strDate.search(/^[0][1-9]\/[0][1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[0][1-9]\/[1-2][0-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[0][1-9]\/[3][0-1]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1][0-2]\/[0][1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1][0-2]\/[1-2][0-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1][0-2]\/[3][0-1]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1-9]\/[0][1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1-9]\/[1-2][0-9]\/[1-2][0-9][0-9][0-9]$/) == -1 && 
     strDate.search(/^[1-9]\/[3][0-1]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1-9]\/[1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[0][1-9]\/[1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 &&
     strDate.search(/^[1][0-2]\/[1-9]\/[1-2][0-9][0-9][0-9]$/) == -1 ){
    return false;
  } else {
    return true;
  }
}
<!--- isAvalidate end ---->

<!--- Detect Browswer Start -->
<!-- TBD - different funcition to detect browser -->
function detectBrowser()	{
	var detect = navigator.userAgent.toLowerCase();
	var browser,version;
	
	if (checkIt('konqueror',detect)) {
		browser = "Konqueror";
	}
	else if (checkIt('safari',detect)) browser = "Safari"
	else if (checkIt('omniweb',detect)) browser = "OmniWeb"
	else if (checkIt('opera',detect)) browser = "Opera"
	else if (checkIt('webtv',detect)) browser = "WebTV";
	else if (checkIt('icab',detect)) browser = "iCab"
	else if (checkIt('msie',detect)) browser = "Internet Explorer"
	else if (!checkIt('compatible',detect)) {
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	} else {
    browser = "An unknown browser";
  }  
	
	if (!version) version = detect.charAt(place + thestring.length);
	
	return browser;

}


function checkIt(string,detect)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
<!--- Detect Browswer End-->

function validateTimeField(fieldIn) {
    var flag = 1;
	
    if (fieldIn.value.length == 4){ //NEW--
    	
	    if (fieldIn.value.search(/^[0-2][0-9][0-5][0-9]$/) == -1) { //NEW--
	      flag = 0;
	    }
    }
    else if (fieldIn.value.length == 5){ 
	    if (fieldIn.value.search(/^[0-9]\:[0-5][0-9][a,A,p,P]$/) == -1) { 
	      flag = 0;
	    }
    } 
    else if (fieldIn.value.length == 6)	{
	    if (fieldIn.value.search(/^[0-1][0-9]\:[0-5][0-9][a,A,p,P]$/) == -1) { 
	      flag = 0;
	    }
    }
    else	{
      flag = 0;
    }

    if (flag == 0)	{
	    alert("Please input the time in one of the following format.\n\n\tFor Military Time\n\tHHMM\n\n\tFor Standard Time\n\tHH:MMa\n\tHH:MMp");
	    fieldIn.value = "";
	    fieldIn.select();
	    fieldIn.focus();
	    return false;
    }
    return true;
}

function validateTimeFieldStandardTimeOnly(fieldIn) {
    var flag = 1;
	
    if (fieldIn.value.length == 5){ 
	    if (fieldIn.value.search(/^[0-9]\:[0-5][0-9][a,A,p,P]$/) == -1) { 
	      flag = 0;
	    }
    } 
    else if (fieldIn.value.length == 6)	{
	    if (fieldIn.value.search(/^[0-1][0-9]\:[0-5][0-9][a,A,p,P]$/) == -1) { 
	      flag = 0;
	    }
    }
    else	{
      flag = 0;
    }

    if (flag == 0)	{
    /*
	    alert("Please input the time in Standard Time\n\tHH:MMa\n\tHH:MMp");
	    fieldIn.value = "";
	    fieldIn.select();
	    fieldIn.focus();
	 */   
	    return false;
    }
    return true;
}

<!--- Hours(not time!!, hours like 8:25 hrs, 8.4 etc) Formatting/Validation --->

function formatHours(fieldValue, hrsIncBy)	{
	var minutes;
	
	minutes = convertHoursStringTimeIntoMinutes(fieldValue)
	
	var netHours;
	var netMinutes;
	
	var returnValue="";
	
	netHours = parseInt(minutes/60);
	netMinutes = parseInt(minutes % 60);
	
	returnValue =  displayHours(netHours, netMinutes, hrsIncBy);

	return returnValue;
}

function displayHours(hr, minutes, incBy) {

	var TS_HW_INC_BY_MINUTES = "0.0";
    var TS_HW_INC_BY_TENTH = "0.1";
    var TS_HW_INC_BY_HUNDREDTH = "0.01";
    var TS_HW_INC_BY_QUARTER = "0.25";
    var TS_HW_INC_BY_HALF = "0.5";
    var TS_HW_INC_BY_ONE = "1.0";

    hh = new Number(hr);
    mm = new Number(minutes);
    
    if (incBy == TS_HW_INC_BY_MINUTES) {
      var total;
      if(minutes<10){
        total = ""+hr+":"+"0"+minutes;
      }else {
      	total = ""+hr+":"+minutes;
      }
    }
    else if (incBy == TS_HW_INC_BY_HUNDREDTH) {
// ** standard ratio to for all the timing difference
       var divRes = 0.1 / 6 * mm;
       var strVal = divRes.toString();
       var decPos = strVal.indexOf('.');
       if (decimalWithOneDigit(incBy)){
         var finalDigit = strVal.substring(decPos+1,decPos+2);
       }
       else if (decimalWithTwoDigits(incBy)){
         var finalDigit = strVal.substring(decPos+1,decPos+4);
       }
       var total = (hr + "."+finalDigit);
    }
    else if (incBy == TS_HW_INC_BY_TENTH) {
// ** for increment by 0.1
      mm = mm.toFixed(0);
      if(mm <= 2){
	      var total = (hh + ".0");
      } else if(mm > 2 && mm <= 8) {
	      var total = (hh + ".1"); 
      } else if(mm > 8 && mm <= 14) {
	      var total = (hh + ".2"); 
      } else if(mm >14 && mm <= 20) {
	      var total = (hh + ".3"); 
      } else if(mm >20 && mm <= 26) {
	      var total = (hh + ".4"); 
      } else if(mm >26 && mm <= 32) {
	      var total = (hh + ".5"); 
      } else if(mm > 32 && mm <= 38) {
	      var total = (hh + ".6"); 
      } else if(mm > 38 && mm <= 44) {
	      var total = (hh + ".7"); 
      } else if(mm > 44 && mm <= 50) {
	      var total = (hh + ".8"); 
      } else if(mm > 50 && mm <= 56) {
	      var total = (hh + ".9"); 
      } else if(mm > 56 && mm <= 60) {
	      finalMinutes = new Number(1.0);        
	      var total = (hh + finalMinutes);
      }  
    } else if (incBy == TS_HW_INC_BY_QUARTER){
// ** for increment by 0.25
      if (mm >= 0 && mm <= 7.0) {
        var total = (hh + ".0");
      } else if(mm >7.0  && mm <= 22) {
        var total = (hh + ".25"); 
      } else if(mm >= 23 && mm <= 37) {
        var total = (hh + ".50"); 
      } else if(mm >= 38 && mm <= 52) {
        var total = (hh + ".75"); 
      } else if(mm > 52 && mm <= 60) {
	      finalMinutes = new Number(1.0);
	      var total = (hh + finalMinutes);
      }
    } else if (incBy == TS_HW_INC_BY_HALF){
// ** for increment by 0.5   
      if (mm >= 0 && mm < 15) {
        var total = (hh + ".0");
      } else if(mm >= 15 && mm <= 44) {
        var total = (hh + ".5"); 
      } else if(mm > 44 && mm <= 60) {
	      finalMinutes = new Number(1.0);
	      var total = (hh + finalMinutes);
      }
    } else if (incBy == TS_HW_INC_BY_ONE){
// ** for increment by 1.0
      if (mm >= 0 && mm < 30) {
        var total = (hh + ".0");
      } else if(mm >= 30 && mm <= 60) {
        finalMinutes = new Number(1.0);
        var total = (hh + finalMinutes);
      }
    }

    return total;
}

function validateHoursField(fieldIn) {

    var valIn = fieldIn;
    var flag = 1;
    
    if (fieldIn.value.indexOf(":")!=-1)	{
   	    if (fieldIn.value.length == 5){ //NEW--
		    if (fieldIn.value.search(/^[0-2][0-9]\:[0-5][0-9]$/) == -1) { //NEW--
		      flag = 0;
	      }
	    }
	    
	    else if (fieldIn.value.length == 4){ //NEW--
		    if (fieldIn.value.search(/^[0-9]\:[0-5][0-9]$/) == -1) { //NEW--
		      flag = 0;
	      }
	    }
	    
	    else	{
	      flag = 0;
	    }
    }
    else	{
    	if (!(isDecimal(fieldIn.value)))	{
        	flag = 0;
        }
    }
    
    if (flag == 0)	{
	    alert("Please input the time in the following format.\n\n\tFor time in hours and minutes HH:MM\n\n\tOr in a decimal number");
	    fieldIn.value = "";
	    fieldIn.select();
	    fieldIn.focus();
	    return false;
    }
    return true;
}

function validateHoursFieldStandard(fieldIn) {

    var valIn = fieldIn;
    var flag = 1;
    
    if (fieldIn.value.indexOf(":")!=-1)	{
   	    if (fieldIn.value.length == 5){ //NEW--
		    if (fieldIn.value.search(/^[0-2][0-9]\:[0-5][0-9]$/) == -1) { //NEW--
		      flag = 0;
	      }
	    }
	    
	    else if (fieldIn.value.length == 4){ //NEW--
		    if (fieldIn.value.search(/^[0-9]\:[0-5][0-9]$/) == -1) { //NEW--
		      flag = 0;
	      }
	    }
	    
	    else	{
	      flag = 0;
	    }
    }
    
    if (flag == 0)	{
	    alert("Please input the time in the following format.\n\n\tFor time in hours and minutes HH:MM\n\n\t");
	    fieldIn.value = "";
	    fieldIn.select();
	    fieldIn.focus();
	    return false;
    }
    return true;
}

function convertHoursStringTimeIntoMinutes(timeString)	{
	
	if (timeString.indexOf(":")!=-1)	{
		var temp = timeString.split(":");
		var hrs = parseInt(parseFloat(temp[0]));
		var mins = parseInt(parseFloat(temp[1]));
		var minutes = hrs * 60 + mins;
		return minutes;
	}
	else	{
		var minutes = parseFloat(timeString) * 60;
		return minutes;
	}
}

function convertStringTimeIntoMinutes(timeString)	{
	//time could be in two formats, military HHMM or standard
	//HH:MM a or HH:MM p
	//this function is going to convert time into elapsed minutes since midnight 12:00 a or 000
	//so 12:00 a is 0 minutes, 1:00 a is 60 minutes and so on
			
	if (timeString==null || timeString=="")	{
		return 0;
	}
		
	if (isStandardTime(timeString))	{
		var len = timeString.length;
		var meridian = timeString.charAt(len-1);
		meridian = meridian.toLowerCase(); 
		timeString = timeString.substring(0,len-1);
		var temp = timeString.split(":");
		var hrs = parseInt(parseFloat(temp[0]));
		var mins = parseInt(parseFloat(temp[1]));
		if (meridian == "p")	{
			if (hrs<12)	{
				hrs = hrs + 12;
			}
		}
		else	{
			if (hrs==12)	{
				hrs = 0;
			}
		}
		minutes = hrs * 60 + mins;
	}
	else	{
		var hrs = parseInt(parseFloat(timeString.substring(0,2)) );
		var mins = parseInt(parseFloat(timeString.substring(2,4)) );
		minutes = hrs * 60 + mins;
	}
		
	return minutes;
	
}
		
function isStandardTime(timeString) {
	
	if ((timeString.lastIndexOf('a')>0) || (timeString.lastIndexOf('p')>0)
			|| (timeString.lastIndexOf('A')>0) || (timeString.lastIndexOf('P')>0)) {
		return true;
	} else {
		return false;
	}
}
function toFormatPhoneNumber(isField){

	isPhoneNumber = isField.value;
	isPhoneNumber = isPhoneNumber.replace(/\D/g,'');
	if (isPhoneNumber.length == 10){
	  isPhoneNumber = isPhoneNumber.replace(/^(\d{3})(\d{3})/,'($1)$2-');isField.value = isPhoneNumber;
	  return true;
	}
	else if (isPhoneNumber.length > 10 && isPhoneNumber.length <= 16){
	  isPhoneNumber = isPhoneNumber.replace(/\D/g,'').replace(/^(\d{3})(\d{3})(\d{4})(\d{1,6})/,'($1)$2-$3X$4');isField.value = isPhoneNumber;
	  return true;
	}
	else if (isPhoneNumber.length < 10 || isPhoneNumber.length > 16 || isNaN(isPhoneNumber)){
	 return false;
	
}
}
function isItZeroToOneHundred(isField){

	isNumber = isField.value;
	if( !isNaN(isNumber) ){
	   if(parseInt(isNumber)>=0 && parseInt(isNumber)<=100){
	     return true;
	   }else{
	     return false;
	   }
	} else{return false;}
}

function validatePhone(field)	{
	if (!toFormatPhoneNumber(field))	{
		alert("'"+field.value + "' is not a valid phone number, it should be at least 10 digits");
		field.value='';
		field.focus();
	}
}

function validateDate(field)	{
	if	(!isAvalidate(field.value))	{
        alert("Invalid date!");
		field.value='';
		field.focus();
	}
}

function validateFormNew(doc,requiredFeilds)	{
	for (var i=0; i<requiredFeilds.length;i++)	{
		var field = requiredFeilds[i];
		var elem = doc.getElementById(field);
		if (!hasText(elem.value))	{
			elem.value='';
			elem.focus();
			alert("Required field can not be empty!");
			return false;
		}
	}
	return true;
}

function validateDecimalOrInteger(field) {
    //Function will check if the given field is number or decimal
    //
    if (isDecimal(field.value) || isNumeric(field.value)) {
        return true;
    }
	alert("This field must be a number.");
	field.value = '';
	field.focus();
	return false;
}

function newXMLHttpRequest() { 
  var xmlreq = false;
 
  if (window.XMLHttpRequest) {
    xmlreq = new XMLHttpRequest();
 
  } else if (window.ActiveXObject) {
 
    try {
      // Try to create XMLHttpRequest in later versions
      // of Internet Explorer 
      xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
     
    } catch (e1) {
       // Failed to create required ActiveXObject
        try {
        // Try version supported by older versions
        // of Internet Explorer
   
        xmlreq = new ActiveXObject("Microsoft.XMLHTTP"); 
      } catch (e2) { 
        // Unable to create an XMLHttpRequest by any means
        xmlreq = false;
      }
    }
  }

return xmlreq;
}

function charCounter(txtArea, limitIn, counterIn) {
  var old = counterIn.value;
  counterIn.value=txtArea.value.length;
  if(counterIn.value > limitIn && old <= limitIn) {
    alert("<i18n:message key='LBL_TOO_MUCH_DATA_IN_THE_BOX'/>!");
    if(document.styleSheets) {
      counterIn.style.fontWeight = 'bold';
      counterIn.style.color = '#ff0000'; 
    } 
  } else if(counterIn.value <= limitIn && old > limitIn
    && document.styleSheets ) {
    counterIn.style.fontWeight = 'normal';
    counterIn.style.color = '#000000'; 
  } 
}


function integersOnly(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
}

function doublesOnly(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
         {
             if (charCode == 46)
             {
                return true;
             }
              return false;
         }
         return true;
}
//start Horizontal + vertical scroll bar
/*
function OnDivScroll(listName){
  
  // var lstCC = document.getElementById("chgAllId");
    var scrollSelections = new Array("chgAllId", "orgAllId", "groupAllId", "payAllId", "taskAllId", "empAllId", "selChgId", "orgSelId","selGrpId", "selPTId", "selTaskId" ,"selEmpId", "group", "employee");
    for (var x=0; x<scrollSelections.length;x++){
       if(scrollSelections[x]==listName){
          var elem = document.getElementById(scrollSelections[x]);
	      if (elem.options.length > 6) {
	          elem.size=elem.options.length;
	      } else {
	          elem.size=6;
	      } 
       }   	 
    }
     
}
function OnSelectFocus(listName, divName){
     //two list order important
     var divs = new Array("divChargecodes","divOrgs", "divGroups", "divPayTypes", "divTasks", "divEmps", "divSelChargecodes","divSelOrgs", "divSelGroups","divSelPayTypes", "divSelTasks", "divSelEmps", "divInOutGroups","divInOutEmps" );
     var scrollSelections = new Array("chgAllId", "orgAllId", "groupAllId", "payAllId", "taskAllId", "empAllId", "selChgId", "orgSelId","selGrpId", "selPTId", "selTaskId" ,"selEmpId", "group", "employee");
  
     for (var x=0; x<divs.length;x++){
       //if(divs[x]==listName){
       if(divs[x]==divName){
         var elem = document.getElementById(divs[x]);
         if (elem.scrollLeft != 0) {
           elem.scrollLeft = 0;
           
         } 
       }
       if(scrollSelections[x]==listName){
           var elem = document.getElementById(scrollSelections[x]);
           if( elem.options.length > 6) {
             elem.focus();
             elem.size=6;
           }
        } 
    }
      
}
*/
//end Horizontal + vertical scroll bar

