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 "March 13th - March 28th, 2010": 
				co = "3-13-2010";
				ci = "3-28-2010";
				break;
			
			case "July 24th - August 8th, 2010": 
				co = "7-24-2010";
				ci = "7-8-2010";
				break;
				
			case "September 11th - September 26th, 2010": 
				co = "9-11-2010";
				ci = "9-26-2010";
				break;
			
			case "November 6th - November 21st, 2010": 
				co = "11-6-2010";
				ci = "11-21-2010";
				break;
				
			case "January 29th - February 13th, 2011": 
				co = "1-29-2011";
				ci = "2-13-2011";
				break;
			
			case "September 10th - September 25th, 2011": 
				co = "9-10-2011";
				ci = "9-25-2011";
				break;
			
			case "November 5th - November 20th, 2011": 
				co = "11-5-2011";
				ci = "11-20-2011";
				break;

			//India: Vegin` Out in the Land of Rajputs	
			case "May 18th - May 29th, 2010": 
				co = "5-18-2010"; 
				ci = "5-29-2010";
				break;
			
			case "August 24th - September 4th, 2010": 
				co = "8-24-2010"; 
				ci = "9-4-2010";
				break;
			
			case "September 28th - October 9th, 2010": 
				co = "9-28-2010"; 
				ci = "10-9-2010";
				break;
			
			case "December 22nd, 2010 - January 2nd, 2011": 
				co = "12-22-2010"; 
				ci = "1-2-2011";
				break;

			case "January 11th - January 22nd, 2011": 
				co = "1-11-2011"; 
				ci = "1-22-2011";
				break;			
			
			case "March 15th - March 26th, 2011": 
				co = "3-15-2011"; 
				ci = "3-26-2011";
				break;		
			
			case "September 27th - October 8th, 2011": 
				co = "9-27-2011"; 
				ci = "10-8-2011";
				break;
			
			//India: Buddhas, Beasts, Badlands & Beaches!	
			case "February 16th - March 10th, 2010": 
				co = "2-16-2010"; 
				ci = "3-10-2010";
				break;
				
			case "April 20th - May 12th, 2010":
				co = "4-20-2010";
				ci = "5-12-2010";
				break;
				
			case "October 12th - November 3rd, 2010": 
				co = "10-12-2010"; 
				ci = "11-3-2010";
				break;
			
			case "October 11th - November 2nd, 2011": 
				co = "10-11-2011"; 
				ci = "11-2-2011";
				break;
			
			//India: The Green Triangle
			case "June 13th - June 20th, 2010 ": 
				co = "6-13-2010"; 
				ci = "6-20-2010";
				break;
				
			case "August 15th - August 22nd, 2010": 
				co = "8-15-2010"; 
				ci = "8-22-2010";
				break;
				
			case "December 12th - December 19th, 2010": 
				co = "12-12-2010"; 
				ci = "12-19-2010";
				break;

			case "March 6th - March 13th, 2011": 
				co = "3-6-2011"; 
				ci = "3-13-2011";
				break;
				
			case "December 11th - December 18th, 2011": 
				co = "12-11-2011"; 
				ci = "12-18-2011";
				break;
				
			//India: Camel & Canines and Cows – Oh My!	
			case "April 3rd - April 17th, 2010": 
				co = "4-3-2010"; 
				ci = "4-17-2010";
				break;

			case "July 3th - July 17th, 2010": 
				co = "7-3-2010"; 
				ci = "7-17-2010";
				break;		

			case "November 27th - December 11th, 2010": 
				co = "11-27-2011"; 
				ci = "12-11-2011";
				break;

			case "February 19th - March 5th, 2011": 
				co = "2-19-2011"; 
				ci = "3-5-2011";
				break;

			case "November 26th - December 10th, 2011": 
				co = "11-26-2011"; 
				ci = "12-10-2011";
				break;

			//India: The Green Triangle
			case "June 13th - June 20th, 2010 ": 
				co = "6-13-2010"; 
				ci = "6-20-2010";
				break;
				
			case "August 15th - August 22nd, 2010": 
				co = "8-15-2010"; 
				ci = "8-22-2010";
				break;
				
			case "December 12th - December 19th, 2010": 
				co = "8-15-2010"; 
				ci = "8-22-2010";
				break;

			case "March 6th - March 13th, 2011": 
				co = "3-6-2011"; 
				ci = "3-13-2011";
				break;
				
			case "May 15th - May 22nd, 2011": 
				co = "5-15-2011"; 
				ci = "5-22-2011";
				break;

			case "August 14th - August 21st, 2011": 
				co = "8-14-2011"; 
				ci = "8-21-2011";
				break;
				
			case "December 11th - December 18th, 2011": 
				co = "12-11-2011"; 
				ci = "12-18-2011";
				break;

			
			//Malaysia: Rainforests, Reefs, Cultures & Cuisines!
			case "July 2nd - July 22nd, 2011": 
				co = "7-2-2011"; 
				ci = "7-22-2011";
				break;
			
			//Laos: Mekong Moments
			case "June 11th - July 1st, 2011":
				co = "6-11-2011"; 
				ci = "7-1-2011";
				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":
			hargadasar="1595";
			hargaextra="68";
			hargasup="450";
			break;
		case "India: Vegin` Out in the Land of Rajputs":
			hargadasar="1275";
			hargaextra="68";
			hargasup="335";
			break;
		case "India: Badlands, Beasts, Bishnois & Beaches!":
			hargadasar="2150";
			hargaextra="68";
			hargasup="630";
			break;
		case "India: Camel & Canines and Cows - Oh My!":
			hargadasar="1495";
			hargaextra="68";
			hargasup="395";
			break;
		/*case "India: Voluntourism Adventure":
			hargadasar="1495";
			hargaextra="68";
			hargasup="395";
			break;*/
		case "India: The Green Triangle":
			hargadasar="975";
			hargaextra="68";
			hargasup="195";
			break;
		case "Malaysia: Rainforests, Reefs, Cultures & Cuisines!":
			hargadasar="1995";
			hargaextra="65";
			hargasup="565";
			break;
		case "Laos: Mekong Moments":
			hargadasar="1995";
			hargaextra="65";
			hargasup="535";
			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(setDate,setDate);	
			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(setDate,setDate);	
			selbox.options[selbox.options.length] = new Option('March 13th - March 28th, 2010','March 13th - March 28th, 2010');
			selbox.options[selbox.options.length] = new Option('July 24th - August 8th, 2010','July 24th - August 8th, 2010');
			selbox.options[selbox.options.length] = new Option('September 11th - September 26th, 2010','September 11th - September 26th, 2010');
			selbox.options[selbox.options.length] = new Option('November 6th - November 21st, 2010','November 6th - November 21st, 2010');
			selbox.options[selbox.options.length] = new Option('January 29th - February 13th, 2011','January 29th - February 13th, 2011');
			selbox.options[selbox.options.length] = new Option('September 10th - September 25th, 2011','September 10th - September 25th, 2011');
			selbox.options[selbox.options.length] = new Option('November 5th - November 20th, 2011','November 5th - November 20th, 2011');
			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('May 18th - May 29th, 2010','May 18th - May 29th, 2010');
			selbox.options[selbox.options.length] = new Option('August 24th - September 4th, 2010','August 24th - September 4th, 2010');
			selbox.options[selbox.options.length] = new Option('September 28th - October 9th, 2010','September 28th - October 9th, 2010');
			selbox.options[selbox.options.length] = new Option('December 22nd, 2010 - January 2nd, 2011','December 22nd, 2010 - January 2nd, 2011');
			selbox.options[selbox.options.length] = new Option('January 11th - January 22nd, 2011','January 11th - January 22nd, 2011');
			selbox.options[selbox.options.length] = new Option('March 15th - March 26th, 2011','March 15th - March 26th, 2011');
			selbox.options[selbox.options.length] = new Option('September 27th - October 8th, 2011','September 27th - October 8th, 2011');
			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('July 3th - July 17th, 2010','July 3th - July 17th, 2010');
			selbox.options[selbox.options.length] = new Option('November 27th - December 11st, 2010','November 27th - December 11st');
			selbox.options[selbox.options.length] = new Option('February 19th - March 5th, 2011','February 19th - March 5th, 2011');
			selbox.options[selbox.options.length] = new Option('November 26th - December 10th, 2011','November 26th - December 10th, 2011');
			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('February 16th - March 10th, 2010','February 16th - March 10th, 2010');
			selbox.options[selbox.options.length] = new Option('April 20th - May 12th, 2010','April 20th - May 12th, 2010');
			selbox.options[selbox.options.length] = new Option('October 12th - November 3rd, 2010','October 12th - November 3rd, 2010');
			selbox.options[selbox.options.length] = new Option('October 11th - November 2nd, 2011','October 11th - November 2nd, 2011');
			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('June 13th - June 20th, 2010 ','June 13th - June 20th, 2010 ');
			selbox.options[selbox.options.length] = new Option('August 15th - August 22nd, 2010','August 15th - August 22nd, 2010');
			selbox.options[selbox.options.length] = new Option('December 12th - December 19th, 2010','December 12th - December 19th, 2010');
			selbox.options[selbox.options.length] = new Option('March 6th - March 13th, 2011','March 6th - March 13th, 2011');
			selbox.options[selbox.options.length] = new Option('December 11th - December 18th, 2011','December 11th - December 18th, 2011');
			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 2nd - July 22nd, 2011','July 2nd - July 22nd, 2011');
			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 11th - July 1st, 2011','June 11th - July 1st, 2011');
			break;
			
		/*case "Laos: South by Southeast":
			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 13th - June 28th, 2009','June 13th - June 28th, 2009');
			selbox.options[selbox.options.length] = new Option('June 12th - June 27th, 2010','June 12th - June 27th, 2010');
			selbox.options[selbox.options.length] = new Option('June 11th - June 26th, 2011','June 11th - June 26th, 2011');
			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;
	}
}
