//fixed by Sebaastian, Now it's work on FF and IE
strErrorHeader = "Error";

errBadDate = "Non-existing date";
errEmpty = "Can't be empty";
errZero = "Can't be 0";
errNaN = "Must be number";
errWrongFormat = "Wrong format";

fldAptType = "Apartment type";
fldArrival = "Arrival Date";
fldCity = "City";
fldPostalCode = "PostalCode";
fldCountryCode = "Country code";
fldDeparture = "Departure Date";
fldEmail = "Email";
fldFirstName = "First Name";
fldHowMany = "Number of people";
fldLastName = "Last Name";
fldPhone = "Phone Number";
fldAddress = "Address";
fldHomePhone = "Home phone";
fldWorkPhone = "Work phone";
fldCCNumber = "Credit Card Number";
fldCCMonth = "Credit Card Expiration Month";
fldCCYear = "Credit Card Expiration Year";
fldLengthStay = "Length of planned stay";
fldEarliestDate="Earliest Arrival Date";
fldLatestDate="Latest Arrival Date";
fldReservationNo="Reservation No.";
fldCCHolderComing = "Is the credit card holder coming?";

function Check (strToCheck, strField) {
    Result = true;
	if (CheckEmpty (strToCheck, strField)) {
		switch (strField){
            case fldHowMany:
            if (!(CheckNumber (strToCheck, strField)))
            {
              Result = Error (strField, errNaN);
            }else if(strToCheck=='0')
            {
              Result = Error (strField, errZero);
            }
            break;
            
            case fldLengthStay:
            if (!(CheckNumber (strToCheck, strField)))
					Result = Error (strField, errNaN);
				break;
			
            case fldArrival:
			case fldDeparture:
            case fldEarliestDate:
            case fldLatestDate:
				if (!(CheckDateForm (strToCheck, strField)))
					Result = Error (strField, errWrongFormat)
				else
					if (!(CheckDateExists (strToCheck, strField)))
						Result = Error (strField, errBadDate);
				break;
			case fldPhone:
				if (!(CheckPhone (strToCheck, strField)))
					Result = Error (strField, errWrongFormat);
				break;
            case fldReservationNo:                
                if (!(CheckLongNumber (strToCheck, strField)))
						Result = Error (strField, errNaN);
            break;
			
            case fldEmail:
				if (!(CheckEmail (strToCheck, strField)))
					Result = Error (strField, errWrongFormat);
				break;
        }
    }else{
        Result = Error (strField, errEmpty);
    }
	return Result;
}

function Error (strField, strError)
	{
	window.alert (strErrorHeader + ":\n\n" + strField + "\n\n" + strError);
	return false;
	}

function CheckDateForm (strToTest, varDate)
	{
	Result = true;
	re = /^\d{2}\/\d{2}\/\d{4}$/
	if (!(re.test (strToTest)))
		Result = false;
	return Result;
	}

function CheckDateExists (strToTest, varDate)
	{
	Result = true;
	re = /^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((1[6-9]|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((1[6-9]|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/
	if (!(re.test (strToTest)))
		Result = false;
	return Result;
	}

function CheckDates ()
	{
	re = new RegExp ("(\d{2})\/(\d{2})\/(\d{4})");
	window.alert (document.all.AD.value);
	read = re.exec (document.all.AD.value);
	window.alert ("ad=" + RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3 + "!");
	redd = re.exec (document.all.DD.value);
	window.alert ("ad=" + RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3 + "!");
	return false;
	}

function CheckEmail (strToTest, strWhere)
	{
	Result = true;
	re = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (!(re.test (strToTest)))
		Result = false;
	return Result;
	}
	
function CheckIfForbidenPhrases(form)
{
    
     
      for(i=0;i<form.elements.length;i++)
      { 
     
        box = form.elements[i];
        if(box.type=="text" || box.type=="textarea" )
        {  
         
         
           regexp=/[\w*\s*\W*]*\w+\.\w+\.\w+[\w*\s*\W*]*$/
           strToTest=box.value;
           
	       if ((regexp.test(strToTest)))
	       {
	         alert("Forbiden phrase was detected");
	         return false;
	       }

		}
			
			
		

      }
     
	 	return true;

}
function CheckEmpty (strToTest, strWhere)
	{
	Result = true;
	if (strToTest == "")
		Result = false;
	return Result;
	}

function CheckNumber (strToTest, strWhere)
	{
	Result = true;
	re = /^\d{1,3}$/
	if (!(re.test (strToTest)))
		Result = false;
	return Result;
	}


function CheckLongNumber (strToTest, strWhere)
	{
	Result = true;
	re = /^\d{1,10}$/
	if (!(re.test (strToTest)))
		Result = false;
	return Result;
	}


function CheckPhone (strToTest, strWhere) 
	{
	Result = true;
	re = /^[\d+\/\- \.\(\)\+]+$/ //re = /^[\d-\/ \.\(\)\+]+$/
	
    if (!(re.test (strToTest)))
		Result = false;
	return Result;
    }

// mb 20051124 start
fldArrivalTime = "Arrival Time";
fldArrivalType = "Arrival Type";
fldFNameOnCard = "First name on the card";
fldLNameOnCard = "Last name on the card";
fldCreditCardType = "Credit card type";
fldFloatGroup = "Apartment type";

errMustBeSelected = "Must be selected";

function CheckDdl(ddlName, strField)
{
    Result = true;
    if ( document.getElementById(ddlName).value == -1 )
    {
        Result = Error(strField, errMustBeSelected);          
    }    
    return Result;
}


function CheckChkCancelationPolicy(chkCancelationPolicy)
    {
		Result = true;
		if (document.getElementById(chkCancelationPolicy).checked == false)
		{
			Result = false;
			window.alert("You have to agree with Cancellation Policy");
            document.getElementById(chkCancelationPolicy).focus();
		}
		return Result;
    }
    
function CheckCkCharge(chkCharge)
    {
        Result = true;
        if (document.getElementById(chkCharge).checked == false)
        {
            Result = false;
            window.alert("You must agree");
            document.getElementById(chkCharge).focus();            
        }
        return Result;
    }
    
function CheckChkDebit(chkDebit)
    {
        Result = true;
        if (document.getElementById(chkDebit).checked == false)
        {
            Result = false;
            window.alert("You must agree to being charged with the prepayment amount");
            document.getElementById(chkDebit).focus();
        }
        return Result;
    }
    
// mb OnlineBook2 start 20060314
function CheckOnlineBook2Form(txtNoOfPeople, txtFirstName, txtLastName, ddlCountryCode, txtPhoneNumber, txtEmail, txtFNameOnCard, txtLNameOnCard
                               ,ctlbCreditCardType, txtCCNumber, ddlExpirationMonth, ddlExpirationYear, ddlArrivalType, chkCancelationPolicy)
{
    Result = true;
    if (document.getElementById(txtNoOfPeople) != null)
        Result = Result && Check (document.getElementById(txtNoOfPeople).value, fldHowMany);
    if (document.getElementById(txtFirstName) != null)
        Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName);  
    if (document.getElementById(txtLastName) != null)    
        Result = Result && Check (document.getElementById(txtLastName).value, fldLastName);   
    if (document.getElementById(ddlCountryCode) != null)
        Result = Result && CheckDdl (ddlCountryCode, fldCountryCode);   
    if (document.getElementById(txtPhoneNumber) != null)
        Result = Result && Check (document.getElementById(txtPhoneNumber).value, fldPhone);
    if (document.getElementById(txtEmail) != null)
        Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);
    if (document.getElementById(txtFNameOnCard) != null)
        Result = Result && Check (document.getElementById(txtFNameOnCard).value, fldFNameOnCard);  
    if (document.getElementById(txtLNameOnCard) != null)
        Result = Result && Check (document.getElementById(txtLNameOnCard).value, fldLNameOnCard);  
    if (document.getElementById(ctlbCreditCardType) != null)
        Result = Result && CheckDdl (ctlbCreditCardType, fldCreditCardType);
    if (document.getElementById(txtCCNumber) != null)
        Result = Result && Check (document.getElementById(txtCCNumber).value, fldCCNumber);  
    if (document.getElementById(ddlExpirationMonth) != null)
        Result = Result && CheckDdl (ddlExpirationMonth, fldCCMonth);
    if (document.getElementById(ddlExpirationYear) != null)
        Result = Result && CheckDdl (ddlExpirationYear, fldCCYear);
    if (document.getElementById(ddlArrivalType) != null)
        Result = Result && CheckDdl (ddlArrivalType, fldArrivalType);  
    if (document.getElementById(chkCancelationPolicy) != null)
        Result = Result && CheckChkCancelationPolicy(chkCancelationPolicy);                                  
                                                                
    return Result;
}

function CheckOnlineBook3Form( txtNoOfPeople, ddlArrivalType, chkCancelationPolicy, txtFirstName
                                , txtLastName, ddlCountryCode, txtPhoneNumber, txtEmail, txtFNameOnCard, txtLNameOnCard
                                , ctlbCreditCardType, txtCCNumber, ddlExpirationMonth, ddlExpirationYear, chkCharge, chkDebit, bookingType)
{
    Result = true;
    
    if (document.getElementById(bookingType) != null && document.getElementById(bookingType).checked)
      return true;    
    if (document.getElementById(txtNoOfPeople) != null)
        Result = Result && Check (document.getElementById(txtNoOfPeople).value, fldHowMany);
    if (document.getElementById(ddlArrivalType) != null)
        Result = Result && CheckDdl (ddlArrivalType, fldArrivalType);  
    if (document.getElementById(chkCancelationPolicy) != null)
        Result = Result && CheckChkCancelationPolicy(chkCancelationPolicy);                                  
    if (document.getElementById(chkDebit) != null)
        Result = Result && CheckChkDebit(chkDebit);                                                  
    if (document.getElementById(chkCharge) != null)
        Result = Result && CheckCkCharge(chkCharge);                                          
    if (document.getElementById(txtFirstName) != null)
        Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName);  
    if (document.getElementById(txtLastName) != null)    
        Result = Result && Check (document.getElementById(txtLastName).value, fldLastName);  
    if (document.getElementById(ddlCountryCode) != null)
        Result = Result && CheckDdl (ddlCountryCode, fldCountryCode);               
    if (document.getElementById(txtPhoneNumber) != null)
        Result = Result && Check (document.getElementById(txtPhoneNumber).value, fldPhone);
    if (document.getElementById(txtEmail) != null)
        Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);
    if (document.getElementById(txtFNameOnCard) != null)
        Result = Result && Check (document.getElementById(txtFNameOnCard).value, fldFNameOnCard);  
    if (document.getElementById(txtLNameOnCard) != null)
        Result = Result && Check (document.getElementById(txtLNameOnCard).value, fldLNameOnCard);  
    if (document.getElementById(ctlbCreditCardType) != null)
        Result = Result && CheckDdl (ctlbCreditCardType, fldCreditCardType);
    if (document.getElementById(txtCCNumber) != null)
        Result = Result && Check (document.getElementById(txtCCNumber).value, fldCCNumber);  
    if (document.getElementById(ddlExpirationMonth) != null)
        Result = Result && CheckDdl (ddlExpirationMonth, fldCCMonth);
    if (document.getElementById(ddlExpirationYear) != null)
        Result = Result && CheckDdl (ddlExpirationYear, fldCCYear);
        
                                
    return  Result;       
}

// mb OnlineBook2 end 20060314

function CheckOnlineBookForm(ddlFloatGroup, txtNoOfPeople, tbcDateFrom, ddlArrivalTime, ddlArrivalType, tbcDateTo, chkCancelationPolicy, txtFirstName, txtLastName, ddlCountryCode, txtPhoneNumber, txtEmail
                             ,txtFNameOnCard, txtLNameOnCard, ctlbCreditCardType, txtCCNumber, ddlExpirationMonth, ddlExpirationYear)
       {       
           Result = true;
           
           if (document.getElementById(ddlFloatGroup) != null)
               Result = Result && CheckDdl (ddlFloatGroup, fldFloatGroup);           
           if (document.getElementById(txtNoOfPeople) != null)
               Result = Result && Check (document.getElementById(txtNoOfPeople).value, fldHowMany);
           if (document.getElementById(tbcDateFrom) != null)
               Result = Result && Check (document.getElementById(tbcDateFrom).value, fldArrival);
           // if (document.getElementById(ddlArrivalTime) != null)
           //    Result = Result && CheckDdl (ddlArrivalTime, fldArrivalTime);
           if (document.getElementById(ddlArrivalType) != null)
               Result = Result && CheckDdl (ddlArrivalType, fldArrivalType);          
           if (document.getElementById(tbcDateTo) != null)
               Result = Result && Check (document.getElementById(tbcDateTo).value, fldDeparture);	
           if (document.getElementById(chkCancelationPolicy) != null)
               Result = Result && CheckChkCancelationPolicy(chkCancelationPolicy);                                  
           if (document.getElementById(txtFirstName) != null)
               Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName);  
           if (document.getElementById(txtLastName) != null)    
               Result = Result && Check (document.getElementById(txtLastName).value, fldLastName);               
           if (document.getElementById(ddlCountryCode) != null)
               Result = Result && CheckDdl (ddlCountryCode, fldCountryCode);               
           if (document.getElementById(txtPhoneNumber) != null)
               Result = Result && Check (document.getElementById(txtPhoneNumber).value, fldPhone);
	       if (document.getElementById(txtEmail) != null)
               Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);
           if (document.getElementById(txtFNameOnCard) != null)
               Result = Result && Check (document.getElementById(txtFNameOnCard).value, fldFNameOnCard);  
           if (document.getElementById(txtLNameOnCard) != null)
               Result = Result && Check (document.getElementById(txtLNameOnCard).value, fldLNameOnCard);  
           if (document.getElementById(ctlbCreditCardType) != null)
               Result = Result && CheckDdl (ctlbCreditCardType, fldCreditCardType);
           if (document.getElementById(txtCCNumber) != null)
               Result = Result && Check (document.getElementById(txtCCNumber).value, fldCCNumber);  
           if (document.getElementById(ddlExpirationMonth) != null)
               Result = Result && CheckDdl (ddlExpirationMonth, fldCCMonth);
           if (document.getElementById(ddlExpirationYear) != null)
               Result = Result && CheckDdl (ddlExpirationYear, fldCCYear);
                                                                                                                                  
           return Result; 
       }


function RedirectToContactPage()
    {
        if ( document.getElementById("ddlCity") != null)
        { 
            if (CheckDdl (ddlCity, fldCity))
            {              
                window.alert(document.getElementById("ddlCity").options [document.getElementById("ddlCity").selectedIndex].value  );
                window.location.href = document.getElementById("ddlCity").options [document.getElementById("ddlCity").selectedIndex].value;  
                
            } 
        } 
    }

// mb 20051212 end

// mb BuyAdvertisement 20051229 start
function CheckBuyAdvertisementForm( txtFirstName, txtLastName, ddlCountryCode, txtPhoneNumber, txtEmail )
    {       
        Result = true;
        if (document.getElementById(txtFirstName) != null)
            Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName);  
        if (document.getElementById(txtLastName) != null)
            Result = Result && Check (document.getElementById(txtLastName).value, fldLastName);  
        if (document.getElementById(ddlCountryCode) != null)
            Result = Result && CheckDdl (ddlCountryCode, fldCountryCode);           
        if (document.getElementById(txtPhoneNumber) != null)
            Result = Result && Check (document.getElementById(txtPhoneNumber).value, fldPhone);
        if (document.getElementById(txtEmail) != null)
            Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);                                 
        return Result;
    }

// mb BuyAdvertisement 20051229 end

function CheckForm ()
	{
	Result = true;
	
    if (document.getElementById("listSelectCity") != null)
		Result = Result && Check (document.getElementById("listSelectCity").options [document.getElementById("listSelectCity").selectedIndex].value, fldCity);
	if (document.getElementById("listSelectApartmentType") != null)
		Result = Result && Check (document.getElementById("listSelectApartmentType").options [document.getElementById("listSelectApartmentType").selectedIndex].value, fldAptType);
       
    if (document.getElementById("tbHowmany") != null)
        Result = Result && Check (document.getElementById("tbHowmany").value, fldHowMany)
    if (document.getElementById("tbDateFrom") != null)
        Result = Result && Check (document.getElementById("tbDateFrom").value, fldArrival);
	if (document.getElementById("tbDateTo") != null)
        Result = Result && Check (document.getElementById("tbDateTo").value, fldDeparture);	
	//added by Sebastian (Vincent new book form)
    if (document.getElementById("tbEarliestDate") != null)
        Result = Result && Check (document.getElementById("tbEarliestDate").value, fldEarliestDate);        
    if (document.getElementById("tbLatestDate") != null)
        Result = Result && Check (document.getElementById("tbLatestDate").value, fldEarliestDate);    
    if (document.getElementById("tbHowLong") != null)
        Result = Result && Check (document.getElementById("tbHowLong").value, fldLengthStay);
    //end    
    if (document.getElementById("tbFirstname") != null)
        Result = Result && Check (document.getElementById("tbFirstname").value, fldFirstName);    
    if (document.getElementById("tbSurname") != null)    
        Result = Result && Check (document.getElementById("tbSurname").value, fldLastName);
	if (document.getElementById("ddCountrycode") != null)
        Result = Result && Check (document.getElementById("ddCountrycode").options [document.getElementById("ddCountrycode").selectedIndex].value, fldCountryCode);
	if (document.getElementById("tbPhone") != null)
        Result = Result && Check (document.getElementById("tbPhone").value, fldPhone);
	if (document.getElementById("tbEmail") != null)
        Result = Result && Check (document.getElementById("tbEmail").value, fldEmail);
        
    

	return Result;
	}

function CheckFormHotelBook ()
	{
	Result = true;
	//if (!(typeof (document.all.listSelectCity) == "undefined"))
	//	Result = Result && Check (document.all.listSelectCity.options [document.all.listSelectCity.selectedIndex].value, fldCity);
	//if (!(typeof (document.all.listSelectApartmentType) == "undefined"))
	//	Result = Result && Check (document.all.listSelectApartmentType.options [document.all.listSelectApartmentType.selectedIndex].value, fldAptType);
	Result = Result
		&& Check (document.getElementById("email").value, fldEmail)
		&& Check (document.getElementById("firstName").value, fldFirstName)
		&& Check (document.getElementById("lastName").value, fldLastName)
		&& Check (document.getElementById("address1").value, fldAddress)
		&& Check (document.getElementById("city").value, fldCity)
		//&& Check (document.getElementById(".ddCountrycode.options [document.getElementById(".ddCountrycode.selectedIndex].value, fldCountryCode)
		&& Check (document.getElementById("postalCode").value, fldPostalCode)
		&& Check (document.getElementById("homePhone").value, fldHomePhone)
		&& Check (document.getElementById("workPhone").value, fldWorkPhone)
		&& Check (document.getElementById("creditCardNumber").value, fldCCNumber);
		if (document.getElementById("readTerms").checked == false)
		{
			Result = false;
			window.alert("You have to agree with Cancellation Policy");
		}
	//	Result = Result && CheckDates ();	
	return Result;
	}
    
    function CheckFormService ()
	{
	Result = true;	
	
    Result = Result
		
		&& Check (document.getElementById("tbFirstname").value, fldFirstName)
		&& Check (document.getElementById("tbSurname").value, fldLastName)
		&& Check (document.getElementById("tbEmail").value, fldEmail)
        && Check (document.getElementById("tbReservation").value, fldReservationNo)
        && Check (document.getElementById("tbTel").value, fldPhone)
        
        //&& Check (document.getElementById("address1").value, fldAddress)
		//&& Check (document.getElementById("city").value, fldCity)
		
		//&& Check (document.getElementById("postalCode").value, fldPostalCode)
		//&& Check (document.getElementById("homePhone").value, fldHomePhone)
		//&& Check (document.getElementById("workPhone").value, fldWorkPhone)
		//&& Check (document.getElementById("creditCardNumber").value, fldCCNumber);
		
	
	return Result;
	}

function linkDates(df, dt)
{
var t1 = df.split('/');
var t2 = dt.split('/');
var datef = new Date(t1[2],t1[1],t1[0]);
var datet = new Date(t2[2],t2[1],t2[0]);
  if(datef>datet)
  {
    window.alert(strErrorHeader + ":\n\n" + fldDeparture + ' is earlier than ' + fldArrival);
    return false;
  }
  else
    return true;
}

function CheckRequestForm( txtNumberOfPeople, tbcDateFrom, tbcDateTo, txtFirstName, txtLastName, ddlCountryCode
                            , txtPhoneNumber, txtEmail, ddlAparType)
{
    Result = true;
    
    if (document.getElementById(ddlAparType) != null)
        Result = Result && CheckDdl (ddlAparType, fldAptType);              
    if (document.getElementById(txtNumberOfPeople) != null)
        Result = Result && Check (document.getElementById(txtNumberOfPeople).value, fldHowMany);
    if (document.getElementById(tbcDateFrom) != null)
        Result = Result && Check (document.getElementById(tbcDateFrom).value, fldArrival);
    if (document.getElementById(tbcDateTo) != null)
        Result = Result && Check (document.getElementById(tbcDateTo).value, fldDeparture);	
    try{
      Result = linkDates(document.getElementById(tbcDateFrom).value,document.getElementById(tbcDateTo).value)
    }catch(err){}
    if (document.getElementById(txtFirstName) != null)
        Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName);  
    if (document.getElementById(txtLastName) != null)    
        Result = Result && Check (document.getElementById(txtLastName).value, fldLastName); 
    if (document.getElementById(ddlCountryCode) != null)
        Result = Result && CheckDdl (ddlCountryCode, fldCountryCode);   
    if (document.getElementById(txtPhoneNumber) != null)
        Result = Result && Check (document.getElementById(txtPhoneNumber).value, fldPhone);
    if (document.getElementById(txtEmail) != null)
        Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);
                                                                        
    return Result;        
}

fldFirstNameOnTheCard = "First Name on the card";
fldLastNameOnTheCard = "Last Name on the card";
fldApartment = "Apartment";
fldSecurityCode = "Security Code";

// with option functionality
function CheckPaymentForm(txtNumberOfPeople, tbcDateFrom, tbcDateTo, txtFirstName, txtLastName
                         ,txtFirstNameOnTheCard, txtLastNameOnTheCard, ctlbCreditCardType, ddlExpirationMonth
						 ,ddlExpirationYear, txtEmail, ddlArrivalTime, ddlArrivalType, ddlApartment, ddlOption, txtCCNumber
						 ,txtSecurityCode, chkCancelationPolicy, ccHolderYesOption, ccHolderNoOption)
{
    Result = true;

    if (document.getElementById(ddlApartment) != null)
        Result = Result && CheckDdl (ddlApartment, fldApartment);	    	
    if (document.getElementById(ddlOption) != null)
        Result = Result && CheckDdl (ddlOption, fldApartment);	    			
    if (document.getElementById(txtNumberOfPeople) != null)
        Result = Result && Check (document.getElementById(txtNumberOfPeople).value, fldHowMany);
    if (document.getElementById(tbcDateFrom) != null)
        Result = Result && Check (document.getElementById(tbcDateFrom).value, fldArrival);
    if (document.getElementById(ddlArrivalTime) != null)
        Result = Result && CheckDdl (ddlArrivalTime, fldArrivalTime);
    if (document.getElementById(ddlArrivalType) != null)
        Result = Result && CheckDdl (ddlArrivalType, fldArrivalType);  		
    if (document.getElementById(tbcDateTo) != null)
        Result = Result && Check (document.getElementById(tbcDateTo).value, fldDeparture);	
    if (document.getElementById(txtFirstName) != null)
        Result = Result && Check (document.getElementById(txtFirstName).value, fldFirstName); 
    if (document.getElementById(txtLastName) != null)    
        Result = Result && Check (document.getElementById(txtLastName).value, fldLastName); 
    if (document.getElementById(txtEmail) != null)
        Result = Result && Check (document.getElementById(txtEmail).value, fldEmail);		
    if (document.getElementById(chkCancelationPolicy) != null)
        Result = Result && CheckChkCancelationPolicy(chkCancelationPolicy);                                  				
    if (document.getElementById(txtFirstNameOnTheCard) != null)
        Result = Result && Check (document.getElementById(txtFirstNameOnTheCard).value, fldFirstNameOnTheCard); 
    if (document.getElementById(txtLastNameOnTheCard) != null)
        Result = Result && Check (document.getElementById(txtLastNameOnTheCard).value, fldLastNameOnTheCard); 
    if (document.getElementById(ctlbCreditCardType) != null)
        Result = Result && CheckDdl (ctlbCreditCardType, fldCreditCardType);
    if (document.getElementById(txtCCNumber) != null)
        Result = Result && Check (document.getElementById(txtCCNumber).value, fldCCNumber);  		
    if (document.getElementById(txtSecurityCode) != null && document.getElementById("secCode") != null)
        Result = Result && Check (document.getElementById(txtSecurityCode).value, fldSecurityCode);		
    if (document.getElementById(ddlExpirationMonth) != null)
        Result = Result && CheckDdl (ddlExpirationMonth, fldCCMonth);
    if (document.getElementById(ddlExpirationYear) != null)
        Result = Result && CheckDdl (ddlExpirationYear, fldCCYear);	
    if (document.getElementById(ccHolderYesOption) != null && document.getElementById(ccHolderNoOption) != null )
        Result = Result && CheckCCHolderComing(ccHolderYesOption, ccHolderNoOption);
		
    return Result;
}

function CheckCCHolderComing(item1, item2)
{
  Result = true;
  try{
        if(document.getElementById(item1).checked == false && document.getElementById(item2).checked == false)
        {
          Result = false;
           alert(fldCCHolderComing);
        }
    return Result;
  }catch(err)
  {    
  }
  return Result;
}
    function OpenCertDetails(domainid) 
    {
    thewindow = window.open( 'https://sealinfo.thawte.com/thawtesplash?form_file=fdf/thawtesplash.fdf&dn=WWW.APARTMENTSAPART.COM&lang=en');

    }

    
