function validate_payment_form(form){if(form.invoice_no.value==''){alert("Please Invoice Number");form.invoice_no.focus();return false;}
if(form.amount.value==''||isNaN(Number(form.amount.value))){alert("Please Enter The US$ Amount");form.amount.focus();return false;}
return true;}
function show_hide_child_ages(no_of_children){var child_agex=document.getElementById('child_age');if(no_of_children==0){child_agex.style.display='none';}
else
{child_agex.style.display='';}}
function show_hide_srilankan_combo(val){var srilankanx=document.getElementById('srilankan');if(val==1){var non_srilankan_resx=document.getElementById('non_srilankan_res');non_srilankan_resx.style.display='none';srilankanx.style.display='';var nonsrilankanx=document.getElementById('nonsrilankan');nonsrilankanx.style.display='none';}
else
{srilankanx.style.display='none';}}
function show_hide_non_srilankan_res_combo(val){var non_srilankan_resx=document.getElementById('non_srilankan_res');if(val==1){var srilankanx=document.getElementById('srilankan');srilankanx.style.display='none';var nonsrilankanx=document.getElementById('nonsrilankan');nonsrilankanx.style.display='none';non_srilankan_resx.style.display='';}
else
{non_srilankan_resx.style.display='none';}}
function show_hide_nonsrilankan_combo(val){var nonsrilankanx=document.getElementById('nonsrilankan');if(val==1){var non_srilankan_resx=document.getElementById('non_srilankan_res');non_srilankan_resx.style.display='none';var srilankanx=document.getElementById('srilankan');srilankanx.style.display='none';nonsrilankanx.style.display='';}
else
{nonsrilankanx.style.display='none';}}
function validate_reservation_form(form){if(form.hotel_id.value==''){alert("Please select a hotel");form.hotel_id.focus();return false;}
if(form.in_date.value==''){alert("Please select check-in date");form.in_date.focus();return false;}
if(form.in_year_month.value==''){alert("Please select check-in month and year");form.in_year_month.focus();return false;}
if(form.out_date.value==''){alert("Please select check-out date");form.out_date.focus();return false;}
if(form.out_year_month.value==''){alert("Please select check-out month and year");form.out_year_month.focus();return false;}
if(form.room_type.value=='-1'){alert("Please select Room Type");form.room_type.focus();return false;}
if(form.rooms.value==0){alert("Please select No. of Rooms");form.rooms.focus();return false;}
if(form.adults.value==0){alert("Please select No. of Adults");form.adults.focus();return false;}
if(form.rooms.value==''){alert("Please select number of rooms you  need");form.rooms.focus();return false;}
if(form.adults.value==''){alert("Please select number of adults");form.adults.focus();return false;}
if(form.children.value==''){alert("Please select number of children");form.children.focus();return false;}
if(form.children.value!=0){var children=form.children.value;var children_0_to_3=form.children_0_to_3.value==''?0:form.children_0_to_3.value;var children_3_to_4=form.children_3_to_4.value==''?0:form.children_3_to_4.value;var children_4_to_5=form.children_4_to_5.value==''?0:form.children_4_to_5.value;var children_5_to_6=form.children_5_to_6.value==''?0:form.children_5_to_6.value;var children_6_to_7=form.children_6_to_7.value==''?0:form.children_6_to_7.value;var children_7_to_8=form.children_7_to_8.value==''?0:form.children_7_to_8.value;var children_8_to_9=form.children_8_to_9.value==''?0:form.children_8_to_9.value;var children_9_to_10=form.children_9_to_10.value==''?0:form.children_9_to_10.value;var children_10_to_11=form.children_10_to_11.value==''?0:form.children_10_to_11.value;var children_11_to_12=form.children_11_to_12.value==''?0:form.children_11_to_12.value;var count_of_children=parseInt(children_0_to_3)+parseInt(children_3_to_4)+
parseInt(children_4_to_5)+parseInt(children_5_to_6)+
parseInt(children_6_to_7)+parseInt(children_7_to_8)+
parseInt(children_8_to_9)+parseInt(children_9_to_10)+
parseInt(children_10_to_11)+parseInt(children_11_to_12);if(count_of_children!=children){alert("No. of Children dosen't match with count of Age Range");return false;}}
if(form.title.value==0){alert("Please Select Title");form.title.focus();return false;}
if(form.first_name.value==''){alert("Please enter your first name");form.first_name.focus();return false;}
if(form.last_name.value==''){alert("Please enter your last name");form.last_name.focus();return false;}
var emailRegEx=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;if(form.email_1.value.search(emailRegEx)==-1){alert("The format of the \"e-mail\" address is incorrect. Please enter in the format 'john@aol.com'");form.email_1.focus();return(false);}
if(form.email_2.value!=form.email_1.value){alert("Email address does no match with confirmed email address");form.email_2.focus();return false;}
if(form.last_name.value==''){alert("Please enter your last name");form.last_name.focus();return false;}
if(form.address.value==''){alert("Please enter your postal address");form.address.focus();return false;}
if(form.city.value==''){alert("Please enter city");form.city.focus();return false;}
if(form.state.value==''){alert("Please enter state");form.state.focus();return false;}
if(form.postal_code.value==''){alert("Please enter postal code");form.postal_code.focus();return false;}
if(form.nationality_id[0].checked==true){if(form.country_iso_2_national.value==''){alert("Please select Residence of Country");form.country_iso_2_national.focus();return false;}if(form.passport_country_iso_2_national.value==''){alert("Please select National of Country");form.passport_country_iso_2_national.focus();return false;}}
if(form.nationality_id[1].checked==true){if(form.country_iso_2_non_srilankan.value==''){alert("Please select Residence of Country");form.country_iso_2_non_srilankan.focus();return false;}if(form.passport_country_iso_2_non_srilankan.value==''){alert("Please select National of Country");form.passport_country_iso_2_non_srilankan.focus();return false;}}
if(form.nationality_id[2].checked==true){if(form.passport_country_iso_2_non_srilankan_res.value==''){alert("Please select National of Country");form.passport_country_iso_2_non_srilankan_res.focus();return false;}}
var country_code=form.country_code.value;var telephone=form.telephone.value;if(country_code==''){alert("Please select your country code");form.country_code.focus();return false;}
if(country_code.length==telephone.length){alert("Please enter your telephone");form.telephone.focus();return false;}
if(telephone.substring(country_code.length,(country_code.length+1))=='0'){alert("A international telephone number can't start with 0 (zero) after the country code.");form.telephone.focus();return false;}
if(telephone==''){alert("Please enter telephone");form.telephone.focus();return false;}
if(form.message.value==''){alert("Please enter you message");form.message.focus();return false;}
validation_code=String(form.validation_code.value);if(isNaN(parseInt(form.validation_code.value))||validation_code.length<4){alert("Please enter validation code as shown on screen");form.validation_code.focus();return false;}
if(!form.agreement.checked){alert("Please agree to the terms and conditions to continue with the reservation");form.agreement.focus();return false;}
form.btn_submit.disabled="disabled";document.forms("reserv_form").submit();return(true);}
function validate_contact_form(form){if(form.title_id.value==''){alert("Please enter your title");form.title_id.focus();return false;}
if(form.first_name.value==''){alert("Please enter your first name");form.first_name.focus();return false;}
if(form.last_name.value==''){alert("Please enter your last name");form.last_name.focus();return false;}
var emailRegEx=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;if(form.email.value.search(emailRegEx)==-1){alert("The format of the \"e-mail\" address is incorrect. Please enter in the format 'john@aol.com'");form.email.focus();return(false);}
if(form.country_id.value==''){alert("Please Select your country");form.country_id.focus();return false;}
var country_code=form.country_code.value;var telephone=form.telephone.value;if(country_code==''){alert("Please select your country code");form.country_code.focus();return false;}
if(country_code.length==telephone.length){alert("Please enter your telephone");form.telephone.focus();return false;}
if(telephone.substring(country_code.length,(country_code.length+1))=='0'){alert("A international telephone number can't start with 0 (zero) after the country code.");form.telephone.focus();return false;}
if(telephone==''){alert("Please enter telephone");form.telephone.focus();return false;}
if(form.subject.value==''){alert("Please enter a subject");form.subject.focus();return false;}
if(form.message.value==''){alert("Please enter your message");form.message.focus();return false;}
validation_code=String(form.validation_code.value);if(isNaN(parseInt(form.validation_code.value))||validation_code.length<4){alert("Please enter validation code as shown on screen");form.validation_code.focus();return false;}
form.btn_submit.disabled="disabled";document.contact_form.submit();return true;}
function onload_code(){var country_code=document.getElementById("country_code").value;document.getElementById("telephone").value=country_code;}
function validate_phone_no(){var country_code=document.getElementById("country_code").value;var telephone=document.getElementById("telephone").value;var country_code_length=country_code.length;if(country_code_length>telephone.length){document.getElementById("telephone").value=country_code;}else if(telephone.substring(0,country_code_length)!=country_code){document.getElementById("telephone").value=country_code;}}
