/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!

var descer_menu=0;
var parar_menu=0;
function checkBrowser(){
this.ver=navigator.appVersion	
this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)	
return this
}
bw=new checkBrowser()

/***************************************************************************
Variables to set.
****************************************************************************/
//There are 2 ways these menus can be placed
// 0 = column
// 1 = row
nPlace=0

//How many menus do you have? (remember to copy and add divs in the body if you add menus)
var nNumberOfMenus=0
var nPxbetween=15; //Pixels between the menus
var nBgcolor='#CECFCE' //The bgColor of the bottom mouseover div 
var nBgcolorchangeto='#6380BC' //The bgColor to change to
var nImageheight=15 //The position the mouseover line div will stop at when going up!

/***************************************************************************
You shouldn't have to change anything below this
****************************************************************************/
//Object constructor
function makeNewsMenu(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'					
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.evnt.offsetHeight
	this.moveIt=b_moveIt;this.bgChange=b_bgChange;
	this.slideUp=b_slideUp; this.slideDown=b_slideDown;
	this.clipTo=b_clipTo;
    this.obj = obj + "Object"; 	eval(this.obj + "=this")		
}
//Objects methods
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}
function b_bgChange(color){if(bw.dom || bw.ie4) this.css.backgroundColor=color; else this.css.bgColor=color}
function b_clipTo(t,r,b,l){
if(bw.ns4){this.css.clip.top=t; this.css.clip.right=r; this.css.clip.bottom=b; this.css.clip.left=l
	}else this.css.clip="rect("+t+","+r+","+b+","+l+")";
}
function b_slideUp(ystop,moveby,speed,fn,wh,qual_menu){
	if (descer_menu==1 && qual_menu!=0)
	{
	this.slideactive=false;
	}
	else
	{
	if(!this.slideactive){
		if(this.y>ystop){
			this.moveIt(this.x,this.y-5); eval(wh)
			setTimeout(this.obj+".slideUp("+ystop+","+moveby+","+speed+",'"+fn+"','"+wh+"',"+qual_menu+")",speed)
		}else{
			this.slideactive=false; this.moveIt(0,ystop); eval(fn)	
		}
	}
	}
}
function b_slideDown(ystop,moveby,speed,fn,wh,qual_menu){
	if (descer_menu==0 && qual_menu!=0)
	{
	this.slideactive=false;
	}
	else
	{
	if(!this.slideactive){
		if(this.y<ystop){
			this.moveIt(this.x,this.y+5); eval(wh)
			setTimeout(this.obj+".slideDown("+ystop+","+moveby+","+speed+",'"+fn+"','"+wh+"',"+qual_menu+")",speed)
		}else{
			this.slideactive=false; this.moveIt(0,ystop); eval(fn)	
		}
	}
	}
}
//Initiating the page, making cross-browser objects
function newsMenuInit(){
var nFromleft=calcx() + desvioxm; //The first menus left position
oTopMenu=new Array()
	zindex=10
	for(i=0;i<=nNumberOfMenus;i++){
		oTopMenu[i]=new Array()
		oTopMenu[i][0]=new makeNewsMenu('divTopMenu'+i)
		oTopMenu[i][1]=new makeNewsMenu('divTopMenuBottom'+i,'divTopMenu'+i)
		oTopMenu[i][2]=new makeNewsMenu('divTopMenuText'+i,'divTopMenu'+i)
		oTopMenu[i][1].moveIt(0,nImageheight)
		oTopMenu[i][0].clipTo(0,nMwidth,nImageheight,0)
		if(!nPlace) oTopMenu[i][0].moveIt(i*nMwidth+nFromleft+(i*nPxbetween),nFromtop)
				else{
					oTopMenu[i][0].moveIt(nFromleft,i*nImageheight+nFromtop+(i*nPxbetween))
					oTopMenu[i][0].css.zIndex=zindex--
				}
				oTopMenu[i][0].css.visibility="visible"
			}
		}
		
//Moves the menu
function topMenu(num){
	if (descer_menu==0)
		{
		descer_menu=1;
		oTopMenu[num][1].slideDown(oTopMenu[num][2].scrollHeight+20,10,40,'oTopMenu['+num+'][0].clipTo(0,nMwidth,oTopMenu['+num+'][1].y,0)','oTopMenu['+num+'][0].clipTo(0,nMwidth,oTopMenu['+num+'][1].y,0)',1)
		}
	else
		{
		descer_menu=0;
		oTopMenu[num][1].slideUp(nImageheight,10,40,'oTopMenu['+num+'][0].clipTo(0,nMwidth,oTopMenu['+num+'][1].y,0)','oTopMenu['+num+'][0].clipTo(0,nMwidth,oTopMenu['+num+'][1].y,0)',1)
		}
//	if(oTopMenu[num][1].y==nImageheight) 
//	else if(oTopMenu[num][1].y==oTopMenu[num][2].scrollHeight+20) 
		}
//Changes background onmouseover
function menuOver(num){oTopMenu[num][1].bgChange(nBgcolorchangeto)}
function menuOut(num){oTopMenu[num][1].bgChange(nBgcolor)}
		
		
//Segundo menu (esquerda)
//Initiating the page, making cross-browser objects
function newsMenueInit(){

var nFromleft=calcx()  
var nFromtop=110 
var nMwidth=143
var nImageheight=14
var nPxbetween=14

oTopMenue=new Array()
	zindex=9
	for(i=0;i<=nNumberOfMenus;i++){
		oTopMenue[i]=new Array()
		oTopMenue[i][0]=new makeNewsMenu('divTopMenue'+i)
		oTopMenue[i][1]=new makeNewsMenu('divTopMenueBottom'+i,'divTopMenue'+i)
		oTopMenue[i][2]=new makeNewsMenu('divTopMenueText'+i,'divTopMenue'+i)
		oTopMenue[i][1].moveIt(0,nImageheight)
		oTopMenue[i][0].clipTo(0,nMwidth,nImageheight,0)
		if(!nPlace) oTopMenue[i][0].moveIt(i*nMwidth+nFromleft+(i*nPxbetween),nFromtop)
				else{
					oTopMenue[i][0].moveIt(nFromleft,i*nImageheight+nFromtop+(i*nPxbetween))
					oTopMenue[i][0].css.zIndex=zindex--
				}
				oTopMenue[i][0].css.visibility="visible"
			}
		}

		
//Moves the menu
function topMenue(num){
	if(oTopMenue[num][1].y==14) oTopMenue[num][1].slideDown(oTopMenue[num][2].scrollHeight+20,10,40,'oTopMenue['+num+'][0].clipTo(0,143,oTopMenue['+num+'][1].y,0)','oTopMenue['+num+'][0].clipTo(0,143,oTopMenue['+num+'][1].y,0)',0)
	else if(oTopMenue[num][1].y==oTopMenue[num][2].scrollHeight+20) oTopMenue[num][1].slideUp(14,10,40,'oTopMenue['+num+'][0].clipTo(0,143,oTopMenue['+num+'][1].y,0)','oTopMenue['+num+'][0].clipTo(0,143,oTopMenue['+num+'][1].y,0)',0)
		}

