// JavaScript Document


var temporiza_link = false;

function jornais(id){
	botao1 = document.getElementById("jornal1");
	botao2 = document.getElementById("jornal2");
	botao3 = document.getElementById("jornal3");
	botao4 = document.getElementById("jornal4");
	botao5 = document.getElementById("jornal5");
	botao6 = document.getElementById("jornal6");
	botao7 = document.getElementById("jornal7");
	
    if(id == 1){
		botao1.target = "_self";
		botao1.alt = "";
		botao1.title = "";
		botao1.innerHTML = "O Estad&atilde;o do Norte";
		botao1.href = "#prev";
		temporiza_link = setInterval(libera_link_estadao,1000);
		
		botao2.innerHTML = "Folha de Rond&ocirc;nia";
		botao2.href = "http://www.folhaderondonia.com.br/";
		
		botao3.innerHTML = "Di&aacute;rio da Amaz&ocirc;nia";
		botao3.href = "http://www.diariodaamazonia.com.br/";
		
		botao4.innerHTML = "O Observador";
		botao4.href = "http://www.oobservador.com/";
		
		botao5.innerHTML = "Porto Velho Agora";
		botao5.href = "http://www.portovelhoagora.com.br/";
		
		botao6.innerHTML = "Folha de S&atilde;o Paulo";
		botao6.href = "http://www.uol.com.br/fsp";
		
		botao7.href = "#next";
		botao7.target = "_self";
		botao7.alt = "próximo";
		botao7.title = "próximo";
		botao7.innerHTML = "<img src='images/layout/down.gif' border='0' onclick='jornais(2)' style='margin-top:-10px'/>";
		
	}
	else if(id == 2){
		botao1.href = "#prev";
		botao1.target = "_self";
		botao1.alt = "anterior";
		botao1.title = "anterior";
		botao1.innerHTML = "<img src='images/layout/up.gif' border='0' onClick='jornais(1)' />";
		
		botao2.innerHTML = "O Estado de S&atilde;o Paulo";
		botao2.href = "http://www.estadao.com.br/";
		
		botao3.innerHTML = "O Globo";
		botao3.href = "http://www.oglobo.globo.com/";
		
		botao4.innerHTML = "O Dia (RJ)";
		botao4.href = "http://www.odia.com.br/";
		
		botao5.innerHTML = "Zero Hora";
		botao5.href = "http://www.zh.com.br/";
		
		botao6.innerHTML = "Correio Braziliense";
		botao6.href = "http://www.correioweb.com.br/";
		botao6.target = "_blank";
		
		botao7.href = "#next";
		botao7.target = "_self";
		botao7.alt = "próximo";
		botao7.title = "próximo";
		botao7.innerHTML = "<img src='images/layout/down.gif' border='0' onclick='jornais(3)' style='margin-top:-10px'/>";
		
	}
	else if(id == 3){
		botao1.href = "#prev";
		botao1.target = "_self";
		botao1.alt = "anterior";
		botao1.title = "anterior";
		botao1.innerHTML = "<img src='images/layout/up.gif' border='0' onclick='jornais(4)' />";
		
		botao2.innerHTML = "Isto &Eacute;";
		botao2.href = "http://www.istoe.com.br/";
		
		botao3.innerHTML = "Veja";
		botao3.href = "http://www.veja.com.br/";
		
		botao4.innerHTML = "&Eacute;poca";
		botao4.href = "http://www.epoca.com.br/";
		
		botao5.innerHTML = "Carta Capital";
		botao5.href = "http://www.cartacapital.com.br/";
		
		botao6.innerHTML = "";
		botao6.href = "#next";
		botao6.target = "_self";
		
		botao7.href = "#next";
		botao7.target = "_self";
		botao7.alt = "";
		botao7.title = "";
		botao7.innerHTML = "";
		
	}
	else if(id == 4){
		botao1.href = "#prev";
		botao1.target = "_self";
		botao1.alt = "anterior";
		botao1.title = "anterior";
		botao1.innerHTML = "<img src='images/layout/up.gif' border='0' onClick='jornais(1)' />";
		
		botao2.innerHTML = "O Estado de S&atilde;o Paulo";
		botao2.href = "http://www.estadao.com.br/";
		
		botao3.innerHTML = "O Globo";
		botao3.href = "http://www.oglobo.globo.com/";
		
		botao4.innerHTML = "O Dia (RJ)";
		botao4.href = "http://www.odia.com.br/";
		
		botao5.innerHTML = "Zero Hora";
		botao5.href = "http://www.zh.com.br/";
		
		botao6.innerHTML = "Correio Braziliense";
		botao6.href = "http://www.correioweb.com.br/";
		botao6.target = "_blank";
		
		botao7.href = "#next";
		botao7.target = "_self";
		botao7.alt = "próximo";
		botao7.title = "próximo";
		botao7.innerHTML = "<img src='images/layout/down.gif' border='0' onclick='jornais(3)' style='margin-top:-10px'/>";
		
	}
    	
}

function libera_link_estadao(){
	botao_estadao = document.getElementById("jornal1");
	botao_estadao.href = "http://www.estadaodonorte.com.br/";
	botao_estadao.target = "_blank";
	if(temporiza_link){
	   clearInterval(temporiza_link);	
	}
}

var banner_id = 0
var banner_topo_so_1 = new Object(); var banner_topo_so_2 = new Object(); var banner_topo_so_3 = new Object(); var banner_topo_so_4 = new Object(); var banner_topo_so_5 = new Object(); var banner_topo_so_6 = new Object(); var banner_topo_so_7 = new Object(); var banner_topo_so_8 = new Object(); var banner_topo_so_9 = new Object(); var banner_topo_so_10 = new Object();
var banner_topo_so_11 = new Object(); var banner_topo_so_12 = new Object(); var banner_topo_so_13 = new Object(); var banner_topo_so_14 = new Object(); var banner_topo_so_15 = new Object();
var banner_topo_so_16 = new Object(); var banner_topo_so_17 = new Object(); var banner_topo_so_18 = new Object(); var banner_topo_so_19 = new Object(); var banner_topo_so_20 = new Object();

var arr_var = [banner_topo_so_1, banner_topo_so_2, banner_topo_so_3, banner_topo_so_4, banner_topo_so_5,
			   banner_topo_so_6, banner_topo_so_7, banner_topo_so_8, banner_topo_so_9, banner_topo_so_10,
			   banner_topo_so_11, banner_topo_so_12, banner_topo_so_13, banner_topo_so_14, banner_topo_so_15,
			   banner_topo_so_16, banner_topo_so_17, banner_topo_so_18, banner_topo_so_19, banner_topo_so_20]

function loadBanner(swf, img, alt, lnk, class_css){
    
	if(lnk != ""){
	   lnk_a = "<a target='_blank' href='"+ lnk +"'>";
	   lnk_b = "</a>";
	}
	else{
	   lnk_a = lnk_b = "";
	}
    
    //if( screen.width <= 800 ){
	if( false ){
	        document.write( lnk_a + "<img src='" + img + "' alt='" + alt + "'>" + lnk_b );
	}
	else{
	    if(swf != ""){
		    //document.write("<embed src='" + swf + "' menu='false'>");
			
			
			if( screen.width <= 800 ){
				if (class_css == "super_banner" ){
					w=606; h=75;
				}
				else if (class_css == "banner_top_right" ){
					w=172; h=75;
				}
				else if (class_css == "anuncieaqui" ){
					w=173; h=60;
				}
				else if(class_css == "anuncieaqui anuncios_left" ){
				    w=173; h=120;
				}
				else if(class_css == "anuncieaqui anuncios_left_oab" ){
				    w=173; h=217;
				}				
				else if(class_css == "anuncieaqui anuncios_left_full" ){
				    w=173; h=600;
				}				
				else if(class_css == "banners_noticia" ){
				    w=172; h=85;
				}
				else if(class_css == "banners_noticia_mid" ){
				    w=550; h=99;
				}
				else if(class_css == "banner_maisnoticias" ){
				    w=130; h=250;
				}
				else if(class_css == "banner_rodape" ){
				    w=552; h=90;
				}
				else if(class_css == "anuncieaqui anuncios_left promotion" ){
				    w=173; h=200;
				}
				else{
					w="100%"; h=60;
				}
			}
			else{
				if (class_css == "super_banner" ){
					w=728; h=90;
				}
				else if (class_css == "banner_top_right" ){
					w=199; h=90;
				}
			    else if (class_css == "anuncieaqui" ){
					w=230; h=60;
				}
				
				else if(class_css == "anuncieaqui anuncios_left" ){
				    w=230; h=120;
				}
				else if(class_css == "anuncieaqui anuncios_left_full" ){
				    w=230; h=360;
				}
				else if(class_css == "banners_noticia" ){
				    w=200; h=99;
				}
				else if(class_css == "banners_noticia_mid" ){
				    w=600; h=100;
				}
				else if(class_css == "banner_maisnoticias" ){
				    w=130; h=250;
				}
				else if(class_css == "banner_rodape" ){
				    w=660; h=90;
				}
				else if(class_css == "anuncieaqui anuncios_left promotion" ){
				    w=230; h=380;
				}
				else{
					w="100%"; h=60;
				}
			}
			
			/*document.write("<div id='banner_site_" + banner_id + "' >" + lnk_a + "<img src='" + img + "' alt='" + alt + "'>" + lnk_b +" </div>");
			arr_var[banner_id] = new SWFObject(swf, "bannersite" + banner_id, w, h, "7", "#ffffff");
			arr_var[banner_id].addParam("menu","false")
			arr_var[banner_id].addParam("wmode","transparent")
			//arr_var[banner_id].write("banner_site_" + banner_id );
			banner_id++
			//alert("banner_site_" + banner_id);*/
			document.write("<embed src='" + swf + "' menu='false' width='" + w + "' height='" + h + "' wmode='transparent'>");
			
		}
		else{
			document.write( lnk_a + "<img src='" + img + "' alt='" + alt + "'>" + lnk_b );
		}
	}
}

function ver_noticia(cod, categoria){
   //alert(cod)
   window.location = "see.asp?codnews="+ cod + "&categoria=" + categoria
}

function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.alt; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' precisa ser um endereço válido.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' precisa ser um número.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' precisa ser um número entre '+min+' e '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' precisa ser informado.\n'; }
  } if (errors) alert('Verifique o(s) seguinte(s) campo(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}

function fechar(){
	try{
		top.Shadowbox.close()
	}
	catch(e){
		try{
		    window.close()
	    }
	    catch(exception){}
	}	
    
	
}

function votar(){}

function comentar(){}

function imprimir(){}

function indicar(){}

function submit_vote(opt_val){
    if(getRSV() != '0'){
		try{
			Shadowbox.open({title:'', type:'iframe', content:'enquete.asp?id='+opt_val+'&option='+getRSV(), height:450, width:470 }); 
		}
		catch(e){
		    document.getElementById("enquete_area").submit();
		}
	}
	else 
	    alert('Selecione uma das  alternativas')	
}

function comentar_materia(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'coment_add.asp?codigo='+ cod + '&tabela=materias', height:480, width:520 }); 
	}
	catch(e){
		openWin('coment_add.asp?codigo='+ cod + '&tabela=materias', 'comentario', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function imprimir_materia(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'print.asp?codigo='+ cod + '&tabela=materias', height:500, width:720 }); 
	}
	catch(e){
		openWin('print.asp?codigo='+ cod + '&tabela=materias', 'imprimir', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function indicar_materia(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'indicate.asp?codigo='+ cod + '&tabela=materias', height:480, width:520 }); 
	}
	catch(e){
		openWin('indicate.asp?codigo='+ cod + '&tabela=materias', 'indicar', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function comentar_coluna(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'coment_add.asp?codigo='+ cod + '&tabela=colunas', height:480, width:520 }); 
	}
	catch(e){
		openWin('coment_add.asp?codigo='+ cod + '&tabela=colunas', 'comentario', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function imprimir_coluna(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'print.asp?codigo='+ cod + '&tabela=colunas', height:500, width:720 }); 
	}
	catch(e){
		openWin('print.asp?codigo='+ cod + '&tabela=colunas', 'imprimir', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function indicar_coluna(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'indicate.asp?codigo='+ cod + '&tabela=colunas', height:480, width:520 }); 
	}
	catch(e){
		openWin('indicate.asp?codigo='+ cod + '&tabela=colunas', 'indicar', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function comentar_comentario(cod){
	try{
		Shadowbox.open({title:'', type:'iframe', content:'coment_add.asp?codigo='+ cod + '&tabela=comentarios', height:480, width:520 }); 
	}
	catch(e){
		openWin('coment_add.asp?codigo='+ cod + '&tabela=materias', 'comentario', 'toolbar=0, location=0, status=0, menubar=0, scrollbars=1, resizable=1, width=520, height=480')
	}
}

function getRSV(){
	var RSV = ""
	try{
	   RSV = document.getElementById("PollVote_selected").value;
	}
	catch(e){}

	return RSV;

   	
}

function skcheckin(input){
   if(input.value == "digite aqui o texto"){
	   input.value = ""
   }
}

function skcheckout(input){
   if(input.value == ""){
	   input.value = "digite aqui o texto"
   }
}

function skcheck_submit(input){
   if(input.value == "digite aqui o texto"){
	   input.value = ""
   }
}

var temporiza_FSMenu = false;

function showFSMenu(){
   try{
	   document.getElementById("menu_font_size_options").style.display = "inline";
   }
   catch(e){}
   
   try{
	  clearInterval(temporiza_FSMenu)
   }
   catch(e){}   
}

function hideFSMenu(){
   try{
	   document.getElementById("menu_font_size_options").style.display = "none";
   }
   catch(e){}
   
}

function hideFSMenuInTime(){
   temporiza_FSMenu = setInterval(hideFSMenu,500);
}