﻿// JScript File
     
    
    function validateHeaderDestinationSearch()
    {
        var theform;
		var postback = true;
		var theformAction;
		var NewUrl;
				
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
			theform = document.forms["aspnetForm"];
		else
			theform = document.aspnetForm;	
			
	    theformAction = theform.action;        
        
        if((theform.txtDestination.value) == "Choose destination...")	
            theform.txtDestination.value = "";            
             
        theform.action = "DestinationSearchResult.aspx";
	    theform.submit();   
 	    
 	    theform.action = theformAction;
	    
	    return false;		
    }        
    
    
    function validateTemplateEnquiryBookingForm()
    {
        var theform;
		var postback = true;
		var theformAction;
				
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
			theform = document.forms["aspnetForm"];
		else
			theform = document.aspnetForm;
			
	    theformAction = theform.action;
	    
	    	    
        if (DivEmptyFieldValidation(theform.txtName,'Please Enter Name','ErrorSpan')==false)
		{
			theform.txtName.focus();
			postback = false; 
			return false;
		} 
		if (DivEmailFieldValidation(theform.txtEmail,'Please Enter Email','ErrorSpan')==false)
		{
			theform.txtEmail.focus();
			postback = false; 
			return false;
		}   		
		if (DivEmptyFieldValidation(theform.txtDetails,'Please Enter Enquiry Details','ErrorSpan')==false)
		{
			theform.txtDetails.focus();
			postback = false; 
			return false;
		}  

		FullClearErrorMessage('ErrorSpan');	

	    theform.action = "EnquiryBookingForm.aspx";
	    theform.submit();
	    
	    theform.action = theformAction;
	    
	    return false;		
    }     
    
    function validateClientTemplateHolidaySearch()
    {
        var theform;
		var postback = true;
		var theformAction;
				
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
			theform = document.forms["aspnetForm"];
		else
			theform = document.aspnetForm;			
	
	    theformAction = theform.action;    
        
		if((theform.txtPriceRange.value) != "")	
	    {
		    if (chkDivDecimal(theform.txtPriceRange,'HotelErrorSpan')==false)
		    {
			    theform.txtPriceRange.focus();
			    postback = false; 
			    return false;
		    }
		}        
        
        FullClearErrorMessage('HotelErrorSpan');	
        
	    theform.action = "HolidaySearchResult.aspx";
	    theform.submit();
	    
	    theform.action = theformAction;
	    
	    return false;		
    }
    function validateTemplateHolidaySearch()
    {
        var theform;
		var postback = true;
				
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
			theform = document.forms["aspnetForm"];
		else
			theform = document.aspnetForm;
	
		if((theform.ctl00$ContentPlaceHolder1$txtPriceRange.value) != "")	
	    {
		    if (chkDivDecimal(theform.ctl00$ContentPlaceHolder1$txtPriceRange,'ctl00_ContentPlaceHolder1_error_div')==false)
		    {
			    theform.ctl00$ContentPlaceHolder1$txtPriceRange.focus();
			    postback = false; 
			    return false;
		    }
		}	
			
		FullClearErrorMessage('ctl00_ContentPlaceHolder1_error_div');	
		return true;	
    
    }
    
    function validateTemplateContactUs()
    {
        var theform;
		var postback = true;
		var theformAction;
				
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) 
			theform = document.forms["aspnetForm"];
		else
			theform = document.aspnetForm;
			
	
	    theformAction  = theform.action;
	    
	    
        if (DivEmptyFieldValidation(theform.txtLowerFirstName,'Please Enter First Name','divContactUsError')==false)
		{
			theform.txtLowerFirstName.focus();
			postback = false; 
			return false;
		} 
		if (theform.txtLowerFirstName.value == "Enter First Name")
		{
		    DivShowMessage('Please Enter First Name','divContactUsError')
		
			theform.txtLowerFirstName.focus();
			postback = false; 
			return false;
		}
		
        if (DivEmptyFieldValidation(theform.txtLowerLastName,'Please Enter Last Name','divContactUsError')==false)
		{
			theform.txtLowerLastName.focus();
			postback = false; 
			return false;
		} 
		if (theform.txtLowerLastName.value == "Enter Last Name")
		{
		    DivShowMessage('Please Enter Last Name','divContactUsError')
		
			theform.txtLowerLastName.focus();
			postback = false; 
			return false;
		}
		
		if (DivEmailFieldValidation(theform.txtLowerContactEmail,'Please Enter Email','divContactUsError')==false)
		{
			theform.txtLowerContactEmail.focus();
			postback = false; 
			return false;
		} 
		if (theform.txtLowerContactEmail.value == "Enter Email")
		{
		    DivShowMessage('Please Enter Email','divContactUsError')
		    
			theform.txtLowerContactEmail.focus();
			postback = false; 
			return false;
		}
		  		
		if (DivEmptyFieldValidation(theform.txtLowerContactMessage,'Please Enter Message','divContactUsError')==false)
		{
			theform.txtLowerContactMessage.focus();
			postback = false; 
			return false;
		} 
		if (theform.txtLowerContactMessage.value == "Enter your message")
		{
		    DivShowMessage('Please Enter Message','divContactUsError')
		    
			theform.txtLowerContactMessage.focus();
			postback = false; 
			return false;
		}  

		FullClearErrorMessage('divContactUsError');	
	    

	    theform.action = "TemplateContactUs.aspx";
	    theform.submit();
	    
	    theform.action = theformAction;
	    
	    return false;		
    }    
