// scripts


// script de mensagem da barra de status
defaultStatus="Busca On-line - A busca que faltava na internet!"


function ValidaNewsletter(){
var email=document.newsletters.email.value;
if (email==""){
alert("Seu e-mail não foi preenchido!")
document.newsletters.email.focus()
return false
}
	
if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){ 
alert("Este endereço de e-mail não é um endereço válido!")
document.newsletters.email.focus()
return false
}
}

// Funções - Incluir Entrevistas

function AddText(text) {
	if (document.form.Entrevista.createTextRange && document.form.Entrevista.caretPos) {      
		var caretPos = document.form.Entrevista.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.form.Entrevista.value += text;  
}

//function AddText(NewCode) {
//	document.form.noticia.value+=NewCode;
//	document.form.noticia.focus();
//}

function hr() {
	AddTxt="<hr>";
	AddText(AddTxt);
}

function size() {
	AddTxt="<font size=\"1\"></font>";
	AddText(AddTxt);
}

function font() {
	AddTxt="<font face=\"Arial\"></font>";
	AddText(AddTxt);
}

function superscript() {
	AddTxt="<sup></sup>";
	AddText(AddTxt);
}

function subscript() {
	AddTxt="<sub></sub>";
	AddText(AddTxt);
}

function image() {
	AddTxt="<img src=\"URL\">";
	AddText(AddTxt);
}

function underline() {
	AddTxt="<u></u>";
	AddText(AddTxt);
}

function emai1() {
	AddTxt="<a href=\"mailto:EMAIL\">EMAIL</a>";
	AddText(AddTxt);
}

function bold() {
	AddTxt="<b></b>";
	AddText(AddTxt);
}

function italicize() {
	AddTxt="<i></i>";
	AddText(AddTxt);
}

function center() {
	AddTxt="<center></center>";
	AddText(AddTxt);
}

function hyperlink() {
	AddTxt="<a href=\"endereco do link\">LINK</a>";
	AddText(AddTxt);
}

//---------------------------------------

//Função para abrir a pop-up de votos
function JanelaVotar(theURL,winName,features) {
  	window.open(theURL,winName,'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=310');
}
// -->

//---------------------------------------


<!-- Função que checa dados do formulário


//Function to count the number of characters in the description text box
function Conta_caracteres() {
	document.Form_incluir.contador.value = document.Form_incluir.descricao.value.length;
}

//Function to check form is filled in correctly before submitting
function Valida_form () {

	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";

	//Check for a URL title
	if (document.Form_incluir.titulo.value == ""){
		errorMsg += "\n\tTítulo do site \t- Digite o título de seu site";
	}
		
	//Check for a URL address
	if ((document.Form_incluir.url.value == "http://")||(document.Form_incluir.url.value == "")){
		errorMsg += "\n\tURL \t\t- Digite o endereço (URL) de seu site";
	}
		
	//Check for keywords
	if (document.Form_incluir.palavras_chave.value == ""){
		errorMsg += "\n\tPalavras-chave \t- Digite as palavras-chave de seu site";
	}
	
	//Check for category
	if (document.Form_incluir.categoria_nome.value == ""){
		errorMsg += "\n\tCategoria \t- Selecione a categoria de seu site";
	}

	//Check for a description
	if (document.Form_incluir.descricao.value == ""){
		errorMsg += "\n\tDescrição \t- Digite a descrição de seu site";
	}	
		
	//Check for a email
	if (document.Form_incluir.email.value == ""){
		errorMsg += "\n\tE-mail \t\t- Digite um e-mail para contato";
	}
	
	//Check the description length before submiting the form	
	if (document.Form_incluir.descricao.value.length > 235){
		errorMsgLong += "\n- Sua descrição contém " + document.Form_incluir.descricao.value.length + " caracteres, só é permitido até 235 caracteres.";
	}
	
	//Check the word length before submitting
	words = document.Form_incluir.descricao.value.split(' ');
	for (var loop = 0; loop <= words.length - 1; ++loop){
		if (words[loop].length > 30){
		errorMsgLong += "\n- Em sua descrição, existe uma palavra com " + words[loop].length + " sílabas, só é permitido palavras com no máximo 30 sílabas.";
		}	
	}	
	
	//Check for HTML tags before submitting the form	
	for (var count = 0; count <= 3; ++count){
		if ((document.Form_incluir.elements[count].value.indexOf("<", 0) >= 0) && (document.Form_incluir.elements[count].value.indexOf(">", 0) >= 0)){
			errorMsgLong += "\n- Tags HTML não são permitidas, por favor, remova.";
		}			
	}
	
	//If there is aproblem with the form then display an error
	if ((errorMsg != "")||(errorMsgLong != "")){
		msg = "___________________________________________________________________\n\n";
		msg += "Seu cadastro não pôde ser efetuado devido a alguns erros no formulário de cadastro.\n";
		msg += "Efetue as correções nos problemas listados abaixo, para completar seu cadastro.\n";
		msg += "___________________________________________________________________\n\n";
		msg += "Os campos abaixo estão incorretos:\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	}
	
	return true;
}
// -->








// retira erros chatos de js que são mostrados ao user
//function semerro(){
//return true;}
//window.onerror=semerro;

