function chgCaptcha(){
	document.getElementById('image').src='_security/securimage_show.php?sid='+Math.random();
	}
	
function hideAlert(){
 document.getElementById('idAlert').style.display = "none";
 document.getElementById('idAlertCenter').style.display = "none";
}
	function abrir(direccion, pantallacompleta, herramientas, direcciones, 
									estado, barramenu, barrascroll, cambiatamano, ancho, alto, 
									izquierda, arriba, sustituir) {
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"vpopup",opciones,sustituir);
	}
	function MostrarPassword() {
		if (document.form1.changePW.checked == true) {
				document.getElementById('areaPW').style["display"] = "";
				document.getElementById('areaPW2').style["display"] = "";
		}
		else {
				document.getElementById('areaPW').style["display"] = "none";
				document.getElementById('areaPW2').style["display"] = "none";
		}
	}	
	function validar(formulario,msg1,msg2,msg3,msg4,msg5) { 
		if (formulario.Usuario.value == "") {
			alert(msg1);
			return false 
		}		
		if (document.form1.changePW.checked == true) {		
			if (formulario.pw1.value != formulario.pw2.value) {
  			alert("ERROR. Las passwords no coinciden.");
	  	  return false  						
			}		
			if (((formulario.pw1.value == "") ||	(formulario.pw2.value == "")) && formulario.pwObligatori.value == "1") {
  			alert("ERROR. Debes rellenar el campo de password.");
	  	  return false 			
			}
			if (((formulario.pw1.value.length<=4) || (formulario.pw1.value.length>10)) && formulario.pwObligatori.value == "1") {
  			alert("ERROR. La password debe tener entre 5 y 10 carácteres.");
	  	  return false 						
			}
		}
		for (var i=0; i<formulario.length; i++) { 
			if ((formulario[i].type == "text") && (formulario[i].name.indexOf("*")!=-1) && (formulario[i].value == "")) {
				alert(msg2);
				return false
			}
		}		
		if (formulario.Email.value == "" && formulario.pwUsuEsMail.value == "0") {
			alert(msg3);
			return false 
		}	
		if (formulario.pwUsuEsMail.value == "1") {
			if(echeck(formulario.Usuario.value)==false){
				alert(msg4);
				return false 
			}
		}	
		if (document.form1.confirmar.checked == false) {
  		alert(msg5);  		
	  	return false 						
		}				
	}
	
	function validarComment(formulario,msg) {
		if (formulario.cuerpo.value == "") {
			alert(msg);
			return false 
		}	
	}
	function validarCommentForo(formulario,msg) {
		if (formulario.cuerpo.value == "") {
			alert(msg);
			return false 
		}
		if (formulario.asunto.value == "") {
			alert(msg);
			return false 
		}
	}
	
	function echeck(str) {   
		var at="@"
  	var dot="."
  	var lat=str.indexOf(at)
  	var lstr=str.length
  	var ldot=str.indexOf(dot)
	  if (str.indexOf(at)==-1){
	     return false
	  }   if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	     return false
	  }   if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	      return false
	  }    if (str.indexOf(at,(lat+1))!=-1){
	      return false
	   }    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	      return false
	   }    if (str.indexOf(dot,(lat+2))==-1){
	      return false
	   }
	  
	   if (str.indexOf(" ")!=-1){
	      return false
	   }     return true     
 } 
 
 function validarContacto(txt){
	c1 = document.fo.email.value.length;
	c2 = document.fo.asunto.value.length;
	c3 = document.fo.mensaje.value.length;
	if(!(c1*c2*c3)){
	alert(txt);
	return false;
	}else{
	 document.fo.submit();
	 }
 }  
 
 function chgLang(value, posLang, href1, href2, href3){
		if(value<3 && posLang>0){
			location.href = href1+value+href2;
		}else if(value<3){
			location.href = href3+'?lang='+value;
		}else{
			window.open('http://translate.google.com/translate?hl=es&sl=es&tl='+value+'&u=http%3A%2F%2Fflashticsalut.com%2Fhome.php%3Flang%3D1','transWin');
		}
	}
	
function func_focusRegNl(){
	document.fregnl.email.value="";
	document.fregnl.email.style.color = '#000000';
}

function func_focusSearch(){
	document.fbuscador.qsearch.value="";
	document.fbuscador.qsearch.style.color = '#000000';
}

function func_showDivAdvice(iddiv){
	div = document.getElementById('idListaCat'+iddiv);
	li = document.getElementById('idLi'+iddiv);
	if(div.style.display=='none'){
		div.style.display = 'block';
		li.style.listStyleImage = 'url(_img/ulDown.gif)';
	}else{
		div.style.display = 'none';
		li.style.listStyleImage = 'url(_img/ulRight.gif)';
	}
}

function func_showDivAdvice2(iddiv){
	div = document.getElementById('idSListaCat'+iddiv);
	if(div.style.display=='none'){
		div.style.display = 'block';
	}else{
		div.style.display = 'none';
	}
}

function func_showDivRec(iddiv){
	div = document.getElementById('idListaCat'+iddiv);
	li = document.getElementById('idLi'+iddiv);
	if(div.style.display=='none'){
		div.style.display = 'block';
		li.style.listStyleImage = 'url(_img/ulDownB.gif)';
	}else{
		div.style.display = 'none';
		li.style.listStyleImage = 'url(_img/ulRightB.gif)';
	}
}

function getStyle(id){
	var temp = document.getElementById("idSubcat"+id).style.display;
	return temp;
}
function switchMain(ind,num){
	var current = getStyle(ind);
	if(num>0){
		if( current == "block"){
			document.getElementById("idSubcat"+ind).style.display = "none";
		}	else {
			var div = document.getElementById("idMenuCatBut"+ind);
			var top = 0;
			var left = div.offsetWidth;
			for (; div; div = div.offsetParent)
			{
				top += div.offsetTop;
				left += div.offsetLeft;
			} 
			document.getElementById("idSubcat"+ind).style.top = Number(top)+'px';
			document.getElementById("idSubcat"+ind).style.left = Number(left-13)+'px';
			document.getElementById("idSubcat"+ind).style.display = "block";
		}
	}
}