function $_freedom_(b)
{
	var i, a,c;
	if(arguments.length > 1){c = new Array(); for(i=0; i<arguments.length; i++) c.push(arguments[i]);}
	if(b instanceof Array){ c = b; }
	if(c instanceof Array){ a = new Array(); for(i=0; i<c.length; i++) a[i] = document.getElementById(c[i]);}
	else a = document.getElementById(b);
	return a;
}
function $_freedom_remove(a) { if(a && a.parentNode) a.parentNode.removeChild(a); }
function _freedom_addEvent(a, b, c, d, e)
{
	if(!a) return false;
	var f;
	if(typeof e != "undefined")
	{
		if ( typeof(e) != 'string' ){ var g = []; for ( var i = 0; i < e.length; i++ ) g.push(e[i]); f = function(e) { c.apply(a,[e].concat(g)); };}
		else f = function(e) { c.apply(a, [e].concat(e)); };
	}
	else f = c;
	if (a.addEventListener){ addEventListener(b, f, d); return true; }
	else{ if (a.attachEvent) return a.attachEvent('on' + b, f); else a['on' + b] = f; }
};
function _freedom_getObjPosition(a)
{
	var b, c; a = $_freedom_(a); b = a.offsetLeft; c = a.offsetTop; var body = document.getElementsByTagName('body')[0];
	while (a.offsetParent && a!=body){ b += a.offsetParent.offsetLeft; c += a.offsetParent.offsetTop; a = a.offsetParent;}
	return {x: b, y:c};
}


var crossbrowser_BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; }
			else if (dataProp) return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ string: navigator.userAgent, subString: "Chrome", identity: "Chrome" },
		{  string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" },
		{ string: navigator.vendor, subString: "Apple", identity: "Safari", versionSearch: "Version" },
		{ prop: window.opera, identity: "Opera" },
		{ string: navigator.vendor, subString: "iCab", identity: "iCab" },
		{ string: navigator.vendor, subString: "KDE", identity: "Konqueror" },
		{ string: navigator.userAgent, subString: "Firefox", identity: "Firefox" },
		{ string: navigator.vendor, subString: "Camino", identity: "Camino" },
		{ string: navigator.userAgent, subString: "Netscape", identity: "Netscape" },
		{ string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" },
		{ string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" },
		{ string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" }
	],
	dataOS : [
		{ string: navigator.platform, subString: "Win", identity: "Windows" },
		{ string: navigator.platform, subString: "Mac", identity: "Mac" },
		{ string: navigator.platform, subString: "Linux", identity: "Linux" }
	]

};

crossbrowser_BrowserDetect.init();
function crossbrowser_down()
{
	var step = 1;
	var timeStep = 20;
	if(_freedom_getObjPosition("crossbrowser").y+step < 0)
	{
		$_freedom_("crossbrowser").style.top = (_freedom_getObjPosition("crossbrowser").y+step)+"px";
		setTimeout("crossbrowser_down()", timeStep);
	}
}

crossbrowser_showed = false;

function crossbrowser_show(){
	if(!crossbrowser_showed &&  (crossbrowser_BrowserDetect.browser == "Internet Explorer" || crossbrowser_BrowserDetect.browser == "Explorer") && crossbrowser_BrowserDetect.version <= "6")
	{
		var stats = document.createElement("img");
		stats.setAttribute("src",crossbrowser_stats);
		stats.style.display = "none";
		document.body.appendChild(stats);

		var iframe = document.createElement("iframe");
		iframe.setAttribute("frameBorder","0");
		iframe.setAttribute("id","crossbrowser");
		iframe.setAttribute("scrolling","no");
		iframe.style.height = "31px";
		iframe.style.position = "absolute";
		iframe.style.width = "100%";
		iframe.style.top = "-40px";
		iframe.style.left = "0px";
		iframe.style.border = "0px solid #000";

		document.body.appendChild(iframe);
		var doc = iframe.document;
		if(iframe.contentDocument) doc = iframe.contentDocument; // For NS6
		else if(iframe.contentWindow) doc = iframe.contentWindow.document; // For IE5.5 and IE6

		doc.open();
		doc.writeln(crossbrowser_iframe);
		doc.close();
		crossbrowser_down();
		crossbrowser_showed = true;

	}
}

function crossbrowser_hide(){
	$_freedom_remove($_freedom_("crossbrowser"));
}

_freedom_addEvent(window, "load", crossbrowser_show);
crossbrowser_iframe = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><body style="margin:0px; padding:0px; overflow:hidden; height:30px;"><div id="crossbrowser" style="height:30px;background:#F5FAFF;position:absolute;width:100%;left:0px;text-align:left;border-bottom:1px solid #AAAEB2;"><ul style="width:800px; margin:0 auto;padding:1px 0;list-style:none;"><li style="margin:3px 0 0 0;float:left;font:bold 16px Arial, Helvetica, sans-serif;color:#666;" title="Atualize seu navegador">Atualize seu navegador</li><li style="margin:3px 100px 0 8px;float:left;font:9px Arial, Helvetica, sans-serif;" title="Seguran&ccedil;a para voc&ecirc;, liberdade aos desenvolvedores">Mais seguran&ccedil;a para voc&ecirc;,<br />mais liberdade aos desenvolvedores</li><li style="float:right;margin: 0 0 0 10px;"><a href="javascript:window.parent.crossbrowser_hide();" style="margin:7px 0 0 0;display:block;width:14px;height:14px;background:url(http://imasters.uol.com.br/crossbrowser/sprBarratopo.png) 0px -41px no-repeat;text-indent:-9999px;" title="Fechar">Fechar</a></li><li style="float:right;margin-left:10px;"><a target="_blank" href="http://imasters.uol.com.br/crossbrowser/pt-br/" style="margin:4px 0 0 0;padding:4px;display:block;font:bold 9px Arial, Helvetica, sans-serif;text-decoration:none;color:#666;" title="Fa&ccedil;a parte da campanha">Fa&ccedil;a parte da campanha</a></li><li style="float:left;padding:2px 0 0 0;font-weight:bold;color:#690"><small style="font:10px Arial, Helvetica, sans-serif;">Baixe agora!</small></li><li style="float:left;"><a target="_blank" href="http://www.mozilla.com/" title="Mozilla Firefox" style="margin:0 0 0 12px;display:block;width:26px;height:26px;background: url(http://imasters.uol.com.br/crossbrowser/img/sprBarratopo.png) -62px -5px no-repeat;text-indent:-9999px;">Mozilla Firefox</a></li><li style="float:left;margin-left:2px;"><a target="_blank" href="http://www.google.com/chrome" title="Google Chrome" style="margin:4px 0 0 4px;display:block;width:19px;height:19px;background:url(http://imasters.uol.com.br/crossbrowser/sprBarratopo.png) -125px -8px no-repeat;text-indent:-9999px;">Google Chrome</a></li><li style="float:left;margin-left:2px;"><a target="_blank" href="http://www.apple.com/safari/download/" title="Apple Safari" style="margin:4px 0 0 4px;display:block;width:19px;height:19px;background:url(http://imasters.uol.com.br/crossbrowser/sprBarratopo.png) -96px -9px no-repeat;text-indent:-9999px;">Safari</a></li><li style="float:left;margin-left:2px;"><a target="_blank" href="http://www.opera.com/download/" title="Opera" style="margin:4px 0 0 4px;display:block;width:22px;height:18px;background:url(http://imasters.uol.com.br/crossbrowser/sprBarratopo.png) -151px -8px no-repeat;text-indent:-9999px;">Opera</a></li><li style="float:left;margin-left:2px;"><a target="_blank" href="http://www.microsoft.com/windows/internet-explorer/" title="Internet Explorer 8" style="margin:4px 0 0 4px;display:block;width:21px;height:20px;background:url(http://imasters.uol.com.br/crossbrowser/sprBarratopo.png) -180px -7px no-repeat;text-indent:-9999px;">Internet Explorer</a></li></ul></div></body></html>';
crossbrowser_stats = 'http://imasters.uol.com.br/crossbrowser/stats.gif?l=pt-br&ua='+navigator.userAgent+'&ref='+window.location+'&p=1';

function SH_Topo($id,$act)
{
   if($act==1)
   {
      if($id>3) document.getElementById("topo4").style.display='none';
      else      document.getElementById("topo0").style.display='none';

      document.getElementById("topo"+$id).style.display='block';
   }

   if($act==2)
   {
      if($id==1) { $ini = 1; $limit = 3; }
      if($id==2) { $ini = 1; $limit = 3; }
      if($id==3) { $ini = 1; $limit = 3; }
      if($id==5) { $ini = 5; $limit = 7; }
      if($id==6) { $ini = 5; $limit = 7; }
      if($id==7) { $ini = 5; $limit = 7; }

      for($x=$ini;$x<=$limit;$x++) {document.getElementById("topo"+$x).style.display='none';}

      if($id>3) document.getElementById("topo4").style.display='block';
      else      document.getElementById("topo0").style.display='block';
   }
}

function SH_Div($id)
{
   for($x=1;$x<=5;$x++)
   {
                  document.getElementById("suporte"+$x).style.display='none';
      if($x==$id) document.getElementById("suporte"+$x).style.display='block';
   }
}

function SWFViewer($arquivo,$altura,$largura,$id,$color){
    document.writeln('    <object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + $largura + '" height="' + $altura + '" id="' + $id + '" name="' + $id + '">');
    document.writeln('        <param name="movie" value="' + $arquivo + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    document.writeln('        <param name="bgcolor" value="' + $color + '" />');
    document.writeln('        <param name="menu" value="false" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="tl" />');
    document.writeln('        <param name="scale" value="noscale" />');
    //document.writeln('        <param name="wmode" value="transparent" />');
    document.writeln('        <embed id="globalnav-embed" src="' + $arquivo + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high" salign="tl" scale="noscale" id="' + $id + '" width="' + $largura + '" height="' + $altura + '"></embed>');
    document.writeln('    </object>');
}

function submit_login(form)
{
   if( imp_login.wu[0].checked==false && imp_login.wu[1].checked==false )
   {
      alert("Selecione o Servidor !");

      return false;
   }
   else
   {
      if(imp_login.wu[0].checked==true) // UNIX
      {
         imp_login.imapuser.value = imp_login.user.value;
         //imp_login.action = 'http://webmail.idchosting.com.br/imp/redirect.php';
         imp_login.action = 'http://webmail.castanha.net/imp/redirect.php';
         imp_login.method = 'POST';
         imp_login.target = '_blank';
      }

      if(imp_login.wu[1].checked==true) // WINDOWS
      {
         imp_login.username.value = imp_login.user.value;
         imp_login.password.value = imp_login.pass.value;
         imp_login.action = 'http://webmail.castanhanet.com.br:32000/mail/login.html';
         imp_login.method = 'POST';
         imp_login.target = '_blank';
      }

      imp_login.submit();
      imp_login.reset();

      return false;
   }

}

function Show_CGC($act)
{
   if($act==1)
   {
      freg.cnpjcpf.value='';
      freg.cnpjcpf.maxLength=18;
      freg.cnpjcpf.disabled=0;
   }
   if($act==2)
   {
      freg.cnpjcpf.value='';
      freg.cnpjcpf.maxLength=14;
      freg.cnpjcpf.disabled=0;
   }
}

function Show_RG($act)
{
   if($act==1)
   {
      freg.inscrg.value='';
      freg.inscrg.maxLength=18;
      freg.inscrg.disabled=0;
   }
   if($act==2)
   {
      freg.inscrg.value='';
      freg.inscrg.maxLength=12;
      freg.inscrg.disabled=0;
   }
}

function getMask()
{
   if(freg.cgc[0].checked==true) // CNPJ
   {
      $length = freg.cnpjcpf.value.length;
      $val    = freg.cnpjcpf.value;
      if($length==2)  $val = $val+"."; // 00.
      if($length==6)  $val = $val+"."; // 00.000.
      if($length==10) $val = $val+"/"; // 00.000.000/
      if($length==15) $val = $val+"-"; // 00.000.000/0000-
      freg.cnpjcpf.value=$val
   }

   if(freg.cgc[1].checked==true) // CPF
   {
      $length = freg.cnpjcpf.value.length;
      $val    = freg.cnpjcpf.value;
      if($length==3)  $val = $val+"."; // 000.
      if($length==7)  $val = $val+"."; // 000.000.
      if($length==11) $val = $val+"-"; // 000.000.000-
      freg.cnpjcpf.value=$val
   }
}

function RG_Mask()
{
   $length = freg.resprg.value.length;
   $val    = freg.resprg.value;
   if($length==2)  $val = $val+"."; // 00.
   if($length==6)  $val = $val+"."; // 00.000.
   if($length==10) $val = $val+"-"; // 00.000.000-0
   freg.resprg.value=$val
}

function CPF_Mask()
{
   $length = freg.respcpf.value.length;
   $val    = freg.respcpf.value;
   if($length==3)  $val = $val+"."; // 000.
   if($length==7)  $val = $val+"."; // 000.000.
   if($length==11) $val = $val+"-"; // 000.000.000-
   freg.respcpf.value=$val
}

function Data_Mask()
{
   $length = freg.respnasc.value.length;
   $val    = freg.respnasc.value;
   if($length==2)  $val = $val+"/";
   if($length==5)  $val = $val+"/";
   freg.respnasc.value=$val
}

function CEP_Mask()
{
   $length = freg.cep.value.length;
   $val    = freg.cep.value;
   if($length==5)  $val = $val+"-";
   freg.cep.value=$val
}

function FoneMask($id)
{
   if($id==1)
   {
      $length = freg.fone.value.length;
      $val    = freg.fone.value;
      if($length==2)  $val = $val+" ";
      if($length==7)  $val = $val+"-";
      freg.fone.value=$val
   }

   if($id==2)
   {
      $length = freg.fax.value.length;
      $val    = freg.fax.value;
      if($length==2)  $val = $val+" ";
      if($length==7)  $val = $val+"-";
      freg.fax.value=$val
   }

   if($id==3)
   {
      $length = ctt.fone1.value.length;
      $val    = ctt.fone1.value;
      if($length==4)  $val = $val+"-";
      ctt.fone1.value=$val
   }

   if($id==4)
   {
      $length = ctt.fone2.value.length;
      $val    = ctt.fone2.value;
      if($length==4)  $val = $val+"-";
      ctt.fone2.value=$val
   }
}

function Show_Planos($id)
{
   if($id=="U")
   {
      document.getElementById("pu").style.display='block';
      document.getElementById("pw").style.display='none';
      for($x=0;$x<6;$x++) freg.pw[$x].checked=false;
   }

   if($id=="W")
   {
      document.getElementById("pw").style.display='block';
      document.getElementById("pu").style.display='none';
      for($x=0;$x<6;$x++) freg.pu[$x].checked=false;
   }

   Ag_Valor(0,0);
}

function valida_dados($form)
{
   var $msg  = "Verificação de Dados\n\n";

   if($form.domain.value=="")         $msg += "- Domínio deve ser informado.\n";
   if($form.domain.value.indexOf('.', 0) == -1) $msg += "- Domínio deve ser preenchido corretamente.\n";
   if($form.plat[0].checked==false && $form.plat[1].checked==false) $msg += "- Plataforma deve ser escolhida.\n";

   $plan=0;
   for($x=0;$x<6;$x++)
   {
      if($form.pu[$x].checked==false) $plan++;
      if($form.pw[$x].checked==false) $plan++;
   }

   if($plan==12)                       $msg += "- Plano deve ser informado.\n";

   if($form.razsoc.value=="")          $msg += "- Razão Social / Nome deve ser informado.\n";
   if($form.cnpjcpf.value=="")         $msg += "- CNPJ / CPF deve ser informado.\n";

   if($form.cgc[0].checked==true)
   {
      if($form.cnpjcpf.value.length<18) $msg += "- CNPJ deve ser informado corretamente.\n";
   }
   if($form.cgc[1].checked==true)
   {
      if($form.cnpjcpf.value.length<14) $msg += "- CPF deve ser informado corretamente.\n";
   }

   if($form.inscrg.value=="")          $msg += "- Inscrição Estadual / RG deve ser informado.\n";
   if($form.endereco.value=="")        $msg += "- Endereço deve ser informado.\n";
   if($form.cep.value=="")             $msg += "- CEP deve ser informado.\n";
   if($form.cidade.value=="")          $msg += "- Cidade deve ser informada.\n";
   if($form.fone.value=="")            $msg += "- Telefone deve ser informado.\n";
   if($form.email.value=="")           $msg += "- E-Mail deve ser informado.\n";

   if($form.email.value.indexOf('@', 0) == -1 || $form.email.value.indexOf('.', 0) == -1) $msg += "- E-Mail deve ser preenchido corretamente.\n";

   if($form.respnome.value=="")        $msg += "- Nome do Responsável deve ser informado.\n";
   if($form.respcpf.value=="")         $msg += "- CPF do Responsável deve ser informado.\n";
   if($form.resprg.value=="")          $msg += "- RG do Responsável deve ser informado.\n";
   if($form.respnasc.value=="")        $msg += "- Data de Nascimento do Responsável deve ser informada.\n";

   if($form.code.value!=$form.vfycd.value) $msg += "- Código de Validação não confere.\n";

   if($msg=="Verificação de Dados\n\n")
   {
      return true;
   }
   else
   {
      alert($msg);
      return false;
   }
}

function buydomain($domain)
{
   buy.domain.value = $domain;
   buy.valid.value  = 'T';
   buy.method       = 'POST';
   buy.action       = 'formreg.php';
   buy.submit();
}

function buyhostu($plano)
{
   hustu.plano.value  = $plano;
   hustu.plata.value  = 'u';
   hustu.valid.value  = 'T';
   hustu.method       = 'POST';
   hustu.action       = 'formreg.php';
   hustu.submit();
}

function buyhostw($plano)
{
   hustw.plano.value  = $plano;
   hustw.plata.value  = 'w';
   hustw.valid.value  = 'T';
   hustw.method       = 'POST';
   hustw.action       = 'formreg.php';
   hustw.submit();
}


function Vfy_Timer()
{
   // Verifico se o Botão de submit está habilitado.
   setInterval(Vfy_Contratos,100);

   // Atualizo o valor total a ser pago.
   setInterval(Atualiza_Total,100);

   // Verifico se algum plano já veio selecionado
   //setInterval(Vfy_Planos,100);
   Vfy_Planos();

   // Verifico se Domínio ou transferência veio marcado
   if(freg.regtransf[0].checked==true || freg.regtransf[1].checked==true) document.getElementById('formulario').style.display='block';

   // Verifico se CNPJ/CPF e/ou Incs Estadual/RG veio marcado
   if(freg.cgc[0].checked==true || freg.cgc[1].checked==true) freg.cnpjcpf.disabled=0;
   if(freg.rg[0].checked==true  || freg.rg[1].checked==true)  freg.inscrg.disabled=0;
}

function Vfy_Contratos($act)
{
   if(freg.regtransf[1].checked==true)
   {
      freg.contrato1.checked=true;
      freg.contrato1.disabled=1;
   }

   if($act==1)
   {
      freg.contrato1.checked=false;
      freg.contrato1.disabled=0;
   }

   if(freg.contrato1.checked==true && freg.contrato2.checked==true) freg.enviar.disabled=0;
   else freg.enviar.disabled=1;
}

function Atualiza_Total()
{
   if(freg.domain.value.indexOf('.br', 0)==-1) $domino = 150;
   if(freg.domain.value.indexOf('.br', 0)!=-1) $domino = 80;

   if(freg.domain.value=="") $domino = 0;

   if(freg.regtransf[0].checked==true)
   {
      $apagar = $config + $plano + $domino;
   }
   else
   {
      $apagar = $config + $plano;
   }

   $mensal = $plano;
   $total  = $apagar;

   if($total != $apagar) $total = $apagar;

   freg.mensal.value = $mensal + ",00/mês";
   freg.total.value  = "Valor Total: R$ " + $total + ",00";

   //if(freg.cobradata[0].checked==true) $pagadia = "0"+freg.cobradata[0].value;
   //if(freg.cobradata[1].checked==true) $pagadia = "0"+freg.cobradata[1].value;
   if(freg.cobradata[0].checked==true) $pagadia = freg.cobradata[0].value;
   if(freg.cobradata[1].checked==true) $pagadia = freg.cobradata[1].value;
   if(freg.cobradata[2].checked==true) $pagadia = freg.cobradata[2].value;
   if(freg.cobradata[3].checked==true) $pagadia = freg.cobradata[3].value;
   if(freg.cobradata[4].checked==true) $pagadia = freg.cobradata[4].value;

   freg.diapaga.value = "(Pagos todo dia "+$pagadia+")";
}

function Vfy_Planos()
{
   if(freg.plat[0].checked==true)
   {
      //document.getElementById("pw").style.display='none';
      document.getElementById("pu").style.display='block';

      for($x=0;$x<6;$x++) if(freg.pu[$x].checked==true) Ag_Valor($x+1,1);
   }

   if(freg.plat[1].checked==true)
   {
      //document.getElementById("pu").style.display='none';
      document.getElementById("pw").style.display='block';

      for($x=0;$x<6;$x++) if(freg.pw[$x].checked==true) Ag_Valor($x+1,2);
   }
}

function Ag_Valor($id, $tipo)
{
   if($tipo==1)
   {
      switch($id)
      {
         case 1: $plano =  23; break;
         case 2: $plano =  33; break;
         case 3: $plano =  51; break;
         case 4: $plano =  83; break;
         case 5: $plano = 186; break;
         case 6: $plano = 328; break;
      }
   }

   if($tipo==2)
   {
      switch($id)
      {
         case 1: $plano =  30; break;
         case 2: $plano =  43; break;
         case 3: $plano =  67; break;
         case 4: $plano = 108; break;
         case 5: $plano = 210; break;
         case 6: $plano = 427; break;
      }
   }

   if($tipo==0 && $id==0) $plano = 0;
}

function blockNumbers(e)
{
var key;
var keychar;
var reg;

if(window.event) {
  // for IE, e.keyCode or window.event.keyCode can be used
  key = e.keyCode;
}
else if(e.which) {
  // netscape
  key = e.which;
	if (key == 8) {
return true;
}

}
else {
  // no event, so pass through
  return true;
}

keychar = String.fromCharCode(key);
reg = /[^\d-]/;
return !reg.test(keychar);
}

function Show_Pub($id)
{
   for($x=1;$x<=3;$x++) document.getElementById("pub"+$x).style.display='none';

   document.getElementById("pub"+$id).style.display='block';
}

$ret = 2;

function Publicidade()
{
   $ret = showPub($ret,"");
}

function showPub($id, $event)
{
  if($event=="T") clearInterval(pubint);

  for($x=1;$x<=3;$x++) document.getElementById("pub"+$x).style.display='none';

  document.getElementById("pub"+$id).style.display='block';

  if($id==1) $ret = 2;
  if($id==2) $ret = 3;
  if($id==3) $ret = 1;

  if($event=="T") pubint = setInterval(Publicidade, 10000);

  return $ret;
}


function buyServer($id)
{
   if($id==1) $servidor = "CONTRATO DE SERVIDOR SEMIDEDICADO UNIX 1";
   if($id==2) $servidor = "CONTRATO DE SERVIDOR SEMIDEDICADO UNIX 2";
   if($id==3) $servidor = "CONTRATO DE SERVIDOR SEMIDEDICADO WINDOWS 1";
   if($id==4) $servidor = "CONTRATO DE SERVIDOR SEMIDEDICADO WINDOWS 2";

   server.servidor.value = $servidor;
   server.valid.value    = "T";
   server.method         = "POST";
   server.action         = "contato.php";

   server.submit();
}

function Valid_Contato($form)
{
   var $msg  = "Verificação de Dados\n\n";

   if($form.dep.value=="")        $msg += "- Departamento deve ser informado.\n";
   if($form.assunto.value=="")    $msg += "- Assunto deve ser informado.\n";
   //if($form.empresa.value=="")    $msg += "- Empresa deve ser informada.\n";
   if($form.nome.value=="")       $msg += "- Nome deve ser informado.\n";

   if($form.ddd1.value=="")       $msg += "- DDD Telefone deve ser informado.\n";
   if($form.ddd1.value.length<2)  $msg += "- DDD Telefone deve ter 2 digitos.\n";

   if($form.fone1.value=="")      $msg += "- Telefone deve ser informado.\n";
   if($form.fone1.value.length<8) $msg += "- Telefone deve ter 8 digitos.\n";

   //if($form.ddd2.value=="")       $msg += "- DDD Celular deve ser informado.\n";
   //if($form.ddd2.value.length<2)  $msg += "- DDD Celular deve ter 2 digitos.\n";

   //if($form.fone2.value=="")      $msg += "- Celular deve ser informado.\n";
   //if($form.fone2.value.length<8) $msg += "- Celular deve ter 8 digitos.\n";

   if($form.email.value=="")      $msg += "- E-Mail deve ser informado.\n";
   if($form.email.value.indexOf('@', 0) == -1 || $form.email.value.indexOf('.', 0) == -1) $msg += "- E-Mail deve ser preenchido corretamente.\n";

   if($form.mensagem.value=="")   $msg += "- Mensagem deve ser escrita.\n";

   if($msg=="Verificação de Dados\n\n")
   {
      return true;
   }
   else
   {
      alert($msg);
      return false;
   }
}

function selectLang()
{
    // We need to reload the login page here, but only if the user hasn't
    // already entered a username and password.
    if (document.imp_login.imapuser.value == '' &&
        document.imp_login.pass.value == '') {
        var lang_page = 'webmail.php?new_lang=' + document.imp_login.new_lang[document.imp_login.new_lang.selectedIndex].value;
        //var lang_page = 'login.php?new_lang=' + document.imp_login.new_lang[document.imp_login.new_lang.selectedIndex].value;
        //self.location = lang_page;
        self.location = lang_page;
    }
}

function comfirmReg($id)
{
  if($id==1)
  {
     confirmreg.acao.value = 'correct';
     confirmreg.method = 'POST';
     confirmreg.action = 'formreg.php';
     confirmreg.submit();
  }

  if($id==2)
  {
     confirmreg.acao.value = 'send';
     confirmreg.method = 'POST';
     confirmreg.action = 'formreg.php';
     confirmreg.submit();
  }
}

