//Função  para checar se o campo está vazio;
function vazio(campo,desc)
{

	if($("#"+campo+"").val()=="")
	{
	
		erros	+= "Campo '"+desc+"' não preenchido \n";
	
	}

}
function limpaVideo()
{
	
	onLoad	: $("#divPlayerVideo").empty();
	onLoad	: $("#divPlayerVideoIndex").empty();
	onLoad	: $("#divPlayerVideo2").empty();
	
}
function captura(tipo){
var d = document;

	if(tipo=='video')
	{
		
		comp	= "v";
			
	}
	if(tipo=='texto')
	{
		
		comp	= "t";	
		
	}
	if(tipo=='foto')
	{
		
		comp	= "f";	
		
	}
	if(tipo=='index')
	{
		
		comp	= "vi";	
		
	}
//	alert(comp);
	var str1 = d.getElementById("str1"+comp+"");
	var str2 = d.getElementById("str2"+comp+"");
	var str3 = d.getElementById("str3"+comp+"");
	var str4 = d.getElementById("str4"+comp+"");
	var str5 = d.getElementById("str5"+comp+"");
	var str6 = d.getElementById("str6"+comp+"");
	var str7 = d.getElementById("str7"+comp+"");
	var str8 = d.getElementById("str8"+comp+"");
	var str9 = d.getElementById("str9"+comp+"");
	var str10 = d.getElementById("str10"+comp+"");
	str1.onmouseover=function(){
		str1.style.backgroundPosition="0";
			
		str2.style.backgroundPosition="-47px 0";
		str3.style.backgroundPosition="-47px 0";
		str4.style.backgroundPosition="-47px 0";
		str5.style.backgroundPosition="-47px 0";
		str6.style.backgroundPosition="-47px 0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str2.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="-47px 0";
		str4.style.backgroundPosition="-47px 0";
		str5.style.backgroundPosition="-47px 0";
		str6.style.backgroundPosition="-47px 0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str3.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="-47px 0";
		str5.style.backgroundPosition="-47px 0";
		str6.style.backgroundPosition="-47px 0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str4.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="-47px 0";
		str6.style.backgroundPosition="-47px 0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str5.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="-47px 0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
        
	};
	str6.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="0";
		str7.style.backgroundPosition="-47px 0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str7.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="0";
		str7.style.backgroundPosition="0";
		str8.style.backgroundPosition="-47px 0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str8.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="0";
		str7.style.backgroundPosition="0";
		str8.style.backgroundPosition="0";
		str9.style.backgroundPosition="-47px 0";
		str10.style.backgroundPosition="-47px 0";
	};
	str9.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="0";
		str7.style.backgroundPosition="0";
		str8.style.backgroundPosition="0";
		str9.style.backgroundPosition="0";
		str10.style.backgroundPosition="-47px 0";
	};
	str10.onmouseover=function(){
		str1.style.backgroundPosition="0";
		str2.style.backgroundPosition="0";
		str3.style.backgroundPosition="0";
		str4.style.backgroundPosition="0";
		str5.style.backgroundPosition="0";
		str6.style.backgroundPosition="0";
		str7.style.backgroundPosition="0";
		str8.style.backgroundPosition="0";
		str9.style.backgroundPosition="0";
		str10.style.backgroundPosition="0";
	};

}
function verificaResolucao()
		{
		
			if(screen.width==1024)
			{
			
				$("#bgGeral").attr("style","width:92494px");
			
			}
		
		}
		
function verificaTipo(tipo)
		{
		
			retorno	= new Array(9);
			switch (tipo) 
			{
			
			case "video":
				
				retorno[0]	= "../tratamento/trata.video.php";
				retorno[1]	= "divColAVideo";
				retorno[2]	= "divIndicesVideo";
				retorno[3]	= "garrafasVideo";
				retorno[4]	= "rankVideo";
				retorno[5]	= "v";
				retorno[6]	= "../video/video.php";
				retorno[7]	= "captchaVideo";
				retorno[8]	= "txtCaptchaVideo";
				retorno[9]	= "divCaptchaVideo";
			
			break
			
			case "texto":
			
				retorno[0]	= "../tratamento/trata.texto.php";
				retorno[1]	= "divColATexto";
				retorno[2]	= "divIndicesTexto";
				retorno[3]	= "garrafasTexto";
				retorno[4]	= "rankTexto";
				retorno[5]	= "t";
				retorno[6]	= "../texto/texto.php";
				retorno[7]	= "captchaTexto";
				retorno[8]	= "txtCaptchaTexto";
				retorno[9]	= "divCaptchaTexto";
				
			break
			
			case "foto":
			
				retorno[0]	= "../tratamento/trata.foto.php";
				retorno[1]	= "divColAFoto";
				retorno[2]	= "divIndicesFoto";
				retorno[3]	= "garrafasFoto";
				retorno[4]	= "rankFoto";
				retorno[5]	= "f";
				retorno[6]	= "../fotos/fotos.php";
				retorno[7]	= "captchaFoto";
				retorno[8]	= "txtCaptchaFoto";
				retorno[9]	= "divCaptchaFoto";
				
			break
			
			}
			return retorno;
		
		}		
		
//Função para marcarar os campos;
function mask(objeto, evt, mask){
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	var Numeros = '0123456789';
	var Fixos  = '().-:/ ';
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";
	
	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if (evt) {
	 var ntecla = (evt.which) ? evt.which : evt.keyCode;
	 tecla = Charset.substr(ntecla - 32, 1);
	 if (ntecla < 32) return true;
	
	 var tamanho = value.length;
	 if (tamanho >= mask.length) return false;
	
	 var pos = mask.substr(tamanho,1);
	 while (Fixos.indexOf(pos) != -1) {
	  value += pos;
	  tamanho = value.length;
	  if (tamanho >= mask.length) return false;
	  pos = mask.substr(tamanho,1);
	 }
	
	 switch (pos) {
	   case '#' : if (Numeros.indexOf(tecla) == -1) return false; break;
	   case 'A' : if (LetrasU.indexOf(tecla) == -1) return false; break;
	   case 'a' : if (LetrasL.indexOf(tecla) == -1) return false; break;
	   case 'Z' : if (Letras.indexOf(tecla) == -1) return false; break;
	   case '*' : objeto.value = value; return true; break;
	   default : return false; break;
	 }
	}
	objeto.value = value;
	return true;
}
function limpaClasses()
{
	
	$(".bt01D").attr("class","bt01");
	$(".bt02D").attr("class","bt02");
	$(".bt03D").attr("class","bt03");

}

//Função para a validação do E-mail.
function emailCheck (emailStr) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var msgerro = "E-mail com formato incorreto"
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	
	if (user.match(userPat)==null) {
		return false
	}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		  for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
			return false
			}
		}
		return true
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		return false
	}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
	   return false
	}
	if (len<2) {
	   return false
	}
	return true;
}

