var lockBar=0;var aOffset = new Array(16,136,256,376,496,569); var aIFrmHt = new Array()
/* Funcion de cambio de CSS para el tamaño de las letras */
function txtSz(text_size) {
  oLnk = document.getElementById("txtSz"); oLnk.href = "/css/"+text_size+".css"
  var datDate = new Date(); var datNextYear = datDate
	datNextYear.setTime(datDate.getTime()+31536000000)
  document.cookie = "txtSz="+text_size+"; expires="+datNextYear.toGMTString()+"; path=/"
}


/* Funciones del Menu desplegable */
function mDsp(menuId) {
  var tmpWidth = 0; lockBar = menuId
  for (ii=1; ii<7;ii++) {
    if (document.body.clientWidth-752 > 0) {tmpWidth = document.body.clientWidth-751} else {tmpWidth = 1}
    if (menuId == ii) {
      document.getElementById("tpMnu"+ii).style.display = "block";document.getElementById("tpMnu"+ii).style.left=aOffset[ii-1]+tmpWidth/2+"px"
      if (navigator.userAgent.indexOf("Opera") < 0) {document.getElementById("navIFrm"+ii).style.display = "block";document.getElementById("navIFrm"+ii).style.left=aOffset[ii-1]+tmpWidth/2+"px"}
      document.getElementById("mnSpn"+ii).style.backgroundImage = "url(/img/bgNavSlct.gif)";document.getElementById("mnSpn"+ii).style.backgroundRepeat = "repeat";
    }
    else {document.getElementById("tpMnu"+ii).style.display = "none";document.getElementById("navIFrm"+ii).style.display = "none";document.getElementById("mnSpn"+ii).style.backgroundImage = "none";}
  }
}

function mOff(menuId) {lockBar=0;setTimeout("mHide("+menuId+")",700)}

function mHide(menuId) {if (menuId != lockBar) {document.getElementById("tpMnu"+menuId).style.display = "none";document.getElementById("navIFrm"+menuId).style.display = "none";document.getElementById("mnSpn"+menuId).style.backgroundImage = "none";}}



/* Funciones relacionadas con el WebMail */

function validarEmail(email) {
	var lsAT;
	lsAT = email.indexOf("@");
	if (lsAT == -1 || email.indexOf(" ") != -1 ) {
		return false;
	}
	return true;
}//validarEmail


function chequearWebmail(){

	mensaje="";
	if (document.login.loginname.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Dirección de E-Mail";
	}
	if (document.login.password.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Contraseña";
	}
	
	if (mensaje.length!=0){ 
		alert("Por favor, Rellene los siguientes campos:"+mensaje);
		return false;
	}
	
	
	
	
	//Comprobar sintaxis de direccion e-mail
	if (!validarEmail(document.login.loginname.value)){
		alert("Lo siento, La dirección de email no es correcta. Vuelva a escribirla.");
		return false;
	}
	else{
		if (document.login.seguro.checked)
			document.login.action="https://webmail.lobocom.es/cgi-bin/webmail/webmail.pl";
		else
			document.login.action="http://webmail.lobocom.es/cgi-bin/webmail/webmail.pl";
  	document.login.submit();
		document.login.loginname.value="";
		document.login.password.value="";
		document.login.seguro.checked=true;
	}	
}




/* Funciones relacionadas con el Contrato de servicios */

function chequearContratar(){

	mensaje="";
	if (document.formulario.nombre.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Nombre";
	}
	if (document.formulario.cif.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"CIF/NIF";
	}
	if (document.formulario.direccion.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Dirección";
	}
	if (document.formulario.poblacion.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Población";
	}
	if (document.formulario.provincia.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Provincia";
	}	
	if (document.formulario.telefono.value.length==0) {
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Teléfono";
	}		
	if (document.formulario.email.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"email";
	}
	
	if (mensaje.length!=0){ 
		alert("Por favor, Rellene los siguientes campos:"+mensaje);
		return false;
	}
	
	//Comprobar sintaxis de direccion e-mail
	if (!validarEmail(document.formulario.email.value)){
		alert("Lo siento, La dirección de email no es correcta. Vuelva a escribirla.");
		return false;
	}
	else if (!document.formulario.condiciones.checked){
		alert("Debe Aceptar Las Condiciones del Servicio");
	}
	else
  	document.formulario.submit();
}



/* Comprobar el registro de dominio */

function chequearContratarDominio(){

	mensaje="";
	
	
	


   if (document.formulario.registrara.value=="empresa"){
   <!-- Si es el registro es para una empresa //-->
	if (document.formulario.empresa.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Nombre de Empresa";
	}


	if (document.formulario.cif.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"CIF";
	}

   if (document.formulario.dominio.value.indexOf(".es")!=-1){

   <!-- Si es el registro para una empresa y es un .es //-->

	if (document.formulario.administrador.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Nombre del Administrador";
	}
   }

	if (document.formulario.nifadministrador.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Nif del Administrador";
	}

   }
   else{


        <!-- Si es el registro es para un particular //-->
       	if (document.formulario.particular.value.length==0){
		   coma=(mensaje.length!=0)?",\n":"\n";
		   mensaje=mensaje+coma+"Nombre y Apellidos";
	    }

	    if (document.formulario.nifparticular.value.length==0){
	       coma=(mensaje.length!=0)?",\n":"\n";
		   mensaje=mensaje+coma+"NIF";
	    }
   
   }

<!-- Datos comunes para cualquier registro //-->
	
	if (document.formulario.direccion.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Dirección";
	}
	if (document.formulario.poblacion.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Población";
	}
	if (document.formulario.provincia.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Provincia";
	}	
	if (document.formulario.telefono.value.length==0) {
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"Teléfono";
	}		
	if (document.formulario.email.value.length==0){
		coma=(mensaje.length!=0)?",\n":"\n";
		mensaje=mensaje+coma+"email";
	}
	
	if (mensaje.length!=0){ 
		alert("Por favor, Rellene los siguientes campos:"+mensaje);
		return false;
	}
	
	//Comprobar sintaxis de direccion e-mail
	if (!validarEmail(document.formulario.email.value)){
		alert("Lo siento, La dirección de email no es correcta. Vuelva a escribirla.");
		return false;
	}
	else if (!document.formulario.condiciones.checked){
		alert("Debe Aceptar Las Condiciones del Servicio");
	}
	else
  	document.formulario.submit();
}



// Abrir Ventana

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// Funcion de PopUp genérico

var ventana;
function popUp(fichero){

	ventana=window.open('','ventana','width=500,height=380,status=yes')
	var texto = "<html><head><title>Ampliación de la imagen</title>";
	texto = texto +"</head><body bgcolor='#c7d9e0' text='#666666' leftmargin='5' topmargin='5' marginwidth='5' marginheight='5' onClick='javascript:window.close();'>";
	texto = texto + "<img src='"+fichero+"' width='480' height='360'></body></html>"	
	ventana.document.open("text/html","replace");
	ventana.document.write(texto);
	ventana.focus();
}

