function AbreJanela(nome,largura,altura) {
   parametros='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,menubar=no,width='+largura+',height='+altura
   window.open(nome,'janela',parametros);
}
function VerEnquete(enquete){
	var valor = RetornaRadioChecked(document.frmenquete,"enquete");
	if(valor == ""){
		alert("Escolha uma opção!");
		return false;
	}else{
		AbreJanela("enquete_votos.asp?enquete="+enquete+"&valor="+valor, "380", "400");		
		return true;
	}
}
function RetornaRadioChecked(pForm,pNomeRadio){
	var i;
	var e = pForm.elements[pNomeRadio];
	
	for(i=0;i<e.length;i++){		
		if (e[i].checked == true){
			return e[i].value;
			break;
		}
	}
	return "";
}
function openPopupVideoCont(video){	w=350
	h=400	popupVideo=window.open('player.asp?video='+ video,'gobatti_popup_video','width='+w+',height='+h+',scrollbars=0')
	popupVideo.focus()
}
function VerificaBusca(e){
	if (e.busca.value == '' || e.busca.value == null){
		alert('Sua busca de conter pelo menos 2 caracteres');
		Select(e.busca);
		return false;
	}else if(String(e.busca.value).length < 2){
		alert('Sua busca de conter pelo menos 2 caracteres');
		Select(e.busca);
		return false;	
	}
	return true;
}
function Select(pCampo)
{
  	pCampo.focus();
    pCampo.select();
} 
// Funções para validar login no chat
function abre_janela() {
  var user    = document.frmchat.user.value;
  var screen  = document.frmchat.screen.value;
  var room    = document.frmchat.room.value;
  var chatter = document.frmchat.chatter.value;
  user = escape(user);
  var URL ='http://inchat.insite.com.br/cgi-bin/inchat/inchat.pl?login=1&user='+user+'&screen='+screen+'&room='+room+'&chatter='+chatter;
  window.open(URL,'OpenInchat','width=790,height=525,top=0,left=0');
  return false;
}
function VerifyForm() {
        if (document.frmchat.user.value.length == 0) {
                alert ("Por favor, preencha o campo 'Apelido'.");                return false;
        }
	abre_janela();
	return false;
}
/*function openPopupAudioCont(audio){
	w=350
	h=400
	popupAudio=window.open('player.asp?audio='+ audio,'gobatti_popup_audio','width='+w+',height='+h+',scrollbars=0')
	popupAudio.focus()
}*/
function chutaDados(email) {
  var posicao = email.indexOf("@")+1;
  document.frmmail2.username.value=email.substring(0,posicao - 1)
  if (posicao>0) {
    var host = email.substring(posicao,email.length);
    var pop = "pop."+host;
    if (host == "usp.br") {
      document.frmmail2.pop_host.value="email.uspnet.usp.br";
    } else if (host == "insite.com.br") {
      document.frmmail2.pop_host.value="fantomas.insite.com.br";
    } else if (host == "uol.com.br") {
      document.frmmail2.pop_host.value="pop3.uol.com.br";
    } else {
      document.frmmail2.pop_host.value=pop;
    }
  }
}
function VerifyFormWebMail(){
        if (document.frmmail1.email.value.length == 0) {
                alert ("Por favor, digite o seu email!");
                Select(document.frmmail1.email);                return false;
        }else if (document.frmmail2.password.value.length == 0) {
                alert ("Por favor, digite a sua senha!");
                Select(document.frmmail2.password);                return false;
        }
	return true;
}