ï»¿function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {
	window.alert("Por favor, utilice el botÃ³n 'Buscar'"); 
	return false; 
	}
}

document.onkeypress = stopRKey;

function ___DirectoryCmd_RememberPasswordFedemco() {
	var oForm = document.forms[0];
	var oAjax = new WBE_AjaxClass();
	var oLayer;
	var oXmlDoc;

	oAjax.clear();

	// Oculta las capas de alertas
	oLayer = document.getElementById('pwd_nok');
	oLayer.style.display = "none";
	oLayer = document.getElementById('pwd_ok');
	oLayer.style.display = "none";

	if (oForm._dir_email.value=='') {
		alert('Debes escribir un correo electrÃ³nico.');
		return;
	}
	oAjax.addPostParameter("_email", oForm._dir_email.value);
	oXmlDoc = oAjax.throwEventXML("directory_remember_password");
	if (!oXmlDoc) {	alert('Se ha producido un error.'); return;	}
	var sStatus = oAjax.getXMLNodeValue(oXmlDoc, 's');
	if (sStatus!=0) {
		var sErrorMessage = oAjax.getXMLNodeValue(oXmlDoc, 'm');
		oLayer = document.getElementById('pwd_nok');
		oLayer.style.display = "block";						
		
	} else {
		oLayer = document.getElementById('pwd_ok');
		oLayer.style.display = "block";				
		
		oLayer = document.getElementById('message');
		oLayer.style.display = "none";		
	}
}

	
/*
function ___DirectoryCmd_ValidateSearch(sUrl) {
	var oForm = document.forms[0];
	var oAjax = new WBE_AjaxClass();
	var oFormValidator = new WBEFormValidator();
	oAjax.clear();

	if (___DirectoryCmd_IsTextEmpty(oForm) && ___DirectoryCmd_IsSectorEmpty(oForm) && 
			___DirectoryCmd_IsProvinceEmpty(oForm) ) {
		alert('Debes especificar algún criterio de búsqueda.');
		return;
	}	

	if (!oFormValidator.validateForm(11, oForm)) return;
	
	if (oForm._dir_s_string) 
		{oAjax.addPostParameter("search_string", oForm._dir_s_string.value);}
	if (oForm._dir_sel_sector) 
		{oAjax.addPostParameter("sector_id", oForm._dir_sel_sector[oForm._dir_sel_sector.selectedIndex].value);}
	if (oForm._dir_s_product) 	
		oAjax.addPostParameter("product_string", oForm._dir_s_product.value);
	if (oForm._dir_sel_province) 
		{oAjax.addPostParameter("province_id", oForm._dir_sel_province[oForm._dir_sel_province.selectedIndex].value);}
	if (oForm._dir_sel_region) 
		{oAjax.addPostParameter("region_id", oForm._dir_sel_region[oForm._dir_sel_region.selectedIndex].value);}
	if (oForm._dir_sel_city) 
		{oAjax.addPostParameter("city_id", oForm._dir_sel_city[oForm._dir_sel_city.selectedIndex].value);}
	if (oForm._dir_sel_city_code) 
		{oAjax.addPostParameter("city_code", oForm._dir_sel_city_code[oForm._dir_sel_city_code.selectedIndex].value);}
	if (oForm._dir_s_city_name) 
		{oAjax.addPostParameter("city_name", oForm._dir_s_city_name.value);}

	oAjax.throwEvent2("directory_search_enterprise");
	window.location.href = sUrl;	
}
*/

function muestra(id,total){
var i

for (i=1;i<=total;i++) { 
	document.getElementById('capa'+i).style.display='none';
}

	document.getElementById(id).style.display='inline';

}



function ___DirectoryCmd_Search(sUrl, iPosID) 
{	
	var oForm = document.forms[0];
	var oAjax = new WBE_AjaxClass();
	var oFormValidator = new WBEFormValidator();
	oAjax.clear();

	if (___DirectoryCmd_IsTextEmpty(oForm) && ___DirectoryCmd_IsSectorEmpty(oForm) && 
			___DirectoryCmd_IsProvinceEmpty(oForm) && ___DirectoryCmd_IsRegionEmpty(oForm) && 
			___DirectoryCmd_IsAddressEmpty(oForm) && ___DirectoryCmd_IsPostalCodeEmpty(oForm) &&
			___DirectoryCmd_IsCityEmpty(oForm) && ___DirectoryCmd_IsEnterpriseEmpty(oForm)) {
		alert('Debes especificar algÃºn criterio de bÃºsqueda.');
		return;
	}	
	
	// 20080318 Â· jpvalls Â· Al parecer no valida bien los campos NGrow y Nimf
	//if (!oFormValidator.validateForm(oForm, iPosID)) return;
	
	if (oForm._dir_s_string!=null) 
		{oAjax.addPostParameter("search_string", oForm._dir_s_string.value);}
	if (oForm._dir_sel_sector!=null) 
		{oAjax.addPostParameter("subsector_id", oForm._dir_sel_sector[oForm._dir_sel_sector.selectedIndex].value);}
	if (oForm._dir_s_product!=null) 	
		oAjax.addPostParameter("product_string", oForm._dir_s_product.value);
	if (oForm._dir_sel_province!=null) 
		{oAjax.addPostParameter("province_id", oForm._dir_sel_province[oForm._dir_sel_province.selectedIndex].value);}
	if (oForm._dir_sel_region!=null) 
		{oAjax.addPostParameter("region_id", oForm._dir_sel_region[oForm._dir_sel_region.selectedIndex].value);}
	if (oForm._dir_sel_city!=null) 
		{oAjax.addPostParameter("city_id", oForm._dir_sel_city[oForm._dir_sel_city.selectedIndex].value);}
	if (oForm._dir_sel_city_code!=null) 
		{oAjax.addPostParameter("city_code", oForm._dir_sel_city_code[oForm._dir_sel_city_code.selectedIndex].value);}
	if (oForm._dir_s_city_name!=null) 
		{oAjax.addPostParameter("city_name", oForm._dir_s_city_name.value);}
	if (oForm._sel_type!=null) 
		{oAjax.addPostParameter("user_type", oForm._sel_type.value);}
	if (oForm._dir_s_enterprise!=null) 
		{oAjax.addPostParameter("enterprise_string", oForm._dir_s_enterprise.value);}
	if (oForm._dir_s_address!=null)
		{oAjax.addPostParameter("address_string", oForm._dir_s_address.value);}
	if (oForm._dir_s_cp!=null)
		{oAjax.addPostParameter("postal_code_string", oForm._dir_s_cp.value);}
		
		
	if (oForm._dir_NGrow!=null)
		{oAjax.addPostParameter("ngrow", oForm._dir_NGrow.value);}

	if (oForm._dir_nimf!=null)
		{oAjax.addPostParameter("nimf", oForm._dir_nimf.value);}
		
	if(oForm._dir_sanitario!=null)
		{oAjax.addPostParameter("sanitario", oForm._dir_sanitario.value);}
		
	/*if (oForm._dir_nimf!=null && oForm._dir_nimf)
		{oAjax.addPostParameter("nimf", oForm._dir_nimf[oForm._dir_nimf.selectedIndex].value);}
	if (oForm._dir_nimf!=null)
		{oAjax.addPostParameter("nimf", oForm._dir_nimf[oForm._dir_nimf.selectedIndex].value);}

*/
	if (oForm._dir_iso9000!=null && oForm._dir_iso9000.checked)
		{oAjax.addPostParameter("iso9000","1");}
	
	if (oForm._dir_iso14000!=null && oForm._dir_iso14000.checked)
		{oAjax.addPostParameter("iso14000","1");}
		
		
	oAjax.addPostParameter("init_before", "1");	

	oAjax.throwEvent2("directory_search_enterprise");
	window.location.href = sUrl;	
}


function ShowErrorMessageWichList (msgMandatoryField,oField,bFormatErrorMsg) {
		//gestelles. para comprobar errores
		if (this.onErrorHandler!=null) this.onErrorHandler(oField);
		if(this.oErrorLayer == null){
			if (this.groupErrorMsg) {
				this.errorObjElements[this.errorObjElements.length] = oField;
				if (!bFormatErrorMsg) 
					this.errorMandatoryPresent = true;
				else 
					if (bFormatErrorMsg) this.errorFormatMsg[this.errorFormatMsg.length] = msgMandatoryField + '\n';
			} else {
				document.getElementById('vform').style.display='';
				document.getElementById('vformb').style.display='';		
				document.getElementById('vformtext').style.display='none';
				alert(msgMandatoryField);
				if (oField!=null && oField.style.display != "none") {
					oField.focus();
					oField.style.backgroundColor='#ffffcc';
				}
			}
		}else{
			oErrorLayer.innerHTML = '<p><b>' + msgMandatoryField + '</b></p>';
			oErrorLayer.style.display = '';
		}
	}
