/*
a colocar no header da página que chama este script

function fixLyr()
{
		var posesq=-Number(document.getElementById("galeria").style.left.replace("px",""));
		
		biblio.setToAnchor("galeria_parent","galeria", posesq,0); 
}
var pageIsLoaded = 0;
function init(){
	fixLyr();
	document.pageIsLoaded=1;
}
window.onresize = window.onload = init;

*/


Biblio=function(id){this.ns4 =(document.layers);this.ie4 =(document.all&&!document.getElementById);this.ie5=(document.all&&document.getElementById);this.ns6=(!document.all&&document.getElementById);this.mac=(navigator.appVersion.indexOf("Mac")>=0)?1:0;this.dom=(document.getElementById)?1:0;this.ie=(this.ie4||this.ie5)?1:0;if(eval("id")){this.currentLayer=this.getLayer(id);this.idLayer=this.getIdLayer(id);}}
var biblio=new Biblio();
Biblio.prototype.getLayer=function(id){var retVal;if(this.ns4)retVal=document.layers[id];else if(this.ie4)retVal=document.all[id].style;else if(this.dom)retVal=document.getElementById(id).style;return retVal;}
Biblio.prototype.getIdLayer=function(id){var retVal;if(this.ns4)retVal=document.layers[id];else if(this.ie4)retVal=document.all[id];else if(this.dom)retVal=document.getElementById(id);return retVal;}
Biblio.prototype.getAnchorObj=function(AnchorName){var retVal;if(this.dom)retVal=document.getElementById(AnchorName);else if(this.ie4)retVal=document.all[AnchorName];else if(this.ns4)retVal=document.anchors[AnchorName];return retVal;}
Biblio.prototype.setLeft=function(x,id){eval("id")?this.getLayer(id).left=x:this.currentLayer.left=x;}
Biblio.prototype.setTop=function(y,id){eval("id")?this.getLayer(id).top=y:this.currentLayer.top=y;}
Biblio.prototype.setTopLeft=function(x,y,id){var currentObject=eval("id")?this.getLayer(id):this.currentLayer;currentObject.top =x;currentObject.left=y;}
Biblio.prototype.setWidth=function(w,id){eval("id")?this.getLayer(id).width=w:this.currentLayer.width=w;}
Biblio.prototype.setHeight=function(h,id){eval("id")?this.getLayer(id).height=h:this.currentLayer.height=h;}
Biblio.prototype.setZ=function(z,id){eval("id")?this.getLayer(id).zIndex=z:this.currentLayer.zIndex=z;}
Biblio.prototype.showHide=function(s,id){eval("id")?this.getLayer(id).visibility=s:this.currentLayer.visibility=s;}
Biblio.prototype.setClip=function(myClip,id){var currentObject=eval("id")?this.getLayer(id):this.currentLayer;if(!this.ns4)currentObject.clip="rect(" + myClip[0] + "px " + myClip[1] + "px " + myClip[2] + "px " + myClip[3] + "px)";  else{currentObject.clip.top=myClip[0];currentObject.clip.right=myClip[1];currentObject.clip.bottom=myClip[2];currentObject.clip.left=myClip[3];}}
Biblio.prototype.getLeft=function(id){var currentObject=eval("id")?this.getLayer(id):this.currentLayer;var retLeft;if(!this.ns4&&!this.mac)retLeft=parseInt(currentObject.left.substring(0,currentObject.left.indexOf("p")));else if(this.dom&&this.mac&&!this.ie)retLeft=parseInt(currentObject.left.substring(0,currentObject.left.indexOf("p")));else retLeft=parseInt(currentObject.left);return retLeft;}
Biblio.prototype.getTop=function(id){var currentObject=eval("id")?this.getLayer(id):this.currentLayer;var retTop;if(!this.ns4&&!this.mac)retTop=parseInt(currentObject.top.substring(0,currentObject.top.indexOf("p")));else if(this.dom&&this.mac&&!this.ie)retTop=parseInt(currentObject.top.substring(0,currentObject.top.indexOf("p")));else retTop=parseInt(currentObject.top);return retTop;}
Biblio.prototype.getWidth=function(id){var currentObject=eval("id")?id:this.idLayer.id;var retWidth;if((this.ie5&&!this.mac)||this.ns6)retWidth=document.getElementById(currentObject).offsetWidth;else if(this.ie4)retWidth=document.all[currentObject].clientWidth;else if(this.ns4)retWidth=document.layers[currentObject].clip.width;else if(this.ie5&&this.mac)retWidth=document.all[currentObject].offsetWidth;else retWidth=document.getElementById(currentObject).offsetWidth;return retWidth;}
Biblio.prototype.getHeight=function(id){var currentObject=eval("id")?id:this.idLayer.id;var retHeight;if((this.ie5&&!this.mac)||this.ns6)retHeight=document.getElementById(currentObject).offsetHeight;else if(this.ie4)retHeight=document.all[currentObject].clientHeight;else if(this.ns4)retHeight=document.layers[currentObject].clip.height; else if(this.ie5&&this.mac)retHeight=document.all[currentObject].offsetHeight;else retHeight=document.getElementById(currentObject).offsetHeight;return retHeight;}
Biblio.prototype.getAnchorLeft=function(AnchorObj){if(this.dom||this.ie4){if(AnchorObj.offsetParent)return(AnchorObj.offsetLeft + biblio.getAnchorLeft(AnchorObj.offsetParent));else return(AnchorObj.offsetLeft);} if(this.ns4)return(AnchorObj.x);}
Biblio.prototype.getAnchorTop=function(AnchorObj){if(this.dom||this.ie4){if(AnchorObj.offsetParent)return(AnchorObj.offsetTop + biblio.getAnchorTop(AnchorObj.offsetParent));else return(AnchorObj.offsetTop);} if(this.ns4)return(AnchorObj.y);}
Biblio.prototype.setToAnchor=function(AnchorName,id,x,y){var deltaX=(eval("x"))?x:0;var deltaY=(eval("y"))?y:0;var AnchorObj=biblio.getAnchorObj(AnchorName);biblio.setLeft(biblio.getAnchorLeft(AnchorObj)+ deltaX,id);biblio.setTop(biblio.getAnchorTop(AnchorObj)+ deltaY,id);}
Biblio.prototype.getAnchorPositions=function(AnchorName){var anchorPos=[];var dynLyrPos=document.write('<div id="anchorPos_'+AnchorName+'" style="position:absolute;visibility:visible;">getPosition_'+AnchorName+'</div>');this.setToAnchor(AnchorName,"anchorPos_"+AnchorName);anchorPos["left"]=this.getLeft("anchorPos_"+AnchorName);anchorPos["top"]=this.getTop("anchorPos_"+AnchorName);return anchorPos;}

