/******************************************************************/
/* TABBED PANELS SWITCH */
function tabSwitch(new_tab, new_content) {
	if (document.getElementById('content_1') != null)
    	document.getElementById('content_1').style.display = 'none';   
	if (document.getElementById('content_2') != null)
    	document.getElementById('content_2').style.display = 'none';   
	if (document.getElementById('content_3') != null)
    	document.getElementById('content_3').style.display = 'none';   
	if (document.getElementById('content_4') != null)
    	document.getElementById('content_4').style.display = 'none';   
	if (document.getElementById('content_5') != null)
    	document.getElementById('content_5').style.display = 'none';   
	if (document.getElementById('content_6') != null)
    	document.getElementById('content_6').style.display = 'none';   
	if (document.getElementById('content_7') != null)
    	document.getElementById('content_7').style.display = 'none';   
	if (document.getElementById('content_8') != null)
    	document.getElementById('content_8').style.display = 'none';   

    document.getElementById(new_content).style.display = 'block';      
  
	if (document.getElementById('tab_1') != null)
	    document.getElementById('tab_1').className = '';   
	if (document.getElementById('tab_2') != null)
	    document.getElementById('tab_2').className = '';   
	if (document.getElementById('tab_3') != null)
	    document.getElementById('tab_3').className = '';   
	if (document.getElementById('tab_4') != null)
	    document.getElementById('tab_4').className = '';   
	if (document.getElementById('tab_5') != null)
	    document.getElementById('tab_5').className = '';   
	if (document.getElementById('tab_6') != null)
	    document.getElementById('tab_6').className = '';   
	if (document.getElementById('tab_7') != null)
	    document.getElementById('tab_7').className = '';   
	if (document.getElementById('tab_8') != null)
	    document.getElementById('tab_8').className = '';   

    document.getElementById(new_tab).className = 'active';         
}  

function MM_preloadImages() { //v3.0
  var d=document; 
  if(d.images){
  	 if(!d.MM_p) 
   		d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
    for(i=0; i<a.length; i++)
   		 if (a[i].indexOf("#")!=0){ 
   	 		d.MM_p[j]=new Image;
   	 		d.MM_p[j++].src=a[i];
   	 	}
   }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  	x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;
    if(!d) d=document; 
    if((p=n.indexOf("?"))>0&&parent.frames.length) {
   	 d=parent.frames[n.substring(p+1)].document;
   	 n=n.substring(0,p);
   	}
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; 
  document.MM_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){
   	document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
   	}
}

function MM_swapImage2() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function changeLanguaje(from, to) {
	var page = window.top.location.href;
	if(from=="en")
		MM_swapImage('ImageB1','','../images/menu/membreteinternon_04.gif',1);
	else
		MM_swapImage('ImageB2','','../images/menu/membreteinternon_06.gif',1);
	window.top.location = page.replace('/' + from + '/', '/' + to + '/');
}


/**********************************************************/
/** FORMS VALIDATION **/
/**********************************************************/

function isEmail(text){
	//alert("mail");
	var textoStr = text.value.toString();
	//Se transforma todo el Campo a String
	var tiene = 0;
	var tieneP= 0;	
	valor = true;

	for(var i = 0;i < textoStr.length;i++)	{ 
	//Se recorre letra por letra para analizar que tenga el caracter (@) y el (.)
		var oneChar = textoStr.charAt(i)
		if (oneChar == "@")		{ 
		//Se busca el Caracter Arroba en cada letra
			tiene = 1
		}
		if ((oneChar == ".")&&(tiene==1))		{ 
		//Se busca el punto una vez que ya fue encontrada el Caracter Arroba
			tieneP = 1
		}
	} //for
	
	if ((tiene != 1)||(tieneP!=1))	{ 
	//control de si se ha encontrado o no el Caracter Arroba
		valor=false;
	}	
	
	if ((valor==false)&&(textoStr!="")){
		//alert("Please enter a valid email address");
		document.frm.emailc.value="invalido";
	}
	return valor;
}//function




function checkdata(){
	var contacto = document.frm.contacto.value;
	var empresa = document.frm.empresa.value;
	var email = document.frm.email.value;
	var consulta = document.frm.consulta.value;
	//var mailOK=isEmail(document.frm.email);
	//alert("check");
	if((contacto=="")||(empresa=="")||(email=="")||(consulta =="")){//||(!mailOK)
		//alert("incompleto");
		document.frm.control.value="incompleto";
		document.frm.action="contactus.php";
		document.frm.submit();
		//return false;
	}else{	
		//alert(document.frm.email.value);
		if(isEmail(document.frm.email)==true){
			document.frm.action="contact.php";
			document.frm.submit();
			//alert("2");
			//return true;	
		}else{
			document.frm.control.value="incompleto";
			document.frm.action="contactus.php";
			document.frm.submit();
			//alert("3");
		}
	} 

}

function checkCVdata(){
	var nombre = document.frm.nombre.value;
	var apellido = document.frm.apellido.value;
	var email = document.frm.email.value;
	var adjunto = document.frm.adjunto.value;
	//var mailOK=isEmail(document.frm.email);
	//alert("check");
	if((nombre=="")||(apellido=="")||(email=="")||(adjunto =="")){//||(!mailOK)
		//alert("incompleto");
		document.frm.control.value="incompleto";
		document.frm.action="cv.php";
		document.frm.submit();
		//return false;
	}else{	
		//alert(document.frm.email.value);
		if(isEmail(document.frm.email)==true){
			document.frm.action="sendcv.php";
			document.frm.submit();
			//alert("2");
			//return true;	
		}else{
			document.frm.control.value="incompleto";
			document.frm.action="cv.php";
			document.frm.submit();
			//alert("3");
		}
	} 

}
