/* formulario */ 
	function ValidarMail(emailStr){
	    var checkTLD=1;
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		var emailPat=/^(.+)@(.+)$/;
	    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars="\[^\\s" + specialChars + "\]";
		var quotedUser="(\"[^\"]*\")";
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom=validChars + '+';
		var word="(" + atom + "|" + quotedUser + ")";
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray=emailStr.match(emailPat);

		if (matchArray==null) {
			return false;
		}

		var user=matchArray[1];
		var domain=matchArray[2];
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {
				return false;
			}
		}

		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				return false;
			}
		}

		if (user.match(userPat)==null) {
		    return false;
		}

		var IPArray=domain.match(ipDomainPat);

		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					return false;
				}
			}
			return true;
		}

		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
			if (domArr[i].search(atomPat)==-1) {
				return false;
			}
		}

		if (checkTLD && domArr[domArr.length-1].length!=2 &&
			domArr[domArr.length-1].search(knownDomsPat)==-1) {
			return false;
		}

		if (len<2) {
			return false;
		}
		return true;
	}

	function RestaurarEstilos(elemento){
		document.getElementById(elemento).style.background = "#FFF";
		document.getElementById(elemento).style.color = "#000";
	}

	function EstiloError(elemento){
		document.getElementById(elemento).style.background = "#F75155";
		document.getElementById(elemento).style.color = "#FFF";
	}


	function ValidarFormEmail (formulario) {
		var error = false;
		
		if(formulario.mail.value.length == 0 || !ValidarMail(formulario.mail.value)){
			EstiloError('mail');
			error = true;
		}else{
			RestaurarEstilos('mail');
		}
	
		if(formulario.mail_rep.value.length == 0 || !ValidarMail(formulario.mail_rep.value)){
			EstiloError('mail_rep');
			error = true;	
		}else{
			if(formulario.mail_rep.value != formulario.mail.value && formulario.mail.value.length > 0){
				EstiloError('mail_rep');
				error = true;
			}else{
				RestaurarEstilos('mail_rep');
			}		
		}		
		
		
		if(!error){
			return true;
		}else{
			
				document.getElementById("div-error").style.visibility = "Visible";
				document.getElementById("div-error").style.height = "30px"	;
				document.getElementById("div-error").style.padding = "8px";
				document.getElementById("div-error").style.margin = "10px auto 15px auto";
			
			return false;
		}		
	}


<!-- 
	function Validar(formulario)
	{
		
		var error = false;
		
		
	if (formulario.name.value.length<=0 || formulario.name.value.length>100) {
			//alert("El campo 'NOMBRE' debe ser una cadena de 1 a 100 caracteres.");
			EstiloError('name');
			error = true
	}else{
			RestaurarEstilos('name');
	}
	if (formulario.empresa.value.length<=0 || formulario.empresa.value.length>25) {
			//alert("El campo 'COMPAÑIA' debe ser una cadena de 5 a 25 caracteres.");
			EstiloError('empresa');
			error = true
	}else{
			RestaurarEstilos('empresa');
	}
	if (formulario.pais.value.length<=0 || formulario.pais.value.length>50) {
			//alert("El campo 'PAIS' debe ser una cadena de 1 a 50 caracteres.");
			EstiloError('pais');
			error = true
	}else{
			RestaurarEstilos('pais');
	}

	if(formulario.mail.value.length == 0 || !ValidarMail(formulario.mail.value)){
		EstiloError('mail');
		error = true;
	}else{
		RestaurarEstilos('mail');
	}
	
	if(formulario.mail_rep.value.length == 0 || !ValidarMail(formulario.mail_rep.value)){
		EstiloError('mail_rep');
		error = true;	
	}else{
		if(formulario.mail_rep.value != formulario.mail.value && formulario.mail.value.length > 0){
			EstiloError('mail_rep');
			error = true;
		}else{
			RestaurarEstilos('mail_rep');
		}		
	}	

	if (formulario.actividades.value.length<=0 || formulario.actividades.value.length>100) {
			//alert("El campo 'actividades' debe ser una cadena de 10 a 100 caracteres.");
			EstiloError('actividades');
			error = true;
	}else{
			RestaurarEstilos('actividades');
	}
	
	actividades=formulario.actividades.value;

	for (var bucle=0;bucle<actividades.length;bucle++){
		if(-1!=actividades.indexOf(" "))
		{
			EspacioBlanco = actividades.indexOf(" "); //posición del espacio en blanco
			var TresEspacios = 1;
			for (var cont=EspacioBlanco; cont<(EspacioBlanco+2);cont++){
				
				if(actividades.charAt(cont) == " ")	{
				TresEspacios++; 
				
				}
				if (TresEspacios==3){
					//alert("El campo 'actividades' debe contener texto");
					EstiloError('actividades');
					error = true;
				}else{
						RestaurarEstilos('actividades');
				}
			}	
			
		}
	}
		if(!error){
			return true;
		}else{
				document.getElementById("div-error").style.visibility = "Visible";
				document.getElementById("div-error").style.height = "30px"	;
				document.getElementById("div-error").style.padding = "8px";
				document.getElementById("div-error").style.margin = "10px 0 15px 0";
			
			return false;
		}
	}
//-->


// acordeon

var TINY={};

function T$(i){return document.getElementById(i)}
function T$$(e,p){return p.getElementsByTagName(e)}

TINY.accordion=function(){
	function slider(n){this.n=n; this.a=[]}
	slider.prototype.init=function(t,e,m,o,k){
		var a=T$(t), i=s=0, n=a.childNodes, l=n.length; this.s=k||0; this.m=m||0;
		for(i;i<l;i++){
			var v=n[i];
			if(v.nodeType!=3){
				this.a[s]={}; this.a[s].h=h=T$$(e,v)[0]; this.a[s].c=c=T$$('div',v)[0]; h.onclick=new Function(this.n+'.pr(0,'+s+')');
				if(o==s){h.className=this.s; c.style.height='auto'; c.d=1}else{c.style.height=0; c.d=-1} s++
			}
		}
		this.l=s
	};
	slider.prototype.pr=function(f,d){
		for(var i=0;i<this.l;i++){
			var h=this.a[i].h, c=this.a[i].c, k=c.style.height; k=k=='auto'?1:parseInt(k); clearInterval(c.t);
			if((k!=1&&c.d==-1)&&(f==1||i==d)){
				c.style.height=''; c.m=c.offsetHeight; c.style.height=k+'px'; c.d=1; h.className=this.s; su(c,1)
			}else if(k>0&&(f==-1||this.m||i==d)){
				c.d=-1; h.className=''; su(c,-1)
			}
		}
	};
	function su(c){c.t=setInterval(function(){sl(c)},20)};
	function sl(c){
		var h=c.offsetHeight, d=c.d==1?c.m-h:h; c.style.height=h+(Math.ceil(d/5)*c.d)+'px';
		c.style.opacity=h/c.m; c.style.filter='alpha(opacity='+h*100/c.m+')';
		if((c.d==1&&h>=c.m)||(c.d!=1&&h==1)){if(c.d==1){c.style.height='auto'} clearInterval(c.t)}
	};
	return{slider:slider}
}();
    

function btActivo( e, lan ){  document.getElementById(e).src = "http://www.model-co.com/images/btn_mas_info_" + lan + "_on.jpg";  }
function btNoActivo( e, lan ){ document.getElementById(e).src = "http://www.model-co.com/images/btn_mas_info_" + lan + "_off.jpg"; }

function btMaqActivo( e ){  document.getElementById(e).className = "foto-dark-opacity";  }
function btMaqNoActivo( e ){ document.getElementById(e).className = "foto-dark"; }

function btFlagActivo( e ){ document.getElementById(e).className = "flag-opacity";  }
function btFlagNoActivo( e ){ document.getElementById(e).className = ""; }

function btSubmitActivo ( e ){ document.getElementById(e).className = "submit-opacity"; }
function btSubmitNoActivo( e ){ document.getElementById(e).className = "img-login-form"; }

function btWorldActivo( e, lan ){  document.getElementById(e).src = "http://www.model-co.com/images/modelco_mundo_" + lan + "_on.jpg";  }
function btWorldNoActivo( e, lan ){ document.getElementById(e).src = "http://www.model-co.com/images/modelco_mundo_" + lan + "_off.jpg"; }

function cambiaFoto(e, path_url){
	
	var pathFotoOriginal = document.getElementById("foto_maqBB").src;
	var arrPath = pathFotoOriginal.split("/");
    var idFotoOriginal = arrPath[arrPath.length-1].replace(".jpg","");
	
	if (e != idFotoOriginal){
		document.getElementById(e).className = "maq-foto-seleccionada";
		document.getElementById(idFotoOriginal).className = "maq-foto-gall";
		document.getElementById("foto_maqBB").src = path_url ;
	}
}

