function _bannerH(b){

//		console.log(b);

	//	console.log((b?'none':'hidden'));

		//console.log($$('.bannerrolante')[0]);

		Element.setStyle($('divBannerRolante'), {'overflow': (b?'visible':'hidden')});
		//Element.setStyle($('divBannerRolante'), {'clip': (b?'auto':'rect(0px, 766px, 70px, 0px)')});
}



function _bannerAba(lado, b){

		var overlay = $$('.overlay')[0]

		var bannerEsq = $('bannerAbaEsquerda');

		var bannerDir = $('bannerAbaDireita');

		var banner;

		if (b) Element.setStyle(overlay, {'display': 'block'}); else Element.setStyle(overlay, {'display': 'none'}); 

		if(lado=='esquerda'){

			//var banner = lado=='esquerda'?'bannerAbaEsquerda':'bannerAbaDireita';

			banner = bannerEsq;

			Element.setStyle(banner, {'z-index': '9999', 'overflow': (b?'visible':'hidden')});

			Element.setStyle(bannerDir, {'z-index': '9997'});

			

		}

		else{

			banner = bannerDir;

			Element.setStyle(banner, {'z-index': '9999', 'clip': (b?'rect(0px, 820px, 400px, 0px)':'rect(0px, 820px, 120px, 700px)')});

			Element.setStyle(bannerEsq, {'z-index': '9997'});

		}

		overlay.onclick=function(){_bannerAba(lado, false); }

}









function getStyleObject(objectId){

    if(document.getElementById && document.getElementById(objectId)){

	    // W3C DOM

	    return document.getElementById(objectId);}else if (document.all && document.all(objectId)){

	    // MSIE 4 DOM

	    return document.all(objectId);} else if (document.layers && document.layers[objectId]){

	    // NN 4 DOM.. note: this won't find nested layers

	    return document.layers[objectId];}else{ return false;	}

}



// Java Sponsor function

var initialTop = 0;

function positionit(sElementId, itopAbsolute, iHeight){

    var dsoctop=document.all? document.documentElement.scrollTop : window.pageYOffset;

    var window_width=document.all? document.documentElement.clientWidth : window.innerWidth;

    var window_height=document.all? document.documentElement.clientHeight : window.innerHeight;

    var crossobj = getStyleObject(sElementId);

    var iTotalHeight = itopAbsolute + iHeight;

    var iNewTop;

    

    if(crossobj.style != null){

        if (document.all || document.getElementById)

        {

            if (window_height < iTotalHeight)

            {

                if (dsoctop <= (iTotalHeight - window_height))

                {

                    iNewTop = itopAbsolute;

                    //crossobj.style.top = itopAbsolute

                }

                else 

                {

                    iNewTop = ( dsoctop - (iHeight + window_height) );

                    //crossobj.style.top = ( dsoctop - iHeight + window_height )

                }

                

                crossobj.style.top = iNewTop + "px";

            }

            else

            {

                if(crossobj.offsetTop > dsoctop && initialTop==0)

                {

                    //initialTop = crossobj.offsetTop - 100;

                    initialTop = crossobj.offsetTop;

                }

                else if(crossobj.offsetTop > window_height)

                {

                    if(dsoctop < initialTop)

                    {

                        crossobj.style.top = "0px";

                    }

                    else

                    {

                        crossobj.style.top = dsoctop + "px";

                    }

                }

                

                if(dsoctop > initialTop)

                {

                    iNewTop = dsoctop - initialTop;

                    //crossobj.style.top = dsoctop - initialTop;

                    crossobj.style.top = iNewTop + "px";

                }

            }

        }

        else if (document.layers)

        {

            crossobj.top = dsoctop + itopAbsolute;

        }

    }

}

function getHeight(sElementId)

{

    var crossobj = getStyleObject(sElementId);  

    if(crossobj != null){return crossobj.height;}

    else{return 0;}

}

function hideElement(sElementId)

{

    var crossobj = document.getElementById(sElementId);    

    if(crossobj != null){crossobj.style.display = "none";}

}

function hideFlash(sElementName,sPanelId,iTime,bIsBigSponsor)

{

    var crossobj = document.getElementsByName(sElementName);

    if(!bIsBigSponsor){

        //It's a small sponsor of brazil, won't dissapear ever

        clearInterval(flashInterval); 

    }  

    else{

        //The sponsor will dissapear

        if(crossobj[0] != null){

            if(crossobj[0].readyState){

                if(crossobj[0].readyState==4){

                    setInterval("hideElement('" + sPanelId + "')", iTime);

                    clearInterval(flashInterval); 

                }

            }else{

                setInterval("hideElement('" + sPanelId + "')", iTime);

                clearInterval(flashInterval); 

            }

        }

    }   

}

function submitOnEnter(clientId, evt)

{

    var charCode;   

    if(evt.which != null)

     charCode = evt.which;

    else

     charCode = evt.keyCode;

    

    if(charCode==13){

        evt.cancel = true;

        var button = document.getElementById(clientId);

        button.click();

        return false;

    }

    return true;

}

function preview(cad, texto, w, h, scroll)

{ 

    var windoew ;

    windoew = window.open(cad, texto, "location=no,height="+ h + ",width=" + w + ",scrollbars=" + scroll);

}

function NewWindow(mypage,myname,w,h,scroll,pos){

if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}

if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}

else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}

settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

win=window.open(mypage,myname,settings);

}

function ReturnFalse(){return false;}

function showHidePnl(pnl1,pnl2,imgId,urlCollapsed,urlExpanded){

    var opnl1 = document.getElementById(pnl1);

    var opnl2 = document.getElementById(pnl2);

    var oimg = document.getElementById(imgId);

    

    if(opnl1.style.display == "none")

    {

        opnl1.style.display = "block";

        opnl2.style.display = "none";

        oimg.src = urlCollapsed;

    }

    else if(opnl2.style.display == "none")

    {

        opnl1.style.display = "none";

        opnl2.style.display = "block";

        oimg.src = urlExpanded;

    }

}

function valResult(txtId,lstId,validateState,msg){

    var txt = document.getElementById(txtId);var lst = document.getElementById(lstId);var res = true;

    if(txt){

        if(validateState == 'true'){res = txt.value.length > 0 && lst.value != '*';}else{res = txt.value.length > 0}

        if(!res){alert(msg);}   

    } 

    return res;

}

function valState(lstId,msg){

    var lst = document.getElementById(lstId);

    var res = lst.value != '*';

    if(!res){alert(msg);}    

    return res;

}