
/*

----------------------------------------------------------------------------------------------------------------------------------------------------

BIBLIOTECA - THFunctions 5.1
THFantini - www.thfantini.com.br
ConsulteSistemas - www.consulteweb.com.br

----------------------------------------------------------------------------------------------------------------------------------------------------

- SWF
- Validacao
- Ferramentas
- Ajax
- Pop
- OnClick

----------------------------------------------------------------------------------------------------------------------------------------------------
FLASH - GERA FILME / SWFOBJECT
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

// SWFObject
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

///// SWFObject - THFlash
//THFlashValor='function%252520THFlash%252528div%25252Canimacao%25252Clargura%25252Caltura%25252Cfundo%25252Ctransp%252529%25257B%25250D%25250Adocument.write%252528%252527%25253Cdiv%252520id%25253D%252522thflash%252522%25253ETHFlash%252521%25253Cbr%25253EFilme%252520n%2525E3o%252520localizado%25253C/div%25253E%252527%252529%25253B%25250D%25250Avar%252520so%252520%25253D%252520new%252520SWFObject%252528%252522%252522+animacao+%252522.swf%252522%25252C%252520%252522mymovie%252522%25252C%252520%252522%252522+largura+%252522%252522%25252C%252520%252522%252522+altura+%252522%252522%25252C%252520%2525228%252522%25252C%252520%252522%252522%252529%25253B%25250D%25250Aso.addVariable%252528%252522titulo_str%252522%25252C%252520%252522THFlash%252522%252529%25253B%25250D%25250Aif%252528transp%25253D%25253D%2525221%252522%252529%25257Bso.addParam%252528%252522wmode%252522%25252C%252520%252522transparent%252522%252529%25253B%25257D%25250D%25250Aso.addParam%252528%252522bgcolor%252522%25252C%252520%252522%252522+fundo+%252522%252522%252529%25253B%25250D%25250Aso.addParam%252528%252522FlashVars%252522%25252C%252520%252522id_titulo%25253D%252522+%252520div%252520+%252522%252522%252529%25253B%252509%252509%25250D%25250Aso.write%252528%252522thflash%252522%252529%25253B%25250D%25250A%25257D';document.write('<'+'script>'+unescape(unescape(unescape(THFlashValor)))+'</s'+'cript>')
// THFlash("1","carousel","400","400","#ffffff","1");

// THFlash
function THFlash(nome_div,animacao,largura,altura,fundo,transp,texto)
	{
		var nome_div = nome_div;
		document.write("<div id='thflash"+ nome_div +"' style='display:block;text-align:left'>THFlash!<br>Filme não localizado</div>");
		var so = new SWFObject(""+animacao+".swf", "mymovie", ""+largura+"", ""+altura+"", "8", "");
		so.addVariable("titulo_str", "THFlash");
		if(transp=="1"){so.addParam("wmode", "transparent");}
		so.addParam("bgcolor", ""+fundo+"");
		so.addParam("FlashVars", "id_titulo="+ texto +"");
		so.write("thflash"+ nome_div +"");
	}

// THFlashPlayer
function THFlashPlayer(nome_div,animacao,largura,altura,fundo,transp,texto)
	{
		var nome_div = nome_div;
		document.write("<div id='thflash"+ nome_div +"' style='display:block;text-align:left'>THFlash!<br>Filme não localizado</div>");
		var so = new SWFObject(""+animacao+".swf", "mymovie", ""+largura+"", ""+altura+"", "8", "");
		so.addVariable("titulo_str", "THFlash");
		if(transp=="1"){so.addParam("wmode", "transparent");}
		so.addParam("bgcolor", ""+fundo+"");
		so.addParam("FlashVars", "mp3=files/"+ texto +"&amp;bgcolor1=C9CACE&amp;bgcolor2=EEEEEE&amp;buttoncolor=ffffff&amp;buttonovercolor=0&amp;slidercolor1=B43400&amp;slidercolor2=442A25&amp;sliderovercolor=BD0306&amp;textcolor=0");
		so.write("thflash"+ nome_div +"");
	}

// THFlashCapa
function THFCapa(animacao)
	{
		document.write("<table border='0' cellpadding='0' cellspacing='0' width='100%' height='100%'>");
		document.write("<tr><td align='center'>");
		document.write("<div id='thflash_index'>THFlash!<br>Filme não localizado</div>");
		var so = new SWFObject("includes/swf/"+animacao+".swf", "mymovie", "1005", "603", "8", "");
		so.addVariable("titulo_str", "THFlash");
		so.addParam("wmode", "transparent");
		so.write("thflash_index");
		document.write("</td></tr></table>");
	}

/*
----------------------------------------------------------------------------------------------------------------------------------------------------
GERAL / UTILITARIOS
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

// Sem Barra
function hidden(){ document.body.style.overflow='hidden'; }

// Gera IFrame
function THFrame(pagina,largura,altura,barra,nome){
document.write('<IFRAME src="'+pagina+'" name="'+nome+'" scrolling="'+barra+'" frameborder=0 width="'+largura+'" height="'+altura+'" marginheight="0" marginwidth="0"></iframe>');
}

/*
----------------------------------------------------------------------------------------------------------------------------------------------------
FORM - VALIDACAO / CADASTRO / CONSULTA / IDENTIFICACAO
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

// Buscar
function verificabusca(buscar)
	{
		if (buscar.PROCURAR.value.length == 0) {
		alert("DIGITE PARA BUSCAR!");
		buscar.PROCURAR.focus();
		return false;
		}

		return true;
	}

// Busca Interna
function verificabuscaint(buscar_int)
	{
		if (buscar_int.PROCURAR.value.length == 0) {
		alert("DIGITE PARA BUSCAR!");
		buscar_int.PROCURAR.focus();
		return false;
		}

		return true;
	}

// Confere E-mail
function isEmail_bad(elm)
	{
		  if (elm.value.indexOf("@") != "-1" &&
			elm.value.indexOf(".") != "-1" &&
			elm.value.indexOf("@.") == "-1" &&
			elm.value.indexOf(".br.") == "-1" &&
			elm.value.indexOf("\"") == "-1" &&
			elm.value.indexOf(" ") == "-1" &&
			elm.value.indexOf("'") == "-1" &&
			elm.value.indexOf(";") == "-1" &&
			elm.value.indexOf(",") == "-1" &&
			elm.value.indexOf("{") == "-1" &&
			elm.value.indexOf("}") == "-1" &&
			elm.value.indexOf("[") == "-1" &&
			elm.value.indexOf("]") == "-1" &&
			elm.value.indexOf("<") == "-1" &&
			elm.value.indexOf(">") == "-1" &&
			elm.value.indexOf("?") == "-1" &&
			elm.value.indexOf("|") == "-1" &&
			elm.value.indexOf("teste@teste.com") == "-1" &&
			elm.value.indexOf("teste@") == "-1" &&
			elm.value.indexOf("teste.com") == "-1" &&
			elm.value.indexOf("@teste.com.br") == "-1" &&
			elm.value.indexOf("TESTE@TESTE.com") == "-1" &&
			elm.value.indexOf("TESTE@") == "-1" &&
			elm.value.indexOf("TESTE.com") == "-1" &&
			elm.value.indexOf("@TESTE.com.br") == "-1" &&
			elm.value.indexOf("xx@xx.com") == "-1" &&
			elm.value.indexOf("xx@") == "-1" &&
			elm.value.indexOf("xxx@") == "-1" &&
			elm.value.indexOf("@xx.com") == "-1" &&
			elm.value.indexOf("@xxx.com") == "-1" &&
			elm.value.indexOf("@xx.com.br") == "-1" &&
			elm.value.indexOf("@xx.br") == "-1" &&
			elm.value.indexOf("123@") == "-1" &&
			elm.value.indexOf("12345@") == "-1" &&
			
			
			elm.value.length > 5 )
			return false;
		  else return true;
	}

// Cadastro Usuario
function VerificaCadastro(form)
	{
		  if (form.empresa.value.length == 0) {
		  alert("Informe a EMPRESA por favor.");
		  form.empresa.focus();
		  return false;
		  }
		  
		  if (form.nome.value.length == 0) {
		  alert("Informe o RESPONSÁVEL por favor.");
		  form.nome.focus();
		  return false;
		  }

		  if (form.telefone.value.length == 0 ) {
		  alert("Informe o TELEFONE por favor.");
		  form.telefone.focus();
		  return false;	
		  }
		  
		  if (form.email.value.length == 0 ) {
		  alert("Informe o EMAIL por favor.");
		  form.email.focus();
		  return false;
		  }

			/*
			if (form.senha.value.length == 0 ) {
			alert("Informe a SENHA por favor.");
			form.senha.focus();
			return false;
			}

			if (form.senha2.value.length == 0 ) {
			alert("Repita a SENHA por favor.");
			form.senha2.focus();
			return false;
			}

			var confere_senha = form.senha.value;
			var confere_senha2 = form.senha2.value;  

			if (confere_senha2 == confere_senha ){
			}else{
			alert("As SENHAS não conferem!");
			form.senha2.focus();
			return false;
			}
			*/

		  if (isEmail_bad(form.email) ) {
			alert("Seu E-MAIL está incorreto!");
			form.email.focus();
			return false;
		  }
		  return true;

	}


// Validacao - Verifica Email / Boletim / Cad / User
function VerificaEmail(formail)
	{
		  if (formail.email.value.length == 0 ) {
		  alert("Informaile o EMAIL por favor.");
		  formail.email.focus();
		  return false;
		  }

		  if (isEmail_bad(formail.email) ) {
			alert("Seu E-MAIL está incorreto!");
			formail.email.focus();
			return false;
		  }
		  return true;
	}

// Validacao - Verifica Email / WebMail
function VerificaWEmail(forwmail)
	{
		  if (forwmail.email.value.length == 0 ) {
		  alert("Informaile o EMAIL por favor.");
		  forwmail.email.focus();
		  return false;
		  }

		  if (isEmail_bad(forwmail.email) ) {
			alert("Seu E-MAIL está incorreto!");
			forwmail.email.focus();
			return false;
		  }
		  return true;
	}


// Validacao - Verifica User
function verificaLogin(form)
	{
		  if (form.login.value.length == 0 ) {
		  alert("Informe o seu EMAIL por favor.");
		  form.login.focus();
		  return false;
		  }

		  if (form.senha.value.length == 0 ) {
		  alert("Informe a sua SENHA por favor.");
		  form.senha.focus();
		  return false;
		  }
		  
		  
		  if (isEmail_bad(form.login) ) {
			alert("Seu E-MAIL está incorreto!");
			form.login.focus();
			return false;
		  }
		  return true;
	}

// Validacao - Verifica User / form padrao
function VerificaIndica(form)
	{
		  if (form.nome.value.length == 0 ) {
		  alert("Informe o seu NOME por favor.");
		  form.nome.focus();
		  return false;
		  }

		  if (form.email.value.length == 0 ) {
		  alert("Informe a seu EMAIL por favor.");
		  form.email.focus();
		  return false;
		  }

		  if (form.nome2.value.length == 0 ) {
		  alert("Informe o(a) AMIGO(A) por favor.");
		  form.nome2.focus();
		  return false;
		  }  

		  if (form.email2.value.length == 0 ) {
		  alert("Informe a seu EMAIL por favor.");
		  form.email2.focus();
		  return false;
		  }
		  
		  if (isEmail_bad(form.email) ) {
			alert("Seu E-MAIL está incorreto!");
			form.email.focus();
			return false;
		  }
		  
		  if (isEmail_bad(form.email2) ) {
			alert("O E-MAIL está incorreto!");
			form.email2.focus();
			return false;
		  }  
		  return true;
	}

// Validacao - Fale Conosco
function VerificaFale(form)
	{

		/*  if (form.nome.value.length == 0) {
		  alert("Informe o NOME por favor.");
		  form.nome.focus();
		  return false;
		  }
		  
		  if (form.email.value.length == 0 ) {
		  alert("Informe o EMAIL por favor.");
		  form.email.focus();
		  return false;
		  }
		  
		  if (form.telefone.value.length == 0 ) {
		  alert("Informe o TELEFONE por favor.");
		  form.telefone.focus();
		  return false;	
		  }
		  
		  if (form.cidade.value.length == 0 ) {
		  alert("Informe a CIDADE por favor.");
		  form.cidade.focus();
		  return false;	
		  }
	*/	  
		  //if (form.endereco.value.length == 0 ) {
		  //alert("Informe o ENDERECO por favor.");
		  //form.endereco.focus();
		  //return false;	
		  //}
		  
		/*  if (form.estado.selectedIndex < 0){
		  alert("Selecione o estado!");
		  form.estado.focus();
		  return (false);
		  }

		  if (form.estado.selectedIndex == 0){
		  alert("Selecione o estado!");
		  form.estado.focus();
		  return (false);
		  }  
		  
		  if (form.obs.value.length == 0 ) {
		  alert("Digite a sua MENSAGEM por favor.");
		  form.obs.focus();
		  return false;
		  }  
		  
		  if (isEmail_bad(form.email) ) {
		  alert("Seu E-MAIL está incorreto!");
		  form.email.focus();
		  return false;
		  }
		*/  
		  return true;
	}

// Validacao - Enquete
function verificaEnquete()
	{
		var cont=0; 
		if(!document.form.votar.length) 
		if (document.form.votar.checked==true) 
		return true; 

		for (i=0;i < document.form.votar.length;i++) 
		if (document.form.votar[i].checked==true) 
		cont++; 

		if(cont==0){ 
		alert('Selecione a RESPOSTA por favor!'); 
		return false; 
		}

		return true; 
	}


/*
----------------------------------------------------------------------------------------------------------------------------------------------------
LINKS / JANELAS / POPS / MODAL
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

function THFVolta(){ document.location.href="index.php"; }
function THFCarDet(id,menu){ document.location.href="produtos_det.php?LISTA=smenu&MENU="+menu+"&ID="+id+""; }
function THFContinua(){ document.location.href="index.php"; }
function THFTodos(menu,campo){ document.location.href="conteudo.php?LISTA=todos&MENU="+menu+"&BCAMPO="+campo+""; }
function THFOrcamento(){ document.location.href="orcamento_envia.php"; }

function THFPop(aURL,nomeJanela,width,height){ window.open(aURL,nomeJanela, 'width='+width+', height='+height+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no'); }
function THFPopSimples(aURL,nomeJanela,features){ window.open(aURL,nomeJanela,features); }
function THFComunicadoPop(){ window.open('includes/thfunctions_externos.php?acao=comunicado','comunicado', 'width=505, height=405, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no'); }
function THFIndicaPop(){ window.open('includes/thfunctions_externos.php?acao=indica','indica', 'width=303, height=275, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no'); }
function THFavoritosPop(dominio){ alert(dominio); }

function THFRss(){ window.open('includes/thfunctions_externos.php?acao=rss','oculto'); }
function THFAbreArquivo(pasta,arquivo,$id){ window.open(pasta+'/'+arquivo,'down', 'width=750, height=405, scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=yes, fullscreen=no'); }

/*
----------------------------------------------------------------------------------------------------------------------------------------------------
FERRAMENTAS - FUNCOES AJAX
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

// Abre-Fecha
function THFShowHide(divId)
	{
		var div = document.getElementById(divId);
		var seta = document.getElementById('botao_'+divId);
		if(div.style.display == "none") {
		div.style.display = "block";
		seta.src = "includes/layout/botao_fechar.gif";

		}else{
		div.style.display = "none";
		seta.src = "includes/layout/botao_fechar.gif";
			}
	}

// Grava Boletim
function THFBoletim()
	{
		var nome = document.formail.nome.value;
		var email = document.formail.email.value;
		var ajax = new AJAX();
		ajax_boletim.style.display = "block";
		ajax.Updater("includes/thfunctions_externos.php?acao=boletim&nome="+nome+"&email="+email+"","ajax_boletim","get","<img src=includes/icones/ico_carregando.gif><br>carregando...");
	}

// Acessa WebMail
function THFWebMail()
	{
		if (forwmail.email.value.length == 0 ) {
		  alert("Informaile o EMAIL por favor.");
		  forwmail.email.focus();
		  return false;
		}

		if (isEmail_bad(forwmail.email) ) {
			alert("Seu E-MAIL está incorreto!");
			forwmail.email.focus();
			return false;
		}else{

		var nome = document.forwmail.nome.value;
		var email = document.forwmail.email.value;
		var dominio = document.forwmail.dominio.value;
		
		window.open("https://mail.google.com/a/"+dominio,"_blank");
		//alert(nome+"-"+email+"-"+dominio);		  
		  
		}
		  
		  return true;		
	}

// Grava Enquete
function THFEnquete()
	{
		var votar = document.formenquet.enquete_total.value;
		var ajax = new AJAX();
		ajax_enquete.style.display = "block";
		ajax.Updater("includes/thfunctions_externos.php?acao=enquete&votar="+votar+"","ajax_enquete","get","<img src=includes/icones/ico_carregando.gif><br>carregando...");
	}

// Enquete / Exibicao valor
function THFVEnquete(campo)
	{
		if (campo.checked)   
		etotal = eval(campo.value);   
		document.formenquet.enquete_total.value = etotal;
	}
	
// Enquete / Resultado
function THFREnquete()
	{
		var ajax = new AJAX();
		ajax_enquete.style.display = "block";
		document.getElementById("ajax_ver").style.display = "none";
		ajax.Updater("includes/thfunctions_externos.php?acao=verenquete","ajax_enquete","get","<img src=includes/icones/ico_carregando.gif><br>carregando...");
	}


// Enquete / Fechar
function THFFEnquete()
	{
		document.getElementById("ajax_enquete").style.display = "none";
		document.getElementById("ajax_ver").style.display = "block";
	}

/*
----------------------------------------------------------------------------------------------------------------------------------------------------
PRODUTOS - FUNCOES GERAIS
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

// Tipo de Cadastro
function THFTipoCad(id)
	{

		if(id=='pf')
			{
				document.getElementById("pf").style.display = "block";
				document.getElementById("pj").style.display = "none";
				document.form.tipo.value = "pf";
				}else{
				document.getElementById("pf").style.display = "none";
				document.getElementById("pj").style.display = "block";
				document.form.tipo.value = "pj";
			}

	}



// Carrinho de Produtos
function THFCar(codigo,produto,valor)
	{
		var codigo = codigo;
		var produto = produto;
		var valor = valor;
		var medida = document.getElementById("medida").value;
		var quantidade = document.getElementById("quantidade").value;

			if(quantidade=="" || quantidade=="0"){
				var quantidade = "1";
				}else{
				var quantidade = quantidade;
			}
			
			if(medida=="0"){

			alert("Selecione a Medida!");
			frmcarrinho.medidas.focus();
			return (false);		
				
				}else{
				var medida = medida;
				var produto = produto+"<br>Medidas: "+medida;
			}	
			
		//alert(""+medida+" - "+quantidade+"");
		window.open("orcamento.php?opc_efetivar=1&txtprod[" + codigo +"][CODIGO]=" + codigo +"&txtprod[" + codigo +"][PRODUTO]=" + produto +"&txtprod[" + codigo +"][VALOR]=" + valor +"&txtprod[" + codigo +"][QTDE]="+ quantidade +"","_self");
	}


// Carrinho de Produtos
function THFCarInt(codigo,produto,valor,quantidade)
	{
		var codigo = codigo;
		var produto = produto;
		var valor = valor;
		var quantidade = quantidade;
		window.open("orcamento.php?opc_efetivar=1&txtprod[" + codigo +"][CODIGO]=" + codigo +"&txtprod[" + codigo +"][PRODUTO]=" + produto +"&txtprod[" + codigo +"][VALOR]=" + valor +"&txtprod[" + codigo +"][QTDE]="+ quantidade +"","_self");
	}

// Remove Itens
function THFCarRemover(produto)
	{
		var produto = produto;
		if (confirm('Deseja remover este produto do orçamento?')){
		document.location="orcamento.php?ACAOC=caremover&check="+ produto +""
		return true;
		} else {
		return false;
		}
	}


// Limpar Carrinho
function THFLimpar()
	{
		if (confirm('Deseja mesmo limpar a cesta?')){
		document.location="orcamento.php?ACAOC=limpar"
		return true;
		} else {
		return false;
		}
	}	
	
// Atualiza Dados
function THFAtualiza()
	{
		document.forms[0].opc_atualizar.value = 1;
		document.forms[0].submit();
	}

// PopCar
function THFPop(URL,LARG,ALT,NOME)
	{
		var width = LARG;
		var height = ALT;
		window.open(URL,'conf', 'width='+width+', height='+height+',scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
	}


/*
----------------------------------------------------------------------------------------------------------------------------------------------------
DINAMICO - MENU HORIZONTAL
----------------------------------------------------------------------------------------------------------------------------------------------------


function horizontal()
	{

	   var navItems = document.getElementById("menu_dropdown").getElementsByTagName("li");
		
	   for (var i=0; i< navItems.length; i++) {
		  if(navItems[i].className == "submenu_topo")
		  {
			 if(navItems[i].getElementsByTagName('ul')[0] != null)
			 {
				navItems[i].onmouseover=function() {this.getElementsByTagName('ul')[0].style.display="block";this.style.backgroundColor = "#E0D7D4";} //this.style.color = "#7D7D7D";
				navItems[i].onmouseout=function() {this.getElementsByTagName('ul')[0].style.display="none";this.style.backgroundColor = "";}
			 }
		  }
	   }

	}

	// window.onload=horizontal();
*/

/*
----------------------------------------------------------------------------------------------------------------------------------------------------
DINAMICO - MENU VERTICAL
----------------------------------------------------------------------------------------------------------------------------------------------------


startList = function()
	{
		if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace(" over", "");
		   }
		   }
		  }
		 }
	}

	window.onload=startList;

*/
/*
----------------------------------------------------------------------------------------------------------------------------------------------------
DINAMICO - MENU VERTICAL
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

function IEHoverPseudo()
{

	var navItems = document.getElementById("primary-nav").getElementsByTagName("li");
	
	for (var i=0; i<navItems.length; i++) {
		if(navItems[i].className == "menuparent") {
			navItems[i].onmouseover=function() { this.className += " over"; }
			navItems[i].onmouseout=function() { this.className = "menuparent"; }
		}
	}

}
	
	window.onload = IEHoverPseudo;




/*
----------------------------------------------------------------------------------------------------------------------------------------------------
DINAMICO - MASCARAS / FORM
----------------------------------------------------------------------------------------------------------------------------------------------------
*/

function FormataCampo(Campo,teclapres,mascara)
	{
		strtext = Campo.value 
		tamtext = strtext.length 
		tammask = mascara.length 
		arrmask = new Array(tammask)     
		 for (var i = 0 ; i < tammask; i++){ 
		  arrmask[i] = mascara.slice(i,i+1) 
		 } 
		 if (((((arrmask[tamtext] == "#") || (arrmask[tamtext] == "9"))) || (((arrmask[tamtext+1] != "#") || (arrmask[tamtext+1] != "9"))))){ 
		  if ((teclapres.keyCode >= 37 && teclapres.keyCode <= 40)||(teclapres.keyCode >= 48 && teclapres.keyCode <= 57)||(teclapres.keyCode >= 96 && teclapres.keyCode <= 105)||(teclapres.keyCode == 8)||(teclapres.keyCode == 9) ||(teclapres.keyCode == 46) ||(teclapres.keyCode == 13)){ 
		   Organiza_Casa(Campo,arrmask[tamtext],teclapres.keyCode,strtext)         
		  } 
		  else{ 
		   Detona_Event(Campo,strtext) 
		  } 
		 } 
		 else{ 
		  if ((arrmask[tamtext] == "A"))    { 
		   charupper = event.valueOf() 
		   Detona_Event(Campo,strtext) 
		   masktext = strtext + charupper 
		   Campo.value = masktext 
		  } 
		 } 
	} 


// Organiza Casas / Mascara
function Organiza_Casa(Campo,arrpos,teclapres_key,strtext)
	{ 
		 if (((arrpos == "/") || (arrpos == ".") || (arrpos == ",") || (arrpos == ":") || (arrpos == " ") || (arrpos == "-")) && !(teclapres_key == 8)){ 
		  separador = arrpos 
		  masktext = strtext + separador 
		  Campo.value = masktext 
		 } 
	}

// Remove Mascara
function Detona_Event(Campo,strtext)
	{ 
		event.returnValue = false 
		if (strtext != "") { 
		Campo.value = strtext 
		} 
	}

function MM_jumpMenu(targ,selObj,restore){ //v3.0 
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
if (restore) selObj.selectedIndex=0; 
}


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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


