
var ajax = new Array();

function getEs(sel)
{
	var TipoCode = sel.options[sel.selectedIndex].value;
	
	var indice = document.getElementById('buscar').options.selectedIndex ;
	var Operacion = document.getElementById('buscar').options[indice].value  ;
	
	document.getElementById('Murcia').options.length = 0;	// Empty poblaciones select box
	if(TipoCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'http://www.opau.es/getCities.php?TipoCode='+TipoCode+'&Operate='+Operacion;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createCities(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
		
		
		document.getElementById('Murcia').options.selectedIndex = 0 ;
	}
}

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






function getTipo(sel)
{
	var TipoCode = sel.options[sel.selectedIndex].value;
	//var buscar = document.getElementById(buscar);

	
	document.getElementById('alquilar').options.length = 0;	// Empty poblaciones select box
	//document.getElementById('Murcia').options.length = 0;	// Empty poblaciones select box
	if(TipoCode.length>0){
		var index = ajax.length;
		ajax[index] = new sack();
		
		ajax[index].requestFile = 'http://www.opau.es/getTipos.php?TipoCode='+TipoCode;	// Specifying which file to get
		ajax[index].onCompletion = function(){ createTipos(index) };	// Specify function that will be executed after file has been found
		ajax[index].runAJAX();		// Execute AJAX function
		
		document.getElementById('alquilar').options.selectedIndex = 0 ;
		
	}
}

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

