function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function calculate_costs()
	{
		var card_type = getCheckedValue(document.form1.cctype);
		var customer_no = document.form1.numofcustomers.value;
		var tourt = document.form1.tour.value;
		var compareit = 4;
		if (customer_no >= 4)
		{
			tourt = tourt - 20;
			var cost =customer_no * tourt;
		
		} else {
			tourt = tourt - 10;
			var cost =customer_no * tourt;
		}
		//var discount = document.form1.disccode.value;
		/*if (discount == "chillax_referral" || discount == "chillax_student")
		{
			cost = cost * 0.9;
		}*/
		/*if(card_type == "Amex"){
			var extra_cost= ((cost * 3)/100);
		}	
		if(card_type == "Master"){
			var extra_cost= ((cost * 1.5)/100);			
		}	
		if(card_type == "Visa"){
			var extra_cost= ((cost * 1.5)/100);			
		}
				var total_cost= cost + extra_cost;*/
		total_cost = cost;

	 	
		if (isNaN(total_cost))
		{
			//document.getElementById("costtotal").innerHTML = "<span class='style10'>(1.5% surcharge for visa & mastercard, 3% surcharge for amex cards)</span>";
			document.getElementById("costtotal").innerHTML = "";
		} else {
			document.getElementById("costtotal").innerHTML = "<span class='style10'>Total Cost = $AUD "+Math.round(total_cost)+"</span>";
		}
	 	//document.getElementById("totalcost").value = total_cost; 
	}
function check_blank()
	{
	
	 	if(document.form1.numofcustomers.options[0].selected){
		  alert("Choose the no of Guest");
		   return false;  
		}
		
		if(document.form1.customer_fname.value.length==0 || document.form1.customer_fname.value.length < 2){
		  alert("Please Enter Customer First Name ");
		   return false;  
		}
		
		if(document.form1.customer_lname.value.length==0 || document.form1.customer_lname.value.length < 2){
		  alert("Please Enter Customer Last Name ");
		   return false;  
		}
		
		if(emailValidate(document.getElementById("txtEmail").value)==false) {
		alert("Please Enter Valid Email.");
		return false;
		}
		
		if(document.form1.txtAddress.value.length==0 || document.form1.txtAddress.value.length < 2){
		  alert("Please Enter Address");
		   return false;  
		}
		
		if(document.form1.txtPostcode.value.length==0 || document.form1.txtPostcode.value.length < 2){
		  alert("Please Enter Postcode");
		   return false;  
		}
		
		/*if(document.form1.booked_by.value.length==0 || document.form1.booked_by.value.length < 2){
		  alert("Can't Be Blank or Invalid Entry! Please Enter Booked By Name");
		   return false;  
		}*/
		
		if(document.form1.pickup_dest.options[0].selected){
		  alert("Select Destination");
		   return false;  
		}
		
		if(document.form1.tourdate.options[0].selected){
		  alert("Select Tour Date");
		   return false;  
		}
		
		if(document.form1.nationality.value.length==0 || document.form1.nationality.value.length < 2){
		  alert("Can't Be Blank or Invalid Entry! Please Enter Your Nationality");
		   return false;  
		}	
		
		if(document.form1.diet.options[0].selected){
		  alert("Select Dietary");
		   return false;  
		}

		if(document.form1.chname.value.length==0 || document.form1.chname.value.length < 2){
		  alert("Please Enter Card Holder Name ");
		   return false;  
		}
		
		if(document.getElementById('cr_type').checked==false && document.getElementById('crtype_master').checked==false && document.getElementById('crtype_Amex').checked==false)
		{
			alert("Select Credit Card Type");			
			return false;
		}
		
		if(document.form1.ccnumber.value.length==0 || document.form1.ccnumber.value.length < 4){
		  alert("Can't Be Blank or Invalid Entry! Please Enter Card Number");
		   return false;  
		}			
				
		if(document.form1.ddlExpiryMonth.value.length==0 || document.form1.ddlExpiryYear.value==0){
			alert("Enter Card Expiration Date");
		   return false;  
		}			
		
	}	

function emailValidate(str){
	
    var  filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i	
    if (filter.test(str)){
        testresults=true;
	}else{
       testresults=false;
    }
    return (testresults);
}	
