
//# Function for checking date validation by combo boxes
function isDate(dtStr)
	{
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : dd.mm.yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter valid date")
		return false
	}
return true
}
//=====================
function validyears(dtStr)
    {
    
    var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	for (var i = 1; i <= 3; i++) 
	{
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	
	year=parseInt(strYr)
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	
return true


}

//==============================
function validmonthyear(dtStr)
  {
   
    var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var len=dtStr.length;
	var strMonth=dtStr.substring(0,pos1)
	var strYear=dtStr.substring(pos1+1,len)
	strYr=strYear
	
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	
	year=parseInt(strYr)
	
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter valid Month")
		return false
	}
	
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter valid 4 digit Year between "+minYear+" and "+maxYear)
		return false
	}
	
return true
}	
//=========================
var dtCh= ".";
var minYear=1900;
var maxYear=2100;
//--------------------------
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
//-------------------------------------
function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}
//------------------------------
function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
//===================
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}
//=====================================
function ValidYear(str)
			{
			var re = /^[\d]{4}$/;
			str=str.toString();
					if(!str.match(re))
					{  
					    alert("The Year format should be : yyyy")
						return false;
					}
					return true;				
			 }	



//=========================================================================================================
function ValidatePwd()
{
	//# Validate Old Password
	if (!ForceDataEntry(document.form1.txtOPwd,'Old Password')) return false; 
	//# Validate New Password
	if (!ForceDataEntry(document.form1.txtNPwd,'New Password')) return false; 
	//# Validate Confirm Password
	if (!ForceDataEntry(document.form1.txtCPwd,'Confirm Password')) return false;
	if( document.form1.txtNPwd.value != document.form1.txtCPwd.value)
	{
		alert("New password and Confirm password should be same");
		return false;
	}

}
//=========================================================================================================
//# function for validating numeric only
function CheckOnlyNumeric()
{
//debugger;
  if ((event.keyCode >= 48 && event.keyCode <= 57 )||(event.keyCode >= 96 && event.keyCode <= 105))
  {
	return true; 
	}
  else
  {
	return false;
  }
}
//=========================================================================================================
function CheckOnlyCharacter()
{
  if ((String.fromCharCode(event.keyCode) >= 'A' && String.fromCharCode(event.keyCode) <= 'Z' )||(String.fromCharCode(event.keyCode) >= 'a' && String.fromCharCode(event.keyCode) <= 'z') ||(String.fromCharCode(window.event.keyCode) == ' '))
  {
	return true; 
	}
  else
  {
	return false;
  }
}

//==========================================================================================================
 //# function for validating alphanumeric values
 function CheckAlphaNumeric()
 {
	if ((event.keyCode > 32 && event.keyCode < 48) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)) 
	event.returnValue = false;
}

//===========================================================================================================
//# Function for checking only character values

function CheckCharacterA()
{

	if((event.keyCode >= 96 && event.keyCode <= 105) ||

	(event.keyCode > 32 && event.keyCode < 48) ||

	(event.keyCode > 57 && event.keyCode < 65) ||

	(event.keyCode > 90 && event.keyCode < 97) ||

	(event.keyCode == 189 || event.keyCode == 109))
		{
			return true; 
		}
	else 
		{
			return false;
		}
}
//============================================================================================================
function chkCountry()
{
	if ((document.getElementById("txtCountry").value).toUpperCase()=="INDIA")	
	{
		document.getElementById("ddlState").disabled=false;
		document.getElementById("ddlCity").disabled=false;
		return true;
	}
	else
	{
		document.getElementById("ddlState").disabled=true;
		document.getElementById("ddlCity").disabled=true;
		return true;
	}

}

//===========================================================================================================
function Confirm()
{
	var ans = confirm("Are yor sure you want to cancel the Booking and you have read the Cancellation Policy");
	if (ans)
	{
		return true;
	}
	else
	{
		return false;
	}

}

////  


//===========================================================================================================
function IsValidTime(objField) 
		{
			//alert("Hi");
			var timeStr=objField.value;
			// Checks if time is in HH:MM:SS AM/PM format.
			// The seconds and AM/PM are optional.
			//debugger;
			
			var timePat = /^(\d{1,2}):(\d{2})(:(\d{2}))?(\s?(AM|am|PM|pm))?$/;
			
			var matchArray = timeStr.match(timePat);
			if (matchArray == null)
			{
				alert("Time is not in a valid format");
				objField.focus();
				return false;
			}
			
			hour = matchArray[1];
			minute = matchArray[2];
			second = matchArray[4];
			ampm = matchArray[6];

			if (second=="") { second = null; }
			if (ampm=="") { ampm = null; }

			if (hour < 1  || hour > 12)
			{
				alert("Hour must be between 1 and 12");
				objField.focus();
				return false;
				
			}
			if (minute<0 || minute > 59)
			{
				alert ("Minute must be between 0 and 59");
				objField.focus();
				return false;
				
			}
			return true;
	}


//============================================================================================================
//~ Checks to see if a required field is blank.  If so, an error message is displayed.
function ForceDataEntry(objField, strFieldName)
{
	// To find out the Value of the control
	var strFieldValue=objField.value;
	//alert("hiii");
	if (IsEmpty(strFieldValue))
	{
		alert("You need to enter information for " + strFieldName);
		objField.focus();
		return false;
	}
	return true;
}
//==============================================================================================================
//# function to generate Random No of 2 Digit



//================================================================================================================
//~ Check whether a given string is empty or not.
function IsEmpty(strTxtBoxValue)
{   if ((strTxtBoxValue == null) || (strTxtBoxValue.length == 0))
	{
		return true;			//^ Returning True, if Empty Text Box found
	}	
}

//===============================================================================================================
//~ Checks to see if a DropDownList is empty. If so, an error message is displayed.
function ForceComboItems(ddlName, strDdlName)
{
	// To find out the Value of the control
	var ItemCount=ddlName.value;
	if (IsComboEmpty(ItemCount))
		{
			alert("First Select the " + strDdlName);
			ddlName.focus();
			return false;
		}
	return true;
}
//===============================================================================================================
//# setting focus 



//================================================================================================================
//~ Check whether a given DropDown value is empty or not.

function IsComboEmpty(ddlValue)
{   if  (ddlValue =="--Select--")
	{
		return true;			//^ Returning True, if Empty Text Box found
	}	
}

	
//===============================================================================================================
 function ShowPopup(formName,popupHeight,popupWidth,popupLeft,popupTop)
	{		
		vMenuBar = 'menubar=no,Height= ' + popupHeight + ',Width=' + popupWidth + ',left=' + popupLeft + ',top=' + popupTop + ', resizable=no'
		window.open(formName,'_blank',vMenuBar)
		//window.close()
	}
	
//================================================================================================================
//~ Check whether a given Email is Valid or not.
function IsEmailValid(objField, strFieldName)
{
	// To find out the Value of the control
	var strFieldValue=objField.value;
	if (IsEmpty(strFieldValue))
	{
		return true;
	}
	else
	{
	    var at="@"
		var dot="."
		var lat=strFieldValue.indexOf(at)
		var lstr=strFieldValue.length
		var ldot=strFieldValue.indexOf(dot)
		
		if (strFieldValue.indexOf(at)==-1)
		{
		    alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		}
		if (strFieldValue.indexOf(at) == -1 || strFieldValue.indexOf(at) == 0 || strFieldValue.indexOf(at) == lstr)
        {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		}
		if (strFieldValue.indexOf(dot)== lstr || strFieldValue.indexOf(dot)== -1 || strFieldValue.indexOf(dot)== 0  )
        {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false
		}
		if ((ldot+1)  == lstr   )
        {
        
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false
		}
		 if (strFieldValue.indexOf(at,(lat+1))!= -1)
         {
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false;
		 }
		 if (strFieldValue.substring(lat-1,lat) == dot || strFieldValue.substring(lat+1,lat+2)== dot)
         {
		   alert("Email should be in abc@xyz.com format");
		   objField.focus();
		   return false;
		 }

		 if (strFieldValue.indexOf(dot,(lat+2))== -1)
         {
		    alert("Email should be in abc@xyz.com format");
		    objField.focus();
		    return false;
		 }
		 
		 if (lstr == strFieldValue.indexOf(dot)+2 || lstr == strFieldValue.indexOf(dot)+5)
          {
		       alert("Email should be in abc@xyz.com format");
		       objField.focus();
		       return false;
		       
		      }
		 if (strFieldValue.indexOf(" ")!= -1)
         {
		     alert("Email should be in abc@xyz.com format");
		     objField.focus();
		     return false;
		 }
		return true;
		}
	
	
}
//--------------------------------------------------------------------------------------------------------------------
 // Create a Function for atleast 6 characters
 
function ValidateLength(objField,strFieldName)
 {
    var strFieldValue=objField.value;
    if (strFieldValue.length < 6)
                {
                    alert(strFieldName + " should be of at least 6 characters");
                    objField.focus();
                    return false;
                }
                return true;
 }
 
//----------------------------------------------------------------------------------------------------------------- 
 // To check whethere the Password & confirm match 
 
 function ValidateTextBox(objPassword,objConfirmPassword)
     {
            var strTextBox1 = objPassword.value
            var strTextBox2 = objConfirmPassword.value
             
            if (strTextBox1 != strTextBox2)
            {
              alert("Password & Confirm Password not Match");
              return false;
            }
         return true;
     }
     
  
  //===============================================================================================================
//~ Returns true if the string passed is a valid number
//~ no characters except a -ve sign at the begining is accepted
//~ otherwise, it displays an error message
function ForceNumericEntry(objField, strFieldName)
{
	var strFieldValue = new String(objField.value);
    var intLoopCounter = 0;

	for (intLoopCounter = 0; intLoopCounter < strFieldValue.length; intLoopCounter++)
		//if ((strFieldValue.charAt(intLoopCounter) < '0' || strFieldValue.charAt(intLoopCounter) > '9') && (strFieldValue.charAt(0) != '-'))
		
		if  ((strFieldValue.charAt(intLoopCounter) > '9') && (strFieldValue.charAt(0) != '-'))
		{
			alert(strFieldName + " must be a valid No. ");
			objField.value="";
			objField.focus();
			return false;
		}
	return true;
}
//================================================================================
// Create a function for validate the user to forcefully select the checkbox
 function ForceCheckBox(objField,strFieldName)
        {
            if (objField.checked == true)
                {
                 return true;
                }
            else
                {
                    alert("You need to check the checkbox for " + strFieldName);
		            objField.focus();
		            return false;
                }
         }
         
//==========================================================================================================
// Validates a Date Entered by User 
// Also Forces the User to stick to either "dd/MMM/yyyy" or "dd-MMM-yyyy" Date Formats.

	function isValidDate(objField,strDateName)
	{
     var strDateValue=trimAll(objField.value)
    
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue)) return true;
     
       
     var arr = [];
     arr['JAN'] = 0;
     arr['FEB'] = 1;
     arr['MAR'] = 2;
     arr['APR'] = 3;
     arr['MAY'] = 4;
     arr['JUN'] = 5;
     arr['JUL'] = 6;
     arr['AUG'] = 7;
     arr['SEP'] = 8;
     arr['OCT'] = 9;
     arr['NOV'] = 10;
     arr['DEC'] = 11;
     
     //^ Splitting the date using the divider "/"
     var arrDate = strDateValue.split('/');
     
     //^ If user did not use the divider "/" then,
     if (arrDate.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate = strDateValue.split('-');
     }
     
     // if splitting occured using the correct divider
     if (arrDate.length==3 && strDateValue.length==11)
     {
       //^ d stores date entered by user in Javascript Internal Date Format
       var d = new Date(arrDate[2], arr[arrDate[1].toUpperCase()], arrDate[0]);
     
       //Checking if the date entered is a valid Date or not
       if (!isNaN(d) && d.getFullYear()==arrDate[2] && d.getMonth()==arr[arrDate[1].toUpperCase()] && d.getDate()==arrDate[0])
       {
             return true;
       }
       else
       {
            alert(strDateName + " Valid Date Formats Are : dd/MMM/yyyy or dd-MMM-yyyy");
            objField.focus();
            return false;
       }
     }
     else
     {
        alert("Valid Date Formats Are : dd/MMM/yyyy or dd-MMM-yyyy");
        objField.focus();
        return false;
     }
}

//=============================================================================================================

// Function for trim any string
function trimAll( strValue )
			 {				
				var objRegExp = /^(\s*)$/;
					      //check for all spaces
					if(objRegExp.test(strValue))
					 {
					strValue = strValue.replace(objRegExp, '');
					if( strValue.length == 0)
						return strValue;
					 }
				        //check for leading & trailing spaces
				    objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
				    if(objRegExp.test(strValue)) 
				     {
					//remove leading and trailing whitespace characters
					strValue = strValue.replace(objRegExp, '$2');
				     }
				return strValue;
			 }


//==================================
function isDecimalValue(fieldName, fieldLabel)
{
    decallowed = 2;  // how many decimals are allowed?
    fieldValue = fieldName.value;
    
    if (isNaN(fieldValue) || fieldValue == "") 
    {
        alert(fieldLabel + " is not a valid number.");
        fieldName.select();
        fieldName.focus();
        return false;
    }
    else 
    {
        if (fieldValue.indexOf('.') == -1) fieldValue += ".";
            dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
    
        if (dectext.length > decallowed)
        {
            alert (fieldLabel + " allows up to " + decallowed + " decimal places only");
            fieldName.select();
            fieldName.focus();
            return false;
        }
        else 
        {
            return true;
        }
    }
}

//==============================================================================================
// JS Functions for Validating Numeric/Decimal values => As User Types Them
//==============================================================================================

//This function performs Entire Value Validation
//Executed on :
//OnKeyUp event (Validates after chracter is entered) & 
//OnBlur  event (Validates when focus is lost - takes care of Copy Paste situation)

function extractNumber(obj, decimalPlaces, allowNegative)
{
	var temp = obj.value;
	
	// avoid changing things if already formatted correctly
	var reg0Str = '[0-9]*';
	if (decimalPlaces > 0) {
		reg0Str += '\\.?[0-9]{0,' + decimalPlaces + '}';
	} else if (decimalPlaces < 0) {
		reg0Str += '\\.?[0-9]*';
	}
	reg0Str = allowNegative ? '^-?' + reg0Str : '^' + reg0Str;
	reg0Str = reg0Str + '$';
	var reg0 = new RegExp(reg0Str);
	if (reg0.test(temp)) return true;

	// first replace all non numbers
	var reg1Str = '[^0-9' + (decimalPlaces != 0 ? '.' : '') + (allowNegative ? '-' : '') + ']';
	var reg1 = new RegExp(reg1Str, 'g');
	temp = temp.replace(reg1, '');

	if (allowNegative) {
		// replace extra negative
		var hasNegative = temp.length > 0 && temp.charAt(0) == '-';
		var reg2 = /-/g;
		temp = temp.replace(reg2, '');
		if (hasNegative) temp = '-' + temp;
	}
	
	if (decimalPlaces != 0) {
		var reg3 = /\./g;
		var reg3Array = reg3.exec(temp);
		if (reg3Array != null) {
			// keep only first occurrence of .
			//  and the number of places specified by decimalPlaces or the entire string if decimalPlaces < 0
			var reg3Right = temp.substring(reg3Array.index + reg3Array[0].length);
			reg3Right = reg3Right.replace(reg3, '');
			reg3Right = decimalPlaces > 0 ? reg3Right.substring(0, decimalPlaces) : reg3Right;
			temp = temp.substring(0,reg3Array.index) + '.' + reg3Right;
		}
	}
	
	obj.value = temp;
}

//==============================================================================================================

//This function performs Character by Character Validation.
//Executed on :
//OnKeyPress event (Validates after character is entered) 

function blockNonNumbers(obj, e, allowDecimal, allowNegative)
{
	var key;
	var isCtrl = false;
	var keychar;
	var reg;
		
	if(window.event) {
		key = e.keyCode;
		isCtrl = window.event.ctrlKey
	}
	else if(e.which) {
		key = e.which;
		isCtrl = e.ctrlKey;
	}
	
	if (isNaN(key)) return true;
	
	keychar = String.fromCharCode(key);
	
	// check for backspace or delete, or if Ctrl was pressed
	if (key == 8 || isCtrl)
	{
		return true;
	}

	reg = /\d/;
	var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
	var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
	
	return isFirstN || isFirstD || reg.test(keychar);
}

//==========================================================================================================
// function to Round off a number

function formatNumber(myNum, numOfDec) 
{ 
  var decimal = 1 
  for(i=1; i<=numOfDec;i++) 
      decimal = decimal *10 
            
  var myFormattedNum = (Math.round(myNum * decimal)/decimal).toFixed(numOfDec) 
  return(myFormattedNum) 
} 

//=======================================================================================================
//nO OF nIGHTS



//============================================================================================================
//Validating 2 dates
function DateDiff(objField1,objField2,strDateName1,strDateName2)
{
	var strDateValue1=objField1.value;  //trimAll(objField1.value);
	var strDateValue2=objField2.value;  //trimAll(objField2.value);
    
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
     
     var arr = [];
     arr['01'] = 'JAN';
     arr['02'] = 'FEB';
     arr['03'] = 'MAR';
     arr['04'] = 'APR';
     arr['05'] = 'MAY';
     arr['06'] = 'JUN';
     arr['07'] = 'JUL';
     arr['08'] = 'AUG';
     arr['09'] = 'SEP';
     arr['10'] = 'OCT';
     arr['11'] = 'NOV';
     arr['12'] = 'DEC';
     var a = arr[0];

     //^ Splitting the date using the divider "/"
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
   
     //^ If user did not use the divider "/" then,
     if (arrDate1.length!=3 && arrDate2.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
     }
 
    if (arrDate1.length==3 && strDateValue1.length==10 && arrDate2.length==3 && strDateValue2.length==10)
    {
    
       var mon1 = Number(arrDate1[1]);
       var mon2 = Number(arrDate2[1]);
     
	   var date1 = Number(arrDate1[0]);
	   var date2 = Number(arrDate2[0]);
	   var year1 = parseInt(arrDate1[2]);
	   var year2 =parseInt(arrDate2[2]);
	 		
	if (year1 > year2)
	{
		alert(strDateName1 + " should be less than" + strDateName2);
		objField1.focus();
		return false;
	}
	else
	{
		if (year1 < year2)
		{
		return true;
		}
		else
		{
			if (mon1 > mon2)
			{
				alert(strDateName1 + " should be less than" + strDateName2);
				objField1.focus();
				return false;
			}
			else
			{
				if (mon1 < mon2)
				{
					return true;
				}
				else
				{
					if ( date1 >= date2)
					{
						alert(strDateName1 + " should be less than" + strDateName2);
						objField1.focus();
						return false; 
					}
					else
					{
						return true;
					}
				}
			 }	
		}
	}
 }
 }	
//==============================================================================================================
function ValidateCheckIn(objField1,objField2,objField3,strDateName1,strDateName2)
{
	//var strDateValue1=trimAll(objField1.value);
	var strDateValue1=trimAll(objField1.innerText);
	var strDateValue2=trimAll(objField2.value);
    var strDateValue3=trimAll(objField3.innerText);
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
    if (IsEmpty(strDateValue3)) return true; 
     
     var arr = [];
     arr['01'] = 'JAN';
     arr['02'] = 'FEB';
     arr['03'] = 'MAR';
     arr['04'] = 'APR';
     arr['05'] = 'MAY';
     arr['06'] = 'JUN';
     arr['07'] = 'JUL';
     arr['08'] = 'AUG';
     arr['09'] = 'SEP';
     arr['10'] = 'OCT';
     arr['11'] = 'NOV';
     arr['12'] = 'DEC';
     var a = arr[0];

     //^ Splitting the date using the divider "/"
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
     var arrDate3 = strDateValue3.split('/');
   
     //^ If user did not use the divider "/" then,
     if (arrDate1.length!=3 && arrDate2.length!=3 && arrDate3.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
         arrDate3 = strDateValue3.split('-');
     }
 
    if (arrDate1.length==3 && strDateValue1.length==10 && arrDate2.length==3 && strDateValue2.length==10 && arrDate3.length==3 && strDateValue3.length==10)
    {
    
       var mon1 = Number(arrDate1[1]);
       var mon2 = Number(arrDate2[1]);
       var mon3 = Number(arrDate3[1]);
     
	   var date1 = Number(arrDate1[0]);
	   var date2 = Number(arrDate2[0]);
	   var date3 = Number(arrDate3[0]);
	   
	   var year1 = parseInt(arrDate1[2]);
	   var year2 =parseInt(arrDate2[2]);
	   var year3 =parseInt(arrDate3[2]);
	 
	 Dchk= new Date(year1,mon1-1,date1);
	 Dcur= new Date(year3,mon3-1,date3);
	 
	var one_day=1000*60*60*24;
	var NOD = Math.ceil((Dchk.getTime()-Dcur.getTime())/(one_day));
	if (NOD<7)
	   {
			alert("CheckIn date cann't be changed as per Terms & Conditions");
			document.getElementById("txtCheckIn").value=strDateValue1;
			document.getElementById("txtCheckIn").focus();
			//objField1.focus();
			return false;
	   }
	if (year1 < year2)
	{
		alert(strDateName2 + " must be lesser than " + strDateName1);
		document.getElementById("txtCheckIn").value=strDateValue1;
		document.getElementById("txtCheckIn").focus();
		return false;
	}
	else
	{
		if (year1 > year2)
		{
		return true;
		}
		else
		{
			if (mon1 < mon2)
			{
				alert(strDateName2 + " must be lesser than " + strDateName1);
				document.getElementById("txtCheckIn").value=strDateValue1;
				document.getElementById("txtCheckIn").focus();
				return false;
			}
			else
			{
				if (mon1 > mon2)
				{
					return true;
				}
				else
				{
					if ( date1 < date2)
					{
						alert(strDateName2 + " must be lesser than " + strDateName1);
						document.getElementById("txtCheckIn").value=strDateValue1;
						document.getElementById("txtCheckIn").focus();
						return false; 
					}
					else
					{
						return true;
					}
				}
			 }	
		}
	}
 }
 }
 //==============================================================================================================
 //=============================================================================================================
 function ValidateCheckOut(objField1,objField2,strDateName1,strDateName2)
{
	//var strDateValue1=trimAll(objField1.value);
	var strDateValue1=trimAll(objField1.innerText);
	var strDateValue2=trimAll(objField2.value);
    
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
     
     var arr = [];
     arr['01'] = 'JAN';
     arr['02'] = 'FEB';
     arr['03'] = 'MAR';
     arr['04'] = 'APR';
     arr['05'] = 'MAY';
     arr['06'] = 'JUN';
     arr['07'] = 'JUL';
     arr['08'] = 'AUG';
     arr['09'] = 'SEP';
     arr['10'] = 'OCT';
     arr['11'] = 'NOV';
     arr['12'] = 'DEC';
     var a = arr[0];

     //^ Splitting the date using the divider "/"
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
   
     //^ If user did not use the divider "/" then,
     if (arrDate1.length!=3 && arrDate2.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
     }
 
    if (arrDate1.length==3 && strDateValue1.length==10 && arrDate2.length==3 && strDateValue2.length==10)
    {
    
       var mon1 = Number(arrDate1[1]);
       var mon2 = Number(arrDate2[1]);
     
	   var date1 = Number(arrDate1[0]);
	   var date2 = Number(arrDate2[0]);
	   var year1 = parseInt(arrDate1[2]);
	   var year2 =parseInt(arrDate2[2]);
	 		
	if (year1 > year2)
	{
		alert(strDateName2 + " must be greater than " + strDateName1);
		//objField2.focus();
		document.getElementById("txtCheckOut").value=strDateValue1;
		document.getElementById("txtCheckOut").focus();
		return false;
	}
	else
	{
		if (year1 < year2)
		{
		return true;
		}
		else
		{
			if (mon1 > mon2)
			{
				alert(strDateName2 + " must be greater than " + strDateName1);
				document.getElementById("txtCheckOut").value=strDateValue1;
				document.getElementById("txtCheckOut").focus();
				return false;
			}
			else
			{
				if (mon1 < mon2)
				{
					return true;
				}
				else
				{
					if ( date1 > date2)
					{
						alert(strDateName2 + " must be greater than " + strDateName1);
						document.getElementById("txtCheckOut").value=strDateValue1;
						document.getElementById("txtCheckOut").focus();
						return false; 
					}
					else
					{
						return true;
					}
				}
			 }	
		}
	}
 }
 }	
 
 //============================================================================================================
 function ValidateAge(objField2,objField3,strDateName1,strDateName2)
{
	//var strDateValue1=trimAll(objField1.value);
	//var strDateValue1=trimAll(objField1.innerText);
	var strDateValue2=trimAll(objField2.value);
   // var strDateValue3=trimAll(objField3.value);
    var strDateValue3=trimAll(objField3);
    // If Date is Blank, Don't Validate
    //if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
    if (IsEmpty(strDateValue3)) return true; 
     
     var arr = [];
     arr['01'] = 'JAN';
     arr['02'] = 'FEB';
     arr['03'] = 'MAR';
     arr['04'] = 'APR';
     arr['05'] = 'MAY';
     arr['06'] = 'JUN';
     arr['07'] = 'JUL';
     arr['08'] = 'AUG';
     arr['09'] = 'SEP';
     arr['10'] = 'OCT';
     arr['11'] = 'NOV';
     arr['12'] = 'DEC';
     var a = arr[0];

     //^ Splitting the date using the divider "/"
    // var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
     var arrDate3 = strDateValue3.split('/');
   
     //^ If user did not use the divider "/" then,
     if ( arrDate2.length!=3 && arrDate3.length!=3)
     {
        //^ Splitting the date using the divider "-"
       //  arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
         arrDate3 = strDateValue3.split('-');
     }
 
    if ( arrDate2.length==3 && strDateValue2.length==10 && arrDate3.length==3 && strDateValue3.length==10)
    {
    
      // var mon1 = Number(arrDate1[1]);
       var mon2 = Number(arrDate2[1]);
       var mon3 = Number(arrDate3[1]);
     
	  // var date1 = Number(arrDate1[0]);
	   var date2 = Number(arrDate2[0]);
	   var date3 = Number(arrDate3[0]);
	   
	   //var year1 = parseInt(arrDate1[2]);
	   var year2 =parseInt(arrDate2[2]);
	   var year3 =parseInt(arrDate3[2]);
	 
	 Dchk= new Date(year2,mon2-1,date2);
	 Dcur= new Date(year3,mon3-1,date3);
	 
	var one_day=1000*60*60*24;
	var NOD = Math.ceil((Dchk.getTime()-Dcur.getTime())/(one_day));
	if (NOD<6570)
	   {
			alert("Your age should be of 18 years");
			return false;
	   }
	   else
	   {
		return true;
	   }
    }
}
	
//==============================================================================================================
function NewDateDiff(objField1,objField2,strDateName1,strDateName2)
{
	alert("22222222");
		var strDateValue1=trimAll(objField1.value);
	var strDateValue2=trimAll(objField2.value);
   //  alert(strDateValue1);
//	 alert(strDateValue2);
	 
    
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
     
       
     var arr = [];
     arr['JAN'] = 0;
     arr['FEB'] = 1;
     arr['MAR'] = 2;
     arr['APR'] = 3;
     arr['MAY'] = 4;
     arr['JUN'] = 5;
     arr['JUL'] = 6;
     arr['AUG'] = 7;
     arr['SEP'] = 8;
     arr['OCT'] = 9;
     arr['NOV'] = 10;
     arr['DEC'] = 11;
     var a = arr[0];
     //^ Splitting the date using the divider "/"
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
     //var a = arrDate1[0];
     //var b = arrDate1[1];
     //var c = arrDate1[2];
     //^ If user did not use the divider "/" then,
     if (arrDate1.length!=3 && arrDate2.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
     }
     if (strDateValue1.length==10)
     {
     strDateValue1="0" + strDateValue1;
     }
     
     if (strDateValue2.length==10)
     {
     strDateValue2="0" + strDateValue2;
     }
     
     // if splitting occured using the correct divider
    if (arrDate1.length==3 && strDateValue1.length==11 && arrDate2.length==3 && strDateValue2.length==11)
    {
       //^ d stores date entered by user in Javascript Internal Date Format
       var d1 = new Date(arrDate1[2], arr[arrDate1[1].toUpperCase()], arrDate1[0]);
       var d2 = new Date(arrDate2[2], arr[arrDate2[1].toUpperCase()], arrDate2[0]);
    //   var mon1 = parseInt(arr[arrDate1[1].toUpperCase()]);
	   var mon1 = parseInt(arrDate1[1].toUpperCase(),10);
	   alert(arrDate1[1].toUpperCase());
     //  var mon2 = parseInt(arr[arrDate2[1].toUpperCase()]);
	   var mon2 =parseInt(arrDate2[1].toUpperCase(),10);
	   alert(arrDate2[1].toUpperCase());
	   alert("month2.... "+mon2);
       var date1 = parseInt(arrDate1[0]);
	   var date2 = parseInt(arrDate2[0]);
	   var year1 = parseInt(arrDate1[2]);
	   var year2 =parseInt(arrDate2[2]);
	   
	   
	   //if (!isNaN(d1) && !isNaN(d2)&& arrDate1[2] < arrDate2[2] && mon1 <= mon2 && arrDate1[0] <= arrDate2[0])
		//{
		//	return true;
	//	}
	
	//alert(year1);
//	alert(year2);
	if (year1 > year2)
	{
		alert("111111111");
		alert(strDateName1 + " should33333333 be less than" + strDateName2);
		objField1.focus();
		return false;
	}
	else
	{
		alert("444444444");
		if (year1 < year2)
		{
		return true;
		}
		else
		{
			alert("mon"+mon1);
				alert("mon"+mon2);
			if (mon1 > mon2)
			{					
				alert(strDateName1 + " should be111111111 less than" + strDateName2);
				objField1.focus();
				return false;
			}
			else
			{				
				if (mon1 < mon2)
				{
					return true;
				}
				else
				{
					if ( date1 >= date2)
					{
						alert(strDateName1 + " should22222222 be less than" + strDateName2);
						objField1.focus();
						return false; 
					}
					else
					{
						return true;
					}
				}
			 }	
			}
		}
	 }
	}	




//==============================================================================================================
function NoOfDays(objField1,objField2)
{
	var strDateValue1=trimAll(objField1.value);
	var strDateValue2=trimAll(objField2.value);
         
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return true;
    if (IsEmpty(strDateValue2)) return true;
           
     var arr = [];
     arr['JAN'] = 0;
     arr['FEB'] = 1;
     arr['MAR'] = 2;
     arr['APR'] = 3;
     arr['MAY'] = 4;
     arr['JUN'] = 5;
     arr['JUL'] = 6;
     arr['AUG'] = 7;
     arr['SEP'] = 8;
     arr['OCT'] = 9;
     arr['NOV'] = 10;
     arr['DEC'] = 11;
     var a = arr[0];
     //^ Splitting the date using the divider "/"
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
     
     //^ If user did not use the divider "/" then,
     if (arrDate1.length!=3 && arrDate2.length!=3)
     {
        //^ Splitting the date using the divider "-"
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
     }
     if (strDateValue1.length==10)
     {
     strDateValue1="0" + strDateValue1;
     }
     
     if (strDateValue2.length==10)
     {
     strDateValue2="0" + strDateValue2;
     }
     
     // if splitting occured using the correct divider
    if (arrDate1.length==3 && strDateValue1.length==11 && arrDate2.length==3 && strDateValue2.length==11)
    {
       //^ d stores date entered by user in Javascript Internal Date Format
       var one_day=1000*60*60*24; 
       var d1 = new Date(arrDate1[2], arr[arrDate1[1].toUpperCase()], arrDate1[0]);
       var d2 = new Date(arrDate2[2], arr[arrDate2[1].toUpperCase()], arrDate2[0]);
     //var dateDiff=Math.ceil((date2.getTime()-date1.getTime())/(one_day)); 
       var NOD = Math.ceil((d2.getTime()-d1.getTime())/(one_day));
       return NOD;

	   }
	  }
	   
//=============================================================================================================
//# Getting No of days between two dates
function NoOfDays1(objField1,objField2)
{
var strDateValue1=trimAll(objField1.value);
var strDateValue2=trimAll(objField2.value);
var date1 = new Date(strDateValue1);
var date2 = new Date(strDateValue2);

var NoOfDays = date1 - date2 ;
return NoOfDays;  
} 	
//get date
function getDate1()
{
	var date;
	date = NoOfDays(document.form1.txtCheckIn1,document.form1.txtCheckOut1);
	//document.form1.lblDays.Text="hello"
	//lbl.Text = "hello";
	//document.form1.lblDays.text=date;
	//alert(date);
	return date;
	//document.fom1.lblDays.value = date ;
	//return date;
	//document.form1.lbl
}
	
//===============================================================================================================
//# Function to Validate Room Type

function ValidateRoomType()
{
	//# Validating Room Type
	if (!ForceDataEntry(document.Form1.txtRoomType,'Room Type')) return false; 

}

//============================================================================================================
//# function to validate Property
function ValidateProperty()
{
	//~ ~ Validating the property Name
	if (!ForceDataEntry(document.property.txtName,'Property Name')) return false; 
	
	//* Validating Address
	if (!ForceDataEntry(document.property.txtAddress,'Address')) return false; 
	
	//* Validates State 
	if (!ForceComboItems(document.property.ddlState,'State')) return false; 
	
	//* Validates City
	if (!ForceComboItems(document.property.ddlCity,'City')) return false; 
	
	//* Validating Phone1 for Blank
	if (!ForceDataEntry(document.property.txtPhone1,'Phone')) return false; 
	//* Validating Phone1,Phone2 and Phone3 for Numeric values
	if (!ForceNumericEntry(document.property.txtPhone1,'Phone')) return false; 
	if (!ForceNumericEntry(document.property.txtPhone2,'Phone')) return false; 
	if (!ForceNumericEntry(document.property.txtPhone3,'Phone')) return false; 
	
	//* Validating Fax for numeric values
	if (!ForceNumericEntry(document.property.txtFax,'Fax')) return false; 
		
	//* Validating Email for a particular format
	if (!IsEmailValid(document.property.txtEmail,'Email Id')) return false; 
		
}

//--------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------

//# function to validate Agent
function ValidateAgent()
{
	//debugger;
	//# Validate Agent Type
	if (!ForceComboItems(document.Form1.ddlAgentType,'Agent Type')) return false; 
	
	//if (document.Form1.getElementById("SP").Visible==true)
	//{
		//# Validate Sales Person
	//	if (!ForceComboItems(document.Form1.ddlSalesPerson,'Sales Person')) return false; 
	//}
	
	//# Validating the Agent Name
	if (!ForceDataEntry(document.Form1.txtAgentName,'Agent Name')) return false; 
	
	//# Validating the UserId
	if (!ForceDataEntry(document.Form1.txtUserId,'User Id')) return false; 
	
	//# Validating the Password
	if (!ForceDataEntry(document.Form1.txtPassword,'Password')) return false;
	
	//# Validating Length of Password
	if (!ValidateLength(document.Form1.txtPassword,'Password')) return false;
		//# Validating the Confirm Password
	//if (!ForceDataEntry(document.Form1.txtCPassword,'Confirm Password')) return false;
	//# Validating the Confirm Password
	//if (!ValidateTextBox(document.Form1.txtPassword,document.Form1.txtCPassword)) return false; 
	//# Validating Sales Office
	if (!ForceComboItems(document.Form1.ddlSalesOffice,'Sales Office')) return false;
	//# Validating the Address
	if (!ForceDataEntry(document.Form1.txtAddress,'Address')) return false;
	
	if (document.Form1.ddlState.disabled==false)
	{
		//# State Validation
		if (!ForceComboItems(document.Form1.ddlState,'State')) return false; 
	
		//# City Validation
		if (!ForceComboItems(document.Form1.ddlCity,'City')) return false; 
	}
	//#ZipCode Validation
	if (!ForceDataEntry(document.Form1.txtZipcode,'ZipCode')) return false;
	
	if (!ForceNumericEntry(document.Form1.txtZipcode, 'ZipCode')) return false;
	
	//# Validating Email Address
	if (!IsEmailValid(document.Form1.txtEmailId,'Enter proper EmailId')) return false;
		
	//# Validating the Phone
	if (!ForceDataEntry(document.Form1.txtPhone,'Phone')) return false;
	if (!ForceNumericEntry(document.Form1.txtPhone, 'Phone')) return false;
	
	//# Validating the Fax
	if (!ForceNumericEntry(document.Form1.txtFax, 'Fax')) return false;
	
	//# Validating the Mobile
	if (!ForceNumericEntry(document.Form1.txtMobile, 'Mobile')) return false;
	//# Validating the Minimum Amount
	//if (!ForceDataEntry(document.Form1.txtMinimumAdvance,'Minimum Advance')) return false;
	//# Validating the Minimum Amount
	//if (!ForceNumericEntry(document.Form1.txtMinimumAdvance, 'Minimum Advance')) return false;
	
}
//============================================================================================================
//# function to validate PackageDescription
function PackageDescription()
{
	//# Validating the Package Description
	if (!ForceDataEntry(document.Form1.txtDescription,'Description')) return false;
	//# Validating the Description Code
	if (!ForceDataEntry(document.Form1.txtCode,'Code')) return false;

}
//============================================================================================================
//# function to validate Package
function ValidatePackage()
{
	//* Validate PropertyId
	if (!ForceComboItems(document.Package.ddlProperty,'Property')) return false; 
	
	//* Validating Package Name
	if (!ForceDataEntry(document.Package.txtPackage,'Package')) return false; 
	
	//* Validates Room Type
	if (!ForceComboItems(document.Package.ddlRoomType,'Room Type')) return false; 
	
	//* Validating Nights
	//if (!ForceDataEntry(document.Package.txtNights,'Nights')) return false; 
	//if (!ForceNumericEntry(document.Package.txtNights, 'txtNights')) return false;
	
	//* Validating Remarks
	//if (!ForceDataEntry(document.Package.txtRemarks,'Remarks')) return false; 
	
	//* Validate Description
	if (!ForceComboItems(document.Package.ddlDescription,'Description')) return false; 
			
}

//-----------------------------------------------------------------------------------------------------------------

//# functon to validate Package rate
function ValidatePackageRate()
{
	//* Validate PackageId
	if (!ForceComboItems(document.PackageRate.ddlPackage,'Package')) return false; 
	
	//* Validating From Date
	if (!ForceDataEntry(document.PackageRate.txtFromDate,'From Date')) return false;
	 //if (!isValidDate(document.PackageRate.txtFromDate,'From Date')) return false;
	//* Validates to Date
	if (!ForceDataEntry(document.PackageRate.txtToDate,'To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.PackageRate.txtFromDate,document.PackageRate.txtToDate,'From Date','To Date')) return false;
	//* Validating Property Rate
	if (!ForceDataEntry(document.PackageRate.txtPropertyRate,'Property Rate')) return false; 
	if (!isDecimalValue(document.PackageRate.txtPropertyRate,'Property Rate')) return false;
	//* Validating Adult Extra
	if(document.PackageRate.chkAdult.checked==true)
	{ 
	if (!ForceDataEntry(document.PackageRate.txtAdultExtra,'Adult Extra')) return false; 
	if (!ForceNumericEntry(document.PackageRate.txtAdultExtra, 'Adult Extra')) return false;
	}
	//* Validate Child Extra
	if(document.PackageRate.chkChild.checked==true)
	{
	if (!ForceDataEntry(document.PackageRate.txtChildExtra,'Child Extra')) return false;
	if (!ForceNumericEntry(document.PackageRate.txtChildExtra, 'Child Extra')) return false; 
	}
			
}
//----------------------------------------------------------------------------------------------------------------

//# Function to validate End User discount
function ValidateDiscount()
{
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
		//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
	//# Validating the Discount
	if (!ForceDataEntry(document.Form1.txtDiscount,'Discount')) return false;
	var Discount;
	Discount = document.Form1.txtDiscount.value;
	if (parseFloat(Discount) > 100)
	{
	    alert("Discount(%) should be less than 100");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
	if (parseFloat(Discount) <= 0)
	{
	    alert("You need to enter information for Discount");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
}
//==========================================================================================================

//# Function to validate DiscountStructure
function ValidateDiscountStructure()
{
	//debugger;
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlPackage,'Package')) return false; 
		//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtBFromDate,'Booking From Date')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtBToDate,'Booking To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtBFromDate,document.Form1.txtBToDate,'Booking From Date','Booking To Date')) return false;
		//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtPFromDate,'Package From Date')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtPToDate,'Package To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtPFromDate,document.Form1.txtPToDate,'Package From Date','Package To Date')) return false;
	//# Validating the Discount
	if (!ForceDataEntry(document.Form1.txtDiscount,'Discount')) return false;
	var Discount;
	Discount = document.Form1.txtDiscount.value;
	if (parseFloat(Discount) > 100)
	{
	    alert("Discount(%) should be less than 100");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
	if (parseFloat(Discount) <= 0)
	{
	    alert("You need to enter information for Discount");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
}

//============================================================================================================
//# Function to validate DiscountStructure
function ValidateSPDiscount()
{
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlSP,'Sales Person')) return false; 
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlPackage,'Package')) return false; 
		//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
	//# Validating the Discount
	if (!ForceDataEntry(document.Form1.txtDiscount,'Discount')) return false;
	var Discount;
	Discount = document.Form1.txtDiscount.value;
	if (parseFloat(Discount) > 100)
	{
	    alert("Discount(%) should be less than 100");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
	if (parseFloat(Discount) <= 0)
	{
	    alert("You need to enter information for Discount");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
}

//--------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------
//# function to validate Room Allocation form
function ValidateRoomAllocation()
{
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlRoomType,'Room Type')) return false; 
	//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
	//# Validating the From Date is Valid
	//if (!isValidDate(document.Form1.txtFromDate,'FromDate')) return false;
	//# Validating the To Date is Valid
	//if (!isValidDate(document.Form1.txtToDate,'ToDate')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
	//# Validating the Discount
	if (!ForceDataEntry(document.Form1.txtNoOfRooms,'No of Rooms')) return false;
	if (!ForceNumericEntry(document.Form1.txtNoOfRooms,'No of Rooms')) return false;
	
	//var NoOfRooms ;
	//NoOfRooms = document.Form1.txtNoOfRooms.value;
	//if (parseFloat(Discount) > 100)
	//{
	  //  alert("Discount(%) should be less than 100");
	   // document.Form1.txtDiscount.focus();
	    //return false;
	//}
	//if (parseInt(NoOfRooms) = 0)
	//{
	//    alert("You need to enter information for No of Rooms");
	//    document.Form1.txtNoOfRooms.focus();
	 //   return false;
	//}
}
//--------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------

//# function to validate Room Type correspond to Property
function ValidatePropertyRoomType()
{
//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 

//# Validate RoomType
	if (!ForceComboItems(document.Form1.ddlRoomType,'RoomType')) return false; 

}	

//--------------------------------------------------------------------------------------------------------------
//# Function to validate Agent Commission
function ValidateAgentCommissionXXX()
{
//# Validate Agent
	if (!ForceComboItems(document.Form1.ddlAgent,'Agent')) return false; 

//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProfileNam,'Profile Name')) return false; 

//# Validate FromDate
//pppppppppppppppppp if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
//# is Valid
//if (!isValidDate(document.Form1.txtFromDate,'From Date')) return false;
//# Validating the To Date
//pppppppppppppppppp 	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
//# DateDiff
//pppppppppppppppppp if (!DateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
//# Validating Commission
//pppppppppppppppppp if (!ForceDataEntry(document.Form1.txtCommission,'Commission')) return false;
//pppppppppppppppppp if (!ForceNumericEntry(document.Form1.txtCommission,'Commission')) return false;
/*pppppppppppppppppp var Commission;
	Commission = document.Form1.txtCommission.value;
	if (parseFloat(Commission) <= 0)
	{
	    alert("Commission can't be 0");
	    document.Form1.txtCommission.focus();
	    return false;
	}
	if (parseFloat(Commission) > 100)
	{
	    alert("Commission(%) should be less than 100");
	    document.Form1.txtCommission.focus();
	    return false;
	}*//////////////////////////////

}
//--------------------------------------------------------------------------------------------------------------
//# Function to validate Agent Commission
function ValidateAgentCommission()
{
	//# Validate Profile Name
	if (!ForceDataEntry(document.Form1.txtProfileName,'Profile Name')) return false;
	
//# Validate Package
if (!ForceComboItems(document.Form1.ddlPackage,'Package')) return false; 

//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 

//# Validate FromDate
if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
//# is Valid
//if (!isValidDate(document.Form1.txtFromDate,'From Date')) return false;
//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
//# DateDiff
if (!DateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
//# Validating Commission
if (!ForceDataEntry(document.Form1.txtCommission,'Commission')) return false;
if (!ForceNumericEntry(document.Form1.txtCommission,'Commission')) return false;
var Commission;
	Commission = document.Form1.txtCommission.value;
	if (parseFloat(Commission) <= 0)
	{
	    alert("Commission can't be 0");
	    document.Form1.txtCommission.focus();
	    return false;
	}
	if (parseFloat(Commission) > 100)
	{
	    alert("Commission(%) should be less than 100");
	    document.Form1.txtCommission.focus();
	    return false;
	}

}
	
//===============================================================================================================

//# Validating Online Booking Details

function ValidateBookingDetails()
{
	//# Validate CheckIn
	if (!ForceDataEntry(document.form1.txtCheckIn,'Check In')) return false;

	//# Validating CheckOut
	if (!ForceDataEntry(document.form1.txtCheckOut,'Check Out')) return false;
	//# DateDiff
	if (!DateDiff(document.form1.txtCheckIn,document.form1.txtCheckOut,'CheckIn Date','CheckOut Date')) return false;

	//# Validating CheckOut date and CheckIn Date
	//var CheckIn;
	//var CheckOut;
	//CheckOut=document.form1.txtCheckIn.value;
	//CheckIn=document.form1.txtCheckOut.value;
	//if (CheckIn<=CheckOut)
	//{
	//alert("CheckIn date should be less than CheckOut date");
	//}

}

//================================================================================================================
//# Validating Online Booking Details

function ValidateBookingDetails1()
{
	//# Validate CheckIn
	if (!ForceDataEntry(document.form1.txtCheckIn1,'Check In')) return false;

	//# Validating CheckOut
	if (!ForceDataEntry(document.form1.txtCheckOut1,'Check Out')) return false;
	//# DateDiff
	if (!NewDateDiff(document.form1.txtCheckIn1,document.form1.txtCheckOut1,'CheckIn Date','CheckOut Date')) return false;

	//# Validating CheckOut date and CheckIn Date
	//var CheckIn;
	//var CheckOut;
	//CheckOut=document.form1.txtCheckIn.value;
	//CheckIn=document.form1.txtCheckOut.value;
	//if (CheckIn<=CheckOut)
	//{
	//alert("CheckIn date should be less than CheckOut date");
	//}

}

//================================================================================================================
//# function for checking radio button selection  in Grid conrtol
function rdbchk(obj)
  {
   var tbl = document.getElementById('DG_Booking');
   var rows= tbl.getElementsByTagName('tr');
    var cols;
    var rdb;
    var rdbid;
    for (var i=0;i <rows.length ;i++)
    {
    cols=rows[i].cells;
    rdb=cols[0].getElementsByTagName('asp:RadioButton');
    
    if (rdb.length >0 )
     {
     	rdbid=rdb[0].id;
     
     if (obj==rdbid)
      {
      rdb[0].checked=true 
      }
     else
      {
      rdb[0].checked=false
      }    
    
     }
     }
 }
 
 //===========================================================================================================
  
function SelectOne(rdo,gridName)
{
/* Getting an array of all the "INPUT" controls on the form.*/
//document.getElementById("lblMessage").visible=false;
//alert("aaaaaaaaaa");
all=document.getElementsByTagName("asp:RadioButton");
//alert("aaaaaaaaaa");
for(i=0;i<all.length;i++)
 {
  if(all[i].GroupName=="radio")/*Checking if it is a radio button*/
  {
/*I have added '__ctl' ASP.NET adds '__ctl' to all 
    the controls of DataGrid.*/
   var count=all[i].id.indexOf(gridName+'__ctl'); 
   if(count!=-1)
   {
    all[i].checked=false;
   }
  }
 }
 rdo.checked=true;/* Finally making the clicked radio button CHECKED */
 
}

//===============================================================================================================
function ValidateSoldOut()
{
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlRoomType,'Room Type')) return false; 
	//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
	//# Validating the From Date is Valid
	//if (!isValidDate(document.Form1.txtFromDate,'FromDate')) return false;
	//# Validating the To Date is Valid
	//if (!isValidDate(document.Form1.txtToDate,'ToDate')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
	//# DateDiff
//	if (!NewDateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
}
//===============================================================================================================
function ValidatePassword()
{
	//# Validating UserId for blank
	if (!ForceDataEntry(document.Form1.txtUserId,'User Id')) return false;
	//# Validating oldPassword for blank
	if (!ForceDataEntry(document.Form1.txtoldPassword,'Old Password')) return false;
	//# Validating New Password for blank
	if (!ForceDataEntry(document.Form1.txtNewPassword,'New Password')) return false;
}
//===============================================================================================================

function ValidateLogin()
{
	//document.Form1.getElementById(txtLogin.ClientID).focus();
	//# Validating LoginId for blank
	if (!ForceDataEntry(document.Form1.txtLogin,'Login Id')) return false;
	//# Validating Password for blank
	if (!ForceDataEntry(document.Form1.txtPassword,'Password')) return false;
	//SetFocus();
}

//==================================================================================================================

function ValidateRightBanner()
{
	//# Validating Image Name for blank
	if (!ForceDataEntry(document.RightBanner.txtImageName,'Image Name')) return false;
	//# Validating Upload Image for blank
	if (!ForceDataEntry(document.RightBanner.Upload_Img,'Image Path')) return false;
}
//==================================================================================================================

function ValidateMainBanner()
{
	//# Validating Image Name for blank
	if (!ForceDataEntry(document.Form1.txtImageName,'Image Name')) return false;
	//# Validating Upload Image for blank
	if (!ForceDataEntry(document.Form1.Upload_Img,'Image Path')) return false;
}
//================================================================================================================	
function ValidateNightsPerPackage()
{
	//# Validate Package
	if (!ForceComboItems(document.PackageNights.ddlPackage,'Package')) return false; 
	//# Validate Nights
	if (!ForceDataEntry(document.PackageNights.txtNights,'No. of Nights')) return false;
	//# Validate Package Code
	if (!ForceDataEntry(document.PackageNights.txtPackageCode,'Package Code')) return false;
}
//================================================================================================================
//# Function to validate End User discount
function ValidatePackageDiscount()
{
	//# Validate Property
	if (!ForceComboItems(document.Form1.ddlProperty,'Property')) return false; 
	//# Validate Package
	if (!ForceComboItems(document.Form1.ddlPackage,'Package')) return false; 
		//# Validating the From Date
	if (!ForceDataEntry(document.Form1.txtFromDate,'From Date')) return false;
	//# Validating the To Date
	if (!ForceDataEntry(document.Form1.txtToDate,'To Date')) return false;
	//# DateDiff
	if (!NewDateDiff(document.Form1.txtFromDate,document.Form1.txtToDate,'From Date','To Date')) return false;
	//# Validating the Discount
	if (!ForceDataEntry(document.Form1.txtDiscount,'Discount')) return false;
	var Discount;
	Discount = document.Form1.txtDiscount.value;
	if (parseFloat(Discount) > 100)
	{
	    alert("Discount(%) should be less than 100");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
	if (parseFloat(Discount) <= 0)
	{
	    alert("You need to enter information for Discount");
	    document.Form1.txtDiscount.focus();
	    return false;
	}
}


//================================================================================================================
//# For index Front Page
function showRooms(fld)
{
	var v1= fld.value;     
	switch(fld.value)
	{
		case '1':
			
			document.getElementById('CheckAvalUC1_room1').style.display='block';
			document.getElementById('CheckAvalUC1_room2').style.display='none';
    		document.getElementById('CheckAvalUC1_room3').style.display='none';
			document.getElementById('CheckAvalUC1_room4').style.display='none';
			document.getElementById('CheckAvalUC1_room5').style.display='none';
			//document.getElementById('childrenAge').style.display='none';
			document.getElementById('CheckAvalUC1_A2').value='00';
			document.getElementById('CheckAvalUC1_A3').value='00';
			document.getElementById('CheckAvalUC1_A4').value='00';
			document.getElementById('CheckAvalUC1_A5').value='00';
			break;
		
		case '2':
			
			document.getElementById('CheckAvalUC1_room1').style.display='block';
			document.getElementById('CheckAvalUC1_room2').style.display='block';
			document.getElementById('CheckAvalUC1_room3').style.display='none';
			document.getElementById('CheckAvalUC1_room4').style.display='none';
			document.getElementById('CheckAvalUC1_room5').style.display='none';
			document.getElementById('CheckAvalUC1_A2').value='02';
			document.getElementById('CheckAvalUC1_A3').value='00';
			document.getElementById('CheckAvalUC1_A4').value='00';
			document.getElementById('CheckAvalUC1_A5').value='00';
			//document.getElementById('roomChild4').style.display='none';
			break;	

		case '3':
			
			document.getElementById('CheckAvalUC1_room1').style.display='block';
			document.getElementById('CheckAvalUC1_room2').style.display='block';
			document.getElementById('CheckAvalUC1_room3').style.display='block';
			document.getElementById('CheckAvalUC1_room4').style.display='none';
			document.getElementById('CheckAvalUC1_room5').style.display='none';
			document.getElementById('CheckAvalUC1_A2').value='02';
			document.getElementById('CheckAvalUC1_A3').value='02';
			document.getElementById('CheckAvalUC1_A4').value='00';
			document.getElementById('CheckAvalUC1_A5').value='00';
			//document.getElementById('roomChild4').style.display='none';
			break;
		
		case '4':
			
			document.getElementById('CheckAvalUC1_room1').style.display='block';
			document.getElementById('CheckAvalUC1_room2').style.display='block';
			document.getElementById('CheckAvalUC1_room3').style.display='block';
			document.getElementById('CheckAvalUC1_room4').style.display='block';
			document.getElementById('CheckAvalUC1_room5').style.display='none';
			document.getElementById('CheckAvalUC1_A2').value='02';
			document.getElementById('CheckAvalUC1_A3').value='02';
			document.getElementById('CheckAvalUC1_A4').value='02';
			document.getElementById('CheckAvalUC1_A5').value='00';
			break;
		case '5':
			
			document.getElementById('CheckAvalUC1_room1').style.display='block';
			document.getElementById('CheckAvalUC1_room2').style.display='block';
			document.getElementById('CheckAvalUC1_room3').style.display='block';
			document.getElementById('CheckAvalUC1_room4').style.display='block';
			document.getElementById('CheckAvalUC1_room5').style.display='block';
			document.getElementById('CheckAvalUC1_A2').value='02';
			document.getElementById('CheckAvalUC1_A3').value='02';
			document.getElementById('CheckAvalUC1_A4').value='02';
			document.getElementById('CheckAvalUC1_A5').value='02';
			break;
			
		//case "":
		
		//	alert("Hello!");	
		}
}

//
function checkAvailabilitySalePer()
{
	//alert("check");
	if (!ForceDataEntry(document.form1.departure_date,'Check In')) return false;	
	if (!ForceDataEntry(document.form1.arrivalDate,'Check Out')) return false;
	
	if (!ForceDataEntry(document.form1.txtNoofRooms,'No of Rooms')) return false;
	if (!ForceNumericEntry(document.form1.txtNoofRooms, 'No of Rooms')) return false;
	if (parseInt(document.getElementById('txtNoofRooms').value)==0)
	{
		alert("No of Room should be greater then Zero");	
		return false;
	}
	
	document.getElementById('txtadultcat1').value=document.getElementById('txtNoofRooms').value.toString();	
	//alert(document.getElementById('ddlsegment').value);
}

//
function checkAllDetailsSalePer()
{
	if (!ForceDataEntry(document.form1.txtamount,'Advance Amount')) return false;
	if (!ForceNumericEntry(document.form1.txtamount, 'Advance Amount')) return false;
	if(document.getElementById('ddlmodofpay').value=="Cheque")
	{
		if (!ForceDataEntry(document.form1.txtchequeno,'Cheque No')) return false;	
		if (!ForceDataEntry(document.form1.txtchkdate,'Cheque Date')) return false;	
		if (!ForceDataEntry(document.form1.txtbank,'Bank/Branch')) return false;
	}
	if (!ForceDataEntry(document.form1.txtFirstName,'First Name')) return false;
	if (!ForceDataEntry(document.form1.txtLastName,'Last Name')) return false;
	if (!ForceDataEntry(document.form1.txtAddress1,'Address')) return false;
	if (!ForceDataEntry(document.form1.txtEmail,'Email')) return false;
	if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
	if (!ForceDataEntry(document.form1.txtMobile,'Mobile no')) return false;
}
//================================================================================================================
//# For validating valid cases of rooms occupancy

function ValidCases(obj)
{
	//debugger
	//# Validate CheckIn
	if (!ForceDataEntry(document.form1.CheckAvalUC1_departure_date,'Check In')) return false;

	//# Validating CheckOut
	if (!ForceDataEntry(document.form1.CheckAvalUC1_arrivalDate,'Check Out')) return false;
	//# DateDiff
	if (!DateDiff(document.form1.CheckAvalUC1_departure_date,document.form1.CheckAvalUC1_arrivalDate,'CheckIn Date','CheckOut Date')) return false;
	
	//# Restricting user for not to make booking for more than 15 days.
	var nights = document.getElementById("CheckAvalUC1_lblMessage1").innerText;
	if(Number(nights)>15)
	{
		alert("You can not make booking for more than 15 days");		
		return false;
	}
	var strVal = obj.value;
	//var m_str = fld1.value+fld2.value+fld3.value;
	/*
	var myArray = new Array();
	myArray[0] = "030101";
	myArray[1] = "020201";
	myArray[2] = "020002";
	myArray[3] = "020102";
	myArray[4] = "030000";
	var i;
	*/
	var var1;
	var var2;
	var var3;
	var T1;
	
	for ( var i=1;i<=strVal;i++)
	{
		switch(i)
		{
			case 1:
				var1  = document.getElementById('CheckAvalUC1_A1').value;
				var2  = document.getElementById('CheckAvalUC1_C1').value;
    			var3  = document.getElementById('CheckAvalUC1_I1').value;
				break;
		
			case 2:
				var1  = document.getElementById('CheckAvalUC1_A2').value;
				var2  = document.getElementById('CheckAvalUC1_C2').value;
    			var3  = document.getElementById('CheckAvalUC1_I2').value;
				break;
			case 3:
				var1  = document.getElementById('CheckAvalUC1_A3').value;
				var2  = document.getElementById('CheckAvalUC1_C3').value;
    			var3  = document.getElementById('CheckAvalUC1_I3').value;
				break;
			case 4:
				var1  = document.getElementById('CheckAvalUC1_A4').value;
				var2  = document.getElementById('CheckAvalUC1_C4').value;
    			var3  = document.getElementById('CheckAvalUC1_I4').value;
				break;
			case 5:
				var1  = document.getElementById('CheckAvalUC1_A5').value;
				var2  = document.getElementById('CheckAvalUC1_C5').value;
    			var3  = document.getElementById('CheckAvalUC1_I5').value;
				break;
		}
		var noOfPeople=parseInt(var1)+parseInt(var2)+parseInt(var3);
		var noOfAC = parseInt(var1)+parseInt(var2);
		if ((noOfPeople > 5 )||(noOfAC==5))
		{
		alert("No. of guest exceed for room No." + i);
		//No. of guest exceed for room No. 1
		return false;
		break;
		}
	/*	
	T1 = var1+var2+var3;
	for (var j=0;j<myArray.length;j++)
	{
		if (T1 == myArray[j])
		{
			
			break;
		}
	} 
	
	if (j == myArray.length)
	{
		alert("For Room No." + i + " no. of guest exceeds.");
		return false;
		break;
	}
	*/ 
	}
}

//============================================================================================================

//# For index Front Page
function c_showRooms(fld)
{
	var v1= fld.value;     
	switch(fld.value)
	{
		case '1':
			
			document.getElementById('room11').style.display='block';
			document.getElementById('room22').style.display='none';
    		document.getElementById('room33').style.display='none';
			document.getElementById('room44').style.display='none';
			document.getElementById('room55').style.display='none';
			//document.getElementById('childrenAge').style.display='none';
			break;
		
		case '2':
			
			document.getElementById('room11').style.display='block';
			document.getElementById('room22').style.display='block';
			document.getElementById('room33').style.display='none';
			document.getElementById('room44').style.display='none';
			document.getElementById('room55').style.display='none';
			//document.getElementById('roomChild3').style.display='none';
			//document.getElementById('roomChild4').style.display='none';
			break;	

		case '3':
			
			document.getElementById('room11').style.display='block';
			document.getElementById('room22').style.display='block';
			document.getElementById('room33').style.display='block';
			document.getElementById('room44').style.display='none';
			document.getElementById('room55').style.display='none';
			//document.getElementById('roomChild4').style.display='none';
			break;
		
		case '4':
			
			document.getElementById('room11').style.display='block';
			document.getElementById('room22').style.display='block';
			document.getElementById('room33').style.display='block';
			document.getElementById('room44').style.display='block';
			document.getElementById('room55').style.display='none';
			break;
		case '5':
			
			document.getElementById('room11').style.display='block';
			document.getElementById('room22').style.display='block';
			document.getElementById('room33').style.display='block';
			document.getElementById('room44').style.display='block';
			document.getElementById('room55').style.display='block';
			break;
			
		//case "":
		
		//	alert("Hello!");	
		}
}		
//===============================================================================================================

//# Validate Function for Contact Details form

function ValidateContactDetails()
{
	//debugger;
	//# Validating Email Address for Blank
	if (!ForceDataEntry(document.form1.txtEmail, 'Email Id')) return false;
	
	//# Validating Email Address for Valid Format
	if (!IsEmailValid(document.form1.txtEmail,'Enter proper Email Id')) return false;
	
	//# Validating DOB for blank
		
	/*var day = document.getElementById("ddlDay").value;
	var mon = document.getElementById("ddlMonth").value;
	var year = document.getElementById("ddlYear").value;
	var DOB = day+"."+mon+"."+year;
	var dt_DOB = day+"/"+mon+"/"+year;
	if(trimAll(day) == "Day")
			{	
				alert("Select Day");
				document.getElementById("ddlDay").focus();
				return false
			}
			
			
			if(trimAll(mon) == "Mon")
			{	
				alert("Select Month");
				document.getElementById("ddlMonth").focus();
				return false
			}
			
			if(trimAll(year) == "Year")
			{	
				alert("Select Year");
				document.getElementById("ddlYear").focus();
				return false
			}
	if(isDate(DOB)==false)
	{
		return false;
	}
	
	if(!ValidateAge(document.getElementById("hdnCurrDate"),dt_DOB,'DOB date','18 years')) return false;*/
	//if (!ForceDataEntry(document.form1.txtDOB,'DOB')) return false;
	
	//var document.getElementById("lblCurrDate").
	//if (!DateDiff(document.form1.txtDOB,document.form1.hdnCurrDate,'Date of Birth','Current Date')) return false;
	
	//if(!ValidateAge(document.form1.hdnCurrDate,document.form1.txtDOB,'DOB date','18 years'))return false;
	
	//# First Name Validation
	if (!ForceDataEntry(document.form1.txtFirstName,'First Name')) return false;

	//# Last Name Validation
	if (!ForceDataEntry(document.form1.txtLastName,'Last Name')) return false;
	
	//# Address Validation
	if (!ForceDataEntry(document.form1.txtAddress,'Address')) return false;
	
	//# Country Validation
	if (!ForceDataEntry(document.form1.txtCountry,'Country')) return false;
	
	if (document.form1.ddlState.disabled==false)
	{
	//# State Validation
	if (!ForceComboItems(document.form1.ddlState,'State')) return false; 
	
	//# City Validation
	if (!ForceComboItems(document.form1.ddlCity,'City')) return false; 
	}
	
	//# ZipCode Validation
	if (!ForceDataEntry(document.form1.txtZipCode,'ZipCode')) return false;
	if (!ForceNumericEntry(document.form1.txtZipCode, 'ZipCode')) return false;
	//if (!ValidateLength(document.form1.txtZipCode, 'ZipCode')) return false;
	if(document.getElementById("txtZipCode").value.length<5)
	{
		alert("Zip Code should be of at least 5 digits");
		return false;
	}
	
	//# Validating the Phone
		if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
		if (!ForceNumericEntry(document.form1.txtPhone, 'Phone')) return false;
	
	//# Validating the Mobile
	if (document.form1.txtMobile.value != "")
	{
		if (!ForceDataEntry(document.form1.txtMobile,'Mobile')) return false;
		if (!ForceNumericEntry(document.form1.txtMobile, 'Mobile')) return false;		
	}
	
	//# Validating Arrival Time 
	if (document.form1.txtArrTime.value!="")
	{
		if (!IsValidTime(document.form1.txtArrTime)) return false;
	}
	
	//# Validating Departure Time 
		if (document.form1.txtDepTime.value!="")
	{
		if (!IsValidTime(document.form1.txtDepTime)) return false;
	}
}


function ValidateDetailsForMisc()
{
	
	//debugger;
	//# No Of Room Validation For Hotel sales Validation	
	///////////////if (!ForceDataEntry(document.form1.noofroomsP,'No Of Room')) return false;
	
	//# No Of Adult Validation For Hotel sales Validation	
	/////////////////////if (!ForceDataEntry(document.form1.totadultP,'No Of adults')) return false;
	
	
	if(document.getElementById('ddlpaytypeP').value==1)
	{
		//# Total Rooms Validation
	if (!ForceDataEntry(document.form1.noofroomsP,'Total Rooms')) return false;
	
	//# No Of Nights. Validation
	if (!ForceDataEntry(document.form1.noofnightP,'No Of Nights.')) return false;
	
	//# Application No. Validation
	if (!ForceDataEntry(document.form1.totadultP,'Total Adults')) return false;
	}
	
	if(document.getElementById('ddlpaytypeP').value==2)
	{
		var temp1;
		var resweek;
		var resort;
		var apptype;
		var picno;
		var temp2=0;
		temp1=document.getElementById('driidP').value;
		//alert(temp1);		
		resort=temp1.substring(0,2);
		resweek=temp1.substring(2,5);
		//alert("WWWWW"+resweek);
		apptype=temp1.substring(6,7);
		picno=temp1.substring(10);
		//alert("PPPPP"+picno);
		
		if(resort==document.getElementById('ddlresortMember').value)
		{
		
		}
		else
		{
	//	alert("no");
			alert("Tour ID Has invalid check.....");
			document.getElementById('driidP').focus();
			return false;		
		}
		if(resweek==document.getElementById('weeknoP').value)
		{
			temp1=1;
		}
		else
		{
			alert("Tour ID Has invalid check.....");		
			document.getElementById('driidP').focus();
			return false;	
		}
		
		if(apptype==document.getElementById('apptypemember').value)
		{
			temp1=1;			
		}
		else
		{
			alert("Tour ID Has invalid check.....");
			document.getElementById('driidP').focus();		
			return false;			
		}
		
		if(picno==document.getElementById('picnoP').value)
		{
			temp1=1;
		}
		else
		{
				alert("Tour ID Has invalid check.....");
				document.getElementById('driidP').focus();			
			return false;			
		}	
	//	alert(document.getElementById('ddlpaytypeP').value);
	if (!ForceDataEntry(document.form1.appnoP,'Application No.')) return false;
		
	//# WEEK NO Validation
	if (!ForceDataEntry(document.form1.weeknoP,'Week No.')) return false;
	
	//# DRI ID Validation  
	if (!ForceDataEntry(document.form1.driidP,'DRI ID')) return false;
	
	//# PIC NO Validation
	if (!ForceDataEntry(document.form1.picnoP,'PIC No.')) return false;
	
	//# AMC Year Validation
	if (!ForceDataEntry(document.form1.amcyearP,'AMC FOR YEAR.')) return false;
	
	
	
	//# No Of Rooms Validation  
	if (!ForceDataEntry(document.form1.noofroom2P,'No Of Rooms')) return false;
	
	
	
	//# Total Adults Validation  
	if (!ForceDataEntry(document.form1.totaladult2P,'Total Adults')) return false;
	}
	
	//# Validating For Voucher No. for Blank
	if (!ForceDataEntry(document.form1.txtvoucher,'Voucher No.')) return false;
	
	//# check for AMC amount
	
	var temp3;
	temp3=parseInt(document.getElementById('electricityP').value)+parseInt(document.getElementById('amenitiP').value)+parseInt(document.getElementById('utilityamount2P').value);
//	alert(temp3)
	
	if(temp3>0)
	{
		if(trimAll(document.getElementById('chickinP').value) == "")
		{
			alert("Select Check In Date");
			document.getElementById("chickinP").focus();
			return false	
		}
		//alert(document.getElementById('electricityP').value);
	//	if (!ForceDataEntry(document.getElementById('chickinP').value, 'Checkin Date')) return true;		
	}
	
	
	
	//# Check Out dates
	if((document.getElementById('chickinP').value!="")&(document.getElementById('checkoutP').value==""))
	{
		//alert("PPPPPPPPPPPpp");
			alert("Select Check out Date");
			document.getElementById("checkoutP").focus();
			return false	
	//if (!ForceDataEntry(document.getElementById('checkoutP').value, 'CheckOut Date')) return false;	
	}
	
	//# Validating Email Address for Blank
	if (!ForceDataEntry(document.form1.txtEmail, 'Email Id')) return false;	

	//# Validating Email Address for Valid Format
	if (!IsEmailValid(document.form1.txtEmail,'Enter proper Email Id')) return false;
	
	//# First Name Validation
	if (!ForceDataEntry(document.form1.txtFirstName,'First Name')) return false;

	//# Last Name Validation
	if (!ForceDataEntry(document.form1.txtLastName,'Last Name')) return false;
	
	//# Validating DOB for blank
	

//	alert("8888888888888");
	//if (!ForceDataEntry(document.form1.txtDOB,'DOB')) return false;
	
	//var document.getElementById("lblCurrDate").
	//if (!DateDiff(document.form1.txtDOB,document.form1.hdnCurrDate,'Date of Birth','Current Date')) return false;
	
	//if(!ValidateAge(document.form1.hdnCurrDate,document.form1.txtDOB,'DOB date','18 years'))return false;
	
	
	
	//# Address Validation
	if (!ForceDataEntry(document.form1.txtAddress,'Address')) return false;
	
	//# Country Validation
	if (!ForceDataEntry(document.form1.txtCountry,'Country')) return false;
	
	if (document.form1.ddlState.disabled==false)
	{
	//# State Validation
	if (!ForceComboItems(document.form1.ddlState,'State')) return false; 
	
	//# City Validation
	if (!ForceComboItems(document.form1.ddlCity,'City')) return false; 
	}
	
	//# ZipCode Validation
	if (!ForceDataEntry(document.form1.txtZipCode,'ZipCode')) return false;
	if (!ForceNumericEntry(document.form1.txtZipCode, 'ZipCode')) return false;
	//if (!ValidateLength(document.form1.txtZipCode, 'ZipCode')) return false;
	if(document.getElementById("txtZipCode").value.length<5)
	{
		alert("Zip Code should be of at least 5 digits");
		return false;
	}
	
	//# Validating the Phone
		if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
		if (!ForceNumericEntry(document.form1.txtPhone, 'Phone')) return false;
	
	//# Validating the Mobile
	if (document.form1.txtMobile.value != "")
	{
		if (!ForceDataEntry(document.form1.txtMobile,'Mobile')) return false;
		if (!ForceNumericEntry(document.form1.txtMobile, 'Mobile')) return false;		
	}
	
	//# Validating Arrival Time 
	if (document.form1.txtArrTime.value!="")
	{
		if (!IsValidTime(document.form1.txtArrTime)) return false;
	}
	
	//# Validating Departure Time 
		if (document.form1.txtDepTime.value!="")
	{
		if (!IsValidTime(document.form1.txtDepTime)) return false;
	}
}
//==============================================================================================================
//# Validate Function for Edit Profile form

function ValidateEditProfile()
{
	//debugger;
	//# First Name Validation
	if (!ForceDataEntry(document.form1.txtFirstName,'First Name')) return false;

	//# Last Name Validation
	if (!ForceDataEntry(document.form1.txtLastName,'Last Name')) return false;
	
	//# Address Validation
	if (!ForceDataEntry(document.form1.txtAddress,'Address')) return false;
	
	//# Country Validation
	if (!ForceDataEntry(document.form1.txtCountry,'Country')) return false;
	
	if (document.form1.ddlState.disabled==false)
	{
	//# State Validation
	if (!ForceComboItems(document.form1.ddlState,'State')) return false; 
	
	//# City Validation
	if (!ForceComboItems(document.form1.ddlCity,'City')) return false; 
	}
	//#ZipCode Validation
	if (!ForceDataEntry(document.form1.txtZipCode,'ZipCode')) return false;
	
	if (!ForceNumericEntry(document.form1.txtZipCode, 'ZipCode')) return false;
	//if (!ValidateLength(document.form1.txtZipCode, 'ZipCode')) return false;
	if(document.getElementById("txtZipCode").value.length<5)
	{
		alert("Zip Code should be of at least 5 digits");
		return false;
	}
	
	//# Validating the Phone
		if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
		if (!ForceNumericEntry(document.form1.txtPhone, 'Phone')) return false;
	
	//# Validating the Mobile
	if (document.form1.txtMobile.value != "")
	{
		if (!ForceDataEntry(document.form1.txtMobile,'Mobile')) return false;
		if (!ForceNumericEntry(document.form1.txtMobile, 'Mobile')) return false;		
	}

	
	//# Validating DOB for blank
	//if (!ForceDataEntry(document.form1.txtDOB,'DOB')) return false;
	//if(!ValidateAge(document.form1.hdnCurrDate,document.form1.txtDOB,'DOB date','18 years'))return false;
	//# Validating DOB for valid Date
	//if (!isValidDate(document.form1.txtDOB,'DOB')) return false;
	//# Validating DOB for blank
		
	var day = document.getElementById("ddlDay").value;
	var mon = document.getElementById("ddlMonth").value;
	var year = document.getElementById("ddlYear").value;
	var DOB = day+"."+mon+"."+year;
	var dt_DOB = day+"/"+mon+"/"+year;
	if(trimAll(day) == "Day")
			{	
				alert("Select Day");
				document.getElementById("ddlDay").focus();
				return false
			}
			
			
			if(trimAll(mon) == "Mon")
			{	
				alert("Select Month");
				document.getElementById("ddlMonth").focus();
				return false
			}
			
			if(trimAll(year) == "Year")
			{	
				alert("Select Year");
				document.getElementById("ddlYear").focus();
				return false
			}
	if(isDate(DOB)==false)
	{
		return false;
	}
	
	if(!ValidateAge(document.getElementById("hdnCurrDate"),dt_DOB,'DOB date','18 years')) return false;
	//# Validating Email Address for Blank
	if (!ForceDataEntry(document.form1.txtEmail, 'EmailId')) return false;
	
	//# Validating Email Address for Valid Format
	if (!IsEmailValid(document.form1.txtEmail,'Enter proper EmailId')) return false;
}
//==============================================================================================================
//# Function for Validating Receipt Details Form Controls

function ValidateReceiptDetail()
{
	//#For Validating Advance textbox
	if (!ForceDataEntry(document.form1.txtAdvance, 'Advance')) return false;
	if (!ForceNumericEntry(document.form1.txtAdvance, 'Advance')) return false;
	
	var Adv=document.form1.txtAdvance.value;  
	var NetAmt=document.form1.txtNetAmt.value;
	var minadvper=document.form1.hdnAdvance.value;
	var minadv=NetAmt*(minadvper/100);
	var type = document.form1.txtHidden.value;
	if (type != 'AD')
	{
	
		if (Number(Adv)>Number(NetAmt))
		{
			alert("Advance can't be more than Net Amount");
			return false;
		}
		
		if (Number(Adv)<Number(minadv))
		{
			alert("Advance should be more and equal to "+minadvper+" % of Net Amount");
			document.form1.txtAdvance.focus();
			return false;
		}
	}	
	//#For Validating MOP DropDown
	if (!ForceComboItems(document.form1.ddlMOP,'Mode of Payment')) return false; 
	
	//#For Validating Cheque No. textbox
	if (document.getElementById("chkno").style.display=="block")
	{
		if (!ForceDataEntry(document.form1.txtChequeNo, 'Cheque No.')) return false;

		//#For Validating Cheque Date textbox
		if (!ForceDataEntry(document.form1.txtChequeDate, 'Cheque Date')) return false;
		//if (!isValidDate(document.form1.txtChequeDate,'Cheque Date')) return false;
		//#For Validating Bank Branch textbox
		if (!ForceDataEntry(document.form1.txtBankBranch, 'Bank Branch')) return false;
	
		//#For Validating Bank City textbox
		if (document.getElementById("city").style.display=="block")
		{
			if (!ForceDataEntry(document.form1.txtCity, 'City')) return false;
		}
	}
		//#For Validating Amount textbox
	if (!ForceDataEntry(document.form1.txtAmount, 'Amount')) return false;
	if (!ForceNumericEntry(document.form1.txtAmount, 'Amount')) return false;
	
	
	if ((Number(document.form1.txtAmount.value))!=(Number(document.form1.txtAdvance.value)))
	{
		alert("Amount must be equal to Advance");
		document.form1.txtAmount.focus();
		return false;
	}
	//#For Validating Remarks textbox
	//if (!ForceDataEntry(document.form1.txtRemarks, 'Remarks')) return false;
}

//===============================================================================================================
//# Function for Validating Receipt Details Form Controls

function ValidateRReceiptDetail()
{
	//#For Validating Advance textbox
	if (!ForceDataEntry(document.form1.txtAdvance, 'Advance')) return false;
	if (!ForceNumericEntry(document.form1.txtAdvance, 'Advance')) return false;
	
	//#For Validating MOP DropDown
	if (!ForceComboItems(document.form1.ddlMOP,'Mode of Payment')) return false; 
	
	//#For Validating Cheque No. textbox
	if (document.getElementById("chkno").style.display=="block")
	{
		if (!ForceDataEntry(document.form1.txtChequeNo, 'Cheque No.')) return false;

		//#For Validating Cheque Date textbox
		if (!ForceDataEntry(document.form1.txtChequeDate, 'Cheque Date')) return false;
		//if (!isValidDate(document.form1.txtChequeDate,'Cheque Date')) return false;
		//#For Validating Bank Branch textbox
		if (!ForceDataEntry(document.form1.txtBankBranch, 'Bank Branch')) return false;
	
		//#For Validating Bank City textbox
		if (document.getElementById("city").style.display=="block")
		{
			if (!ForceDataEntry(document.form1.txtCity, 'City')) return false;
		}
	}
		//#For Validating Amount textbox
	if (!ForceDataEntry(document.form1.txtAmount, 'Amount')) return false;
	if (!ForceNumericEntry(document.form1.txtAmount, 'Amount')) return false;
	
	/*var Adv=document.form1.txtAdvance.value;  
	var NetAmt=document.form1.txtNetAmt.value;
	var minadvper=document.form1.hdnAdvance.value;
	var minadv=NetAmt*(minadvper/100);
	var type = document.form1.txtHidden.value;
	if (type != 'AD')
	{
		if (Adv<minadv)
		{
			alert("Advance should be more and equal to "+minadvper+" % of Net Amount.");
			document.form1.txtAdvance.focus();
			return false;
		}
	}*/	
	if ((Number(document.form1.txtAmount.value))!=(Number(document.form1.txtAdvance.value)))
	{
		alert("Amount must be equal to Advance");
		document.form1.txtAmount.focus();
		return false;
	}
	//#For Validating Remarks textbox
	//if (!ForceDataEntry(document.form1.txtRemarks, 'Remarks')) return false;
}

//===============================================================================================================
//# Validating Occupancy in Rooms at the tme of Rescheduling 

//# For validating valid cases of rooms occupancy

function ValidateRescheduling(obj)
{
	
	//debugger
	//# Validate CheckIn
	if (!ForceDataEntry(document.form1.txtCheckIn,'Check In')) return false;

	//# Validating CheckOut
	if (!ForceDataEntry(document.form1.txtCheckOut,'Check Out')) return false;
	//# DateDiff
	if (!DateDiff(document.form1.txtCheckIn,document.form1.txtCheckOut,'CheckIn Date','CheckOut Date')) return false;
	
	//# Restricting user for not to make booking for more than 15 days
	var nights=Nights(document.form1.txtCheckIn.value,document.form1.txtCheckOut.value)
	if(Number(nights)>15)
	{
		alert("You can not make booking for more than 15 days");
		return false;
	}
	//# Validating whether CheckIn date is changed or CheckOut date is changed.
	//if((document.getElementById("lblCheckIn").value)!="")
	//{
	//	alert("Hello!");
	//}
	
	/*
	if (((document.getElementById("lblCheckIn").innerText)!=(document.form1.txtCheckIn.value))&&((document.getElementById("lblCheckOut").innerText)!=(document.form1.txtCheckOut.value)))
	{
		alert("Either CheckIn or CheckOut Date can be changed");
		document.form1.txtCheckIn.focus();
		return false;
	}*/
	
	var strVal = obj.innerText;
	//var strVal = obj;
	//var m_str = fld1.value+fld2.value+fld3.value;

	var var1;
	var var2;
	var var3;
	var T1;
	
	for ( var i=1;i<=strVal;i++)
	{
		switch(i)
		{
			case 1:
				var1  = document.getElementById('A1').value
				var2  = document.getElementById('C1').value;
    			var3  = document.getElementById('I1').value;
				break;
		
			case 2:
				var1  = document.getElementById('A2').value;
				var2  = document.getElementById('C2').value;
    			var3  = document.getElementById('I2').value;
				break;
			case 3:
				var1  = document.getElementById('A3').value;
				var2  = document.getElementById('C3').value;
    			var3  = document.getElementById('I3').value;
				break;
			case 4:
				var1  = document.getElementById('A4').value;
				var2  = document.getElementById('C4').value;
    			var3  = document.getElementById('I4').value;
				break;
			case 5:
				var1  = document.getElementById('A5').value;
				var2  = document.getElementById('C5').value;
    			var3  = document.getElementById('I5').value;
				break;
		}
		var noOfPeople=parseInt(var1)+parseInt(var2)+parseInt(var3);
		var noOfAC = parseInt(var1)+parseInt(var2);
		if ((noOfPeople > 5 )||(noOfAC==5))
		{
		alert("For Room No." + i + " no. of guest exceeds");
		return false;
		break;
		}
	}
}
//===============================================================================================================
//# validating User Login
function ValidateUserLogin()
{
	//# Validating UserType to be selected
	if (!ForceComboItems(document.form1.ddlUserType,'Login')) return false;
	//# Validating LoginId for blank
	if (!ForceDataEntry(document.form1.txtUserName,'User Id')) return false;
	//# Validating Password for blank
	if (!ForceDataEntry(document.form1.txtPassword,'Password')) return false;

}
//================================================================================================================
//# Validating Email Id for Forget Password
function ValidateEmailId()
{
	//# Validating Email Address
	if (!ForceDataEntry(document.form1.txtEmail,'User Id')) return false;
	//if (!IsEmailValid(document.form1.txtEmail,'Enter proper EmailId')) return false;
		
}

//================================================================================================================
//# validate search control 
function ValidateSearch()
{
	//debugger;
	//# Validating Booking No textbox for blank
	if (!ForceDataEntry(document.form1.SearchUC1_txtBookingNo,'Booking No.')) return false;
	if(document.getElementById("SearchUC1_txtBookingNo").value.length<12)
	{
		alert("Invalid Booking No.");
	}
}

//================================================================================================================
function ValidateOccupantDetails(obj)
{
	var objId = obj.id;
	//if (!ForceDataEntry(document.form1.objId,'all Textboxes')) return false;
	var TBox = document.getElementById(objId);
	//if (!ForceDataEntry(TBox,'all Textboxes')) return false;
	var data = TBox.value;
	
	if (data == "")
	{
		alert("You need to enter information for all textboxes");
		//obj.focus();
		return false;
	}
	return true;
}

//==============================================================================================================
function SelectOne(rdo,gridName)
{
/* Getting an array of all the "INPUT" controls on the form.*/
//document.form1.txtEmail.focus();
//alert("BBBBBBBBBB");
//pppp  document.getElementById("tblamountDetal").style.display = "inline";
//pppp  document.getElementById("tblPayModeDet").style.display = "inline";
//pppp  document.getElementById("tblNameDetl").style.display = "inline";
//pppp  document.getElementById("tblPerInfoDet").style.display = "inline";
all=document.getElementsByTagName("input");

//alert("bbbbbbbbbb");
//document.form1.txtEmail.focus();
 for(i=0;i<all.length;i++)
 {
  if(all[i].type=="radio")/*Checking if it is a radio button*/
  {
/*I have added '__ctl' ASP.NET adds '__ctl' to all 
    the controls of DataGrid.*/
   var count=all[i].id.indexOf(gridName+'__ctl'); 
   if(count==-1)
   {
    all[i].checked=false;
   }
  }
 }
 rdo.checked=true;/* Finally making the clicked radio button CHECKED */
}
//================================================================================================================
//# Validating Cancel Booking for of Admin
function ValidateCancelBooking()
{
	//# Validating Booking No
	if (!ForceDataEntry(document.Form1.txtBookingNo,'Booking No.')) return false;	
	//# Validating Rentention Amount
	if (!ForceDataEntry(document.Form1.txtRAmount,'Retention Amount')) return false;
	//# For retention not more than NetAmount
	//if ((document.Form1.txtRAmount.value)>(document.Form1.lblNetAmount.value))
	//{
	//	alert("Retention Amount should be less than Net Amount.");
	//}
	
	//# Validating Cancel Remarks
	if (!ForceDataEntry(document.Form1.txtCRemarks,'Cancel Remarks')) return false;	
	
	//# Validating Cancel combo is selected or not
	if (!ForceComboItems(document.Form1.ddlCancel,'Cancel')) return false;
	//debugger;
	//# Checking for Cancellation altered by Admin
	if (document.Form1.ddlCancel.selectedIndex==2)
	{
		if (document.Form1.txtRAmount.value!=0)
		{
			alert("Retention Amount should be 0");
			return false;
		}
		if(document.Form1.txtCRemarks.value=="")
		{
			alert("Cancel Remarks should not be blank");
			return false;
		}
		if (document.Form1.ddlCompletePartial.selectedIndex!=0)
		{
			alert("Complete/Partial option can't be selected");
			document.Form1.ddlCompletePartial.selectedIndex=0;
		}
		if (document.Form1.txtRAmount1.value!=0)
		{
			alert("Enter Retention Amount Again should be 0");
			return false;
		}
		
	}	
	else
	{
		//# Validating CompleteOartial combo is selected or not
		if (!ForceComboItems(document.Form1.ddlCompletePartial,'Complete/Partial')) return false;
		//# Validating LoginId for blank
		if (!ForceDataEntry(document.Form1.txtRAmount1,'Enter Retention Amount Again')) return false;
		if ((document.Form1.txtRAmount.value)<(document.Form1.txtRAmount1.value))
		{
			alert("Both the Retention Amount should be equal");
			return false;
		}
	}
}
//========================================================================================================

//# Function for validating Feedback Form.
 function ValidateFeedback()
 {
	//# Validating About combo is selected or not
	if (!ForceComboItems(document.form1.ddlAbout,'About')) return false;
	//# Validating Name field should not be blank
	if (!ForceDataEntry(document.form1.txtName,'Name')) return false;
	//# Validating Company field should not be blank
	//if (!ForceDataEntry(document.form1.txtCName,'Company')) return false;
	//# Validating Email field should not be blank and in Proper Format
	if (!ForceDataEntry(document.form1.txtEmail,'Email Id')) return false;
	if (!IsEmailValid(document.form1.txtEmail,'Enter proper EmailId')) return false;
	//# Validating Phone field should not be blank and should be numeric
	if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
	if (!ForceNumericEntry(document.form1.txtPhone, 'Phone')) return false;
	//# Validating Mobile field should not be blank and should be numeric
	if (!ForceDataEntry(document.form1.txtMobile,'Mobile')) return false;
	if (!ForceNumericEntry(document.form1.txtMobile, 'Mobile')) return false;		
	//# Validating Comment field should not be blank
	if (!ForceDataEntry(document.form1.txtComment,'Comment')) return false;
 }
 //========================================================================================================

//# Function for validating ContactUs Form.
 function ValidateContactUs()
 {
	
	//# Validating Name field should not be blank
	if (!ForceDataEntry(document.form1.txtName,'Name')) return false;
	//# Validating Address field should not be blank
	if (!ForceDataEntry(document.form1.txtAddress,'Address')) return false;
	//# Validating Email field should not be blank and in Proper Format
	if (!ForceDataEntry(document.form1.txtEmail,'Email Id')) return false;
	if (!IsEmailValid(document.form1.txtEmail,'Enter proper EmailId')) return false;
	//# Validating Phone field should not be blank and should be numeric
	if (!ForceDataEntry(document.form1.txtPhone,'Phone')) return false;
	if (!ForceNumericEntry(document.form1.txtPhone, 'Phone')) return false;
	
 }
 
 
		
		function showdivResort() {
document.getElementById('resortdivHref').style.display = "inline";
} 

function hidedivResort() {
document.getElementById('resortdivHref').style.display = "none";
} 

function Nights(objField1,objField2)
{
    var strDateValue1=objField1;
    var strDateValue2=objField2;
    // If Date is Blank, Don't Validate
    if (IsEmpty(strDateValue1)) return -1;
    if (IsEmpty(strDateValue2)) return -1;
     var arr = [];
     arr['01'] = 'JAN';
     arr['02'] = 'FEB';
     arr['03'] = 'MAR';
     arr['04'] = 'APR';
     arr['05'] = 'MAY';
     arr['06'] = 'JUN';
     arr['07'] = 'JUL';
     arr['08'] = 'AUG';
     arr['09'] = 'SEP';
     arr['10'] = 'OCT';
     arr['11'] = 'NOV';
     arr['12'] = 'DEC';
     var a = arr[0];
     
     var arrDate1 = strDateValue1.split('/');
     var arrDate2 = strDateValue2.split('/');
    
     if (arrDate1.length!=3 && arrDate2.length!=3)
     {
         arrDate1 = strDateValue1.split('-');
         arrDate2 = strDateValue2.split('-');
     }
   if (arrDate1.length==3 && strDateValue1.length==10 && arrDate2.length==3 && strDateValue2.length==10)
	{
       var one_day=1000*60*60*24; 
       var d1 = new Date(arrDate1[2], Number(arrDate1[1])-1, arrDate1[0]);
       var d2 = new Date(arrDate2[2], Number(arrDate2[1])-1, arrDate2[0]);
		//var dateDiff=Math.ceil((date2.getTime()-date1.getTime())/(one_day)); 
       var NOD = Math.ceil((d2.getTime()-d1.getTime())/(one_day));
       //document.form1.lblmessage1.value = NOD;
	     return NOD;
	}
}
