window.scroll = true;

function compruebaBoletin() {
	
	var colorFondoError = "#FFFF00";
	var Nombre       = document.formBoletin.Nombre.value;
	var lNombre      = Nombre.length;
    var Correo        = document.formBoletin.Correo.value;
    var lCorreo       = Correo.length; 
	var ok = true;
    var cnt = 0;
	
	if (Nombre=="tu nombre"){
		alert ("Debe introducir un nombre v\álido");
      	document.getElementById('Nombre').style.backgroundColor = colorFondoError;
		return false;
	}
	
	if (lNombre==0){
		alert ("Debe introducir el nombre");
      	document.getElementById('Nombre').style.backgroundColor = colorFondoError;
		return false;
	} else {
		document.getElementById('Nombre').style.backgroundColor = '';
    }
	
	if (Correo=="correo"){
		alert ("Debe introducir un correo electr\ónico v\álido");
      	document.getElementById('Correo').style.backgroundColor = colorFondoError;
		return false;
	}
	
	if (lCorreo==0){
		alert ("Debe introducir un correo electr\ónico");
		document.getElementById('Correo').style.backgroundColor = colorFondoError;
		return false;
    }

    for (var i=0; i<lCorreo; i++){
       var oneChar = Correo.charAt(i);
       if (oneChar == '@'){
			if (cnt == 0){
				cnt++;
				document.getElementById('Correo').style.backgroundColor = '';
			}else{
				alert ("¡Direcci\ón de correo electr\ónico Inv\álida!");
				document.getElementById('Correo').style.backgroundColor = colorFondoError;
				return false;
			}
		} 
	}

    if (!cnt){
       alert ("¡Direcci\ón de correo electr\ónico Inv\álida!");
	   document.getElementById('Correo').style.backgroundColor = colorFondoError;
       return false;
    } else {
		document.getElementById('Correo').style.backgroundColor = '';
	}

	return true;
}
 function comprobaCampo(campo) { 
	 if(campo.value=="") { 
	  campo.value=campo.defaultValue; 
	 }
 }
 function borraCampo(campo) { 
	if (campo.value==campo.defaultValue) { 
	  campo.value=""; 
	} 
} 
function anadeFavoritos()
   {
	var agt = navigator.userAgent.toLowerCase();
	var app = navigator.appName.toLowerCase();
	var ieAgent = agt.indexOf('msie');
	var nsAgent = app.indexOf('netscape');
	var opAgent = app.indexOf('opera');
	var NSstring = "Pulse [Ctrl + D] para a\ñadir a favoritos";
	var OPstring = "Pulse [Ctrl + T] para a\ñadir a favoritos";
	if (ieAgent!= -1) { 
		window.external.AddFavorite("http://www.editorialveramar.com/","Editorial Veramar") 
	} else if (nsAgent!= -1){ 
		alert(NSstring); 
	} else if (opAgent!= -1){
		alert(OPstring); 
	}
}
function paginaInicio(obj)
   {
	var agt = navigator.userAgent.toLowerCase();
	var ieAgent = agt.indexOf('msie');
	var string = "Esta opci\ón s\ólo funciona con el navegador Internet Explorer de Microsoft, en otros navegadores hay que hacerlo manualmente en el men\ú de configuraci\ón.";
	if (ieAgent > -1) { 
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage ("http://www.editorialveramar.com") ;
	} else { 
		alert(string) ; 
	}
}