function abrirDicas(){
	window.open("/formatacao.php","dicas","width=305,height=420");
}


/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(theform,thelimit,limitused,texto){
	saldo = Number(thelimit)-Number(limitused)
	var limit_text='<b><span id="'+theform.toString()+'">'+saldo+'</span></b> '+texto
	if (document.all||ns6)
	document.write(limit_text)
	if (document.all){
	eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
	eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
	}
	else if (ns6){
	document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
	document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
	}
}

isIE = (navigator.userAgent.indexOf("MSIE") > -1);
digitos = 1;

function LoginFotolist(campo, evento){
	lastkey = campo.value.charAt(campo.value.length-1);
	tamanho = campo.value.length;
	varNumeros = "_";
	if (isIE){
		tecla = evento.keyCode;
	} else {
		tecla = evento.which;
	}
	//alert(varNumeros.indexOf(String.fromCharCode(tecla)));
	if(tamanho==0 && varNumeros.indexOf(String.fromCharCode(tecla)) >= 0){
		return false;
	}
	permitidos = "0123456789_abcdefghijklmnopqrstuvxzwy";
	if (permitidos.indexOf(String.fromCharCode(tecla)) == -1){
		return false;
	} else if (String.fromCharCode(tecla) == " "){
		return false;
	}
	
}

function montarCores(campo, evento){
	lastkey = campo.value.charAt(campo.value.length-1);
	
	if (isIE){
		tecla = evento.keyCode;
	} else {
		tecla = evento.which;
	}
	
	permitidos = "0123456789abcdefghijklmnopqrstuvxzwy";
	if (permitidos.indexOf(String.fromCharCode(tecla)) == -1){
		return false;
	} else if (String.fromCharCode(tecla) == " "){
		return false;
	}
	
}

function Numeros(campo, evento){
	lastkey = campo.value.charAt(campo.value.length-1);
	
	if (isIE){
		tecla = evento.keyCode;
	} else {
		tecla = evento.which;
	}
	
	permitidos = "0123456789";
	if (permitidos.indexOf(String.fromCharCode(tecla)) == -1){
		return false;
	} else if (String.fromCharCode(tecla) == " "){
		return false;
	}
	
}

function validarData(data,campo){
	dia = data.substr(0,2);
	mes = data.substr(3,2);
	ano = data.substr(6,4);

	fimMes = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	
	if (eval(mes)==2){
		if (ano%4==0){
			fimMes[1]=29;
		}
	}
	indice = eval(mes)-1;

	if (fimMes[indice]<eval(dia) || (eval(ano)<1900 && eval(ano)>3000) || eval(mes)>12){
		alert("Data Inválida!\nPor favor, digite-a novamente.")
		campo.value=""
		campo.focus()
	}
}

function about(login){
	window.open("/about.php?user="+login+"","about","width=270,height=400,scrollbars=yes");
}

function enviarfoto(url,login){
	window.open("/templates/enviarfoto.php?url="+url+"&login="+login+"","enviarfoto","width=470,height=320");
}

function denunciar(idfoto,idusuario){
	window.open("/denunciation.php?iduser="+idusuario+"&idfoto="+idfoto+"","denuncia","width=250,height=200");
}

function mOvr(src,clrOver) {
  if (!src.contains(event.fromElement)) {
      src.style.cursor = 'hand';
      //src.bgColor = clrOver;
  }
}
function mOut(src,clrIn) {
  if (!src.contains(event.toElement)) {
     src.style.cursor = 'default';
     //src.bgColor = clrIn;
  }
}
function gotourl(url) {
  window.location.href=url;
}

function enviarMensagem(){
	var erro = "";
	
	if (document.getElementById("remetente").value == "") 	erro += "\n - Remetente não preenchido";
	if (document.getElementById("msg").value == "") 		erro += "\n - Mensagem não preenchida";
	if (document.getElementById("validacao").value == "") 	erro += "\n - Código de Validação não preenchido";
	
	if (erro==""){
		document.getElementById("form_msg").submit();
	}else{
		alert("Os seguintes erros ocorreram:"+erro)
	}
}

function enviarSugestao(){
	varNome = sugestao.name.value;
	varEmail = sugestao.email.value;
	varAssunto = sugestao.subject.value;
	varSugestao = sugestao.suggestions.value;
	if (varNome=="" && varEmail=="" && varAssunto=="" && varSugestao==""){
		alert("<? echo $textos[55];?>");
	}else{
		sugestao.submit();
	}
}

function btEnter(TeclaPres){
    var tecla = TeclaPres.keyCode;
	if (tecla == 13){
		novaBusca()
	}
}

function novaBusca(){
	varBusca = busca.value;
	if (varBusca!=""){
		window.location="/busca/"+varBusca;
	}
}

function achar_par(){
	window.location="search/meupar.php?sexo="+sexo.value+"&estado="+estado.value+"&idade="+idade.value;
}

function efetuarLogin(){
	if (ns6){
		campoSenha = window.parent.document.getElementById("fotolist_pass").value;
		window.parent.document.getElementById("fotolist_pass").value= enCrypt(campoSenha);
	}else{
		form_login.fotolist_pass.value=enCrypt(form_login.fotolist_pass.value);
	}
}

function enCrypt(senha){
	var keylist="abcdefghijklmnopqrstuvwxyz1234567890";
	var varSenha="";
	var c ="";
	var retorno = "";
	if (senha!=""){
		for (n=0;n<senha.length;n++){
			c = "";
			for (m=0;m<10;m++){
				c += keylist.charAt(Math.floor(Math.random()*keylist.length));
			}
			varSenha = varSenha + senha.substr(n,1)+c;
		}
		retorno = varSenha;
	}
	return senha;
}

function excluirTodasMesagens(){
	if (navigator.appName.indexOf("Netscape")!=1&&parseInt(navigator.appVersion)>=5){
		var total = document.getElementById("totalMsg").value;
		//var objetos = document.getElementById("mensagem");
		if (total>1){
			for(t=0;t<total;t++){
				//objetos[t].checked=true;
			}
		}else{
			document.getElementById("mensagem").checked = true;
		}
		document.getElementById("form1").submit();
	}else{
		var total = form1.totalMsg.value;
		if (total>1){
			for(t=0;t<total;t++){
				form1.mensagem[t].checked = true;
			}
		}else{
			form1.mensagem.checked = true;
		}
		form1.submit();
	}
}

google_ad_client = "pub-9108252987340758";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text";
google_ad_channel ="";
