function get_excursion_zona(zona,nombre_zona){
	$('#wrapper').load('backend/load_json_excursion_zona.php', { zona: zona, nombre_zona: nombre_zona },
		function(){
			$("#booking").hide();
			$("#form_ok").html('');
		});
}

function get_pro_cat(cat,nombre_cat){
	$('#wrapper').load('backend/load_json_pro_cat.php', { cat: cat, nombre_cat: nombre_cat },
		function(){
		});
}

function book_here(codigo,titulo) {
	document.getElementById('codigo').value = codigo;
	document.getElementById('titulo').value = titulo;
	if ($("#booking").is(":hidden")) {
		$("#booking").slideDown("slow");
	} else {
		$("#booking").slideUp("slow");
	}
}

function get_detail_pro(producto){
	$('#wrapper').load('backend/load_json_detail_pro.php', { producto: producto },
		function(){
			
		}
	);
}

function get_detail(excursion){
	$('#wrapper').load('backend/load_json_detail.php', { excursion: excursion },
		function(){
			
		}
	);
}

function clearform() {
	document.getElementById('RANGO').value = '';
	document.getElementById('FIRST_NAME').value = '';
	document.getElementById('SECOND_NAME').value = '';
	document.getElementById('TEL1').value = '';
	document.getElementById('MOB1').value = '';
	document.getElementById('MAIL').value = '';
	document.getElementById('ADRESS').value = '';
	document.getElementById('CITY').value = '';
	document.getElementById('ZIP').value = '';
	document.getElementById('COUNTRY').value = '';
	document.getElementById('RAND').value = '';
	document.getElementById('RESULT').value = '';
	document.getElementById('codigo').value = '';
	document.getElementById('titulo').value = '';
	document.getElementById('acceptterms').checked = false;
}

function enviar_form() {
	RANGO = document.getElementById('RANGO').value;
	FIRST_NAME = document.getElementById('FIRST_NAME').value;
	SECOND_NAME= document.getElementById('SECOND_NAME').value;
	TEL1 = document.getElementById('TEL1').value;
	MOB1 = document.getElementById('MOB1').value;
	MAIL = document.getElementById('MAIL').value;
	ADRESS = document.getElementById('ADRESS').value;
	CITY = document.getElementById('CITY').value;
	ZIP = document.getElementById('ZIP').value;
	COUNTRY = document.getElementById('COUNTRY').value;
	RAND = document.getElementById('RAND').value;
	RESULT = document.getElementById('RESULT').value;
	codigo = document.getElementById('codigo').value;
	titulo = document.getElementById('titulo').value;
	PAX = document.getElementById('PAX').value;
	chbx = document.getElementById('acceptterms').checked;
	if(!/^[a-zA-Z0-9_\-\.]+(\+[a-zA-Z0-9_\-\.]+)*@[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,4}$/.test(MAIL)) {
		mail = false;
	} else {
		mail = true;
	}
	if (chbx == true &&
		FIRST_NAME != '' &&
		SECOND_NAME != '' &&
		mail == true
		) {
		$('#form_ok').load('enviar_form.php', { FIRST_NAME: FIRST_NAME, SECOND_NAME: SECOND_NAME, TEL1: TEL1, MOB1: MOB1, MAIL: MAIL, ADRESS: ADRESS, CITY: CITY, ZIP: ZIP, COUNTRY: COUNTRY, RAND: RAND, RESULT: RESULT ,codigo: codigo, titulo: titulo, RANGO: RANGO, PAX: PAX }, function(){
			clearform();
		});
	} else {
		if (mail == false) al_var = 'Your email is not correct.\r\n'
		if (FIRST_NAME == '') al_var += 'First name field required.\r\n';	
		if (SECOND_NAME == '') al_var += 'Last name field required.\r\n';
		if (chbx == false) al_var += 'You must accept terms and conditions.\r\n';
		alert(al_var);
	}
}

