function cambiarimagen(imagen, ruta){	
$(imagen).hide();
$(imagen).attr({'src':''});
$(imagen).show(function(){
		$(imagen).attr({'src':ruta});
});
}

function email(){
	document.getElementById("emailcontacto").style.background = "#FFFFFF";
	document.getElementById("telefonocontacto").style.background = "#FFFFFF";
	if(document.getElementById("idpromocioncontacto").value=="" && document.getElementById("idpisocontacto").value=="")
		return false;	
	if(document.getElementById("emailcontacto").value!="")
	{
		if (checkMail(document.getElementById("emailcontacto").value)){
			return true;
		}
		else
		{
			document.getElementById("emailcontacto").style.background = "#EEBBBB";
			return false;
		}
	}	
	if(document.getElementById("telefonocontacto").value!="")
		return true;
	document.getElementById("emailcontacto").style.background = "#EEBBBB";
	document.getElementById("telefonocontacto").style.background = "#EEBBBB";	
	return false;
}

function email2(){
	document.getElementById("emailcontactog").style.background = "#FFFFFF";
	document.getElementById("telefonocontactog").style.background = "#FFFFFF";	
	if(document.getElementById("emailcontactog").value!="")
	{
		if (checkMail(document.getElementById("emailcontactog").value)){
			return true;
		}
		else
		{
			document.getElementById("emailcontactog").style.background = "#EEBBBB";
			return false;
		}
	}	
	if(document.getElementById("telefonocontactog").value!="")
		return true;
	document.getElementById("emailcontactog").style.background = "#EEBBBB";
	document.getElementById("telefonocontactog").style.background = "#EEBBBB";	
	return false;
}

function checkMail(mail){
        var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
        if(typeof(mail) == "string"){
                if(er.test(mail)){ return true; }
        }else if(typeof(mail) == "object"){
                if(er.test(mail.value)){ 
                                        return true; 
                                }
        }else{
                return false;
                }
}
