//Function Name : fnCheckNotSelected
//Description   : This function checks whether passed string is blank or not
//							: (for list boxes)
//Return Value  : boolean
	function fnCheckNotSelected(obj, name){
		var objThis, strName, strPattern, strValue;

		objThis		= obj;
		strValue	= objThis[objThis.selectedIndex].value;
		strName		= name;
		if (strValue == "" || strValue == null ){
			if (strName != ""){
				alert ("Select " + strName + ".");
				objThis.focus();
			}
			return false;
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnCheckNoneSelected
//Description   : This function checks whether passed string is blank or not
//							: (for list boxes)
//Return Value  : boolean
	function fnCheckNoneSelected(obj, name){
		var objThis, strName, strPattern, strValue;

		objThis		= obj;
		strValue	= objThis[objThis.selectedIndex].value;
		strText		=objThis[objThis.selectedIndex].text;
		strName		= name;
		if (strText == "None" || strText == "none" ){
			if (strName != ""){
				alert ("Select a Value for " + strName + ".");
				objThis.focus();
			}
			return false;
		}
		return true;
}

//-----------------------------------------------------------------------------
//Function Name : fnCheckNotSelMultiple
//Description   : This function checks whether passed string is blank or not
//							: (for list boxes with mutiple selects)
//Return Value  : boolean
	function fnCheckNotSelMultiple(obj, name){
		var objThis, strName, blnSelected;
		
		objThis		= obj;
		strName		= name;
		blnSelected = false;
		
		for(var a=0; a<objThis.options.length; a++){
			if(objThis[a].selected == true){
				blnSelected = true;
				break;
			}
		}
		
		if (!blnSelected){
			if (strName != ""){
				alert ("Select " + strName + ".");
				objThis.focus();
			}
			return false;
		}
		return true;
	}
	
//-----------------------------------------------------------------------------
//Function Name : fnCheckBlank
//Description   : This function checks whether passed string is blank or not
//							:	(for text boxes)
//Return Value  : boolean
	function fnCheckBlank(obj, name){
		var objThis, strName, strPattern, strValue;
		strPattern = /"/gi;
		objThis		= obj;
		strValue	= obj.value;
		
		strValue	= strValue.replace(strPattern,"\"");
		
		strName		= name;
		
		if (strValue == "" || strValue == null){
			if (strName != "") {
				alert ("Enter " + strName + ".");
				objThis.focus();
				objThis.select();
			}
			return false;
		}
		return true;
	}

//-------------------------------------------------------------------------------------------------
//Function Name : fnGetDays
//Description   : This function returns the no of days in a month
//Return Value  : integer
	function fnGetDays(month){
		var intDays;
		var intMonth = month;
		if (intMonth < 8) {
			if  (intMonth % 2 == 0)
					intDays = 30;
			else
					intDays = 31;
		}	
		else{
				if  (intMonth % 2 == 0) 
					intDays = 31;
				else
					intDays = 30;
		}
		return intDays;	
	}

//-----------------------------------------------------------------------------
//Function Name : fnValidDate
//Description   : This function validates date
//Return Value  : boolean
	function fnValidDate(objM, objD, objY, name) {
		var objDate, blnIsLeap, noOfDays, arrMonth, blnFlag, strName;
		var objFocus;
		
		objDateM = objM;	
		objDateD = objD;	
		objDateY = objY;	
		
		strName = name;

		blnFlag = true;

		var arrDates;

		var intYear = objY[objY.selectedIndex].value;
		var intDate = objD[objD.selectedIndex].value;
		var intMonth = objM[objM.selectedIndex].value;


		if(isNaN(intYear)) {
			blnFlag = false; objFocus = "Y";
		}
		else{
			if(isNaN(intDate)) {
				blnFlag = false; objFocus = "D";
			}
			else{
				if(isNaN(intMonth)) {
					blnFlag = false; objFocus = "M";
				}
				else{
					if(intMonth < 0 || intMonth > 13){
						blnFlag = false; objFocus = "M";
					}
					else{	
						if(intDate.length < 0 && intDate.length > 2){
							blnFlag = false; objFocus = "Y";
						}
						else{
							if(intYear.length != 4){
								blnFlag = false; objFocus = "Y";
							}
							else{
								if(intMonth != 2 && intDate > fnGetDays(intMonth)){
									blnFlag = false; objFocus = "D";
								}
								else{
									if (intYear % 4 == 0 && intYear % 100 != 0 || intYear % 400 == 0){
										blnIsLeap = true;
									}

									if (intMonth == 2 && intDate > 29 && blnIsLeap){
										blnFlag = false; objFocus = "D";
									}
									
									if (intMonth == 2 && intDate > 28 && !blnIsLeap){
										blnFlag = false; objFocus = "D";
									}
								}
							}
						}
					}
				}
			}
		}
		
		if(!blnFlag){
			if(strName != "") {
				alert("Enter valid "+strName);
			
				if("D" == objFocus){
					objD.focus();
				}
				else{
					if("M" == objFocus){
						objM.focus();
					}
					else{
						if("Y" == objFocus){
							objY.focus();
						}
					}
				}
			}
			return false;
		}
		else
			return true;
}

//-----------------------------------------------------------------------------
//Function Name : fnValidStrDate
//Description   : This function validates date takes input as a string
//Return Value  : boolean
	function fnValidStrDate(obj, name) {
		var objDate, objValue, blnIsLeap, noOfDays, arrMonth, blnFlag, strName;

		objDate = obj;	
		objValue = obj.value;	
			
		if(objValue == ""){
			return true;
		}
		
		strName = name;
		
		blnFlag = true;
		
		if (objValue.split("/").length != 3) {
			blnFlag = false;
		}
		var arrDates;

		arrDates = objValue.split("/");

		var intYear = arrDates[2];
		var intDate = arrDates[1];
		var intMonth = arrDates[0];
		if(!funIsValidWholeNumber(intYear) || !funIsValidWholeNumber(intDate) || !funIsValidWholeNumber(intMonth)){

			blnFlag = false;
		}
		else{
			if(intMonth < 1 || intMonth > 12){
				blnFlag = false;
			}
			else{
				if(intDate.length < 0 && intDate.length > 2){
					blnFlag = false;
				}
				if(intDate == 0){
					blnFlag = false;
				}
				else{
					if(intYear.length != 4){
						blnFlag = false;
					}
					if(parseInt(intYear) == 0 ){
						blnFlag = false;
					}
					else{
						if(intMonth != 2 && intDate > fnGetDays(intMonth)){
							blnFlag = false;
						}
						else{
							if (intYear % 4 == 0 && intYear % 100 != 0 || intYear % 400 == 0){
								blnIsLeap = true;
							}
	
							if (intMonth == 2 && intDate > 28 && !blnIsLeap){
								blnFlag = false;
							}
						}
					}
				}
			}
		}
		
		if (!blnFlag){
			alert ("Enter valid " + strName + ".");
			objDate.focus();
			objDate.select();
			return false;
		}
		else{
			return true;
		}
}


//------------------------------------------------------------------------------
//Function Name : fnCheckTextSize
//Description   : This function validates characters entered in the textarea
//Return Value  : boolean
	function fnCheckTextSize(obj, name, intLength){
		var objThis, strName, strValue, isValid;

		objThis = obj;
		strName = name;
		strValue = objThis.value;
		isValid = true;

		if(strValue.length > intLength){
			alert( strName + " should not exceed "+ intLength +" characters.");
			objThis.focus();
			objThis.select();
			return false;
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnValidName
//Description   : This function validates Person Name. Checks for all characters
//							:	and "." and "'"
//Return Value  : boolean
	function fnValidName(obj, name){
		var objThis, strName, strPattern, blnValid, strValue, str;

		blnValid		 = true;
		objThis		= obj;
		strValue	= obj.value;
		strName		= name;
		strPattern = "`~!@#$%^*()-_=+[{]}\|;:<>?1234567890"
		str = /\\/gi;

		if(strValue.length > 0){
			if(strValue.search("\"") != -1)
				blnValid = false;
			if(strValue.search(str) != -1)
				blnValid = false;

			else{
				for(var i=0; i<strValue.length; i++){
					for(var j=0; j<strPattern.length; j++){
						if(strValue.substr(i,1) == strPattern.substr(j,1)){
							blnValid = false;
							break;
						}
					}
					if (!blnValid)
						break;
				}
			}
		}
		if(!blnValid){
			if (strName != ""){
				alert ("Enter valid " + strName + ".");
				objThis.focus();
				objThis.select();
			}
			return false;
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnValidEmail
//Description   : This function validates Email Id
//Return Value  : boolean
function fnValidEmail(emailStr) {
	/* The following pattern is used to check if the entered e-mail address
	   fits the user@domain format.  It also is used to separate the username
	   from the domain. */
	var emailPat=/^(.+)@(.+)$/
	/* The following string represents the pattern for matching all special
	   characters.  We don't want to allow special characters in the address.
	   These characters include ( ) < > @ , ; : \ " . [ ]    */
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	/* The following string represents the range of characters allowed in a
	   username or domainname.  It really states which chars aren't allowed. */
	var validChars="\[^\\s" + specialChars + "\]"
	/* The following pattern applies if the "user" is a quoted string (in
	   which case, there are no rules about which characters are allowed
	   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	   is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")"
	/* The following pattern applies for domains that are IP addresses,
	   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	   e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	/* The following string represents an atom (basically a series of
	   non-special characters.) */
	var atom=validChars + '+'
	/* The following string represents one word in the typical username.
	   For example, in john.doe@somewhere.com, john and doe are words.
	   Basically, a word is either an atom or quoted string. */
	var word="(" + atom + "|" + quotedUser + ")"
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	/* The following pattern describes the structure of a normal symbolic
	   domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


	/* Finally, let's start trying to figure out if the supplied address is
	   valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	   different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat)
	if(matchArray==null){
	  /* Too many/few @'s or something; basically, this address doesn't
		 even fit the general mould of a valid e-mail address. */
		alert("Email address seems incorrect (check @ and .'s)")
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid
	if(user.match(userPat)==null){
		// user is not valid
		alert("The Email doesn't seem to be valid(check the name in the email address).")
		return false
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	   host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat)
	if(IPArray!=null){
		// this is an IP address
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Destination IP address is invalid!")
			return false
			}
		}
		return true
	}

	// Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if(domainArray==null){
		alert("The domain name doesn't seem to be valid.")
		return false
	}

	/* domain name seems valid, but now make sure that it ends in a
	   three-letter word (like com, edu, gov) or a two-letter word,
	   representing country (uk, nl), and that there's a hostname preceding
	   the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
	   it consists of. */
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 ||
		domArr[domArr.length-1].length>3) {
	   // the address must end in a two letter or three letter word.
	   alert("The address must end in a three-letter domain, or two letter country.")
	   return false
	}

	// Make sure there's a host name preceding the domain.
	if(len<2){
	   var errStr="This address is missing a hostname!"
	   alert(errStr)
	   return false
	}

	// If we've gotten this far, everything's valid!
	return true;
	}
 
//-----------------------------------------------------------------------------
//Function Name : fnValidNumber
//Description   : This function checks the for all numbers
//Return Value  : boolean
	function fnValidNumber(obj,name){
		var objThis, strName, i, j;
		objThis = obj;
		strName = name;
		for(i=0;i<(objThis.value).length;i++){
			if(objThis.value.charAt(i) < "0" || objThis.value.charAt(i) >"9"){
				alert("Enter valid " + strName + ".");
				objThis.focus();
				objThis.select();
				return false;
			}
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnValidAlphaNumeric
//Description   : This function checks the alpha numerics
//Return Value  : boolean
	function fnValidAlphaNumeric(obj,name){
		var objThis, strName, blnFlag, strDouble, strValue;
		objThis = obj;
		strName = name;
		strDouble = /"/gi;

		strValue = objThis.value.replace(strDouble,"\"");
		blnFlag = false;
		for(i=0; i<strValue.length; i++){
			theChar=strValue.charAt(i);
		  if(!((theChar>="a" && theChar<="z") ||
			     (theChar>="A" && theChar<="Z") ||
					 (theChar>="0" && theChar<="9")))
			{
		    blnFlag = true;
				break;
			}
		}
	  if (blnFlag){
			alert ("Enter valid " + strName + ".");
			objThis.focus();
			objThis.select();
			return false;
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnValidDescription
//Description   : This function validates description. Checks for all characters
//							:	and "." and "'"
//Return Value  : boolean
	function fnValidDescription(obj, name){
		var objThis, strName, strPattern, blnValid, strValue, str;

		blnValid 	= true;
		objThis		= obj;
		strValue	= obj.value;
		strName		= name;
		strPattern = "`~!@$%^*=[{]}|;<>?"
		str = /\\/gi;

		if(strValue.length > 0){
			if(strValue.search("\"") != -1)
				blnValid = false;
			if(strValue.search(str) != -1)
				blnValid = false;

			else{
				for(var i=0; i<strValue.length; i++){
					for(var j=0; j<strPattern.length; j++){
						if(strValue.substr(i,1) == strPattern.substr(j,1)){
							blnValid = false;
							break;
						}
					}
					if (!blnValid)
						break;
				}
			}
		}
		if(!blnValid){
			if (strName != ""){
				alert ("Enter valid " + strName + ".");
				objThis.focus();
				objThis.select();
			}
			return false;
		}
		return true;
	}

//-----------------------------------------------------------------------------
//Function Name : fnCheckSpecial
//Description   : This function special characters in the textarea
//Return Value  : boolean
function fnCheckSpecial(obj, name){
	var objThis, strName, blnValid, strValue;

	objThis		= obj;
	blnValid 	= true;
	strValue	= obj.value;
	strName 	= name;

	if(strValue.indexOf(String.fromCharCode(60,37)) != -1)
		blnValid = false;
	else if(strValue.indexOf("%>")!=-1)
		blnValid = false;
	else if(strValue.indexOf(String.fromCharCode(60)+"script") != -1)
		blnValid = false;
	else if(strValue.indexOf("/script>") != -1)
		blnValid = false;
	else
		blnValid = true;

	if(!blnValid){
		if (strName != ""){
			alert ("Enter valid " + strName + ".");
			objThis.focus();
			objThis.select();
		}
		return false;
	}
	return true;
}

/*
* This function checks whether the day,month and year are blanks

*/
function isDayMonthYearNonblank(tDay,tMonth,tYear){
	if(tDay.options[tDay.options.selectedIndex].value=="0"){
		alert("Please select day.");
		tDay.focus();
		return false;
	}//end of if
	if(tMonth.options[tMonth.options.selectedIndex].value=="0"){
		alert("Please select month.");
		tMonth.focus();
		return false;
	}//end of if
	if(tYear.options[tYear.options.selectedIndex].value=="0"){
		alert("Please select year.");
		tYear.focus();
		return false;
	}//end of if
	return true;
}//end of function

/*
 * This method will check whether a char is in 
 * the string of allowed characters
 */
 function isSpecial(legalChars,theChar){
 	for(k=0;k<legalChars.length;k++){
 		if(theChar==legalChars.charAt(k)){
 			return true;
 		}//end of if
 	}//end of for-loop
 	return false;
 }//end of function


/*
 * This function checks whether the char passed is an alphabet or not
 */
function isAlphabet(chValue){
	if((chValue>='a' && chValue<='z') ||
	   (chValue>='A' && chValue<='Z'))
	   return true;
	else
		return false;
}//end of function


/*
 * This function checks whether the char passed is an alphabet or not
 */
function isDigit(chValue){
	if(chValue>=0 && chValue<=9)
		return true;
	else
		return false;
}//end of function

/*
 * This method validates all the form fields
 */
function isValidDate(tDay,tMonth,tYear){
	day   = parseInt(tDay.options[tDay.options.selectedIndex].value);
	month = parseInt(tMonth.options[tMonth.options.selectedIndex].value);
	year  = parseInt(tYear.options[tYear.options.selectedIndex].value);
	//check valid month/date combination
	if((month==4 || month==6 || month==9 || month==11) && day > 30){
		return false;
	}//end of if
	//check for leap year combination
	if(month==2){
		if(year%400==0 || (year%100!=0 && year%4==0)){
			//year is a leap century/year
			if(day > 29){
				return false;
			}//end of if(day > 29)
		}//end of if(year%400 == 0 || year%4 == 0)
		else{
			//year is a non-leap century/year
			if(day > 28)
				return false;
		}//end of else
	}//end of if(month==2)
	//all's well
	return true;	
}//end of function

function isFloat(objThis){
	strValue=objThis.value;
	if(strValue.indexOf(".")!=strValue.lastIndexOf(".")){
		alert("Invalid value.");
		objThis.select();
		objThis.focus();
		return false;
	}//end of if
	var strTemp1;
	var strTemp2;
	if(strValue.indexOf(".") !=-1){
		strTemp1 = strValue.substring(0,strValue.indexOf("."));//value before decimal
		strTemp2 = strValue.substring((strValue.indexOf(".")+1));//value after decimal
		strValue =strTemp1+strTemp2;
		for(i=0;i<strValue.length;i++){
			if(!isDigit(strValue.charAt(i))){
				alert("Enter a numeric value.");
				objThis.select();
				objThis.focus();
				return false;
			}//end of if
		}//end of for-loop
		if(strTemp2.length>2){
			alert("Value should be upto two decimal places.");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
		if(strTemp1.length>13){
			alert("Enter a numeric value lower than 100,000,000 or that has few than 9 characters..");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
	}//end of if
	else{
		for(i=0;i<strValue.length;i++){
			if(!isDigit(strValue.charAt(i))){
				alert("Enter a numeric value.");
				objThis.select();
				objThis.focus();
				return false;
			}//end of if
		}//end of for-loop
		if(strValue.length>11){
			alert("Enter a numeric value lower than 1,000,000,0000 or that has few than 12 characters. .");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
	}//end of if
	//all's well
	return true;
}//end of function

/*
 * This method checks for amount which can contain negative values.
 */

function isFloatNeg(objThis){
	strValue=objThis.value;
	if(strValue.indexOf(".")!=strValue.lastIndexOf(".")){
		alert("Invalid value.");
		objThis.select();
		objThis.focus();
		return false;
	}//end of if
	if(strValue.indexOf("-")!=strValue.lastIndexOf("-")){
		alert("Invalid value.");
		objThis.select();
		objThis.focus();
		return false;
	}//end of if
	if(strValue.lastIndexOf("-")!=-1){
		if(strValue.lastIndexOf("-")!=0){
		alert("Invalid value.");
		objThis.select();
		objThis.focus();
		return false;
		}
	}//end of if
	if(isNaN(strValue)){
		alert("Invalid value.");
		objThis.select();
		objThis.focus();
		return false;
	}//end of if
	if(strValue.lastIndexOf("-")==0){
		strValue=strValue.substr(1);
	}
	var strTemp1;
	var strTemp2;
	if(strValue.indexOf(".") !=-1){
		strTemp1 = strValue.substring(0,strValue.indexOf("."));//value before decimal
		strTemp2 = strValue.substring((strValue.indexOf(".")+1));//value after decimal
		strValue =strTemp1+strTemp2;
		for(i=0;i<strValue.length;i++){
			if(!isDigit(strValue.charAt(i))){
				alert("Enter a numeric value.");
				objThis.select();
				objThis.focus();
				return false;
			}//end of if
		}//end of for-loop
		if(strTemp2.length>2){
			alert("Value should be upto two decimal places.");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
		if(strTemp1.length>13){
			alert("Enter a numeric value lower than 9,99,99,99,999 or that has few than 9 characters..");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
	}//end of if
	else{
		for(i=0;i<strValue.length;i++){
			if(!isDigit(strValue.charAt(i))){
				alert("Enter a numeric value.");
				objThis.select();
				objThis.focus();
				return false;
			}//end of if
		}//end of for-loop
		if(strValue.length>10){
			alert("Enter a numeric value lower than 9,99,99,99,999 or that has few than 9 characters. .");
			objThis.select();
			objThis.focus();
			return false;
		}//end of if
	}//end of if
	//all's well
	return true;
}//end of function

/*
 * This method will trim the white spaces from the start and end
 */
function trim(strValue){
	//trim at start
	while(strValue.charAt(0)==' '){
		strValue = strValue.substring(1);//remove the space at start
		if(strValue.length==0){
			return strValue;
		}//end of if
	}//end of if
	//trim at end
	while(strValue.charAt((strValue.length-1))==' '){
		strValue = strValue.substring(0,(strValue.length-1));//remove the space at start
	}//end of if
	return strValue;
}//end of function


function fnCheckAll(selBox,strName)
{
	var i = 0;
	var selLength = selBox.length;
	for(j=0;j<selLength;j++){
			if(selBox.options[j].selected){
				i++;
			}//end if
	}//end for
	if(i>1)
	{
		if(selBox.options[0].selected == true)
		{
			alert("Select either 'All' or other options in "+ strName + " dropdown" );
			for(j=1;j<selLength;j++){
				if(selBox.options[j].selected){
					selBox.options[j].selected = false;
				}//end if
			}//end for
			selBox.focus();
		}//end if
	}//end if
}//end fnCheckAll(selBox)


//-----------------------------------------------------------------------------
//Function Name : fnGreaterPeriod
//Description   : This function validates Start Date being greater than the End Date
//Return Value  : boolean
function fnGreaterPeriod(objStartM, objStartD, objStartY, objEndM, objEndD, objEndY, startName, endName){
	
	var bShowAlert = false;	
	var eYear = parseInt(objEndY.options[objEndY.selectedIndex].value);
	var sYear = parseInt(objStartY.options[objStartY.selectedIndex].value);

	var eMonth = parseInt(objEndM.options[objEndM.selectedIndex].value);
	var sMonth = parseInt(objStartM.options[objStartM.selectedIndex].value);
	
	var eDay = parseInt(objEndD.options[objEndD.selectedIndex].value);
	var sDay = parseInt(objStartD.options[objStartD.selectedIndex].value);
					
	if(sYear > eYear){
		objEndY.focus();
		bShowAlert = true;
	}//end if
			
	if(sYear == eYear){
		if(sMonth > eMonth){
			objEndM.focus();
			bShowAlert = true;
		}//end if
	}//end if
			
	if(sYear == eYear){
		if(sMonth == eMonth){
			if(sDay > eDay){
				objEndD.focus();
				bShowAlert = true;
			}//end if
		}//end if
	}//end if

	if(bShowAlert) {
		alert("Select "+endName+" Date greater than "+startName +" Date");
		return false;
	}
	else {
		return true;
	}
}

//-----------------------------------------------------------------------------
//Function Name : fnCheckTimeSpan
//Description   : This function validates if the Date entered is between Start Date and End Date
//Return Value  : boolean
function fnCheckTimeSpan(objDate, strStart, strEnd, dtName, startName, endName){
		
	if ((objDate.value).split("/").length != 3) {
		return true;
	}
	var arrDates, arrStart, arrEnd;

	arrDates = (objDate.value).split("/");
	arrStart = strStart.split("/");

	var dtDate = new Date(Number(arrDates[2]),Number(arrDates[0]-1),Number(arrDates[1]));
	var dtStart = new Date(Number(arrStart[2]),Number(arrStart[0]-1),Number(arrStart[1]));

	if(strEnd != "") {
		arrEnd = strEnd.split("/");
		var dtEnd = new Date(Number(arrEnd[2]),Number(arrEnd[0]-1),Number(arrEnd[1]));
	}	

	if (dtDate < dtStart){
		alert(dtName+" must be greater or equal to "+startName +" Date");
		objDate.focus();
		return false;
	}
	else {
		if (dtEnd < dtDate){
			alert(dtName+" must be lesser or equal to "+endName +" Date");
			objDate.focus();
			return false;
		}	
		else {
			return true;
		}
	}		

}

//-----------------------------------------------------------------------------
//Function Name : fnGreaterPeriod
//Description   : This function validates Start Date being greater than the End Date
//Return Value  : boolean
function fnGreaterPeriod_new(strStartMM,strStartDD,strStartYYYY,strEndMM,strEndDD,strEndYYYY, startName, endName){
	
	var bShowAlert = false;	
	var eYear = strEndYYYY * 1;
	var sYear = strStartYYYY * 1;

	var eMonth = strEndMM * 1;
	var sMonth = strStartMM * 1;
	
	var eDay = strEndDD * 1;
	var sDay = strStartDD * 1;

	if(sYear > eYear){
		bShowAlert = true;
	}//end if
	if(sYear == eYear){
		if(sMonth > eMonth){
			bShowAlert = true;
		}//end if
	}//end if
	if(sYear == eYear){
		if(sMonth == eMonth){
			if(sDay > eDay){
				bShowAlert = true;
			}//end if
		}//end if
	}//end if
	if(bShowAlert){
		alert("Select "+endName+" Date greater than "+startName +" Date");
		return false;
	}
	else {
		return true;
	}
}
// This function checks whether the argument is a valid Whole Number
// without any decimals
function funIsValidWholeNumber(theField){
    iPerValue = parseInt(theField * 1);
	fPerValue = parseFloat(theField);

	if(isNaN(theField)){
		return false;
	}
	if(iPerValue!=fPerValue){
		return false;
	}
	return true;
}

//-----------------------------------------------------------------------------
//Function Name : fnCheckPhone
//Description   : This function validates phone and fax
//Return Value  : boolean
	function fnCheckPhone(obj, name){
		var objThis, strName, strPattern, blnValid, strValue, str;

		blnValid 	= true;
		objThis		= obj;
		strValue	= obj.value;
		strName		= name;
		strPattern = "`~!@$%^*=|;:<>?"
		str = /\\/gi;

		if(strValue.length > 0){
			if(strValue.search("\"") != -1)
				blnValid = false;
			if(strValue.search(str) != -1)
				blnValid = false;

			else{
				for(var i=0; i< strValue.length; i++){
					for(var j=0; j< strPattern.length; j++){
						if(strValue.substr(i,1) == strPattern.substr(j,1)){
							blnValid = false;
							break;
						}
					}
					if (!blnValid)
						break;
				}
			}
		}
		if(!blnValid){
			if (strName != ""){
				alert ("Enter valid " + strName + ".");
				objThis.focus();
				objThis.select();
			}
			return false;
		}
		return true;
	}

function fnValidURL(obj,name){
	objThis		= obj;
	strValue	= obj.value;
	strName		= name;
	var re_http = /^(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/; 
  	if (!re_http.test(strValue))
  	 {
 		alert("The "+name+" is incorrectly entered \n\nPlease ensure that it is a valid URL.");
  	    objThis.focus();
  		return (false);
  	 }
	return true;
}

function openPage(strUrl){
	strTemp = window.open(strUrl);
	return;
}
