














//////////////////////////////////////////////////////////////////////  isValidDate















function isValidDate(MM,DD,YYYY,str) {















str1=".Please check the Date.";















month = MM;















day = DD;















year = YYYY;















Datestr=month+"-"+DD+"-"+YYYY+" "















if (month+day+year =="" ){// check the blank















return true;















}















if (month < 1 || month > 12) { // check month range














alert(Datestr+ str+ "Month must be between 1 and 12 !"+str1);














return false;














}














if (day < 1 || day > 31) {














alert( Datestr+str+"Day must be between 1 and 31 !"+str1);














return false;














}














if (year < 1900 || year > 2100) {
alert( Datestr+str+"Year must be between 1900 and 2100 !"+str1);
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {














alert(Datestr+str+"Month "+month+" doesn't have 31 days !"+str1)














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(Datestr+str +"February " + year + " doesn't have " + day + " days !"+str1);














return false;














}














}














return true;














}














////////////////////////////////////////////////////////////////////// isEmpty(inputStr) 














function isEmpty(inputStr) {





        if (inputStr == null || inputStr == "")         {




			return true





        }





        return false






}















//////////////////////////////////////////////////////////////////////  function Trim(s)
function Trim(s){














var sTrimmed=s;
















sTrimmed = sTrimmed.replace(/(^\s+)|(\s+$)/g, '');


















return sTrimmed

















}


















//////////////////////////////////////////////////////////////////////   getcheckNumber()
function getcheckNumber(){



if (event.keyCode < 48 || event.keyCode > 57) event.returnValue = false;



}




//////////////////////////////////////////////////////////////////////   getcheckNumberDecimal()
function getcheckNumberDecimal(){
if (event.keyCode < 48 || event.keyCode > 57) 
 if (event.keyCode !=46) {
event.returnValue = false;
}
}


//////////////////////////////////////////////////////////////////////  getcheckNumberPhone
function getcheckNumberPhone(){


if (event.keyCode < 48 || event.keyCode > 57) 


{


if (event.keyCode != 45) event.returnValue = false;


}


}


/////////////////////////////////////////////////////////////////////////////////////////////////////        Trim





function trim(s){






var a=' '+s;





a=a.replace(/^\s+/,'')





a=a.replace(/\s+$/,'')






a=a.replace('   ','');










a=a.replace('  ','');


















if (a==' '){a=''}

















return a















}















//////////////////////////////////////////////////////////////////////    readradio
function readradio( who ) {
        for (i=0;i,who.length;i++) {
           if (who[i].checked) return who[i].value;
        }
        return 'Nothing selected as yet.';
      }

//////////////////////////////////////////////////////////////////////  check Length PhoneNumber and add dash like 121-121-1111




















function checkLengthPhoneNumber(test){


if ((event.keyCode ==45 )&&((test.value.length == 3)||(test.value.length == 7))){
test.value=test.value+"-"
}


if (event.keyCode >47 && event.keyCode < 58) {


if ((test.value.length == 3)||(test.value.length == 7))



{


test.value=test.value+"-"


return true


}


}


else

event.returnValue = false;










}



















//////////////////////////////////////////////////////////////////////  check Length SSN and add dash like 121-12-1111



function checkLengthSSN(test){


if (event.keyCode >47 && event.keyCode < 58) {




if ((test.value.length == 3)||(test.value.length == 6))




{test.value=test.value+"-"





return true}






}






else






{event.returnValue = false;}

}


//////////////////////////////////////////////////////////////////////  check Length Date and add / like 01/25/2000

function checkLengthDate(test){

if ((event.keyCode ==47 )&&((test.value.length == 2)||(test.value.length ==5 ))){
test.value=test.value+"/"
}

if (event.keyCode >47 && event.keyCode < 58) {

if ((test.value.length == 2)||(test.value.length == 5))

{test.value=test.value+"/"

return true}

}
else
{event.returnValue = false;}

}

//////////////////////////////////////////////////////////////////////  set ListBox Seleted By Value
function setListBoxSeletedByValue( who,v ) {

if (v=="")
{

v=" "
}
   for (i=0;i,who.length;i++) {
           if (who.value=v) return who.selectedindex=i;
        }
        return 'Nothing selected as yet.';
      }


////////////////////////////////////////////////////////////////////////////////////////////////////////// 
///////////////////////////////////////////  checkTime 12:12  ///////////////////////////////////////////
function checkTime(test){
//alert(event.keyCode)
if ((event.keyCode >47 && event.keyCode < 59)||(event.keyCode == 97 || event.keyCode == 112 ||event.keyCode == 109 ||event.keyCode == 32 ||event.keyCode == 80||event.keyCode == 77||event.keyCode == 65)) {
	if (test.value.length == 2&& event.keyCode != 58){
		test.value=test.value+":"
		return true		}}
		
else 
   {event.returnValue = false  }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////

function greeting(Name) {
var today = new Date();
var hrs = today.getHours();

if ((hrs >=6) && (hrs <=18))
{

//document.writeln("<IMG SRC=\"blank");
//document.write(Math.floor(hrs / 10));
//document.write(Math.floor(hrs % 10));
//document.write("00.gif \">");

}
else

document.write("<b>Good ");   
  
if (hrs < 6)
	document.write("(Early) Morning");
else if (hrs < 12)
	document.write("Morning");
else if (hrs <= 18)
	document.write("Afternoon");
else
	document.write("Evening</b>");
if (Name!="" )
	document.write("<br><b>" + Name + "</b><br>");

document.writeln();
document.write("You entered this page at ");
dayStr = today.toLocaleString();
document.write(dayStr);



}

//////////////////////////////// isStrValidDate //////////////////////////////////////////////////////////////////////////
function isStrValidDate(dateStr) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

//var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
 var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("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;  // date is valid
}
//////////////////////////////// isStrValidDate //////////////////////////////////////////////////////////////////////////