function lanzaMensaje(msg, url) {
  msg = msg.replace(/xxx/i, "\n");
  alert (msg);
  window.location = url;
}

function send(f) {
  f.submit();
}

function confirmOperation(f,op) {
  var msg;
  switch (op) {
    case "CompraSMS":
      msg = "Se dispone a comprar mediante mensaje SMS";
      break;
    case "CompraBONO":
      var marcado;
      marcado = false;
      for (i=0;i<f.radIdBono.length;i++){
        if (f.radIdBono[i].checked) {
          marcado = true;
          break;
        }
      }
      if (marcado) {
        msg = "Se dispone a comprar mediante un Bono";
      } else {
        alert("Debe de marcar uno de los bonos disponibles");
        return;
      }
  }
  if (confirm(msg+'.\n\nøDesea continuar?')) f.submit();
}

var ventana;

function openIT(URL,name,prop) {
  if (ventana) {
    if (ventana.closed) {
      ventana=open(URL,name,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      ventana.focus();
    }
    else {
      ventana=open(URL,name,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");
      ventana.focus();
    }
  }
  else {
      ventana=open(URL,name,prop+",location=no,status=no,directories=no,toolbar=no,resizable=no,menubar=no");          
      ventana.focus();
  }
}

function printIt() {
  window.print();
}

function zoomText(Accion,Elemento){
  //inicializaciones
  obj=document.getElementById(Elemento);
  if (obj.style.fontSize==""){
  obj.style.fontSize="100%";
  }
  actual=parseInt(obj.style.fontSize); //valor actual del tamaÒo del texto
  incremento=10;// el valor del incremento o decremento en el tamaÒo
  
  //accion sobre el texto
  if(Accion=="reestablecer"){
  obj.style.fontSize="100%"
  }
  if(Accion=="aumentar"){
  		valor=actual+incremento;
  	if(valor <= 130){
  		
  		
  		obj.style.fontSize=valor+"%"
  	}
  }
  if(Accion=="disminuir"){
  		valor=actual-incremento;
  	if(valor >= 70) {
  		
  		obj.style.fontSize=valor+"%"
  	}
  }
}


function login(f) {
  if ((f.pass.value != "") && (f.user.value != ""))
    f.submit();
  else
    alert("Debe rellenar obligatoriamente\nel usuario y la password");
}

function express(f) {
	if(validateEmail(f.txtEmail.value) == false){
		alert("Por favor, compruebe su correo.");
	}else {
		f.submit();	
	}
}


function comentarios(f)
{
  if ((f.txtComentario.value != "") && (f.txtNombre.value != "") && (f.txtEmail.value != "") ) {
  	
	if(f.chkAcepto.checked == false){
		alert("Debe aceptar la clausula de privacidad.");
	}else {
		if(validateEmail(f.txtEmail.value) == false){
			alert("Por favor, compruebe su correo.");
		}
		else {
			//alert("submit");
			f.submit();	
		}		
	}
    
    
  } else {
    alert("Debe rellenar obligatoriamente\nel nombre y el email");
  }
}

function enviar_amigo(f)
{
  if ((f.txtTuNombre.value != "") && (f.txtTuEmail.value != "") && (f.txtSuNombre.value != "") && (f.txtSuEmail.value != "")  ) {
  	
	if(validateEmail(f.txtTuEmail.value) == false){
		alert("Por favor, compruebe su correo.");
	}
	else {
	
		if(validateEmail(f.txtSuEmail.value) == false){
			alert("Por favor, compruebe el correo de su amigo.");	
		} else {
			f.submit();		
		}

   }
  } else {
    alert("Debe rellenar obligatoriamente\n todos los campos");
  }
 
}


function buscador(f) {
	f.submit();
}



function recuerda(f) {
  if(validateEmail(f.txtEmail.value) == false){
		alert("Por favor, compruebe su correo.");
	}
	else {
		//alert("submit");
		f.submit();	
	}
}

function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}

function votos(f) {
	f.submit();
}
//mostrar y ocultar capas (div)

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
//With nested layers for netscape, this function hides the layer if it's visible and visa versa
function showHide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	if(obj.visibility=='visible' || obj.visibility=='show') obj.visibility='hidden'
	else obj.visibility='visible'
}

//Shows the div
function show(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='visible'
}
//Hides the div
function hide(div,nest){
	obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
	obj.visibility='hidden'
}