//TABS			
			$(function() {
                $('#search> ul').tabs();
            });

//PARA ESCOGER FECHAS
$(document).ready(function(){
   $("#keys").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 2, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys2").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 2, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys3").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 2, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys4").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 2, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys5").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 1, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys6").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 1, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys7").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 1, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys8").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 1, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	$("#keys9").datepicker({ 
    showOn: "both", 
	firstDay: 1,
	numberOfMonths: 1, 
	dateFormat: "dd/mm/yy", 
    buttonImage: "/images/icons/calendar.gif", 
    buttonImageOnly: true 
	});
	
	$("a#masCourse").click( function() {
        	$("div#courseZona").show("fast");
			$("div#masCourseDiv").hide();
			$("div#menosCourseDiv").show();
    	}
	);
	$("a#menosCourse").click( function() {
        	$("div#courseZona").hide("fast");
			$("div#masCourseDiv").show();
			$("div#menosCourseDiv").hide();
    	}
	);
	
	$("a#masCH").click( function() {
        	$("div#carZona").show("fast");
			$("div#masCHDiv").hide();
			$("div#menosCHDiv").show();
    	}
	);
	$("a#menosCH").click( function() {
        	$("div#carZona").hide("fast");
			$("div#masCHDiv").show();
			$("div#menosCHDiv").hide();
    	}
	);
	
	$("a#masA").click( function() {
        	$("div#accZona").show("fast");
			$("div#masADiv").hide();
			$("div#menosADiv").show();
    	}
	);
	$("a#menosA").click( function() {
        	$("div#accZona").hide("fast");
			$("div#masADiv").show();
			$("div#menosADiv").hide();
    	}
	);
	
  });




function sendForm(f) {
		f.submit();
}


//FUNCIONES PARA HACER EL ANIDADO DE CIUDADES, REGIONES Y CAMPOS
var ajax = new Array();

function listaCiudades(sel)
{
	var codigoProv = sel.options[sel.selectedIndex].value;
	document.getElementById('ciudad').options.length = 0;	// Empty city select box
	document.getElementById('campo').options.length = 0;	// Empty city select box
	if(codigoProv.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'php/ciudades.php?zona='+codigoProv;	// Specifying which file to get
		ajax[index].onCompletion = function(){ creaCiudades(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function listaCiudades2(sel)
{
	var codigoProv = sel.options[sel.selectedIndex].value;
	document.getElementById('ciudad').options.length = 0;	// Empty city select box
	if(codigoProv.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'php/ciudades2.php?zona='+codigoProv;	// Specifying which file to get
		ajax[index].onCompletion = function(){ creaCiudades2(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}


function listaCampos(sel)
{
	var codigoProv = sel.options[sel.selectedIndex].value;
	document.getElementById('campo').options.length = 0;	// Empty city select box
	if(codigoProv.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'php/campos.php?zona='+codigoProv;	// Specifying which file to get
		ajax[index].onCompletion = function(){
										creaCampos(index);
									 };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function listaCamposZona(sel)
{
	var codigoProv = sel.options[sel.selectedIndex].value;
	document.getElementById('campocart').options.length = 0;	// Empty city select box
	if(codigoProv.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'php/campos2.php?zona='+codigoProv;	// Specifying which file to get
		ajax[index].onCompletion = function(){
										creaCampos2(index);
									 };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function listaAccZona(sel)
{
	var codigoProv = sel.options[sel.selectedIndex].value;
	document.getElementById('acc').options.length = 0;	// Empty city select box
	if(codigoProv.length>0){
		var index = ajax.length;
		ajax[index] = new sack();

		ajax[index].requestFile = 'php/accommodation.php?zona='+codigoProv;	// Specifying which file to get
		ajax[index].onCompletion = function(){
										creaAcc(index);
									 };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
	}
}

function creaCiudades(index)
{
	var obj = document.getElementById('ciudad');
	var obj2 = document.getElementById('campo');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function creaCiudades2(index)
{
	var obj = document.getElementById('ciudad');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}


function creaCampos(index)
{
	var obj2 = document.getElementById('campo');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}
function creaCampos2(index)
{
	var obj3 = document.getElementById('campocart');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}

function creaAcc(index)
{
	var obj3 = document.getElementById('acc');
	eval(ajax[index].response);	// Executing the response from Ajax as Javascript code	
}