


//-----------------------------------------------------------------------------------------------
function AbreVentana( ruta, ancho, alto ) {
	var ventana = window.open(ruta,"popup","width="+ancho+",height="+alto+",location=no,directories=no,status=no,menubar=no,resizable=no,top=0,left=0" );
	ventana.focus();
}

//-----------------------------------------------------------------------------------------------
function validar( frm ) {
	var errno = 0;
	var NOMBRE = frm.nombre.value;
	var EMAIL = frm.email.value;
	var TEXTO = frm.texto.value;
	if ( NOMBRE == "" ) errno = 1;
	else if ( EMAIL == "" ) errno = 2;
	else if ( EMAIL.indexOf( "@" ) < 2 ) errno = 4;
	else if ( EMAIL.indexOf( "." ) < EMAIL.indexOf( "@" ) ) errno = 5;
	else if ( TEXTO == "" ) errno = 3;
	switch ( errno ) {
		case 1 : alert( "Por favor, indíquenos quién nos escribe" ); frm.nombre.focus(); break;
		case 2 : alert( "Por favor, introduzca un email de contacto" ); frm.email.focus(); break;
		case 3 : alert( "Por favor, escriba un mesnsaje" ); frm.texto.focus(); break;
		case 4 : case 5 : alert( "email incorrecto" ); frm.email.focus(); break;
		default : return true;
	}
	return false;
}	
//-----------------------------------------------------------------------------------------------
function validar_miniform( frm ) {
	var errno = 0;
	var NOMBRE = frm.nombre.value;
	var EMAIL = frm.email.value;
	if ( NOMBRE == "" ) errno = 1;
	else if ( EMAIL == "" ) errno = 2;
	else if ( EMAIL.indexOf( "@" ) < 2 ) errno = 3;
	else if ( EMAIL.indexOf( "." ) < EMAIL.indexOf( "@" ) ) errno = 4;
	switch ( errno ) {
		case 1 : alert( "Por favor, indíquenos quién nos escribe" ); frm.nombre.focus(); break;
		case 2 : alert( "Por favor, introduzca un email de contacto" ); frm.email.focus(); break;
		case 3 : case 4 : alert( "Email incorrecto" ); frm.email.focus(); break;
		default : return true;
	}
	return false;
}	
//-----------------------------------------------------------------------------------------------
function Volver( cad ) {
	window.location=cad;
}

//-----------------------------------------------------------------------------------------------
function validar_login( frm ) {
	var errno = 0;
	var LOGIN = frm.login.value;
	var PASS = frm.pass.value;
	if ( LOGIN == "" ) errno = 1;
	else if ( PASS == "" ) errno = 2;
	switch ( errno ) {
		case 1 : alert( "Por favor, indique un Usuario" ); frm.login.focus(); break;
		case 2 : alert( "Por favor, indique una Contraseña" ); frm.pass.focus(); break;
		default : return true;
	}
	return false;
}	
//-----------------------------------------------------------------------------------------------

function validar_email( frm ) {
	var errno = 0;
	var EMAIL = frm.email.value;
	//alert(EMAIL);
	if ( EMAIL == "" ) errno = 1;
	else if ( EMAIL.indexOf( "@" ) < 2 ) errno = 2;
	else if ( EMAIL.indexOf( "." ) < EMAIL.indexOf( "@" ) ) errno = 3;
	switch ( errno ) {
		case 1 : alert( "Por favor, introduzca un email de contacto" ); frm.email.focus(); break;
		case 2 : case 3 : alert( "email incorrecto" ); frm.email.focus(); break;
		default : return true;
	}
	return false;
}


/******************************************************************** 
Cambiar el zoom de la página y empleo de cookies 
*********************************************************************/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 0);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

function menu_home() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="269" height="176" id="menu" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="swf/menu.swf" />\n');
	document.write('<param name="menu" value="false" />\n');
	document.write('<param name="quality" value="high />\n');
	document.write('<param name="FlashVars" value="html_02=1" />\n');
	document.write('<param name="wmode" value="transparent"  />\n');
	document.write('<param name="bgcolor" value="#ffffff" />\n');
	document.write('<embed src="swf/menu.swf" menu="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="269" height="176" name="menu" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  />\n');
	document.write('</object>\n');

}



function menu_contacto() {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="269" height="176" id="menu" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
	document.write('<param name="movie" value="swf/menu.swf" />\n');
	document.write('<param name="menu" value="false" />\n');
	document.write('<param name="quality" value="high />\n');
	document.write('<param name="FlashVars" value="html_00=1" />\n');
	document.write('<param name="wmode" value="transparent"  />\n');
	document.write('<param name="bgcolor" value="#ffffff" />\n');
	document.write('<embed src="swf/menu.swf" menu="false" quality="high" wmode="transparent" bgcolor="#ffffff" width="269" height="176" name="menu" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"  />\n');
	document.write('</object>\n');

}

