﻿function Gtotal(vForm){
vForm.Excursion_total.value=vForm.Excursion_Program_Total.value;
vForm.Total_Cost.value=parseInt(vForm.Accommodation_total.value) + parseInt(vForm.Visa_total.value) + parseInt(vForm.Transfer_total.value) + parseInt(vForm.Excursion_total.value)
}
function Calc(vForm){
if ((document.vForm.EX11.checked)||(document.vForm.EX12.checked)){vForm.Total_cost_tour1.value=parseInt(vForm.Number_of_pax1.value * 20);}else{vForm.Total_cost_tour1.value=0;vForm.Number_of_pax1.value='0';}
if (document.vForm.EX3.checked){}else{vForm.Total_cost_tour3.value=0;vForm.Number_of_pax3.value='0';}
if (document.vForm.EX4.checked){}else{vForm.Total_cost_tour4.value=0;vForm.Number_of_pax4.value='0';}
if (document.vForm.EX5.checked){}else{vForm.Total_cost_tour5.value=0;vForm.Number_of_pax5.value='0';}
if (document.vForm.EX6.checked){}else{vForm.Total_cost_tour6.value=0;vForm.Number_of_pax6.value='0';}
if (document.vForm.EX7.checked){}else{vForm.Total_cost_tour7.value=0;vForm.Number_of_pax7.value='0';}
if (document.vForm.EX8.checked){}else{vForm.Total_cost_tour8.value=0;vForm.Number_of_pax8.value='0';}
vForm.Excursion_Program_Total.value=parseInt(vForm.Total_cost_tour8.value) + parseInt(vForm.Total_cost_tour7.value) + parseInt(vForm.Total_cost_tour6.value) + parseInt(vForm.Total_cost_tour5.value) + parseInt(vForm.Total_cost_tour4.value) + parseInt(vForm.Total_cost_tour3.value) + parseInt(vForm.Total_cost_tour2.value) + parseInt(vForm.Total_cost_tour1.value);
vForm.Excursion_total.value=vForm.Excursion_Program_Total.value;
}

function calcDays(){
  var date1 = document.vForm.Arrival_Date.value;
  var date2 = document.vForm.Departure_Date.value;
  date1 = date1.split("-");
  date2 = date2.split("-");
  var sDate = new Date(date1[0]+"/"+date1[1]+"/"+date1[2]);
  var eDate = new Date(date2[0]+"/"+date2[1]+"/"+date2[2]);
  var daysApart = Math.abs(Math.round((sDate-eDate)/86400000));
  return document.vForm.nb_night.value = daysApart;
}


function Checkform(vForm) {
if (vForm.Last_Name.value == ""){alert("Please enter your Last Name"); vForm.Last_Name.focus(); vForm.Last_Name.style.background = "orange"; return false;}
if (vForm.First_Name.value == ""){alert("Please enter your First Name"); vForm.First_Name.focus(); vForm.First_Name.style.background = "orange"; return false;}
if (document.vForm.Title.selectedIndex == 0){alert("Please select your Title"); vForm.Title.focus(); vForm.Title.style.background = "orange"; return false;}
if (vForm.Institution_Company.value == ""){alert("Please enter your Please enter your Institution/Company Name"); vForm.Institution_Company.focus(); vForm.Institution_Company.style.background = "orange"; return false;}
if (vForm.City.value == ""){alert("Please enter your City"); vForm.City.focus(); vForm.City.style.background = "orange"; return false;}
if (document.vForm.Country.selectedIndex == 0){alert("Please select your Country"); vForm.Country.focus(); vForm.Country.style.background = "orange"; return false;}
if (vForm.Email.value == ""){alert("Please enter your Email"); vForm.Email.focus(); vForm.Email.style.background = "orange"; return false;}
if (vForm.Email_Confirm.value == ""){alert("Please enter your Email"); vForm.Email_Confirm.focus(); vForm.Email_Confirm.style.background = "orange"; return false;}
var x = vForm.Email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) {}else {alert('NO! Incorrect email address'); return false;}

if (vForm.Phone.value == ""){alert("Please enter your Phone"); vForm.Phone.focus(); vForm.Phone.style.background = "orange"; return false;}

if (vForm.Arrival_Date.value == ""){alert("Please enter your Arrival Date"); vForm.Arrival_Date.focus(); vForm.Arrival_Date.style.background = "orange"; return false;}
if (vForm.Departure_Date.value == ""){alert("Please enter your Departure Date"); vForm.Departure_Date.focus(); vForm.Departure_Date.style.background = "orange"; return false;}
if (vForm.nb_night.value == ""){alert("Please enter the number of Nights"); vForm.nb_night.focus();  return false;}
var checkOK = "0123456789";
var checkStr = vForm.nb_night.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++){ch = checkStr.charAt(i);for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length){allValid = false;break;}
if (ch != ",")
allNum += ch;
}
if (!allValid){alert("Please enter only Number field.");vForm.nb_night.focus();vForm.nb_night.style.background = "orange";return (false);}


if (vForm.Visa_required[0].checked == true&&vForm.passport_name.value == "")
{alert("Please enter your Passport Last Name"); vForm.passport_name.focus(); vForm.passport_name.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.passport_first_name.value == "")
{alert("Please enter your Passport First Name"); vForm.passport_first_name.focus(); vForm.passport_first_name.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Date_Birth.value == "")
{alert("Please enter your Date of Birth"); vForm.Date_Birth.focus(); vForm.Date_Birth.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Place_Birth.value == "")
{alert("Please enter your Place of Birth"); vForm.Place_Birth.focus(); vForm.Place_Birth.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Nationality.value == "")
{alert("Please enter your Nationality"); vForm.Nationality.focus(); vForm.Nationality.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Passport_number.value == "")
{alert("Please enter your Passport Number"); vForm.Passport_number.focus(); vForm.Passport_number.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Issue_Date.value == "")
{alert("Please enter your Date of Issue"); vForm.Issue_Date.focus(); vForm.Issue_Date.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Expiry_Date.value == "")
{alert("Please enter your Expiry Date"); vForm.Expiry_Date.focus(); vForm.Expiry_Date.style.background = "orange";return false;}
if (vForm.Visa_required[0].checked == true&&vForm.Visa_cost_total.value == "")
{alert("Please enter Select Your Visa Approval Letter"); vForm.Visa_cost_total.focus(); return false;}

if (vForm.Require_Airport_Pickup[0].checked == true&&vForm.Date_of_pickup.value == "")
{alert("Please enter your Pick Up Date"); vForm.Date_of_pickup.focus(); vForm.Date_of_pickup.style.background = "orange";return false;}
if (vForm.Require_Airport_Pickup[0].checked == true&&vForm.Pick_up_time.value == "")
{alert("Please enter your Pick Up Time"); vForm.Pick_up_time.focus(); vForm.Pick_up_time.style.background = "orange";return false;}
if (vForm.Require_Airport_Pickup[0].checked == true&&vForm.Flight_number.value == "")
{alert("Please enter your Flight Number"); vForm.Flight_number.focus(); vForm.Flight_number.style.background = "orange";return false;}
if (vForm.Require_Airport_Pickup[0].checked == true&&vForm.Flight_Arrival_Time.value == "")
{alert("Please enter your Flight Arrival Time"); vForm.Flight_Arrival_Time.focus(); vForm.Flight_Arrival_Time.style.background = "orange";return false;}

if (vForm.Require_hotel_drop[0].checked == true&&vForm.Date_of_dropoff.value == "")
{alert("Please enter your Drop Off Date"); vForm.Date_of_dropoff.focus(); vForm.Date_of_dropoff.style.background = "orange";return false;}
if (vForm.Require_hotel_drop[0].checked == true&&vForm.Pick_up_from2.value == "")
{alert("Please enter your Drop Off From Location"); vForm.Pick_up_from2.focus(); vForm.Pick_up_from2.style.background = "orange";return false;}
if (vForm.Require_hotel_drop[0].checked == true&&vForm.Pick_up_time2.value == "")
{alert("Please enter your Drop Off Time"); vForm.Pick_up_time2.focus(); vForm.Pick_up_time2.style.background = "orange";return false;}
if (vForm.Require_hotel_drop[0].checked == true&&vForm.Flight_Number2.value == "")
{alert("Please enter your Flight Number"); vForm.Flight_Number2.focus(); vForm.Flight_Number2.style.background = "orange";return false;}
if (vForm.Require_hotel_drop[0].checked == true&&vForm.Flight_Departure.value == "")
{alert("Please enter your Flight Departure Time"); vForm.Flight_Departure.focus(); vForm.Flight_Departure.style.background = "orange";return false;}

return true;
}

function Check3(form1) {

if (form1.username.value == ""){alert("Please enter the Preferred username"); form1.username.focus(); form1.username.style.background = "orange"; return false;}
if (form1.firstname.value == ""){alert("Please enter the First name"); form1.firstname.focus(); form1.firstname.style.background = "orange"; return false;}
if (form1.lastname.value == ""){alert("Please enter the Last name"); form1.lastname.focus(); form1.lastname.style.background = "orange"; return false;}
if (form1.company.value == ""){alert("Please enter the Company"); form1.company.focus(); form1.company.style.background = "orange"; return false;}

if (form1.email.value == "")
{
	alert("Please enter the E-mail"); form1.email.focus(); form1.email.style.background = "orange"; return false;
}
else
{
	var x = form1.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) {}else {alert('Incorrect E-mail address'); form1.email.focus(); form1.email.style.background = "orange"; return false;}
}

return true;
}