<!--
//#############################################################
//#############################################################
//#############################################################
msg			= "Todos os campos devem ser preenchidos.";
msgEmail	= "Esse não é um e-mail válido.";
msgCpf		= "Esse não é um CPF válido.";
//#############################################################
function vld_enquete(){
	with(document.formEnquete){
		checado = false;
		for(var i=0; i<elements.length; i++){
			if(elements[i].type == 'radio'){
				if(elements[i].checked == true){
					checado = true;
				}
			}
		}
		if(!checado){
			alert('Selecione uma das respostas.');
			return false;
		}
	}
	return true;
}
//#############################################################
function vld_sorteio(){
	with(document.form1){
		if(sorConNome.value.length == 0){
			alert(msg);
			sorConNome.focus();
			return false;
		}
		if(sorConCpf.value.length == 0){
			alert(msg);
			sorConCpf.focus();
			return false;
		}else{
			if(!validaCPF(sorConCpf.value)){
				alert(msgCpf);
				sorConCpf.focus();
				return false;
			}
		}
		if(sorConEmail.value.length == 0){
			alert(msg);
			sorConEmail.focus();
			return false;
		}else{
			if(!vld_email(sorConEmail.value)){
				alert(msgEmail);
				sorConEmail.focus();
				return false;
			}
		}
		if(sorConTelefone.value.length == 0){
			alert(msg);
			sorConTelefone.focus();
			return false;
		}
		if(!sorNews.checked){
			alert('Para concorrer é necessário marcar a opção "Aceito receber newsletter"');
			return false;
		}
	}
	return true;
}
//#############################################################
function validaCPF(cpf)   
{   
  erro = new String;   
  
    if (cpf.length == 11)   
    {     
            cpf = cpf.replace('.', '');   
            cpf = cpf.replace('.', '');   
            cpf = cpf.replace('-', '');   
  
            var nonNumbers = /\D/;   
       
            if (nonNumbers.test(cpf))   
            {   
                    erro = "A verificacao de CPF suporta apenas números!";   
            }   
            else   
            {   
                    if (cpf == "00000000000" ||   
                            cpf == "11111111111" ||   
                            cpf == "22222222222" ||   
                            cpf == "33333333333" ||   
                            cpf == "44444444444" ||   
                            cpf == "55555555555" ||   
                            cpf == "66666666666" ||   
                            cpf == "77777777777" ||   
                            cpf == "88888888888" ||   
                            cpf == "99999999999") {   
                               
                            erro = "Número de CPF inválido!"   
                    }   
       
                    var a = [];   
                    var b = new Number;   
                    var c = 11;   
  
                    for (i=0; i<11; i++){   
                            a[i] = cpf.charAt(i);   
                            if (i < 9) b += (a[i] * --c);   
                    }   
       
                    if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }   
                    b = 0;   
                    c = 11;   
       
                    for (y=0; y<10; y++) b += (a[y] * c--);   
       
                    if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }   
       
                    if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])) {   
                        erro = "Número de CPF inválido.";   
                    }   
            }   
    }   
    else   
    {   
        if(cpf.length == 0)   
            return false   
        else   
            erro = "Número de CPF inválido.";   
    }   
    if (erro.length > 0) {   
//            alert(erro);   
//            cpf.focus();   
            return false;   
    }     
    return true;       
}   
  
//envento onkeyup   
function maskCPF(CPF) {   
    var evt = window.event;   
    kcode=evt.keyCode;   
    if (kcode == 8) return;   
    if (CPF.value.length == 3) { CPF.value = CPF.value + '.'; }   
    if (CPF.value.length == 7) { CPF.value = CPF.value + '.'; }   
    if (CPF.value.length == 11) { CPF.value = CPF.value + '-'; }   
}   
  
// evento onBlur   
function formataCPF(CPF)   
{   
    with (CPF)   
    {   
        value = value.substr(0, 3) + '.' +   
                value.substr(3, 3) + '.' +   
                value.substr(6, 3) + '-' +   
                value.substr(9, 2);   
    }   
}   
function retiraFormatacao(CPF)   
{   
    with (CPF)   
    {   
        value = value.replace (".","");   
        value = value.replace (".","");   
        value = value.replace ("-","");   
        value = value.replace ("/","");   
    }   
} 
//#############################################################
// CALENDÁRIO
function createQCObject() { 
   var req; 
   if(window.XMLHttpRequest){ 
	  // Firefox, Safari, Opera... 
	  req = new XMLHttpRequest(); 
   } else if(window.ActiveXObject) { 
	  // Internet Explorer 5+ 
	  req = new ActiveXObject("Microsoft.XMLHTTP"); 
   } else { 
	  alert('Problem creating the XMLHttpRequest object'); 
   } 
   return req; 
} 
// Make the XMLHttpRequest object 
var http = createQCObject(); 
function displayQCalendar(doc,par,m,y) {
	var ran_no=(Math.round((Math.random()*9999))); 
	http.open('get', '/inc/calendar.php?doc='+doc+'&par='+par+'&m='+m+'&y='+y+'&ran='+ran_no);
	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) { 
			var response = http.responseText;
			if(response) { 
				document.getElementById("calendar").innerHTML = http.responseText; 
			} 
		} 
	} 
	http.send(null); 
}

// ENTREVISTAS
function flashembed(g,h,j){if(typeof g=='string')g=document.getElementById(g);var k={src:'#',width:'100%',height:'100%',version:null,loadEvent:null,onFail:null,expressInstall:null,allowfullscreen:true,allowscriptaccess:'always',quality:'high',bgcolor:'#ffffff',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};extend(k,h);var l=k.loadEvent;k.loadEvent=null;if(l){g['on'+l]=function(){return load()}}else{return load()}function extend(a,b){if(b){for(key in b){a[key]=b[key]}}}function load(){var a=getVersion();var b=k.version;var c=k.expressInstall;if(!g)return;if(!b||isSupported(b)){k.onFail=k.version=k.expressInstall=null;g.innerHTML=getHTML();return g.firstChild}else if(k.onFail){var d=k.onFail.call(k,getVersion(),j);if(d)g.innerHTML=d}else if(b&&c&&isSupported([6,0,65])){extend(k,{src:c});j={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};g.innerHTML=getHTML()}else{if(g.innerHTML!=''){}else{g.innerHTML="<h2>Flash version "+b+" or greater is required</h2>"+"<h3>"+(a[0]>0?"Your version is "+a:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+k.pluginspage+"'>here</a></p>"}}g['on'+l]=null}function isSupported(a){var b=getVersion();return b[0]>=a[0]&&b[1]>=a[1]&&(b[2]==null||b[2]>=a[2])}function getHTML(){var a="";if(typeof j=='function')j=j();if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){a='<embed type="application/x-shockwave-flash" ';extend(k,{name:k.id});for(var b in k){if(k[b]!=null)a+=[b]+'="'+k[b]+'"\n\t'}if(j){a+='flashvars=\'';for(var b in j){a+=[b]+'='+asString(j[b])+'&'}a+='\''}a+='/>'}else{a='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';a+='width="'+k.width+'" height="'+k.height+'"';if(document.all&&parseInt(navigator.appVersion)<=6){k.id="_"+(""+Math.random()).substring(5)}if(k.id)a+=' id="'+k.id+'"';a+='>';a+='\n\t<param name="movie" value="'+k.src+'" />';k.id=k.src=k.width=k.height=null;for(var b in k){if(k[b]!=null)a+='\n\t<param name="'+b+'" value="'+k[b]+'" />'}if(j){a+='\n\t<param name="flashvars" value=\'';for(var b in j){a+=[b]+'='+asString(j[b])+'&'}a+='\' />'}a+="</object>"}return a}function getVersion(){var a=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var b=navigator.plugins["Shockwave Flash"].description;if(typeof b!="undefined"){b=b.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var c=parseInt(b.replace(/^(.*)\..*$/,"$1"),10);var d=/r/.test(b)?parseInt(b.replace(/^.*r(.*)$/,"$1"),10):0;a=[c,d]}}else if(window.ActiveXObject){try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(e){try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a=[6,0];f.AllowScriptAccess="always"}catch(e){if(a[0]==6)return}try{var f=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}}if(typeof f=="object"){var b=f.GetVariable("$version");if(typeof b!="undefined"){b=b.replace(/^\S+\s+(.*)$/,"$1").split(",");a=[parseInt(b[0],10),parseInt(b[2],10)]}}}return a}function asString(b){switch(typeOf(b)){case'string':return'"'+b.replace(new RegExp('(["\\\\])','g'),'\\$1')+'"';case'array':return'['+map(b,function(a){return asString(a)}).join(',')+']';case'object':var c=[];for(var d in b){c.push('"'+d+'":'+asString(b[d]))}return'{'+c.join(',')+'}'}return String(b).replace(/\s/g," ").replace(/\'/g,"\"")}function typeOf(a){if(a===null||a===undefined)return false;var b=typeof a;return(b=='object'&&a.push)?'array':b}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function map(a,b){var c=[];for(var i in a){c[i]=b(a[i])}return c}flashembed.getVersion=getVersion;flashembed.isSupported=isSupported;return g}if(typeof jQuery=='function'){(function($){$.fn.extend({flashembed:function(a,b){return this.each(function(){new flashembed(this,a,b)})}})})(jQuery)}

function exibeDiv(div){
	if(document.getElementById(div).style.display == 'block'){
		document.getElementById(div).style.display = 'none';
	}else{
		document.getElementById(div).style.display = 'block';
	}
}

function vld_comentarios(){
	with(document.formComments){
		if(comNome.value.length == 0){
			alert("Todos os campos marcados com * devem ser preenchidos.");
			comNome.focus();
			return false;
		}
		if(comEmail.value.length == 0){
			alert("Todos os campos marcados com * devem ser preenchidos.");
			comEmail.focus();
			return false;
		}else{
			if(!vld_email(comEmail.value)){
				alert('O e-mail informado não é válido.');
				comEmail.focus();
				return false;
			}
		}
		if(comMensagem.value.length == 0){
			alert("Todos os campos marcados com * devem ser preenchidos.");
			comMensagem.focus();
			return false;
		}
	}
	return true;
}
//#############################################################
//#############################################################
//#############################################################



//#############################################################
function vld_news(){
	with(document.r_news){
		if(newAssEmail.value.length == 0 || newAssEmail.value == 'E-mail'){
			alert('Você precisa informar seu e-mail.');
			newAssEmail.focus();
			return false;
		}else{
			if(!vld_email(newAssEmail.value)){
				alert('O e-mail informado não é válido.');
				newAssEmail.focus();
				return false;
			}
		}
	}
	return true;
}
//#############################################################
function labelNewsOn(){
	if(document.r_news.newAssEmail.value=='') document.r_news.newAssEmail.value='E-mail';
}
function labelNewsOff(){
	if(document.r_news.newAssEmail.value=='E-mail') document.r_news.newAssEmail.value='';
}
//#############################################################
function labelSearchOn(form){
	form = eval('document.' + form + '_search');
	if(form.q.value=='') form.q.value='Buscar no DomTotal';
}
function labelSearchOff(form){
	form = eval('document.' + form + '_search');
	if(form.q.value=='Buscar no DomTotal') form.q.value='';
}
//#############################################################
function load_swf(ban_widht,ban_height,ban_swf){
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="' + ban_widht + '" height="' + ban_height + '">');
	document.writeln('  <param name="movie" value="' + ban_swf + '">');
	document.writeln('  <param name="quality" value="high">');
	document.writeln('  <embed src="' + ban_swf + '" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + ban_widht + '" height="' + ban_height + '"></embed>');
	document.writeln('</object>');
}
//#############################################################
function showSubmenu(btn){
//	var btns = ['direito','noticias','esporte','agenda','religiao','colunas','especiais','entrevistas','voce','contato'];
	var btns = ['direito','noticias','esporte','agenda','religiao','colunas','especiais','entrevistas','contato'];
	for(var i in btns){
	    if(btns[i] == btn){
			document.getElementById('sm_' + btn).style.display = 'block';
			document.getElementById('btn_' + btn).className = 'active';
		}else{
			document.getElementById('sm_' + btns[i]).style.display = 'none';
			document.getElementById('btn_' + btns[i]).className = '';
		}
	}
}
//#############################################################
function vld_email(email){
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	if(er.test(email)){
		return true;
	}else{
		return false;
	}
}
//#############################################################
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//#############################################################
-->
