/* script do menu em n&iacute;veis */

function IEHoverPseudo() {

	var navItems = document.getElementById("menu_menu").getElementsByTagName("li");
	var navItems_pesquisa = document.getElementById("menu_pesquisa").getElementsByTagName("li");
	for (var i=0; i<navItems.length; i++) {
		if(navItems[i].className == "menuparent") {
			navItems[i].onmouseover=function() { this.className += " over"; }
			navItems[i].onmouseout=function() { this.className = "menuparent"; }
		}
	}
	for (var i=0; i<navItems_pesquisa.length; i++) {
		if(navItems_pesquisa[i].className == "menuparent") {
			navItems_pesquisa[i].onmouseover=function() { this.className += " over"; }
			navItems_pesquisa[i].onmouseout=function() { this.className = "menuparent"; }
		}
	}
	for (var i=0; i<navItems_cdrom.length; i++) {
		if(navItems_cdrom[i].className == "menuparent") {
			navItems_cdrom[i].onmouseover=function() { this.className += " over"; }
			navItems_cdrom[i].onmouseout=function() { this.className = "menuparent"; }
		}
	}
	for (var i=0; i<navItems_usoconteudo.length; i++) {
		if(navItems_usoconteudo[i].className == "menuparent") {
			navItems_usoconteudo[i].onmouseover=function() { this.className += " over"; }
			navItems_usoconteudo[i].onmouseout=function() { this.className = "menuparent"; }
		}
	}
}
window.onload = IEHoverPseudo;

function NewWindow(mypage,myname){
LeftPosition=(screen.width)?(screen.width-(screen.width-20))/2:100;
TopPosition=(screen.height)?(screen.height-(screen.height-20))/2:100;
settings='width='+(screen.width-20)+',height='+((screen.height-20))+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewWindow2(mypage,myname){
LeftPosition=(screen.width)?(screen.width-(790))/2:100;
TopPosition=(screen.height)?(screen.height-(400))/2:100;
settings='width='+(790)+',height='+(400)+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewWindow3(mypage,myname,w,h){
LeftPosition=(screen.width)?(screen.width-(w))/2:100;
TopPosition=(screen.height)?(screen.height-(h))/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewWindow3b(mypage,myname,w,h){
LeftPosition=(screen.width)?(screen.width-(w))/2:100;
TopPosition=(screen.height)?(screen.height-(h))/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewWindow4(mypage,myname,w,h){
LeftPosition=(screen.width)?(screen.width-(w))/2:100;
TopPosition=(screen.height)?(screen.height-(h))/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function NewWindow5(mypage,myname){
LeftPosition=(screen.width)?(screen.width-(790))/2:100;
TopPosition=(screen.height)?(screen.height-(400))/2:100;
settings='width='+(790)+',height='+(400)+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function start_cookie_fontsize(){

if(!Get_Cookie("fontsize")){
var ft = 13;
var today = new Date();
var zero_date = new Date(0,0,0);
today.setTime(today.getTime() - zero_date.getTime());
var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000)); 
Set_Cookie("fontsize" , ft , cookie_expire_date); 
}else{
	allP = document.getElementsByTagName("td");
	for (var i = 0; i < allP.length; i++) {
    if (allP[i].className.indexOf("tabela_cont_princ") != -1)
	allP[i].style.fontSize = Get_Cookie("fontsize")+"px";
	}
}

}
//cookie para gravar tamando da fonte escolhida


function Get_Cookie(name) {
   var start = document.cookie.indexOf(name+"=");
   var len = start+name.length+1;
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
   if (start == -1) return null;
   var end = document.cookie.indexOf(";",len);
   if (end == -1) end = document.cookie.length;
   return unescape(document.cookie.substring(len,end));
}

function Set_Cookie(name,value,expires) {
    var cookieString = name + "=" +escape(value) +
       ( (expires) ? ";expires=" + expires.toGMTString() : "");
    document.cookie = cookieString;
} 
//final do cookie

var min = 9;
var max = 19;


  function decreaseFont() {
    allP = document.getElementsByTagName("td");
	
    for (var i = 0; i < allP.length; i++) {
      if (allP[i].className.indexOf("tabela_cont_princ") != -1 && Get_Cookie("fontsize") > min){
		
		var today = new Date();
		var zero_date = new Date(0,0,0);
		today.setTime(today.getTime() - zero_date.getTime());
		var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000)); 
		Set_Cookie("fontsize" , Get_Cookie("fontsize")-1 , cookie_expire_date); 
		allP[i].style.fontSize = Get_Cookie("fontsize")+"px";
		}
	}
  }
  
   function increaseFont() {
	allP = document.getElementsByTagName("td");
	
  for (var i = 0; i < allP.length; i++) {
	
      if (allP[i].className.indexOf("tabela_cont_princ") != -1 && Get_Cookie("fontsize") < max){
       
	   	var today = new Date();
		var zero_date = new Date(0,0,0);
		today.setTime(today.getTime() - zero_date.getTime());
		var cookie_expire_date = new Date(today.getTime() + (8 * 7 * 86400000)); 
		var teste = Get_Cookie("fontsize");
		teste = parseInt(teste) + 1;
		Set_Cookie("fontsize" , teste , cookie_expire_date); 
		allP[i].style.fontSize = Get_Cookie("fontsize")+"px";
		}
    }
  }


function openFull(URLen) {
  var windowNamen="mainwindow";
  var browserName=navigator.appName;
  var operatingSystem=navigator.platform;
  var version = parseFloat(navigator.appVersion);
  // Netscape check version 4.0+ on Win
  if (browserName.indexOf("Netscape")!=-1 && version>=4.0 && operatingSystem.indexOf("Mac")!=-1)
  {
  window.open(URLen,windowNamen,'titlebar=no,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen.availWidth+',screenX=0,screenY=0,top=0,left=0')
  }
  // MSIE Mac check
  else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Mac")!=-1)
  {
  window.open(URLen,windowNamen,'titlebar=no,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen.availWidth+',screenX=0,screenY=0,top=0,left=0')
  }
  // Netscape Mac check
  else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Mac")!=-1)
  {
  window.open(URLen,windowNamen,'width='+screen.width+',height='+screen.height+',top=0,left=0');
  }
  // MSIE Windows
  else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Win")!=-1)
  {
  var win = window.open(URLen,windowNamen,'channelmode=yes', 'titlebar=true')
  }
  // Netscape Windows
  else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Win")!=-1)
  {
  window.open(URLen,windowNamen,'width='+screen.width+',height='+screen.height+',top=0,left=0');
  }
  else
  {
  window.open(URLen,windowNamen);
  }
}


