function openWindow(theURL,winName,features){
  window.open(theURL,winName,features);
}


function set_name1(value) {
    var expdate = new Date ();                                        
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
	var vol = (value)
	SetCookie ("volume", vol, expdate);

}

function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
       if (endstr == -1)
       endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}


function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
    var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
        }

return null;
}


function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}


function show_name() {
    if(GetCookie("jtotwname") == null)
       var abrir = window.open ('verificacookie.html', '', 'height=300,width=410');
		
}

function set_name(form) {
    var expdate = new Date ();                                        
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
	var name = (form.nameinput.value)    
    var username = ("Loja: " + form.nameinput.value) +"<br> "+ ("Tel.: " + form.telinput.value)
        if (form.nameinput.value == "")
	  alert("Por favor, Digite a Razão social da sua empresa");
	else{
            if (confirm("Você tem certeza que deseja salvar estes dados?"))
	    {
          SetCookie ("jtotwname", username, expdate);
		  SetCookie ("jtotw", name, expdate);
 	      window.history.go(0);   
		  window.close();	
	    }		
            }
}	
function Tecla(e,n)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if ((tecla ==46) || (tecla == 44) || (tecla > 47 && tecla < 58 )) // numeros de 0 a 9 , e .
			return true;
		else
		  	{
			if ((tecla == 13)||(tecla==9)){
			 n.focus();
			 return false;}
				if (tecla != 8) // backspace
					{event.keyCode = 0;
					alert ("Por favor, digite somente números!")
					//return false;
					}else
					return true;
					}
}

function ph() {

if ((document.hth.p.value < 00) || (document.hth.p.value > 14))
    {
	alert('pH não pode ser menor que 0 ou maior que 14!');
	document.hth.p.select();
	document.hth.p.focus();
	return	}

}
	
function calcula(tipo) {
if (tipo == "c_m_cubico"){
if (document.hth.n1.value > 0){
	volume = document.hth.n1.value;
}else{
  if (document.hth.n1.value == ''){
  	alert("Informe o volume da piscina!");
	document.hth.n1.focus()
  }else{
  	alert("Por favor, digite somente números!");
	document.hth.n1.focus()
	return } 
}}else{
if (tipo == "c_medida"){
if ((document.hth.n3.value > 0) && (document.hth.n4.value > 0) && (document.hth.n5.value > 0)){
 document.hth.n6.value = ((document.hth.n3.value) * (document.hth.n4.value) * (document.hth.n5.value));
 Arredonda ((document.hth.n6.value),1); 
 volume = document.hth.n6.value;
 } else{
  if ((document.hth.r3.value > 0) && (document.hth.r4.value > 0)) 
   { document.hth.n6.value = ((0.7853975)* (Math.pow(document.hth.r4.value, 2)) * (document.hth.r3.value));
   Arredonda ((document.hth.n6.value),1);
   volume = document.hth.n6.value;
  } else {
    if ((document.hth.o3.value > 0) && (document.hth.o4.value > 0) && (document.hth.o5.value > 0)) 
     { document.hth.n6.value =( 3.14159 * (document.hth.o4.value / 2) * (document.hth.o5.value  / 2) * (document.hth.o3.value ));
     Arredonda ((document.hth.n6.value),1);
     volume = document.hth.n6.value;
    } else {
	
	 alert('Informe as medidas da piscina!')
	 document.hth.n4.focus()
	 return } 
  }
}   var expdate = new Date ();                                        
    expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365));
	var vol = (volume);
	SetCookie ("volume", vol, expdate);	
}else{
if (tipo =="c_litro"){
if (document.hth.m2.value > 0){
	volume = (document.hth.m2.value / 1000);
}else{
  if (document.hth.m2.value == ''){
  	alert("Informe o volume da piscina!");
	document.hth.m2.focus()
  }else{
  	alert("Por favor, digite somente números!");
	document.hth.m2.focus()
	return } 
}}}}	
	
 if (window.document.hth.rad[1].checked) {
	 window.location=("prob_solucoes.htm" );
}else{ 
	if (window.document.hth.rad[2].checked){
	window.location=("tab_basica_var.html");
}else{	

if ((document.hth.alcalinidade.value >= 080) && (document.hth.alcalinidade.value <= 120)){
  v_alcalinidade = (" informada:" + document.hth.alcalinidade.value + "  (Alcalinidade Total na faixa ideal)");
}else{
 if (document.hth.alcalinidade.value != ""){
  v_alcalinidade = (" informada: " + document.hth.alcalinidade.value);
 }else{
  v_alcalinidade = ":  n&atilde;o informada";}
}
if ((document.hth.p.value >=7.2) && (document.hth.p.value <=7.6)){
 v_ph = (" informado: " + document.hth.p.value + "  (pH na faixa ideal)");
}else{
  if (document.hth.p.value != ""){
   v_ph = (" informado: " + document.hth.p.value);
  }else{
   v_ph = ": n&atilde;o informado";
  } 
}
}

   a2 = ("<BR><BR><i>Para corrigir a Alcalinidade Total use:</i>" ); 
   a3 = ("<BR>-<strong>hth Elevador de Alcalinidade:</strong>   ");
   av3= (volume * 17);
   a4 = ("<BR>-<strong>hth Redutor de Alcalinidade e pH:</strong>      ");
   av4= (volume * 13);

   a5 = ("<BR><BR><i>Para corrigir o pH use:</i>");
   a6 = ("<BR>-<strong>hth Elevador de pH</strong>:      " + Arredondainterno(volume * 10, 1)+" g");
   a7 = ("<BR>-<strong>hth Elevador de pH</strong>:       " + Arredondainterno(volume * 20, 1)+" g");
   a8 = ("<BR>-<strong>hth Redutor de Alcalinidade e pH</strong>:       " + Arredondainterno(volume * 13, 1)+ " ml");
   a9 = ("<BR>-<strong>hth Redutor de Alcalinidade e pH</strong>:      " + Arredondainterno(volume * 25, 1)+ " ml");

if(document.hth.p.value == "") {
p1 = (a5 + a6 + (", para pH entre 6,8 e 7,2") + a7 + (", para pH abaixo de 6,8") + 
a8 + (", para pH entre 7,8 e 8") + a9 + (", para pH maior que 8"));
}else{
if (document.hth.p.value <= 6.8){
 p1 = (a5 + a7 );
} else {
 if ((document.hth.p.value >= 6.9) && (document.hth.p.value <= 7.1)){
  p1 = (a5 + a6);
 } else {
 if ((document.hth.p.value >=7.2) && (document.hth.p.value <=7.6)){
 p1 = ("");
 }else{
   if ((document.hth.p.value >=7.6) && (document.hth.p.value <= 8.0)){
   p1 = (a5 + a8);
   }else{
   p1 = (a5 + a9);
}
}
}
}
}
   
if (document.hth.alcalinidade.value ==""){
c1 = (a2 + a3 + (Arredondainterno(av3, 1)) + " ml para cada 10 ppm que se deseje elevar" + a4 + (Arredondainterno(av4, 1)) + " ml para cada 10 ppm que se deseje reduzir");
 }else{
  if ((document.hth.alcalinidade.value >= 080) && (document.hth.alcalinidade.value <= 120)){
  c1 = ("");
  }else{
   if (document.hth.alcalinidade.value <= 079){
   ppm = (080 - document.hth.alcalinidade.value)/10;
   c1 = (a2 + a3 + (Arredondainterno(av3 * ppm, 1)) + "g");
   }else{
    if (document.hth.alcalinidade.value >= 120){
    ppm = (document.hth.alcalinidade.value - 120)/10;
    c1 = (a2 + a4 + (Arredondainterno(av4 * ppm, 1)) + "ml");
}
}
}
}
}
document.write("<html><head><SCRIPT LANGUAGE='JavaScript'>"+
"</SCRIPT></head><link rel='stylesheet' href='sty.css'><style>a:hover {font-family:Arial; font-size: 9pt; color:'#1e90ff';text-decoration:none;} }</style><BODY>"+
"<body leftmargin='10' topmargin='10'><form><table border='1' bordercolor='#dcdcdc' cellpadding='0' cellspacing='0' width=100% height=100%>" +
"<td align='center'><table border='0' width=90% height=90% cellpadding='0' cellspacing='0'><tr align='center' valign='middle'>" +
"<td align='left'><TABLE WIDTH=100%><TR><TD width=20%><img src='logo_menu.jpg'width='162' height='148'></TD><TD width=80% valign='middle' class='texto_loja'"+
"align='right'>"+GetCookie('jtotwname')+"</TD></TR></TABLE><table width='90%'>" +
"<tr><br><div align='center' class='texto_fdo'><strong>"+
" Tabela de manuten&ccedil;&atilde;o residencial - Ver&atilde;o</strong></div>" +
"<br><div class='texto_fd'>A <a class='texto_hth'>hth</a> e a  Loja " + GetCookie("jtotw") +
" lhe oferecem uma receita com as dosagens dos principais produtos <a class='texto_hth'>hth</a>, " + 
"para uma piscina com &aacute;gua sempre saud&aacute;vel e cristalina! </div>"+
"</tr></table><table width='90%'><TR>" +
"<TD align='center'><br><table border='1' cellpadding='0' cellspacing='0' bordercolor='#000000'><TR><TD class='texto_fd_maior'> " + 
"&nbsp;&nbsp;&nbsp; Para uma piscina de "+GetCookie('volume')+"&nbsp;m&sup3;&nbsp;&nbsp;&nbsp;</TD></TR></table></TD></tr></table>"+
"<BR><div class='texto_fd'>Alcalinidade Total" + v_alcalinidade +
"<br></A>pH" + v_ph + c1 + p1 + 
"</div><div class='texto_fd'><BR><i>Para a manuten&ccedil;&atilde;o da &aacute;gua use:</i>" +
"<BR>-<strong>hth Cloro Granulado </strong> manuten&ccedil;&atilde;o residencial:      " + Arredondainterno(volume * 4, 1)+" g"+
"<BR>-<strong>hth Algicida Fibra &amp; Vinil</strong> para manuten&ccedil;&atilde;o:      " + Arredondainterno(volume * 5, 1)+" ml"+
"<BR>-<strong>hth Maxfloc</strong> para clarificar:      " + Arredondainterno(volume * 1.5, 1)+  " ml"+
"</div><p class='texto_fd'>A <a class='texto_hth'>hth</a> e a loja "+ GetCookie("jtotw") +" tem um grande prazer em atend&ecirc;-lo.</p>"+
"<table width=90%>"+
"<table border='1' cellpadding='0' cellspacing='0' width=100% align='center' bordercolor='#FFFFFF'>"+
"<tr><div class='texto_fd_menor'><strong>Dica: Tabela de manuten&ccedil;&atilde;o residencial - "+
"V E R &Atilde; O</strong></div><td colspan='8' bgcolor='#DFF0FF'>"+
"<p align='center' class='texto_fd_menor'><strong>P R O C E S S O &nbsp;&nbsp;&nbsp;Q U &Iacute; M I C O </strong></p>"+
"</td></tr><tr bgcolor='#DFF0FF'><td>&nbsp; </td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Seg</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Ter</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Qua</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Qui</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Sex</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Sab</div></td><td width='32'>"+
"<div align='center' class='texto_fd_menor'>Dom</div></td></tr>"+
"<tr bgcolor='DFF0FF'><td class='texto_fd_menro'>Medir a Alcalinidade Total (80-120ppm)</td>"+
"<td colspan='7' bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>1 vez por m&ecirc;s</div>"+
"</td></tr><tr bgcolor='#DFF0FF'><td><p class='texto_fd_menor'>Medir o pH (7,2 - 7,6)</p>"+
"</td><td bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>Sim</div></td>"+
"<td><div align='center'>&nbsp;</div></td><td><div align='center'>&nbsp;</div></td>"+
"<td><div align='center'>&nbsp;</div></td><td bgcolor='#dcdcdc'>"+
"<div align='center' class='texto_fd_menor'>Sim</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td><div align='center'>&nbsp;</div></td></tr><tr bgcolor='#DFF0FF'>"+
"<td class='texto_fd_menor'>Clorar com <strong>hth Cloro Granulado</strong></td><td bgcolor='#dcdcdc'> "+
"<div align='center' class='texto_fd_menor'>Sim</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>Sim</div></td><td> "+
"<div align='center'>&nbsp;</div></td><td bgcolor='#dcdcdc'>"+
"<div align='center' class='texto_fd_menor'>Sim</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td><div align='center'>&nbsp;</div></td></tr><tr bgcolor='#DFF0FF'>"+
"<td class='texto_fd_menor'>Medir o cloro livre</td><td><div align='center'>&nbsp;</div>"+
"</td><td bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>Sim</div></td>"+
"<td><div align='center'>&nbsp;</div></td><td bgcolor='#DCDCDC'>"+
"<div align='center' class='texto_fd_menor'>Sim</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>Sim</div></td><td>"+
"<div align='center'>&nbsp;</div></td></tr><tr bgcolor='#DFF0FF'><td class='texto_fd_menor'>"+
"Clarificar com <strong>hth Maxfloc</strong></td><td><div align='center'>&nbsp;</div>"+
"</td><td><div align='center'>&nbsp;</div></td><td bgcolor='#DCDCDC'>"+
"<div align='center' class='texto_fd_menor'>Sim</div></td><td> "+
"<div align='center'>&nbsp;</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td><div align='center'>&nbsp;</div></td><td><div align='center'>&nbsp;</div>"+
"</td></tr><tr bgcolor='#DFF0FF'><td class='texto_fd_menor'>"+
"Acrescentar <strong>hth Algicida</strong>*</td><td><div align='center'>&nbsp;</div>"+
"</td><td><div align='center'>&nbsp;</div></td><td><div align='center'>&nbsp;</div>"+
"</td><td bgcolor='#dcdcdc'><div align='center' class='texto_fd_menor'>Sim</div></td><td>"+
"<div align='center'>&nbsp;</div></td><td><div align='center'>&nbsp;</div></td><td>"+
"<div align='center'>&nbsp;</div></td></tr><tr bgcolor='#DFF0FF'>"+
"<td class='texto_fd_menor'>Decantar</td><td colspan='7' bgcolor='dcdcdc'>"+
"<div align='center' class='texto_fd_menor'>Quando necess&aacute;rio</div></td></tr>"+
"</table></td></tr><tr><td><a class='texto_fd_menor' align='justify'>"+
"* ATEN&Ccedil;&Atilde;O: Em piscina de fibra ou vinil utilizar&nbsp;<strong>hth "+
"Algicida Fibra &amp; Vinil</strong>. </a><p class='texto_fd_menor' align='justify'>"+
"A utiliza&ccedil;&atilde;o de dois produtos no mesmo dia requer um intervalo de "+
"1 (uma) hora entre o uso de um e de outro.	A &uacute;nica exce&ccedil;&atilde;o "+
"&eacute; a utiliza&ccedil;&atilde;o do cloro granulado juntamente com os Algicidas "+
"(exceto&nbsp;<strong>hth Algicida Fibra &amp; Vinil</strong>), os quais precisam de um "+
"intervalo de 24 (vinte e quatro) horas entre o uso de um e de outro.</p>"+
"</td></tr></table><p class='printButtons'>"+
"<a href=prob_solucoes.htm class='link_controles'>Principais Problemas e Solu&ccedil;&otilde;es</a><br><br>" +	
"<a href=tab_basica_var.html class='link_controles'>Dosagens dos produtos hth"+
"</a></p>" +
"<TABLE WIDTH='500' bgcolor='#f5f5f5' border='0' cellpadding='0' cellspacing='0' bordercolor='#ffffff'>" +
"<tr><TD width=50% align='left' class='printButtons'>"+
"<a href='javascript:void(0);' onclick='window.focus();window.top.print();'class='link_controles'>Imprimir<\/a>"+
"<TD width=50% align='right' class='printButtons'>"+
"<a href='javascript:history.back(1)' class='link_controles'>Voltar</a></TD></tr>"+
"</TABLE></td></tr></TABLE></td></tr></table></td></table></form></html>");
}


function prof() {
if (document.hth.n3.value > 20){
alert ('profundidade não pode ser maior que 20m!');
document.hth.n3.focus();
document.hth.n3.select();
return }
if (document.hth.o3.value > 20){
alert ('profundidade não pode ser maior que 20 m!');
document.hth.o3.focus();
document.hth.o3.select();
return }
if (document.hth.r3.value > 20){
alert ('profundidade não pode ser maior que 20 m!');
document.hth.r3.focus();
document.hth.r3.select();
return }
}

function Arredonda( valor, casa ){
   document.hth.n6.value = Math.round( valor * Math.pow( 10 , casa ) ) / Math.pow( 10 , casa );
   return( document.hth.n6.value );
  }
  
function Arredondainterno(valor, casa ){
var volume = Math.round( valor * Math.pow( 10 , casa ) ) / Math.pow( 10 , casa );
return( volume );
}
  
function troca(valor){

re = /,/;
re1 = / /;
str = valor;
newstr=str.replace(re, ".");
newstr1=newstr.replace(re1, "");
valor = newstr1;
return valor;

}
function printMe() {
	if ( window.print ) {
		window.print();
	}
}
function abrir_problema(problema){

 if (document.prob.n9.value > 0){
	 volume = document.prob.n9.value;
	 window.location=(problema);
 }else{
	  if (document.prob.n9.value == ''){
  	   alert("Informe o volume da piscina!");
	   document.prob.n9.focus();
	   return;
      }else{
  	   alert("Por favor, digite somente números!");
	   document.prob.n9.focus();
      return; }}}
	  
function mostraremm3(tipo){
if(tipo == "litros"){
volume=document.hth.m2.value/1000
}
if(tipo == "medida_retangular"){
document.hth.n6.value = ((document.hth.n3.value) * (document.hth.n4.value) * (document.hth.n5.value));
 Arredonda ((document.hth.n6.value),1); 
 volume = document.hth.n6.value;}
 
 if(tipo == "medida_redonda"){
   document.hth.n6.value = ((0.7853975)* (Math.pow(document.hth.r4.value, 2)) * (document.hth.r3.value));
   Arredonda ((document.hth.n6.value),1);
   volume = document.hth.n6.value;}
 
 if(tipo == "medida_oval"){
   document.hth.n6.value =( 3.14159 * (document.hth.o4.value / 2) * (document.hth.o5.value  / 2) * (document.hth.o3.value ));
   Arredonda ((document.hth.n6.value),1);
   volume = document.hth.n6.value;}
 
 document.hth.m3.style.visibility=''
 document.hth.m3.value="** Corresponde a "+volume+" metros cúbicos **"
}

function limpa_outros(campo_fixo){
if(campo_fixo=="retangular" || campo_fixo=="redonda"){	
	hth.o4.value="";
	hth.o5.value="";	
	hth.o3.value="";
}
if(campo_fixo=="retangular" || campo_fixo=="oval"){	
	hth.r4.value="";
	hth.r3.value="";	
}
if(campo_fixo=="redonda" || campo_fixo=="oval"){	
	hth.n4.value="";
	hth.n5.value="";	
	hth.n3.value="";	
}
}

function chama_tab_basica(tipo){
  if (tipo == "semvolume"){
 	 window.location=("tab_basica.html");
	 }else{
if (tipo == "calcula"){
 if (document.hth.n1.value > 0){
	 volume = document.hth.n1.value;
	 window.location=("tab_basica_var.html");
 }else{
	  if (document.hth.n1.value == ''){
  	   alert("Informe o volume da piscina!");
	   document.hth.n1.focus();
	   return;
      }else{
  	   alert("Por favor, digite somente números!");
	   document.hth.n1.focus();
      return; }}
}}}

function calcula_pace(valor){
var a,b,c,d, volume
if (valor >=30){
  if ((valor % 30) ==0){
   b=((valor/30)+ " tab. de 200g ou "+ (valor/2) +" tab. de 14g");
   return(b);
  }else{
   b=(Math.floor(valor / 30));
   volume=((valor % 30)/2);
   c=(Arredondainterno(volume,1));
   a=(Arredondainterno(valor/2,1));
   d=b +" tab. de 200g e "+ c +" tab. de 14g ou "+ a +" tab. de 14g";
   return(d);
}}else{
b=(Math.abs(valor/2));
c=(Arredondainterno(b,1))
d=c +" tab. de 14g";
return(d);
}}

