offset_top=0; offset_left=1;
_ANCHO=window.screen.width-20;
_ALTO=21;
espetit=false; posicio=0;
if (document.getElementById || document.all) /*setTimeout('*/window.onload=meuinit/*',10)*/;

function getLayer(nomLayer){
 if (document.getElementById) return (document.getElementById(nomLayer).style);
 else if (document.all) return (document.all[nomLayer].style);
 else if (document.layers) return (document.layers[nomLayer]);
}
function getFrame(nomFrame){
 if (document.getElementById) return (document.getElementById(nomFrame));
 else if (document.all) return document.all[nomFrame];
 else return document.layers[nomFrame];
}
function meuscroll(){
 if (document.all) {sY=document.body.scrollTop; sX=document.body.scrollLeft; wW=document.body.clientWidth; wH=document.body.clientHeight;}
 else {sY=window.scrollY; sX=window.scrollX; wW=window.innerWidth-5; wH=window.innerHeight-5;}
 la=getLayer('il01');
 /*la.visibility='hidden'; window.setTimeout('la.visibility="visible"',1000);*/
 a1=wH - parseInt(la.height) - 2*offset_top;
 a2=sY+a1;
 a3=sY+offset_top;
 if (a1>0) la.top=(posicio>2 ? a2 : a3);
 else{
  if (parseInt(la.top)<a2) la.top= a2;
  if (parseInt(la.top)>a3) la.top=a3;
 }
 b1=wW - parseInt(la.width) - offset_left;
 b2=sX+b1;
 b3=sX+offset_left;
 if (b1>0) la.left=(posicio%2==0 ? b2: b3);
 else{
  if (parseInt(la.left)<b2) la.left=b2;
  if (parseInt(la.left)>b3) la.left= b3;
 }
}
function fesPetitGran(la,ifr){
 if (espetit){
  la.height=parseInt(la.height)+_ALTO;//anunci.height;
  ifr.height=_ALTO;//anunci.height;
  ifr.width=_ANCHO;//anunci.width;
  la.width=_ANCHO;//anunci.width;
  espetit=false;
 }else{
  la.height=parseInt(la.height)-73;//anunci.height;
  ifr.height=0;
  la.width=_ANCHO;
  ifr.width=0;
  espetit=true;
 }
 meuscroll();
 return false;
}
function trobamax(){
 if (document.all) {mW=document.body.clientWidth; mH=document.body.clientHeight;}
 else {mW=window.innerWidth; mH=window.innerHeight;}
 mA=mW*mH;
 aW=0;aH=0;aA=0;aF=0;
 nframes=window.top.frames.length;
 for(i=0;i<nframes;i++){
  if (document.all) {xW=window.top.frames[i].document.body.clientWidth; xH=window.top.frames[i].document.body.clientHeight;}
  else {xW=window.top.frames[i].innerWidth; xH=window.top.frames[i].innerHeight;}
  xA=xW*xH;
  if (xA>aA) {aA=xA;aF=i;}
 }
 return aF;
}

function meuinit(){

 if (window==window.top||window.top.frames[trobamax()]==window){
  la=getLayer('il01');
  posicio=4;
  la.width=_ANCHO;
  la.height=_ALTO;
  fr=getFrame('niframe');
  fr.width=_ANCHO;
  fr.height=_ALTO;
  window.onresize=meuscroll;
  window.onscroll=meuscroll;
  meuscroll();
  la.visibility="visible";
 }
}
function MM_findObj(n, d) { 
  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); return x;
}
function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
