function comprobarmail() {
 
 valor=$J('input[name=Catalogo]:checked').val() ;

if(valor.toLowerCase()=="si"){
	if(   document.getElementById("Nombre").value ==""	||
	   document.getElementById("Apellidos").value =="" 	||
		document.getElementById("Direccion").value =="" 	||
		 document.getElementById("Codigopostal").value ==""	||
		 document.getElementById("Provincia").value =="" 	 ||
				  		 document.getElementById("Email").value =="" 	 
		)
		{
		
		alert("Por favor, rellene los campos marcados como obligatorios");
		 return false;
		
		}
	}

  if (  document.getElementById("Email").value == ""||
    document.getElementById("Email").value != "" && 
     document.getElementById("Email").value.indexOf('@', 0) == -1 ||
	   document.getElementById("Email").value != "" && 
	   document.getElementById("Email").value.indexOf('.', 0) == -1) 
        {
		
		  alert("Direccion e-mail no válida! Por favor, compruébela. Si no posee e-mail, deje esta casilla en blanco");
		  return false;


}


	
if(bw.ie){
window.location.href='../fichaenviada.php?proc='+pagina;
return true;
}
if(bw.ns6)
{

alert('Está utilizando un navegador Mozilla tipo Netscape o Firefox, es posible que en vez de enviar el formulario, dicho navegador abra un mensaje en blanco. En tal caso, por favor, rellene dicho mensaje con la información que le solicitábamos en el formulario y pulse aceptar');
return true
}



}
function cambioobligatorio(){
	
	$J("input.radioobliga").click(function()
	{
			$J("div.cambiaobligacion label").each(function()
			{
					if($J(this).text().indexOf("*")<0) 
					{
						$J(this).prepend("*");
					}
			});
	});
	
	$J("input.radioquita").click(function()
	{
				if($J("#labelmail").text().indexOf("*")<0) 
				{
					$J("#labelmail").prepend("*");
				}
		
			$J("div.cambiaobligacion label").each(function()
			{
					var textooriginal=$J(this).text();
					if(textooriginal.indexOf("*")>-1) {
					$J(this).text(textooriginal.substr(1));}
			
			});
		
	});
}
var highlightcolor="lightyellow"
var previous=''
var eventobj
//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (bw.ns6 && eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
if (bw.ie||bw.ns6){
eventobj=bw.ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}}else{return false}
}