function SEO_search() { //v4.00000000

	var i,p,q,nm,test,num,min,max,errors='',args=SEO_search.arguments,checked_values;

	p=document.search_iresform.sel_sale.value;
	var er=/ņ/i; 
	var prop=/properties/;
	var cat=/category/;
	
	if (document.search_iresform.province) if (document.search_iresform.province.value) p=p+'province/'+document.search_iresform.province.value.replace(er,'%F1')+'/';
	if (document.search_iresform.location) if (document.search_iresform.location.value) p=p+'location/'+escape(document.search_iresform.location.value)+'/';
	if (document.search_iresform.subarea) if (document.search_iresform.subarea.value) p=p+'subarea/'+document.search_iresform.subarea.value.replace(er,'%F1')+'/';
//	if (document.search_iresform.newdevs.checked && document.search_iresform.sel_sale.selectedIndex == 0) p=p+'newdevs/';

	var IsPromo=false;
	if (document.search_iresform.category){
		if (document.search_iresform.category.value=='0'){		
			aux=(p.replace(prop,'developments')).replace(cat,'');
			p=aux;	  
			IsPromo=true;
		}else{
			if (document.search_iresform.category.value) p=p+'category/'+document.search_iresform.category.value.replace(er,'%F1')+'/';
		}
	}

	if (IsPromo==false){
		if (document.search_iresform.resbudgetpath) if (document.search_iresform.resbudgetpath.value) p=p+document.search_iresform.resbudgetpath.value+'/';
	}
	

	//alert(p);
	document.search_iresform.action=p;
        
	document.MM_returnValue = (errors == '');
}


function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem, act_prov, act_loc, arr_type) {
	var i, j, act, act_prov, act_loc, arr_type;
	var prompt;
	act = 0;
	// empty existing items
	for (i = selectCtrl.options.length; i >= 0; i--) {
		selectCtrl.options[i] = null;
	}
//	prompt = (itemArray != null) ? goodPrompt : badPrompt;
//	alert(prompt);
	if (prompt == null) {
		j = 0;
	} else {
		selectCtrl.options[0] = new Option(prompt);
		j = 1;
	}
	if (itemArray != null) {
		// add new items
		for (i = 0; i < itemArray.length; i++) {
			selectCtrl.options[j] = new Option(itemArray[i][0]);
			if (itemArray[i][1] != null) {
				selectCtrl.options[j].value = itemArray[i][1];
				if (itemArray[i][1] == act_prov && selectCtrl.name == 'province') act = i;
				if (itemArray[i][1] == act_loc && selectCtrl.name == 'location') act = i;
			}
			j++;
		}
		// select first item (prompt) for sub list
		if (selectCtrl.name == 'province') {
			selectCtrl.options[act].selected = true;
			if (arr_type == 'rent_') {
				fillSelectFromArray(document.search_iresform.location, rent_ar_cities[act],'','','',act_prov,act_loc,arr_type);
			} else {
				fillSelectFromArray(document.search_iresform.location, ar_cities[act],'','','',act_prov,act_loc,arr_type);
			}
		}
		if (selectCtrl.name == 'location') selectCtrl.options[act].selected = true;
	}
}
 
function resetSel(s,check,lang){
	//check==1 -> ciudad, check=2->barrio, check=0->limpieza antes de introducir nuevos(no hacer nada)
	for (i = s.options.length; i >= 0; i--) {
		s.options[i] = null;
	}
	
	if (check>0){
		if (check==1) { fr='villes';}else{fr='zones' ;}
		if (check==1) { es='ciudades';}else{es='zonas' ;}
		if (check==1) { en='cities';}else{en='subareas' ;}
		
		switch (lang){
		 case 'fr': msg='Toutes les '+fr; break;
		 case 'es': msg='Todas las '+es; break;
		 case 'en': msg='All '+en; break;
		}			 					 
		s.options[0]=new Option(msg,0,false,false);
	}
}

function selectIt(sel, val){
	i=0; 
	found=false;
	while((found==false) && (i<sel.options.length)){
		if (sel.options[i].value==val){
		 	sel.options[i].selected=true;
			found=true;
			return true;
		}			
		i++;	
	}
	return true;
}

function setSel(h, o, s, province, selectThis){  
	resetSel(s,0,'not important');

	//control espacios
	var arrPal=o.split(' ');
	o=arrPal[0];
	if (arrPal.length>1){
	 	for (cont=1;cont<arrPal.length;cont++){
		 	o+='_'+arrPal[cont];
		}
	}				  

	//control guiones
	var arrPal=o.split('-');
	o=arrPal[0];
	if (arrPal.length>1){
	 	for (cont=1;cont<arrPal.length;cont++){
		 	o+=arrPal[cont];
		}
	}
	
	//control eņes
	var arrPal=o.split('ņ');
	o=arrPal[0];
	if (arrPal.length>1){
	 	for (cont=1;cont<arrPal.length;cont++){
		 	o+='ny'+arrPal[cont];
		}
	}
	
	if (province==true)	o='P_'+o;
	
	for (i = 0; i < h[o].length; i++) {
		select=false;
		s.options[i]=new Option (h[o][i],(i==0) ? '' : h[o][i], select,select); 
	}
	selectIt(s,selectThis);
}

/*
Todas las funciones en IE necesitan un 'return true' para cambiar el estado del formulario.
*/
