function SearchClearc()	{
		// Clears the search text box once the user has clicked into it.
		if (document.Geral.body.value == 'Escreva suas dúvidas aqui') 
			document.Geral.body.value = '';
}

function janela(popup_url,name,width,height,left,top)
 {
 size = 'width=' + width + ',height=' + height;
 window.open(popup_url,name,'resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,directories=no,top=110,left=350,'+size);
 }


function NovoVerifica_f1(f1)
{
	var ret = true;
	var doms = f1.fqdn.value.replace(/(^\s+)|(\s+$)/g,"");
	if (doms.length == 0)
	{
    alert("Por favor, o campo de pesquisa precisa ser preenchido.");
    f1.fqdn.focus();
    return (false);
	}
	var doms = f1.fqdn.value.replace(/(^\s+)|(\s+$)/g,"");
	if (doms.length == 1)
	{
    alert("Seu domínio deve ter pelo menos 3 caracteres.");
    f1.fqdn.focus();
    return (false);
	}
	var doms = f1.fqdn.value.replace(/(^\s+)|(\s+$)/g,"");
	if (doms.length == 2)
	{
    alert("Seu domínio deve ter pelo menos 3 caracteres.");
    f1.fqdn.focus();
    return (false);
	}
	var sldArray = doms.split(",");
	if (sldArray.length > 3)
	{
		alert("Por favor, a pesquisa poderá ser feita com no máximo 3 nomes.");
		f1.fqdn.focus();
		return (false);
	}
	for(var i=0;i<sldArray.length;i++)
	{
		ret = ret && verifica_f1(f1,sldArray[i]);
	}
	return(ret);
}
function verifica_f1(f1,val)
{
// Validação dos campos do form

	if (val.length == 0)
	{
    alert("O Campo de Pesquisa tem caracteres inválidos.");
    f1.ddomain.focus();
    return (false);
	}
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.";
  var checkStr = val;
  var allValid = true;
  var temponto = false; // Se há ou não ponto no SLD
  var maisdeumpt = false;// Se tem mais de um ponto no SLD
  var extremo = false;  // Se o ponto está em um dos extremos do SLD
  var maisdeduasvgs = false //Se tem mais de duas vírgulas
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    if (ch == ".")
		{
			if (temponto)
				maisdeumpt = true;
			temponto = true;
			if ((i == 0) || (i == checkStr.length-1))
				extremo = true;
		}
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
			break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Por favor, entre somente letras, números e os caracteres \"- .\" no campo de Pesquisa.");
    f1.ddomain.focus();
    return (false);
  }
//  if (temponto && !f1.cbnom.checked)
//  {
//    alert("Somente poderá haver pontos em nomes de domínios com extensão NOM.BR.");
//    f1.ddomain.focus();
//    return (false);	
//  }
//  if (f1.cbnom.checked && maisdeumpt)
//  {
//    alert("Somente é permitido um único ponto no interior dos nomes de domínios NOM.BR.");
//    f1.ddomain.focus();
//    return (false);
//  }  
//  if (f1.cbnom.checked && extremo)
//  {
//    alert("Não pode haver pontos nos extremos do nome.");
//    f1.ddomain.focus();
//    return (false);
//  }
//  if (f1.cbnom.checked && !temponto)
//  {
//    alert("Domínios com extensão NOM.BR serão válidos somente com um ponto no interior do nome escolhido.");
///	f1.ddomain.focus();
//    return (false);
//  }  
//----------------------
	var countcb = 0;
	for(i=0;i<f1.qtd.value;i++)
	   {
		if (f1.cb[i].checked==true)
			countcb++;
		}
		if (countcb > 4)
			{alert ("Por favor, marque no máximo 4 extensões para pesquisar.");
			 return(false);}
		if ((countcb==0) && (f1.cbnom.checked==false))
			{alert ("Por favor, marque pelo menos 1 extensão para pesquisar.");
			 return(false);}
		 
//----------------------
return(true);
}

//-----------------------
// Desmarca checkboxes quando se marca a caixa "nom.br"
function enabledisable(f1,caixa)
{
	if (document.f1.cbnom.checked)
		{
			//alert(caixa);
			if (caixa == "nom")
				{
					for(i=0;i<document.f1.qtd.value;i++)
						document.f1.cb[i].checked=false;
				}
			else
				{
					document.f1.cbnom.checked = false;
				}
		}
}
//---------------------

 function abrejanela(pURL,altura,largura,x,y) 
{
	var wip = Math.round((0.015 * screen.availWidth));
	var hip = Math.round((0.048 * screen.availHeight));
	if (altura > screen.availHeight)
		altura = screen.availHeight;
	if (largura > screen.availWidth)
		largura = screen.availWidth;
	if (altura < 10)
		altura = 10;
	if (largura < 10)
		largura = 10;
	if (y > screen.availHeight - altura - hip)
		y = screen.availHeight - altura - hip;
	if (x> screen.availWidth - largura - wip )
		x = screen.availWidth - largura - wip;
	if (y < 0)
		y = 0;
	if (x < 0)
		x = 0;
	//showModelessDialog(pURL,window,"dialogLeft:" + x + ";dialogTop:" + y + ";status:false;scroll:yes;help:no;dialogWidth:" + largura + "px;dialogHeight:" + altura + "px");	
    var j=window.open(pURL,"dpns","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=" + largura + ",height=" + altura); 
    j.moveTo(x,y);
}

	var win= null;
	function NewWindow(mypage,myname,w,h,scroll)
	{
		var winl = (screen.width-w)/2;
		var wint = (screen.height-h)/2;
		var settings  ="height="+h+",";
		settings +="width="+w+",";
		settings +="top="+wint+",";
		settings +="left="+winl+",";
		settings +="scrollbars="+scroll+",";
		settings +="resizable=yes";
		win=window.open(mypage,myname,settings);
		if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
	}

function VerificaPergunta(){
if (document.Geral.email.value == "")  {
    alert("O campo E-mail está vazio!!");    document.Geral.email.focus();    return (false);
    }   else   {
	var Branco = " ";   var Posic, Carac;   var Temp = document.Geral.email.value.length;       var Cont = 0;
   for (var i=0; i < Temp; i++)      {     
         Carac =  document.Geral.email.value.charAt (i);   Posic  = Branco.indexOf (Carac);   
         if (Posic == -1)    Cont++;   }   
   if (Cont <= 0)   {
    	alert("O campo E-mail está vazio!!");    	document.Geral.email.focus();    	return (false);
   }   }   
   
if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.Geral.email.value))) 
    { 
     alert("Favor informar um email válido.") ;
     document.Geral.email.focus();
     return (false);
    }
if (document.Geral.body.value == "")  {
    alert("O campo Assunto está vazio!!");    document.Geral.body.focus();    return (false);
    }   else   {
	var Branco = " ";   var Posic, Carac;   var Temp = document.Geral.body.value.length;       var Cont = 0;
   for (var i=0; i < Temp; i++)      {     
         Carac =  document.Geral.body.value.charAt (i);   Posic  = Branco.indexOf (Carac);   
         if (Posic == -1)    Cont++;   }   
   if (Cont <= 0)   {
    	alert("O campo Assunto está vazio!!");    	document.Geral.body.focus();    	return (false);
   }   }  
}	