//////// RUTINAS JAVASCRIPT PARA CIRCUITO DE JEREZ ///////// Arconet Servicios Telemáticos S.L. 2003 ///

function EsNumerico (valor) { return !(isNaN(valor)); }

// DETECCION BROWER
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function EmailHTML(usuario,dominio,clase){
var HTMLContent="";
 if(usuario!=undefined && dominio!=undefined){
  HTMLContent+="<a href=mailto:"+usuario+"@"+dominio; 
  HTMLContent+= (clase!=undefined) ? " class="+clase+">" : ">";
  HTMLContent+= usuario+"@"+dominio;
  HTMLContent+="</a>";
  document.write(HTMLContent);
 }
}


// PARA INSERTAR OBJETOS FLASH Y EVITAR EL PROBLEMA DE SEGURIDAD CON IE
function ObjetoFlash(id,archivo,ancho,alto,bgcolor,clase){
var str1 = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"';
var str2 = 'width='+ ancho +' height='+ alto +' id='+ id +' class="'+ clase +'">';
var str3 = '<param name="movie" value="'+ archivo +'" />';
var str4 = '<param name="quality" value="high" /><param name="menu" value="false" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="sameDomain" />';
var str5 = '<param name="bgcolor" value="'+ bgcolor +'"/>';
if (bgcolor=='transparent'){ str5 = '<param name="wmode" value="'+ bgcolor +'"/>'; }
var str6 = '<embed src="'+ archivo +'" quality="high" width="'+ ancho +'" height="'+ alto +'" name="'+ id +'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"';
var str7 = ' bgcolor="'+ bgcolor +'" /></object>';
if (bgcolor=='transparent'){ str7 = ' wmode="'+ bgcolor +'" /></object>'; }
document.write(str1+str2+str3+str4+str5+str6+str7);
}

// VALIDACION DEL FORMULARIO DE REGISTRO
function ValidaLogin(elform){
var todok=true;
var msgerror='Para acceder a la zona reservada se requiere:\n\n';
if (elform.usuario.value==""){msgerror+=' - Su identificador de usuario\n';todok=false;}
if (elform.clave.value==""){msgerror+=' - Su contrase\xF1a\n';todok=false;}
if (todok){
	elform.acceder.disabled=true;
	document.getElementById('progreso').style.visibility='visible';
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

// INGLÉS
function ValidaLoginEN(elform){
var todok=true;
var msgerror='To access the reserved zone is required: \n\n';
if (elform.usuario.value==""){msgerror+=' - Your user name\n';todok=false;}
if (elform.clave.value==""){msgerror+=' - Your password\n';todok=false;}
if (todok){
	elform.acceder.disabled=true;
	document.getElementById('progreso').style.visibility='visible';
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}

// VALIDACION DEL FORMULARIO DE REGISTRO
function ValidaLogin2(elform){
var todok=true;
var msgerror='Para acceder a la zona reservada es necesario que proporcione:\n\n';
if (elform.usuario.value==""){msgerror+=' - Su identificador de usuario.\n';todok=false;}
if (elform.clave.value==""){msgerror+=' - Su contrase\xF1a de usuario.\n';todok=false;}
if (todok){
	elform.acceder.disabled=true;
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}
// INGLÉS
function ValidaLoginEN2(elform){
var todok=true;
var msgerror='To access the reserved zone is required: \n\n';
if (elform.usuario.value==""){msgerror+=' - Your user name.\n';todok=false;}
if (elform.clave.value==""){msgerror+=' - Your password.\n';todok=false;}
if (todok){
	elform.acceder.disabled=true;
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}



// VALIDACION DEL FORMULARIO DE CONTACTO
function ValidaContacto(elform){
var todok=true;
var msgerror='Los siguientes datos son obligatorios:\n\n';
if (elform.nombre.value==""){msgerror+=' - Su nombre.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - Su E-mail.\n';todok=false;}
if (!EsNumerico(elform.preguntacontrol.value)){elform.preguntacontrol.value='';}
if (elform.preguntacontrol.value==""){msgerror+=' - Resultado de la pregunta de control.\n';todok=false;}
if (todok){
	elform.enviar.disabled=true;
	document.getElementById('progreso').style.visibility='visible';
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}
// INGLÉS
function ValidaContactoEN(elform){
var todok=true;
var msgerror='This information is needed: \n\n';
if (elform.nombre.value==""){msgerror+=' - Your full Name.\n';todok=false;}
if (elform.email.value==""){msgerror+=' - your email address.\n';todok=false;}
if (!EsNumerico(elform.preguntacontrol.value)){elform.preguntacontrol.value='';}
if (elform.preguntacontrol.value==""){msgerror+=' - Result of the question of control.\n';todok=false;}
if (todok){
	elform.enviar.disabled=true;
	document.getElementById('progreso').style.visibility='visible';
}
if (!todok){alert(msgerror);return(false)} else {return(true)}
}


// EFECTOS AL PASAR CURSOR SOBRE MINI-FOTOGRAFIAS
function EfectoMinifoto(lafoto,activo){
if (activo){
	lafoto.style.filter='alpha(opacity=100)';
	lafoto.style.border='1px solid white';
 } else {
	lafoto.style.filter='alpha(opacity=50)';
	lafoto.style.border='1px solid red';
 }
}


// Abre ventana para ver foto
function OpenFoto(imagen,texto){
var codigo1='<html><head><title>CIRCUITO DE JEREZ .::. Fotografía: ' + texto + '</title><link href="../css/circuito.css" rel="STYLESHEET" type="text/css"></head><body leftmargin=0 topmargin=0 bgcolor=black style="background:black;"><div align=right><img src="../graf/logofoto.gif" alt="" width="470" height="34" border="0"></div><table border=0 width="100%" height="90%"><tr><td width="100%" height="70%" align=center valign=middle bgcolor="black">';
var codigo2='</td></tr></table><table width="100%" bgcolor="#222222"><tr><td><b><font face=arial size=2 color=silver>' + texto + '</td><td align=right><input type=button class="botoncerrar" value="||| cerrar" onclick="javascript:window.close()"></td></tr></table></body></html>';
doctag = '<img src="' + imagen + '" border=0 style="border:1px solid red">';
ventana=open("","IMAGEN","width=640,height=480,scrollbars=yes,resizable=yes,left=100,top=100,screenX=100,screenY=100");
ventana.document.write(codigo1);
ventana.document.write(doctag);
ventana.document.write(codigo2);
}
// INGLÉS
function OpenFotoEN(imagen,texto){
var codigo1='<html><head><title>CIRCUITO DE JEREZ .::. Photo: ' + texto + '</title><link href="../css/circuito.css" rel="STYLESHEET" type="text/css"></head><body leftmargin=0 topmargin=0 bgcolor=black style="background:black;"><table border=0 width="100%" height="100%"><tr><td width="100%" height="92%" align=center valign=middle bgcolor="black">';
var codigo2='</td></tr></table><div align=right style="background:gray;"><input type=button class="botoncerrar" value="|||  close" onclick="javascript:window.close()"></div></body></html>';
doctag = '<img src="' + imagen + '" border=0 style="border:1px solid red">';
ventana=open("","IMAGEN","width=640,height=480,scrollbars=yes,resizable=yes,left=100,top=100,screenX=100,screenY=100");
ventana.document.write(codigo1);
ventana.document.write(doctag);
ventana.document.write(codigo2);
}

// Abre ventana para ver foto
var ventanaabierta=false;
function OpenTribuna(imagen,texto){
var codigo1='<html><head><title>CIRCUITO DE JEREZ .::. Fotografía: ' + texto + '</title></head><body leftmargin=0 topmargin=0 bgcolor=black><div align=right><img src="../graf/logofoto.gif" alt="" width="470" height="34" border="0"></div><table border=0 width="100%"><tr><td width="100%" align=center valign=middle bgcolor="black">';
var codigo2='</td></tr></table><table width="100%" bgcolor="#222222"><tr><td><b><font face=arial size=2 color=silver>' + texto + '</td><td align=right><input type=button value="cerrar" onclick="javascript:window.close()"></td></tr></table></body></html>';
doctag = '<img src="' + imagen + '" border=0 style="border:1px solid red">';
if (ventanaabierta){ventana.close()}
ventana=open("","TRIBUNA","width=490,height=350,scrollbars=yes,resizable=yes,left=100,top=100,screenX=100,screenY=100");
ventana.document.write(codigo1);
ventana.document.write(doctag);
ventana.document.write(codigo2);
ventanaabierta=true;
}

// Para abrir highslide
function OpenTribunaHS(imagen,texto){
var ancla=document.getElementById('afotohs');
if (ancla != undefined){
	document.getElementById('divfotohstext').innerText=texto;
	ancla.href=imagen;
	ancla.click();
	}
}

// Abre ventana para ver foto de tribuna desde la pagina de precios
var ventanaabierta=false;
function OpenTribuna2(imagen,texto){
var codigo1='<html><head><title>CIRCUITO DE JEREZ .::. Fotografía: ' + texto + '</title></head><body leftmargin=0 topmargin=0 bgcolor=black><div align=right><img src="../../graf/logofoto.gif" alt="" width="470" height="34" border="0"></div><table border=0 width="100%"><tr><td width="100%" align=center valign=middle bgcolor="black">';
var codigo2='</td></tr></table><table width="100%" bgcolor="#222222"><tr><td><b><font face=arial size=2 color=silver>' + texto + '</td><td align=right><input type=button value="cerrar" onclick="javascript:window.close()"></td></tr></table></body></html>';
doctag = '<img src="' + imagen + '" border=0 style="border:1px solid red">';
if (ventanaabierta){ventana.close()}
ventana=open("","TRIBUNA","width=490,height=350,scrollbars=yes,resizable=yes,left=100,top=100,screenX=100,screenY=100");
ventana.document.write(codigo1);
ventana.document.write(doctag);
ventana.document.write(codigo2);
ventanaabierta=true;
}


// OBTIENE FECHA ACTUAL
	var laFecha = new Date();
	var elMes = laFecha.getMonth();
	var elDia = laFecha.getDate();
	var elAnio = laFecha.getYear();
	var elDiaS = laFecha.getDay();
	var Ameses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
	var AmesesI = new Array ("January","February","March","April","May","Juny","July","August","September","October","November","December");
	var ADiaS = new Array ("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
// ESCRIBE LA FECHA EN EL HTM
function PonFecha(){
	document.write( ADiaS[elDiaS] + "&nbsp;" );
	document.write( elDia + "&nbsp;de&nbsp;" );
	document.write( Ameses[elMes] + "&nbsp;de&nbsp;" );
	document.write( elAnio );
}
// ESCRIBE EL NOMBRE DEL MES DE UNA FECHA DADA
/*function PonMes(elmes){
	document.write( Ameses[elmes] )
}*/


// ABRIDOR DE VENTANA DE NOTICIAS
function VerNoticia(URLNoticia){
var parametros = "width=600,height=480,scrollbars=yes,status=yes,resizable=yes,menubar=yes,left=10,top=10,screenX=10,screenY=10";
 winnoticia = window.open (URLNoticia,'winnoticia',parametros);
}
// ABRIDOR DE VENTANA DE AYUDA
function AyudaNoticia(URLAyuda){
var parametros = "width=500,height=350,scrollbars=yes,status=yes,resizable=no,menubar=no,left=100,top=100,screenX=100,screenY=100";
 winnoticia = window.open (URLAyuda,'winayuda',parametros);
}


// PRECARGA DE IMAGENES	
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')}
}//preload('solapa','graf/solapaopc.gif');
// CAMBIA EL OBJETO DE UNA IMAGEN
function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src")
	}
}



// BARRAS DE GRUPOS DE ITEMS
preload('baritem1','../graf/barratitleft1.gif');
preload('baritem2','../graf/barratitleft2.gif');


function VerBloque(idobjeto,idimagen){
var objeto=document.getElementById(idobjeto);
var imagen=document.getElementById(idimagen);
if (imagen!=undefined){ if (imagen.src==baritem1.src){imagen.src=baritem2.src} else {imagen.src=baritem1.src} }
if (objeto!=undefined){ if (objeto.style.display=='none'){ objeto.style.display='block'} else {objeto.style.display='none'}}
}

function VerBloqueSinIMG(iobjeto){
var objeto=document.getElementById(idobjeto);
if (objeto.style.display=='none'){ objeto.style.display='block'} else {objeto.style.display='none'}
}


// MOSTRAR Y OCULTAR CAPAS
function VerCapa(id){
// Netscape 4
if(ns4){ document.layers[id].visibility = "show"; }
// Explorer 4
else if(ie4){ document.all[id].style.visibility = "visible"; }
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){ document.getElementById(id).style.visibility = "visible";}
}

function OcultaCapa(id){
// Netscape 4
if(ns4){ document.layers[id].visibility = "hide";}
// Explorer 4
else if(ie4){ document.all[id].style.visibility = "hidden"; }
// W3C - Explorer 5+ and Netscape 6+
else if(ie5 || ns6){ document.getElementById(id).style.visibility = "hidden"; }
}


function OpenWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

