function INFOJANELA(url,w,h)
	{
   	var conf;
      conf = 'toolbar=No,menubar=No,location=No,scrollbars=Yes,resizable=No,status=No,width='+w+',height='+h+',left=200,top=125'
		window.open(url,'',conf);
   }

function FECHARWIN(url)
	{
		parent.location=url;
   }

function NOVAWIN(url)
	{
		parent.location=url;
   }

function BIBLIOTECA(url)
	{
		window.open(url,'','toolbar=No,menubar=No,location=No,scrollbars=Yes,resizable=No,status=Yes,width=350,height=500,left=200,top=25');
   }

function MOSTRAHELP(url)
	{
		showModalDialog(url,window,'status:false;dialogWidth:550px;dialogHeight:200px');
//--		showHelp(url);

   }


function WINMSGUSEROK(url)
	{
		showModalDialog(url,window,'status:false;dialogWidth:300px;dialogHeight:200px');
   }

function VERIFICA_CPF(valor)
	{
	   erro = 0;
	   aux1 = 0;
	   aux2 = 0;
	   aux3 = 1;
	   for (i=0;i<valor.length-2;i++)
	      {
	         if ((valor.substr(i,1) != "/") && (valor.substr(i,1) != "-") && (valor.substr(i,1) != "."))
	            {
	               aux1 = aux1+(11-aux3)*valor.substr(i,1);
	               aux2 = aux2+(12-aux3)*valor.substr(i,1);
	               aux3++;
	            }
	      }
	   resto = aux1-((Math.floor(aux1/11))*11);
	   (resto < 2) ? dig1=0 : dig1=11-resto;
	   aux2 = aux2+(2*dig1);
	   resto = aux2-((Math.floor(aux2/11))*11);
	   (resto < 2) ? dig2=0 : dig2=11-resto;
	   aux = dig1+" "+dig2;
	   aux = aux.substr(0,1)+aux.substr(2,1);
	   if (aux != valor.substr(valor.length-2))
      	{
         	alert('Erro no CPF, verifique!');
	      	return false;
         }
	   else
	      if ((valor == "00000000000") || (valor == "11111111111") || (valor == "22222222222") || (valor == "33333333333") || (valor == "44444444444") || (valor == "55555555555") || (valor == "66666666666") || (valor == "77777777777") || (valor == "88888888888") || (valor == "99999999999"))
	         {
	            alert('Erro no CPF, verifique!');
	            return false;
	         }
	      else
	         return true;
	}

function VERIFICA_CNPJ(valor)
	{
	   aux1 = 0;
	   aux2 = 0;
	   aux3 = 1;
	   aux4 = 0;
	   for (i=0;i<valor.length-2;i++)
	      {
	         if ((valor.substr(i,1) != "/") && (valor.substr(i,1) != "-") && (valor.substr(i,1) != "."))
	            {
	               (aux3 < 5) ? aux4 = 6-aux3 : aux4 = 14-aux3;
	               aux1 = aux1+(valor.substr(i,1)*aux4);
	               (aux3 < 6) ? aux4 = 7-aux3 : aux4 = 15-aux3;
	               aux2 = aux2+(valor.substr(i,1)*aux4);
	               aux3++;
	            }
	      }
	   resto = aux1-((Math.floor(aux1/11))*11);
	   (resto < 2) ? dig1=0 : dig1=11-resto;
	   aux2 = aux2+(2*dig1);
	   resto = aux2-((Math.floor(aux2/11))*11);
	   (resto < 2) ? dig2=0 : dig2=11-resto;
	   aux = dig1+" "+dig2;
	   aux = aux.substr(0,1)+aux.substr(2,1);
	   if (aux != valor.substr(valor.length-2))
      	{
         	alert('Erro no CNPJ, verifique!');
	      	return false;
         }
	   else
	      if ( (valor == "99999999999962") || (valor == "00000000000000") )
      	{
         	alert('Erro no CNPJ, verifique!');
	      	return false;
         }
	      else
	         return true;
	}

function POPUP(url)
	{
	   showModalDialog(url,window,"status:false;dialogWidth:650px;dialogHeight:500px");
   }

function AbrePagina(Foto, tamx, tamy)
	{
		showModalDialog(Foto,window,'status:false;dialogWidth:558px;dialogHeight:500px')
	}

function AbreWin(url)
	{
//		showModalDialog(url,window,'status:false;dialogWidth:558px;dialogHeight:500px');
		window.open(url,'','toolbar=No,menubar=No,location=No,scrollbars=Yes,resizable=No,status=Yes,width=558,height=500,left=150,top=25');
	}

function AbreEnquete(url)
	{
		showModalDialog(url,window,'status:false;dialogWidth:300px;dialogHeight:400px');
	}

function NOVAURL(url)
	{
	   parent.location=url;
	}

function AbreMusica(url)
	{
		window.open(url,'','toolbar=No,menubar=No,location=No,scrollbars=No,resizable=No,status=Yes,width=200,height=185,left=250,top=225');
	}

function AbreAUDIO(url)
	{
		window.open(url,'','toolbar=No,menubar=No,location=No,scrollbars=No,resizable=No,status=Yes,width=450,height=385,left=250,top=225');
	}

function ReturnSizePage(type)
	{
      var width = document.body.clientWidth;
      var height = document.body.clientHeight;

		if (type.toLowerCase()=="w")
			{
				return width;
			}
				else (type.toLowerCase()=="h")
			{
				return height;
			}
	}
