function toggletrav(number) {
	if (document.frm.adventureName.options[document.frm.adventureName.selectedIndex].value== "") {
		alert("Please select an adventure first");
		document.frm.travnum.options.selectedIndex=0;
		document.frm.adventureName.focus();
	} else {
		for (i=parseInt(number)+1;i<=4;i++) {
			eval("document.getElementById('trav"+i+"').style.display='none'");

			//reset values;
			eval("document.frm.title"+i+".options.selectedIndex=0");
			eval("document.frm.firstName"+i+".value=''");
			eval("document.frm.lastName"+i+".value=''");
			eval("document.frm.dofMonth"+i+".options.selectedIndex=0");
			eval("document.frm.dofDay"+i+".options.selectedIndex=0");
			eval("document.frm.dofYear"+i+".options.selectedIndex=0");
			eval("document.frm.nationality"+i+".value=''");
			eval("document.frm.passportNumber"+i+".value=''");
			eval("document.frm.vegetarian"+i+".options.selectedIndex=0");
		}
		for (i=1;i<=number;i++) {
			eval("document.getElementById('trav"+i+"').style.display=''");
		}
	}
}

function setCO(){
	wantExtra = document.frm.wantExtra1.value;
	if(wantExtra == "Yes"){
		advDate = document.frm.adventureDate.value;
		
		switch(advDate){
			//VegNews Great Adventure to India with VegVoyages		
			case "October 11th - October 22nd, 2010": 
				co = "10-11-2010";
				ci = "10-22-2010";
				break;
			
			//India: Desert Kingdoms of Rajputana		
			case "November 10, 2012 - November 25, 2012": 
				co = "11-10-2012";
				ci = "11-24-2012";
				break;
			
/*			case "November 12, 2011 - November 27, 2011": 
				co = "11-12-2011";
				ci = "11-27-2011";
				break;
*/
			case "March 23, 2013 - April 7, 2013": 
				co = "3-23-2013"; 
				ci = "4-7-2013";
				break;

			case "November 2, 2013 - November 17, 2013": 
				co = "11-2-2013"; 
				ci = "11-17-2013";
				break;
/*
			case "December 22, 2012 - January 5, 2013": 
				co = "12-22-2012"; 
				ci = "1-5-2013";
				break;
*/
			//India: Vegin` Out in the Land of Rajputs	
			case "January 24, 2012 - February 4, 2012": 
				co = "1-24-2012"; 
				ci = "2-4-2012";
				break;
			
			case "March 6, 2012 - March 17, 2012": 
				co = "3-6-2012"; 
				ci = "3-17-2012";
				break;
			
			case "September 18, 2012 - September 29, 2012": 
				co = "9-18-2011"; 
				ci = "9-29-2012";
				break;

			case "December 11, 2012 - December 22, 2012": 
				co = "12-11-2012"; 
				ci = "12-22-2012";
				break;

			case "January 15, 2013 - january 26, 2013": 
				co = "1-15-2013"; 
				ci = "1-26-2013";
				break;

			case "February 26, 2013 - March 9, 2013": 
				co = "2-26-2013"; 
				ci = "3-9-2013";
				break;

			case "September 17, 2013 - September 28, 2013": 
				co = "9-17-2013"; 
				ci = "9-28-2013";
				break;


			case "December 3, 2013 - December 14, 2013": 
				co = "12-3-2013"; 
				ci = "12-14-2013";
				break;



			//India: Badlands, Beasts, Bishnois & Beaches!
			case "March 20, 2012 - April 11, 2012": 
				co = "3-20-2012"; 
				ci = "4-11-2012";
				break;
			
			case "October 16, 2012 – November 7, 2012": 
				co = "10-16-2012"; 
				ci = "11-7-2012";
				break;
			
			case "October 8, 2013 – October 30, 2013": 
				co = "10-8-2013"; 
				ci = "10-30-2013";
				break;

			//India: Camel & Canines and Cows – Oh My!	
			case "August 25, 2012 - September 8, 2012": 
				co = "8-25-2012"; 
				ci = "9-8-2012";
				break;
				
			case "August 24, 2013 - September 7, 2013": 
				co = "8-24-2013"; 
				ci = "9-7-2013";
				break;

			//India: The Green Triangle
			case "February 26, 2012 - March 4, 2012": 
				co = "2-26-2012"; 
				ci = "3-4-2012";
				break;
				
			case "September 30, 2012 - October 7, 2012": 
				co = "9-30-2012"; 
				ci = "10-7-2012";
				break;

			case "December 2, 2012 - December 9, 2012": 
				co = "12-2-2012"; 
				ci = "12-9-2012";
				break;

			case "January 6, 2013 - January 13, 2013": 
				co = "1-6-2013"; 
				ci = "1-13-2013";
				break;

			case "March 10, 2013 - March 17, 2013": 
				co = "3-10-2013"; 
				ci = "3-17-2013";
				break;

			case "September 8, 2013 - September 15, 2013": 
				co = "9-8-2013"; 
				ci = "9-15-2013";
				break;

			case "November 24, 2013 - December 1, 2013": 
				co = "11-24-2013"; 
				ci = "12-1-2013";
				break;
			
			case "December 15, 2013 - December 22, 2013": 
				co = "12-15-2013"; 
				ci = "12-22-2013";
				break;

			//Malaysia: Rainforests, Reefs, Cultures & Cuisines!
			case "July 7, 2012 - July 22, 2012": 
				co = "7-7-2012"; 
				ci = "7-22-2012";
				break;
			
			case "June 22, 2013 - July 7, 2013": 
				co = "6-22-2013"; 
				ci = "7-7-2013";
				break;
			
		
			//Laos: Mekong Moments
			case "June 16, 2012 - July 2, 2012":
				co = "6-16-2012"; 
				ci = "7-2-2012";
				break;

			case "November 3, 2012 - November 19, 2012":
				co = "11-3-2012"; 
				ci = "11-19-2012";
				break;

			case "July 13, 2013 - July 29, 2013":
				co = "7-13-2013"; 
				ci = "7-22-2013";
				break;

			//blank
			case "": 
				co = ""; 
				ci = "";
				break;
		}
		document.frm.preTo1.value = co ;
		document.frm.postFrom1.value = ci ;
	}
}

function resetCO(){
	document.frm.preTo1.value = "" ;
	document.frm.preFrom1.value = "" ;
	document.frm.postFrom1.value = "" ;
	document.frm.postTo1.value = "" ;
}

function togglextra(num,sekarang) {
	switch (sekarang) {
		case "Yes":
			eval("document.getElementById('supl"+num+"').style.display=''");
			document.frm.preFrom1.value="";
			document.frm.postTo1.value="";
			break;
		case "No":
			eval("document.getElementById('supl"+num+"').style.display='none'");
			document.frm.preTo1.value="";
			document.frm.postFrom1.value="";			
			break;
		default:
			//reset values;
			eval("document.frm.preNights"+num+".options.selectedIndex=0");
			eval("document.frm.preFrom"+num+".value=''");
			eval("document.frm.postNights"+num+".options.selectedIndex=0");
			eval("document.frm.postFrom"+num+".value=''");
			eval("document.frm.postTo"+num+".value=''");
			
			eval("document.getElementById('supl"+num+"').style.display='none'");
			break;
	}
}

function toggleothers(sekarang) {
	switch (sekarang) {
		case "Vegetarian Societies":
		case "Others":
			document.getElementById('hearothers').style.display='';
			break;
		default:
			//reset values;
			document.frm.otherveg.value="";
			
			document.getElementById('hearothers').style.display='none';
			break;
	}

}

function frm_onsubmit(j) {

	if (document.frm.adventureName.value=="") {
		alert("Please choose Adventure Name");
		document.frm.adventureName.focus();
		return false;
	}
	
	if (document.frm.adventureDate.value=="") {
		alert("Please choose Adventure Date");
		document.frm.adventureDate.focus();
		return false;
	}
	
		wantExtra = document.frm["wantExtra1"];
		preNights = document.frm["preNights1"];
		preFrom = document.frm["preFrom1"];
		postNights = document.frm["postNights1"];
		postFrom = document.frm["postFrom1"];
		postTo = document.frm["postTo1"];

		if (wantExtra.value=="") {    
			alert("Please tell us if you want some extra nights or not");
			wantExtra.focus();
			return false;
		}

		if (wantExtra.value=="Yes") {    
			if (preNights.value=="0" && postNights.value=="0") {
				alert("If you require any extra hotel nights, please enter the number of extra nights required.");
				preNights.focus();
				return false;
			}
		}

		singlesup = document.frm["singlesup1"];
		if (singlesup.value=="") {    
			alert("Please tell us if you want a single supplement or not");
			singlesup.focus();
			return false;
		}
		
	//j = parseInt(j) + 1 ;	
	//for(i=1;i<j;i++) {
		fName=document.frm["firstName1"];
		if (fName.value == "") {
			alert("Please enter Full Name of Contact");
			fName.focus();
			return false;
		}
		
		address=document.frm["address1"];
		if (address.value=="") {
			alert("Please enter Address of Contact");
			address.focus();
			return false;
		}
		
		city=document.frm["city1"];
		if (city.value=="") {
			alert("Please enter City of Contact");
			city.focus();
			return false;
		}
		
		state=document.frm["state1"];
		if (state.value=="") {
			alert("Please enter State of Contact");
			state.focus();
			return false;
		}
		
		post=document.frm["post1"];
		if (post.value=="") {
			alert("Please enter Post/Zip Code of Contact");
			post.focus();
			return false;
		}
		
		country=document.frm["country1"];
		if (country.options[country.selectedIndex].value=="") {
			alert("Please enter Country of Contact");
			country.focus();
			return false;
		}
		
		telcountry=document.frm["telcountry1"];
		if (telcountry.value=="") {
			alert("Please enter Telephone Country Code of Contact");
			telcountry.focus();
			return false;
		} else {
			if (isNaN(parseInt(telcountry.value))) {
				alert("Please enter a valid Telephone Country Code of Contact");
				telcountry.focus();
				return false;
			}
		}

		telarea=document.frm["telarea1"];
		if (telarea.value=="") {
			alert("Please enter Telephone Area Code of Contact");
			telarea.focus();
			return false;
		} else {
			if (isNaN(parseInt(telarea.value))) {
				alert("Please enter a valid Telephone Area Code of Contact");
				telarea.focus();
				return false;
			}
		}

		telephone=document.frm["telephone1"];
		if (telephone.value=="") {
			alert("Please enter Telephone Number of Contact");
			telephone.focus();
			return false;
		} else {
			if (isNaN(parseInt(telephone.value))) {
				alert("Please enter valid Telephone of Contact");telephone.focus();
				return false;
			}
		}
		
		email=document.frm["email1"];
		if (email.value=="") {
			alert("Please enter Email of Contact");
			email.focus();
			return false;
		} else {
			if (email.value.indexOf(".") <= 2 || email.value.indexOf("@") <= 0) {
				alert("Please enter a valid Email of Contact");email.focus();
				return false;
			}
		}
		
		dMonth=document.frm["dofMonth1"];
		if (dMonth.options[dMonth.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Month of Contact");
			dMonth.focus();
			return false;
		}

		dDay=document.frm["dofDay1"];
		if ( dDay.options[dDay.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Day of Contact");
			dDay.focus();
			return false;
		}

		dYear=document.frm["dofYear1"];
		if (dYear.options[dYear.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Year of Contact");
			dYear.focus();
			return false;
		}

		if (!cektanggal(dMonth.options[dMonth.selectedIndex].value+"/"+dDay.options[dDay.selectedIndex].value+"/"+dYear.options[dYear.selectedIndex].value)) {
			alert("Please enter a valid Date Of Birth of Contact");
			dDay.focus();
			return false;
		}

		nation=document.frm["nationality1"];
		if (nation.value=="") {
			alert("Please enter Nationality of Contact");
			nation.focus();
			return false;
		}

		passport=document.frm["passportNumber1"];
		if (passport.value=="") {
			alert("Please enter Passport Number of Contact");
			passport.focus();
			return false;
		}

		veg=document.frm["vegetarian1"];
		if (veg.options[veg.selectedIndex].value=="") {
			alert("Please enter Type Of Vegetarian of Contact");
			veg.focus();
			return false;
		}
		
	//}
	
	//cek Additional Travelers
	travnum = document.frm["travnum"];
	if(travnum.value >= "2"){
		fName2=document.frm["firstName2"];
		if (fName2.value == "") {
			alert("Please enter Full Name of Additional Traveler #2");
			fName2.focus();
			return false;
		}
		
		dMonth2=document.frm["dofMonth2"];
		if (dMonth2.options[dMonth2.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Month of Additional Traveler #2");
			dMonth2.focus();
			return false;
		}

		dDay2=document.frm["dofDay2"];
		if (dDay2.options[dDay2.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Day of Additional Traveler #2");
			dDay2.focus();
			return false;
		}

		dYear2=document.frm["dofYear2"];
		if (dYear2.options[dYear2.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Year of Additional Traveler #2");
			dYear2.focus();
			return false;
		}

		if (!cektanggal(dMonth2.options[dMonth2.selectedIndex].value+"/"+dDay2.options[dDay2.selectedIndex].value+"/"+dYear2.options[dYear2.selectedIndex].value)) {
			alert("Please enter a valid Date Of Birth of Additional Traveler #2");
			dDay2.focus();
			return false;
		}
		
		nation2=document.frm["nationality2"];
		if (nation2.value=="") {
			alert("Please enter Nationality of Additional Traveler #2");
			nation2.focus();
			return false;
		}

		passport2=document.frm["passportNumber2"];
		if (passport2.value=="") {
			alert("Please enter Passport Number of Additional Traveler #2");
			passport2.focus();
			return false;
		}

		veg2=document.frm["vegetarian2"];
		if (veg2.options[veg2.selectedIndex].value=="") {
			alert("Please enter Type Of Vegetarian of Additional Traveler #2");
			veg2.focus();
			return false;
		}
	}
	
	if(travnum.value >= "3"){
		fName3=document.frm["firstName3"];
		if (fName3.value == "") {
			alert("Please enter Full Name of Additional Traveler #3");
			fName3.focus();
			return false;
		}
		dMonth3=document.frm["dofMonth3"];
		if (dMonth3.options[dMonth3.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Month of Additional Traveler #3");
			dMonth3.focus();
			return false;
		}

		dDay3=document.frm["dofDay3"];
		if (dDay3.options[dDay3.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Day of Additional Traveler #3");
			dDay3.focus();
			return false;
		}

		dYear3=document.frm["dofYear3"];
		if (dYear3.options[dYear3.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Year of Additional Traveler #3");
			dYear3.focus();
			return false;
		}

		if (!cektanggal(dMonth3.options[dMonth3.selectedIndex].value+"/"+dDay3.options[dDay3.selectedIndex].value+"/"+dYear3.options[dYear3.selectedIndex].value)) {
			alert("Please enter a valid Date Of Birth of Additional Traveler #3");
			dDay3.focus();
			return false;
		}

		nation3=document.frm["nationality3"];
		if (nation3.value=="") {
			alert("Please enter Nationality of Additional Traveler #3");
			nation3.focus();
			return false;
		}

		passport3=document.frm["passportNumber3"];
		if (passport3.value=="") {
			alert("Please enter Passport Number of Additional Traveler #3");
			passport3.focus();
			return false;
		}

		veg3=document.frm["vegetarian3"];
		if (veg3.options[veg3.selectedIndex].value=="") {
			alert("Please enter Type Of Vegetarian of Additional Traveler #3");
			veg3.focus();
			return false;
		}
	}
	
	if(travnum.value >= "4"){
		fName4=document.frm["firstName4"];
		if (fName4.value == "") {
			alert("Please enter Full Name of Additional Traveler #4");
			fName4.focus();
			return false;
		}
		dMonth4=document.frm["dofMonth4"];
		if (dMonth4.options[dMonth4.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Month of Additional Traveler #4");
			dMonth4.focus();
			return false;
		}

		dDay4=document.frm["dofDay4"];
		if (dDay4.options[dDay4.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Day of Additional Traveler #4");
			dDay4.focus();
			return false;
		}

		dYear4=document.frm["dofYear4"];
		if (dYear4.options[dYear4.selectedIndex].value==0) {
			alert("Please enter Date Of Birth Year of Additional Traveler #4");
			dYear4.focus();
			return false;
		}

		if (!cektanggal(dMonth4.options[dMonth4.selectedIndex].value+"/"+dDay4.options[dDay4.selectedIndex].value+"/"+dYear4.options[dYear4.selectedIndex].value)) {
			alert("Please enter a valid Date Of Birth of Additional Traveler #4");
			dDay4.focus();
			return false;
		}

		nation4=document.frm["nationality4"];
		if (nation4.value=="") {
			alert("Please enter Nationality of Additional Traveler #4");
			nation4.focus();
			return false;
		}

		passport4=document.frm["passportNumber4"];
		if (passport4.value=="") {
			alert("Please enter Passport Number of Additional Traveler #4");
			passport4.focus();
			return false;
		}

		veg4=document.frm["vegetarian4"];
		if (veg4.options[veg4.selectedIndex].value=="") {
			alert("Please enter Type Of Vegetarian of Additional Traveler #4");
			veg4.focus();
			return false;
		}
	}

		
		contactName=document.frm["contactName1"];
		if (contactName.value=="") {
			alert("Please enter the Emergency Contact Name");
			contactName.focus();
			return false;
		}

		contactPhonecountry=document.frm["contactPhonecountry1"];
		if (contactPhonecountry.value=="") {
			alert("Please enter the Emergency Contact Phone Country Code");
			contactPhonecountry.focus();
			return false;
		} else {
			if (isNaN(parseInt(contactPhonecountry.value))) {
				alert("Please enter a valid the Emergency Contact Phone Country Code");
				contactPhonecountry.focus();
				return false;
			}
		}

		contactPhonearea=document.frm["contactPhonearea1"];
		if (contactPhonearea.value=="") {
			alert("Please enter the Emergency Contact Phone Area Code");
			contactPhonearea.focus();
			return false;
		} else {
			if (isNaN(parseInt(contactPhonearea.value))) {
				alert("Please enter a valid the Emergency Contact Phone Area Code");
				contactPhonearea.focus();
				return false;
			}
		}

		contactPhone=document.frm["contactPhone1"];
		if (contactPhone.value=="") {
			alert("Please enter the Emergency Contact Phone Number");
			contactPhone.focus();
			return false;
		} else {
			if (isNaN(parseInt(contactPhone.value))) {
				alert("Please enter a valid the Emergency Contact Phone Number");
				contactPhone.focus();
				return false;
			}
		}
//dulu ikut blok for next atas karena ikut 1 dan 2, sekarang 1 saja
//	for(i=1;i<j;i++) {
		i=1;
/*
		housenumber=document.frm["housenumber"+i];
		if (housenumber.value=="") {
			alert("Please enter the house name or number");
			housenumber.focus();
			return false;
		}

		street=document.frm["street"+i];
		if (street.value=="") {
			alert("Please enter the street");
			street.focus();
			return false;
		}

		

		post=document.frm["post"+i];
		if (post.value=="") {
			alert("Please enter the post/zip code");
			post.focus();
			return false;
		}
*/
		
//	}

	if (document.frm.havetraveled.value=="") {    
		alert("Please tell us if you have or have not traveled with us before.");
		document.frm.havetraveled.focus();
		return false;
	}

	if (document.frm.vegVoyages.value=="") {    
		alert("We really appreciate if you can tell how you know us.");
		document.frm.vegVoyages.focus();
		return false;
	}

	if (document.frm.vegVoyages.value=="Others" && document.frm.otherveg.value=="") {
		alert("Please specify where you know us.");
		document.frm.otherveg.focus();
		return false;
	}

	if (document.frm.vegVoyages.value=="Vegetarian Societies" && document.frm.otherveg.value=="") {
		alert("Please specify from what vegetarian societies you know us.");
		document.frm.otherveg.focus();
		return false;
	}

	if (! document.frm.agree.checked) {
		 alert("Please check the box verifying you accept the Booking Conditions.");
		 document.frm.agree.focus();
		 return false;
	}

	return true;
}


function hitung() {	
	//Pricelist
	switch (document.frm.adventureName.options[document.frm.adventureName.selectedIndex].value) {
		case "":
			hargadasar="0";
			hargaextra="0";
			hargasup="0";
			break;
		case "VegNews Great Adventure to India with VegVoyages":
			hargadasar="1295";
			hargaextra="68";
			hargasup="325";
			break;
		case "India: Desert Kingdoms of Rajputana":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				default:
					// hargadasar="1595";
					hargadasar="1895";
					break;
			}
			hargaextra="68";
			hargasup="450";
			break;
		case "India: Vegin` Out in the Land of Rajputs":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				default:
					hargadasar="1495";
					break;
			}
			hargaextra="68";
			hargasup="335";
			break;
		case "India: Badlands, Beasts, Bishnois & Beaches!":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				default:
					// hargadasar="2250";
					hargadasar="2395";
					break;
			}
			hargaextra="68";
			hargasup="630";
			break;
		case "India: Camel & Canines and Cows - Oh My!":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				default:
					hargadasar="1795";
					break;
			}
			hargaextra="68";
			hargasup="395";
			break;
		case "India: The Green Triangle":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				default:
					// hargadasar="990";
					hargadasar="995";
					break;
			}
			hargaextra="68";
			hargasup="195";
			break;
		case "Malaysia: Rainforests, Reefs, Cultures & Cuisines!":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
			/*
				case 'July 3, 2011 - July 17, 2011':
					hargadasar="1575";
					hargasup="420";
					break;
				case 'July 3, 2011 - July 19, 2011':
					hargadasar="1795";
					hargasup="480";
					break;
				case 'July 3, 2011 - July 22, 2011':
					break;
			
				case 'July 7, 2012 - July 22, 2012':
					hargadasar="1895";
					hargasup="480";
					break;
			*/
				default:
					hargadasar="1895";
					hargasup="480";
					break;
			}
			hargaextra="65";
			break;
		case "Laos: Mekong Moments":
			switch (document.frm.adventureDate.options[document.frm.adventureDate.selectedIndex].value) {
				/*2011
				case 'June 11, 2011 - June 23, 2011':
					hargadasar="1430";
					hargasup="330";
					break;
				case 'June 11, 2011 - June 26, 2011':
					hargadasar="1725";
					hargasup="405";
					break;
				case 'June 11, 2011 - July 1, 2011':
					hargadasar="1995";
					hargasup="535";
					break;
				*/
				/* 2012 */
				//case 'June 16, 2012 - July 2, 2012':
					// hargadasar="1895";
					// hargadasar="1895";
					// hargasup="455";
					// break;
				/*case 'November 3, 2012 - November 19, 2012':
					hargadasar="1995";
					hargasup="455";
					break;*/
				// case 'June 23, 2012 - July 13, 2012':
					// hargadasar="2295";
					// hargasup="535";
					// break;
				default:
					hargadasar="1995";
					hargasup="455";
					break;
			}
			hargaextra="65";
			break;
	}
	jmlpeserta = parseInt(document.frm.travnum.value);
	totalhargadasar = hargadasar*jmlpeserta;

//	jmlmalam = parseInt(document.frm.preNights1.value) + parseInt(document.frm.postNights1.value) + parseInt(document.frm.preNights2.value) + parseInt(document.frm.postNights2.value);
	//var date1 = document.getElementById('preFrom1').lastChild.data;
	//var date2 = document.getElementById('preTo1').lastChild.data;
	
	//pretrip	
	var preFrom = document.frm["preFrom1"].value;
	var preTo = document.frm["preTo1"].value;
	preFrom = preFrom.split("-");
	preTo = preTo.split("-");
	  
	var preFrom = new Date(preFrom[0]+"/"+preFrom[1]+"/"+preFrom[2]);
	var preTo = new Date(preTo[0]+"/"+preTo[1]+"/"+preTo[2]);
	var delayPre = (preTo-preFrom)/86400000;
	
	if(document.frm["preFrom1"].value == "" || document.frm["preTo1"].value == ""){delayPre = "0";}
	if(delayPre < 0){delayPre="0";}
		
	//posttrip
	var postFrom = document.frm["postFrom1"].value;
	var postTo = document.frm["postTo1"].value;
	postFrom = postFrom.split("-");
	postTo = postTo.split("-");
	  
	var postFrom = new Date(postFrom[0]+"/"+postFrom[1]+"/"+postFrom[2]);
	var postTo = new Date(postTo[0]+"/"+postTo[1]+"/"+postTo[2]);
	var delayPost = (postTo-postFrom)/86400000;
	
	if(document.frm["postFrom1"].value == "" || document.frm["postTo1"].value == ""){delayPost = "0";}
	if(delayPost < 0){delayPost="0";}	
	
	var totalDelay = parseInt(delayPre) + parseInt(delayPost);
	
	//document.frm.jml.value= totalDelay;

	jmlmalam = totalDelay ;
	
	wantextra = document.frm.wantExtra1.value;
	if(wantextra == "" || wantextra == "No"){ jmlmalam = "0"; }
	
	//jmlmalam = parseInt(document.frm.preNights1.value) + parseInt(document.frm.postNights1.value);
	//alert("jmlmalam: " +jmlmalam);
	totalsupl = 0;
	if (document.frm.singlesup1.value=="Yes") {
		totalsupl = totalsupl +	parseInt(hargasup);
	}
/*
	if (document.frm.singlesup2.value=="Yes") {
		totalsupl = totalsupl +	parseInt(hargasup);
	}
*/
	totalekstra = jmlmalam * hargaextra;

	document.frm.travelers.value = jmlpeserta;
	document.frm.tourPrice.value = totalhargadasar;
	document.frm.totalExtra.value = totalekstra;
	document.frm.totalSingleSuplement.value = totalsupl;
	document.frm.total.value = parseInt(totalhargadasar)+parseInt(totalekstra)+parseInt(totalsupl);

	setTimeout('hitung()', 0);
}

function setOptions(chosen) {
	var selbox = document.frm.adventureDate;
	selbox.options.length = 0;
	switch (chosen) {
		case "":
			selbox.options[selbox.options.length] = new Option('Please select an adventure first...','');
			break;
		case "VegNews Great Adventure to India with VegVoyages":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			//selbox.options[selbox.options.length] = new Option('','');	
			selbox.options[selbox.options.length] = new Option('October 11th - October 22nd, 2010','October 11th - October 22nd, 2010');
			break;
		case "India: Desert Kingdoms of Rajputana":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			//selbox.options[selbox.options.length] = new Option('','');	
			selbox.options[selbox.options.length] = new Option('November 10, 2012 - November 25, 2012','November 10, 2012 - November 25, 2012');
			selbox.options[selbox.options.length] = new Option('March 23, 2013 - April 7, 2013','March 23, 2013 - April 7, 2013');
			selbox.options[selbox.options.length] = new Option('November 2, 2013 - November 17, 2013','November 2, 2013 - November 17, 2013');
			break;
			
		case "India: Vegin` Out in the Land of Rajputs":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			//selbox.options[selbox.options.length] = new Option('','');
			selbox.options[selbox.options.length] = new Option('January 24, 2012 - February 4, 2012','January 24, 2012 - February 4, 2012');
			selbox.options[selbox.options.length] = new Option('March 6, 2012 - March 17, 2012','March 6, 2012 - March 17, 2012');
			selbox.options[selbox.options.length] = new Option('September 18, 2012 - September 29, 2012','September 18, 2012 - 29 September, 2012');
			selbox.options[selbox.options.length] = new Option('December 11, 2012 - December 22, 2012','December 11, 2012 - December 22, 2012');
			selbox.options[selbox.options.length] = new Option('January 15, 2013 - January 26, 2013','January 15, 2013 - January 26, 2013');
			selbox.options[selbox.options.length] = new Option('February 26, 2013 - March 9, 2013','February 26, 2013 - March 9, 2013');
			selbox.options[selbox.options.length] = new Option('September 17, 2013 - September 28, 2013','September 17, 2013 - September 28, 2013');
			selbox.options[selbox.options.length] = new Option('December 3, 2013 - December 14, 2013','December 3, 2013 - December 14, 2013');
			break;
			
		case "India: Camel & Canines and Cows - Oh My!":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			selbox.options[selbox.options.length] = new Option('August 25, 2012 - September 8, 2012','August 25, 2012 - September 8, 2012');
			selbox.options[selbox.options.length] = new Option('August 24, 2013 - September 7, 2013','August 24, 2013 - September 7, 2013');
			break;
			
		case "India: Badlands, Beasts, Bishnois & Beaches!":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			selbox.options[selbox.options.length] = new Option('March 20, 2012 - April 11, 2012','March 20, 2012 - April 11, 2012');
			selbox.options[selbox.options.length] = new Option('October 16, 2012 - November 7, 2012','October 16, 2012 - November 7, 2012');
			selbox.options[selbox.options.length] = new Option('October 8, 2013 - October 30, 2013','October 8, 2013 - October 30, 2013');
			break;			
			
		case "India: The Green Triangle":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			selbox.options[selbox.options.length] = new Option('February 26, 2012 - March 4, 2012','February 26, 2012 - March 4, 2012');
			selbox.options[selbox.options.length] = new Option('September 30,2012 - October 7, 2012','September 30,2012 - October 7, 2012');
			selbox.options[selbox.options.length] = new Option('December 2, 2012 - December 9, 2012','December 2, 2012 - December 9, 2012');
			selbox.options[selbox.options.length] = new Option('January 6, 2013 - January 13, 2013','January 6, 2013 - January 13, 2013');
			selbox.options[selbox.options.length] = new Option('March 10, 2013 - March 17, 2013','March 10, 2013 - March 17, 2013');
			selbox.options[selbox.options.length] = new Option('September 8, 2013 - September 15, 2013','September 8, 2013 - September 15, 2013');
			selbox.options[selbox.options.length] = new Option('November 24, 2013 - December 1, 2013','November 24, 2013 - December 22, 2013');
			selbox.options[selbox.options.length] = new Option('December 15, 2013 - December 22, 2013','December 15, 2013 - December 22, 2013');
			break;
			
		case "Malaysia: Rainforests, Reefs, Cultures & Cuisines!":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}
			/*
			selbox.options[selbox.options.length] = new Option('July 3, 2011 - July 22, 2011','July 3, 2011 - July 22, 2011');
			selbox.options[selbox.options.length] = new Option('July 3, 2011 - July 19, 2011','July 3, 2011 - July 19, 2011');*/
			selbox.options[selbox.options.length] = new Option('July 7, 2012 - July 22, 2012','July 7, 2012 - July 22, 2012');
			selbox.options[selbox.options.length] = new Option('July 22, 2013 - July 7, 2013','July 22, 2013 - July 7, 2013');
			break;
			
		case "Laos: Mekong Moments":
			var setDate = document.frm.dateSet.value;		
			if(setDate == ""){selbox.options[selbox.options.length] = new Option('-Select-','');}
			else{
				selbox.options[selbox.options.length] = new Option(setDate,setDate);
				document.frm.dateSet.value = "";
			}/*
			selbox.options[selbox.options.length] = new Option('June 11, 2011 - July 1, 2011','June 11, 2011 - July 1, 2011');
			selbox.options[selbox.options.length] = new Option('June 11, 2011 - June 26, 2011','June 11, 2011 - June 26, 2011');
			selbox.options[selbox.options.length] = new Option('June 11, 2011 - June 23, 2011','June 11, 2011 - June 23, 2011');
			selbox.options[selbox.options.length] = new Option('June 23, 2012 - July 5, 2012','June 23, 2012 - July 5, 2012');
			selbox.options[selbox.options.length] = new Option('June 23, 2012 - July 8, 2012','June 23, 2012 - July 8, 2012');*/
			selbox.options[selbox.options.length] = new Option('June 16, 2012 - July 2, 2012','June 16, 2012 - July 2, 2012');
			selbox.options[selbox.options.length] = new Option('November 3, 2012 - November 19, 2012','November 3, 2012 - November 19, 2012');
			selbox.options[selbox.options.length] = new Option('July 13, 2013 - July 29, 2013','July 13, 2013 - July 29, 2013');
			break;
			
	}
}

function cektanggal(dtStr) {
	var daysInMonth = new Array(0,31,29,31,30,31,30,31,31,30,31,30,31);
	var pos1=dtStr.indexOf('/');
	var pos2=dtStr.indexOf('/',pos1+1);
	var strMonth=dtStr.substring(0,pos1);
	var strDay=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);
	var maxfeb = (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>maxfeb) || day > daysInMonth[month]) {
		return false;
	}
	return true;
}

function insmtr() {
	smtr00 = document.frm.travelers.value;
	smtr01 = document.frm.tourPrice.value;
	smtr02 = document.frm.totalExtra.value;
	smtr03 = document.frm.totalSingleSuplement.value;
	smtr04 = document.frm.total.value;

	smtr05 = document.frm.preFrom1.value;
	smtr06 = document.frm.postFrom1.value;
	smtr07 = document.frm.postTo1.value;
}

function outsmtr() {
	document.frm.travelers.value = smtr00;
	document.frm.tourPrice.value = smtr01;
	document.frm.totalExtra.value = smtr02;
	document.frm.totalSingleSuplement.value = smtr03;
	document.frm.total.value = smtr04;

	document.frm.preFrom1.value = smtr05;
	document.frm.postFrom1.value = smtr06;
	document.frm.postTo1.value = smtr07;
}

function openpopup(popurl){
	winpops=window.open(popurl,"","width=640,height=480,scrollbars=yes,status=no")
}



function trim(teks) {
	teks=teks.replace(/^(\s)+/,'');
	teks=teks.replace(/(\s)+$/,'');
	return teks;
}

		
function add_onsubmit(j) {	
	
	if (document.frm.havetraveled.value=="") {    
		alert("Please tell us if you have or have not traveled with us before.");
		document.frm.havetraveled.focus();
		return false;
	}

	if (document.frm.vegVoyages.value=="") {    
		alert("We really appreciate if you can tell how you know us.");
		document.frm.vegVoyages.focus();
		return false;
	}
	
	if (document.frm.vegVoyages.value=="Others" && document.frm.otherveg.value=="") {
		alert("Please specify where you know us.");
		document.frm.otherveg.focus();
		return false;
	}

	if (document.frm.vegVoyages.value=="Vegetarian Societies" && document.frm.otherveg.value=="") {
		alert("Please specify from what vegetarian societies you know us.");
		document.frm.otherveg.focus();
		return false;
	}
	/* COMENT NOT REQUIRE
	if (document.frm.comments.value=="") {
		alert("Please give me a comments.");
		document.frm.comments.focus();
		return false;
	}
	*/
	if (!document.frm.agree.checked) {
		 alert("Please check the box verifying you accept the Booking Conditions.");
		 document.frm.agree.focus();
		 return false;
	}
}


function valUmbal() {
	if (trim(document.frmUmbal.txtNama.value) == '') {
		window.alert("Please fill in your name. Thank you!");
		document.frmUmbal.txtNama.focus();
		return false;
	}
	if (trim(document.frmUmbal.txtTelepon.value) == '') {
		window.alert("Please fill in your telephone number. Thank you!");
		document.frmUmbal.txtTelepon.focus();
		return false;
	}
	if (trim(document.frmUmbal.txtEmail.value) == '') {
		window.alert("Please fill in your e-mail address. Thank you!");
		document.frmUmbal.txtEmail.focus();
		return false;
	}
	if (document.frmUmbal.txtEmail.value.match((/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/)) || !(document.frmUmbal.txtEmail.value.match(/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/))) {
		window.alert("You enter an invalid e-mail address. Please fix it up. Thank you!");
		document.frmUmbal.txtEmail.focus();
		return false;
	}
	if (trim(document.frmUmbal.txtKomentar.value) == '') {
		window.alert("Please fill in your comments. Thank you!");
		document.frmUmbal.txtKomentar.focus();
		return false;
	}
}

function valUmbalbrosur() {
	if (trim(document.frmUmbalb.firstName.value) == '') {
		window.alert("Please fill in your First Name. Thank you!");
		document.frmUmbalb.firstName.focus();
		return false;
	}
	if (trim(document.frmUmbalb.lastName.value) == '') {
		window.alert("Please fill in your Last Name. Thank you!");
		document.frmUmbalb.lastName.focus();
		return false;
	}
	if (trim(document.frmUmbalb.post.value) == '') {
		window.alert("Please fill in your Zip/Postal Code. Thank you!");
		document.frmUmbalb.post.focus();
		return false;
	}
	if (trim(document.frmUmbalb.email.value) == '') {
		window.alert("Please fill in your e-mail address. Thank you!");
		document.frmUmbalb.email.focus();
		return false;
	}
	if (document.frmUmbalb.email.value.match((/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/)) || !(document.frmUmbalb.email.value.match(/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/))) {
		window.alert("You enter an invalid e-mail address. Please fix it up. Thank you!");
		document.frmUmbalb.email.focus();
		return false;
	}
}

