// JavaScript Document

menusPrincipais = new Array();
menusPrincipais[menusPrincipais.length] = "menuAbraccef";
menusPrincipais[menusPrincipais.length] = "menuAssocie";


function fecharMenus(fecharAtual){
	hiddenMenus(menusPrincipais, fecharAtual);
}

function hiddenMenus(menus, menuAtual){
	for(var i = 0; i < menus.length; i++){
		nomeMenu = menus[i];
		if(menuAtual != nomeMenu){
			//document.getElementById(nomeMenu).style.top = '-1000px';
			document.getElementById(nomeMenu).style.visibility = 'hidden'
		}
	}
}

function showMenu(ancora, nomeMenu)
{
	hiddenMenus(menusPrincipais,'');
//	var x = moveXbySlicePos(0,ancora);
//	var y = moveYbySlicePos(0,ancora);
	
//	document.getElementById(nomeMenu).style.top = y+'px';
//	document.getElementById(nomeMenu).style.left = x+'px';
	document.getElementById(nomeMenu).style.visibility = 'visible';
	$fade(nomeMenu, 'fadein');
}

function moveXbySlicePos (x, img) { 
	if (!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
			if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
			if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}
	} else if (img.x) x += img.x;
	return x;
}

function moveYbySlicePos (y, img) {
	if(!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}		
	} else if (img.y >= 0) y += img.y;
	return y;
}

function $fade(id, type){

         if(type=="fadein"){
         var n=(typeof arguments[2]!="undefined")?arguments[2]:-10
         var limit=n > 100
         n+=40
         }
         else if(type=="fadeout"){
         var n=(typeof arguments[2]!="undefined")?arguments[2]:110
         var limit=n < 0
         n-=10
         }

         if(limit)
         try{
         $fade_callback()
         return
         }catch(e){return}
        
        document.getElementById(id).style.filter="alpha(opacity="+n+")"
        document.getElementById(id).style.MozOpacity=(n/100)
        document.getElementById(id).opacity=(n/100)
        document.getElementById(id).KhtmlOpacity =(n/100)
        setTimeout("$fade('"+id+"','"+type+"',"+n+")", 100)
}

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];}
}
