
// geral do site //
function Login () { 

	//Inicia as Variaveis
	var errorMsg = "";

	if (document.login.login.value == ""){
		errorMsg += "\n\tLogin\t	- Digite seu login";	
	}

	if (document.login.senha.value == ""){
		errorMsg += "\n\tSenha\t	- Digite sua senha";	
	}

	//Se houver algum problema com o formulário ele indica
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "É necessário preencher os campos para fazer o login.\n";
		msg += "Corrija o problema e clique em ENVIAR\n";
		msg += "______________________________________________________________\n\n";
		msg += "O(s) seguinte(s) campo(s) tem que ser(em) corrigido(s): -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}

//verificar se o formulario foi preenchido corretamente
function MuralEnvia () { 

	//Inicia as Variaveis
	var errorMsg = "";

	if (document.mural.nome.value == ""){
		errorMsg += "\n\tNome\t	- Digite seu Nome";	
	}

	if (document.mural.email.value == ""){
		errorMsg += "\n\tE-mail\t	- Digite seu e-mail";	
	}

	if (document.mural.email.value.indexOf("@",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem @";
	}

	if (document.mural.email.value.indexOf(".",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem .com ou .com.br";
	}

	if (document.mural.dddtelefone.value == ""){
		errorMsg += "\n\tDDD\t	- Código de área inválido";	
	}

	if (document.mural.telefone.value == ""){
		errorMsg += "\n\tTelefone\t	- Digite seu telefone";	
	}

	if (document.mural.dddcelular.value == ""){
		errorMsg += "\n\tDDD\t	- Código de área inválido";	
	}

	if (document.mural.celular.value == ""){
		errorMsg += "\n\tCelular\t	- Digite seu celular";	
	}

	if (document.mural.mensagem.value == ""){
		errorMsg += "\n\tMensagem\t- Digite sua mensagem";	
	}

	//Se houver algum problema com o formulário ele indica
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "O recado não pode ser gravado !\n";
		msg += "Corrija o problema e clique em ENVIAR\n";
		msg += "______________________________________________________________\n\n";
		msg += "O(s) seguinte(s) campo(s) tem que ser(em) corrigido(s): -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
// fim de checkform


//verificar se o formulario foi preenchido corretamente
function ContatoEnvia () { 

	//Inicia as Variaveis
	var errorMsg = "";

	if (document.contato.nome.value == ""){
		errorMsg += "\n\tNome\t	- Digite seu Nome";	
	}

	if (document.contato.email.value == ""){
		errorMsg += "\n\tE-mail\t	- Digite seu e-mail";	
	}

	if (document.contato.email.value.indexOf("@",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem @";
	}

	if (document.contato.email.value.indexOf(".",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem .com ou .com.br";
	}

	if (document.contato.dddtelefone.value == ""){
		errorMsg += "\n\tDDD\t	- Código de área inválido";	
	}

	if (document.contato.telefone.value == ""){
		errorMsg += "\n\tTelefone\t	- Digite seu telefone";	
	}

	if (document.contato.dddcelular.value == ""){
		errorMsg += "\n\tDDD\t	- Código de área inválido";	
	}

	if (document.contato.celular.value == ""){
		errorMsg += "\n\tCelular\t	- Digite seu celular";	
	}

	if (document.contato.assunto.value == ""){
		errorMsg += "\n\tAssunto\t	- Digite o assunto";	
	}

	if (document.contato.mensagem.value == ""){
		errorMsg += "\n\tMensagem\t- Digite sua mensagem";	
	}

	//Se houver algum problema com o formulário ele indica
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "A mensagem não pode ser enviada !\n";
		msg += "Corrija o problema e clique em ENVIAR\n";
		msg += "______________________________________________________________\n\n";
		msg += "O(s) seguinte(s) campo(s) tem que ser(em) corrigido(s): -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
// fim de checkform


//verificar se o formulario foi preenchido corretamente
function NewsletterEnvia () { 

	//Inicia as Variaveis
	var errorMsg = "";

	if (document.newsletter.email.value == "E-mail"){
		errorMsg += "\n\tE-mail\t	- Digite seu e-mail";	
	}

	if (document.newsletter.email.value.indexOf("@",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem @";
	}

	if (document.newsletter.email.value.indexOf(".",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem .com ou .com.br";
	}

	//Se houver algum problema com o formulário ele indica
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "O e-mail não pode ser gravado !\n";
		msg += "Corrija o problema e clique na SETA ao lado\n";
		msg += "______________________________________________________________\n\n";
		msg += "O(s) seguinte(s) campo(s) tem que ser(em) corrigido(s): -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
// fim de checkform

function IndicaVideosEnvia () { 

	//Inicia as Variaveis
	var errorMsg = "";

	if (document.videosindica.nomeamigo.value == ""){
		errorMsg += "\n\tAmigo\t	- Digite o nome do amigo";	
	}

	if (document.videosindica.emailamigo.value == ""){
		errorMsg += "\n\tE-mail\t	- Digite o e-mail do amigo";	
	}

	if (document.videosindica.emailamigo.value.indexOf("@",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem @";
	}

	if (document.videosindica.emailamigo.value.indexOf(".",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem .com ou .com.br";
	}

	if (document.videosindica.seunome.value == ""){
		errorMsg += "\n\tNome\t	- Digite seu nome";	
	}

	if (document.videosindica.seuemail.value == ""){
		errorMsg += "\n\tE-mail\t	- Digite seu e-mail";	
	}

	if (document.videosindica.seuemail.value.indexOf("@",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem @";
	}

	if (document.videosindica.seuemail.value.indexOf(".",0) == - 1){ 
		errorMsg += "\n\tE-mail\t	- O campo e-mail não tem .com ou .com.br";
	}

	//Se houver algum problema com o formulário ele indica
	if (errorMsg != ""){
		msg = "______________________________________________________________\n\n";
		msg += "O e-mail não pode ser enviado !\n";
		msg += "Corrija o problema e clique em ENVIAR\n";
		msg += "______________________________________________________________\n\n";
		msg += "O(s) seguinte(s) campo(s) tem que ser(em) corrigido(s): -\n";
		
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	
	return true;
}
// fim de checkform


//contador de caracteres do campo de textarea
	function blocTexto(valor){
		quant = 102;
		total = valor.length;
		if(total <= quant)
		{
			resto = quant - total;
			document.getElementById('cont').innerHTML = resto;
		}
		else
		{
			document.getElementById('mensagem').value = valor.substr(0,quant);
		}
	}
//fim contador de caracteres do campo de textarea

//contador de caracteres do campo de textarea
	function blocTextoContato(valor){
		quant = 612;
		total = valor.length;
		if(total <= quant)
		{
			resto = quant - total;
			document.getElementById('cont').innerHTML = resto;
		}
		else
		{
			document.getElementById('mensagem').value = valor.substr(0,quant);
		}
	}
//fim contador de caracteres do campo de textarea


//contador de caracteres do campo de textarea
	function blocTextoIndicarVideo(valor){
		quant = 204;
		total = valor.length;
		if(total <= quant)
		{
			resto = quant - total;
			document.getElementById('cont').innerHTML = resto;
		}
		else
		{
			document.getElementById('mensagem').value = valor.substr(0,quant);
		}
	}
//fim contador de caracteres do campo de textarea

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}


function mostraLinha(nome){
	nome = document.getElementById( nome );

	if(nome.style.display == 'none')
		{	nome.style.display = '';	} 
	else{	nome.style.display = 'none'	}	
}

 function ocultaLinha(nome){
	nome = document.getElementById( nome );

	if(nome.style.display == '')
		{	nome.style.display = 'none';	} 
	else{	nome.style.display = ''	}	
}


	function ajaxInit() {
        var req;
        try {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            try {
                req = new ActiveXObject("Msxml2.XMLHTTP");
            } catch(ex) {
                try {
                    req = new XMLHttpRequest();
                } catch(exc) {
                    alert("Esse browser não suporta Ajax");
                    req = null;
                }
            }
        }
        return req;
    }


	function pegarvideo(variavel){
		if(variavel.value!=""){
			ajax = ajaxInit(); 
			ajax.open("GET", "buscavideo.asp?codigovideo=" +variavel,true); 
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4){
				document.getElementById("video").innerHTML=ajax.responseText;
	
				}
			}
			ajax.send(null);
		}
	}

