function popupWindow(url, w, h) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h+',screenX=150,screenY=150,top=30,left=100')
}

function redirWebsite(wid, url){

	if(wid!=""){
		window.location.href= url + "?website_id=" + wid;
	}else{
		window.location.href= url;
	}
	
}

function redirPage(url, page, params){

	if(page!=""){
		window.location.href= url + "?page=" + page + params;
	}else{
		window.location.href= url;
	}
	
}

function redirBookingDate(url, tid, dt){

	if(dt!=""){
		window.location.href= url + "?tour_id=" + tid + "&booking_date=" + dt;
	}else{
		window.location.href= url + "?tour_id=" + tid;
	}
	
}

function disableInput(name){
	$('#'+name).attr('disabled', true);
}

function enableInput(name){
	$('#'+name).removeAttr('disabled');
}


function validate_booking_form(){

	var is_valid = true;

	if($('#first_name').val()==""){

		$('#sp_first_name').html("Please enter your first name!");

		is_valid = false;

	}else{

		$('#sp_first_name').html("");

	}
	

	if($('#last_name').val()==""){

		$('#sp_last_name').html("Please enter your last name!");

		is_valid = false;

	}else{

		$('#sp_last_name').html("");

	}


	if($('#address').val()==""){

		$('#sp_address').html("Please enter your address!");

		is_valid = false;

	}else{

		$('#sp_address').html("");

	}


	if($('#city').val()==""){

		$('#sp_city').html("Please enter your city!");

		is_valid = false;

	}else{

		$('#sp_city').html("");

	}


	if($('#state').val()==""){

		$('#sp_state').html("Please enter your state!");

		is_valid = false;

	}else{

		$('#sp_state').html("");

	}


	if($('#zip').val()==""){

		$('#sp_zip').html("Please enter your zip code!");

		is_valid = false;

	}else{

		$('#sp_zip').html("");

	}


	if($('#email').val()==""){

		$('#sp_email').html("Please enter your email address!");

		is_valid = false;

	}else{

		$('#sp_email').html("");

	}
	

	if($('#phone').val()==""){

		$('#sp_phone').html("Please enter your phone number!");

		is_valid = false;

	}else{

		$('#sp_phone').html("");

	}


	if($('#income').val()==""){

		$('#sp_income').html("Please select your income!");

		is_valid = false;

	}else{

		$('#sp_income').html("");

	}


	if($('#age').val()==""){

		$('#sp_age').html("Please select your age!");

		is_valid = false;

	}else{

		$('#sp_age').html("");

	}

	
	if($('#marital_status').val()==""){

		$('#sp_marital_status').html("Please select your marital status!");

		is_valid = false;

	}else{

		$('#sp_marital_status').html("");

	}


	if($('#cc_type').val()==""){

		$('#sp_cc_type').html("Please select the credit card type!");

		is_valid = false;

	}else{

		$('#sp_cc_type').html("");

	}


	if($('#cc_num').val()==""){

		$('#sp_cc_num').html("Please enter the credit card number!");

		is_valid = false;

	}else{

		$('#sp_cc_num').html("");

	}


	if($('#cc_cvv').val()==""){

		$('#sp_cc_cvv').html("Please enter the credit card CVV number!");

		is_valid = false;

	}else{

		$('#sp_cc_cvv').html("");

	}


	if($('#cc_zip').val()==""){

		$('#sp_cc_zip').html("Please enter the billing zip code!");

		is_valid = false;

	}else{

		$('#sp_cc_zip').html("");

	}


	if($('#cc_expiry_m').val()==""){

		$('#sp_cc_expiry_m').html("Please select the month of credit card expiration date!");

		is_valid = false;

	}else{

		$('#sp_cc_expiry_m').html("");

	}


	if($('#cc_expiry_y').val()==""){

		$('#sp_cc_expiry_y').html("Please select the year of credit card expiration date!");

		is_valid = false;

	}else{

		$('#sp_cc_expiry_y').html("");

	}


	if($('#cc_cc_name').val()==""){

		$('#sp_cc_name').html("Please enter credit cards holder's name!");

		is_valid = false;

	}else{

		$('#sp_cc_name').html("");

	}

	if($('#terms_conditions').is(":checked")==false){
		
		$('#sp_terms_conditions').html("You must agree with our terms and conditions!");

		is_valid = false;
	
	}else{
		
		$('#sp_terms_conditions').html("");
	
	}
	
	return is_valid;
}
