var BoniBor,BoniBod,isLoaded=0;
window.onresize = NSResize;
 function AreaResize()
 {
 BoniBod = 0;//body
 BoniBor = 0;//border
  if(ecranH<700)
  {
  IncrSize();
  BoniBod = 56;//head
  BoniBor = 28;//border
  }

  if(isNS)
  {
  ScrWdt = window.innerWidth;
  ScrHgt = window.innerHeight-3;
  }
  else
  {
  ScrWdt = D.body.clientWidth;
  ScrHgt = D.body.clientHeight-3;
  }

  if(ecranH < 600 && ScrHgt < 500 )
  mp_msg(5,'');
  else if(ScrHgt < 370 || ScrWdt < 550)
  mp_msg(4,'');

 factorH = (ScrHgt-56+BoniBor)/(712+BoniBor);
 factorW = (ScrWdt-62)/(1218);
 factorImWH = Math.min(Math.min(factorW,factorH),1);//images up to x 1.20((+-)
 factorWH = factorImWH*1.15;//cross webs correction
  if(factorWH > 1)
  factorWH = Math.min(factorWH,1.1);
  if(isOP) factorWH=factorWH*1.1;
 ArrSpot = 32;//32ie, 32ns / scr arrow height - margin 2
  if(isNS)
  ArrSpot = 32;

 ScrBarHgt = VerBarHgt = ScrHgt-((56-BoniBod)*factorH)-56+BoniBor;//head / bord
 ScrBarHgt -= (55*factorH);//head / bord
 CatBarHgt = ScrHgt-((261-BoniBod)*factorH)-56+BoniBor-ArrSpot;//top,men,tit,foot, / bord
 smB = Math.max(CatBarHgt-(40*factorH),1);//butt

 MovieScr=175*factorWH;//wmv
 divh=hgt=wdt=195;
  if(isNS){wdt=hgt=175}
  pad=14*factorWH;

 LaliH('SmTBarA',smB);//keep at top
 n = D.all.length;
 namList="";
  for (i=0;i<n;i++)
  {
  si=0;
  nam=D.all(i).id;
   if(nam)
   {
    if(nam.indexOf("Fws")>-1)
    {
    val=nam.replace(/[^0-9\.]/g,'');
    LaliW(nam,val*factorW);
    }
    else if(nam.indexOf("Fhs")>-1)
    {
    val=nam.replace(/[^0-9\.]/g,'');
    LaliH(nam,val*factorH);
    }
    if(nam.indexOf("Ffs")>-1)
    {
    val=nam.replace(/[^0-9\.]/g,'');
     if(val>0)
     D.getElementById(nam).style.width = (val*factorW)+17;//ext. sidebar
    }
    else if(nam.replace(/[0-9\.]/g,'')=="BA")
    {
    val=205*factorH;
    LaliH(nam,val);
    LaliVA(nam,'bottom');
    }
    else if(nam.indexOf("SmTBar")>-1)
    LaliH(nam,smB);
    else 
    {
    ImgH=0; ImgW=0; Hei=0; Wid=0; ImgR=1;
    namIm = D.all(i).name;
     if(namIm && nam==namIm+"A")
     {
      if(D.getElementById(nam))
      {
      elalli=D.getElementById(nam);
      hei=elalli.height;
      wid=elalli.width;
       if(isNS && hei == wid)//bug Mozilla
       wid=elalli.naturalWidth;
       if(wid > 0)
       {
       ImgR = hei/wid;
        if(nam.indexOf("ImgAmz")>-1)
        {
        ImgW = Math.min(195*factorImWH,wid);
        ImgH = Math.round(ImgW*ImgR);
        ImgH = Math.min(195*factorImWH,ImgH);
        ImgW = Math.round(ImgH/ImgR);
        }
        else
        {
        ImgH = Math.round(hei*factorImWH);
        ImgW = Math.round(ImgH/ImgR);
        }
       }
      LaliW(nam,ImgW);
      LaliH(nam,ImgH);
       if(nam.indexOf("ImgAmz")>-1)
       LaliAl(nam,'bottom');
      }
     }//if(namIm==
    }//else
   }//if(nam
  }//for
//CS
 
 LaliH('CatScrBarDiv',CatBarHgt);
 LaliH('CatScrBarDivL',CatBarHgt);
 LaliH('MainScrBarDiv',ScrBarHgt);
 LaliH('MainVertBarTD',VerBarHgt);
 LaliH('MainVertBarTDR',VerBarHgt);


 CBhei=435*factorW;
 LaliH('cadreB',CBhei);
 wCs=280*factorW;wCsS=150*factorW;
  if(D.getElementById("pop"))
  { 
  D.getElementById("pop").style.width=wCs;
  D.getElementById("pop_content").style.width=wCs;
  
		tp=D.getElementById("pop").style.top.replace(/[^0-9\.]/g,'')  
  Blim = ScrHgt-(250*factorH);
		 if( tp > Blim )
  	D.getElementById("pop").style.top = Blim;
  }

  if(SLShow)
  {
 		if(document.getElementById("HeartA"))
   document.getElementById("HeartA").style.display='block'; 
  }
  else if(D.getElementById("pop"))
  {
  D.getElementById("pop").style.display='none';
  D.getElementById("pop").style.display='none';
  }

 elalli=D.getElementById("RszFulldoc");
  if(elalli)
  {
  val=elalli.style.fontSize;
  val=val.replace(/[^0-9\.]/g,'')
  elalli.style.fontSize=(val*factorWH)+"%";
  elalli.style.zIndex=3; 
  elalli.style.visibility='visible';
  }

 elalli=D.getElementById("RszTopdoc");
  if(elalli)
  {
  val=elalli.style.fontSize;
  val=val.replace(/[^0-9\.]/g,'')
  elalli.style.fontSize=(val*factorWH)+"%";
  elalli.style.zIndex=1001; 
  elalli.style.visibility='visible';
  }

//Overflow control
 ScrollHgt = D.body.scrollHeight;
 SpaceNeedH = ScrollHgt-ScrHgt;
 ScrollWdt = D.body.scrollWidth;
 SpaceNeedW = ScrollWdt-ScrWdt;
  if(D.getElementById("MainScrBarDiv") ) 
  {
   if(SpaceNeedH > 0)
   LaliH("MainScrBarDiv",ScrBarHgt-SpaceNeedH);
  }
  if((Math.abs(D.body.scrollHeight-ScrHgt)+Math.abs(D.body.scrollWidth-ScrWdt))>3)
  Backflow(ScrollHgt,ScrBarHgt);

 VerBarHgt = D.body.scrollHeight-((56-BoniBod)*factorH)-56+BoniBor;//head / borders
 LaliH('MainVertBarTD',VerBarHgt);
 LaliH('MainVertBarTDR',VerBarHgt);
 FhNew = D.getElementById('FhsTopML56').scrollHeight;
 LaliH('FhsTopML56',FhNew);
 LaliH('FhsTopMR56',FhNew);

 AdjB = 0;
  if(D.getElementById("FootInfoBlock"))
  AdjB = D.getElementById("FootInfoBlock").scrollHeight;
 smBB = VerBarHgt-Math.max((AdjB),0)-((55)*factorH)-20;
 LaliH('SmBarB',smBB);
 smBBW = 1200*factorW;
 LaliW('SmBarB',smBBW);

 AvailH = D.getElementById('MainVertBarTDR').scrollHeight-CatBarHgt-D.getElementById('FhsFootBlock55').scrollHeight-D.getElementById('ContextHlp').scrollHeight-34*factorH;//formerly -D.getElementById('TopMenu').scrollHeight-
 TopMenHgt=D.getElementById('TopMenu').scrollHeight+(0.5*AvailH);
  if(AvailH > 5)
  LaliH('TopMenu',TopMenHgt);
 LaliMT('CatScrBarDiv',0.5*AvailH);
 LaliMT('CatScrBarDivL',0.5*AvailH);

 DHTo = D.location.hash; 
 val = DHTo.replace(/[^0-9\.]/g,'');
  if(val > 3)
  val=0;
  if(val.length==0)
  val=0;
 ShowNxt('0',val);
 isLoaded=1;
 }//End AreaResize

 function MenOnMouse(s)
 { 
  if(D.getElementById(s).style.display=='none') D.getElementById(s).style.display=DBlock;  
   for(i=0; i<9; i++)
    if(D.getElementById("MovieFormA"+i)) 
    D.getElementById("MovieFormA"+i).style.visibility='hidden';//select
 }

 function HideSideMenu()
 {
		if(D.getElementById('FfsListADiv150'))  D.getElementById('FfsListADiv150').style.display = 'none'; 
	 if(D.getElementById('FfsListADiv150'))  D.getElementById('FfsListBDiv150').style.display = 'none'; 
	 if(D.getElementById('FfsListCDiv150'))  D.getElementById('FfsListCDiv150').style.display = 'none'; 
	 if(D.getElementById('FfsListDDiv150'))  D.getElementById('FfsListDDiv150').style.display = 'none'; 
  if(D.getElementById('Santa'))  D.getElementById('Santa').style.zIndex = 4;
   for(i=0; i<9; i++)
    if(D.getElementById("MovieFormA"+i)) 
    D.getElementById("MovieFormA"+i).style.visibility='visible';//select
 }

 function IncrSize()
 {
 D.getElementById("Header").style.display = 'none';
 D.getElementById("HideTop4").style.display = 'none';
 D.getElementById("HideTop5").style.display = 'none';
 D.getElementById("HideTop6").style.display = 'none';
 D.getElementById("FhsTopML56").style.display = 'none';
 D.getElementById("FhsTopMR56").style.display = 'none';
 D.getElementById("HideTop1").style.display = 'none';
 D.getElementById("HideTop2").style.display = 'none';
 D.getElementById("HideTop3").style.display = 'none';
 }

 function Backflow(ScrollHgt,ScrBarHgt)
 {
 D.getElementById("MainMenus").style.fontSize='85%';
 D.getElementById("TopMenu").style.fontSize='90%';
 D.getElementById("CatScrBarDivL").style.fontSize='85%';
 D.getElementById("CatScrBarDiv").style.fontSize='85%';
 D.getElementById("Header").style.fontSize='90%';
 D.getElementById("FootInfo").style.fontSize='90%';
 D.getElementById("TitleH1").style.fontSize='90%';
 //Loupe
  if( (Math.abs(D.body.scrollHeight-ScrHgt)+Math.abs(D.body.scrollWidth-ScrWdt)) > 2)
  {
  D.body.style.overflow='auto';
  LaliH("MainScrBarDiv",ScrBarHgt);
		popWdt=((wCs/factorW));
		 if(isOP)
			popWdt=(popWdt/2);
  D.getElementById("pop").style.width=popWdt+'px';
  D.getElementById("Cs").style.width='99%';
  D.getElementById("pop_content").style.width='100%';
//  D.getElementById("CsForm").style.width=(wCs/factorW)+'px';
  }
}//End f AssessSize
 
 function AreaFormat() { D.body.style.overflow='hidden'; D.body.scroll='no'; }

//Common
function DBP(a,d) {D.getElementById(a).style.borderWidth='thin';D.getElementById(a).style.margin='2px';D.getElementById(a).style.backgroundColor=d;}
function UBP(a,d) {D.getElementById(a).style.borderWidth='medium';D.getElementById(a).style.margin='0px';D.getElementById(a).style.backgroundColor=d;}
function OuC(a,c) {D.getElementById(a).style.color=c;}
function OvC(a) {D.getElementById(a).style.color='#FFCC00';}
function Raz(a) {window.location.href=a;}
//function CoP(a) {c=a+"=1";if(b.indexOf(c)<0){if(b.indexOf("?")<0){b=b+"index.php?"}else (b=b+"&");window.location.href=b+c}}

 function GlanceRw(a)
 {
  if(a == 0)  {b=1;c=2;}  else if(a == 1)  {b=0;c=2;}  else if(a == 2)  {b=0;c=1;}  else if(a == 3)  {b=4;c=5;}  else if(a == 4)  {b=3;c=5;}  else if(a == 5)  {b=3;c=4;}  else if(a == 6)  {b=7;c=8;}  else if(a == 7)  {b=6;c=8;}  else if(a == 8)  {b=6;c=7;}
 ElRTa=D.getElementById('RwTxt'+a);  ElRTb=D.getElementById('RwTxt'+b);  ElRTc=D.getElementById('RwTxt'+c);  ElRBa=D.getElementById('RowBlock'+a);  ElRBb=D.getElementById('RowBlock'+b);  ElRBc=D.getElementById('RowBlock'+c); 
  if(D.getElementById('RwTxt'+a).style.display=='none')  {  ElRTa.style.display='block';  ElRTb.style.display='none';  ElRTc.style.display='none';  ElRBb.style.display='none';  ElRBc.style.display='none';
  if(isNS)   {   ElRTa.style.display='table-cell';   ElRBa.style.display='table-cell';   }
  if( D.getElementById('Fiche'+a) )  D.getElementById('Fiche'+a).innerHTML='Retour';
  } else {
  ElRTa.style.display='none';  ElRTb.style.display='none';  ElRTc.style.display='none';  ElRBa.style.display='block';  ElRBb.style.display='block';  ElRBc.style.display='block';  
   if(isNS)   {   ElRBa.style.display='table-cell';   ElRBb.style.display='table-cell';   ElRBc.style.display='table-cell';   }  
 if( D.getElementById('Fiche'+a) ) D.getElementById('Fiche'+a).innerHTML='Aperçu ';  }
 }
 
 function drag_dropB(e)
 {
  if ( ie4&&dragapproved )
  {
  NewX=tempx+event.clientX-offsetx;
  NewY=tempy+event.clientY-offsety;
  }
  else if ( ns6&&dragapproved )
  {
  NewX=tempx+e.clientX-offsetx;
  NewY=tempy+e.clientY-offsety;
  }

  if(NewX > 0 && NewX < ScrWdt-wdt)
  crossobj.style.left=NewX+'px';
  if(NewY > 0 && NewY < ScrHgt-hgt)
  crossobj.style.top=NewY+'px';
 return false
 }

 function initB_drag(e,f,g)
 {
 crossobj = D.getElementById(g);
 var firedobj=ns6? e.target : event.srcElement
 var topelement=ns6? "html" : D.compatMode && D.compatMode!="BackCompat"? "documentElement" : "body"
  while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!=f)
  {
  firedobj=ns6? firedobj.parentNode : firedobj.parentElement
  }
  if (firedobj.id==f)
  {
  offsetx = ie4? event.clientX : e.clientX
  offsety = ie4? event.clientY : e.clientY
  tempx = parseInt(crossobj.style.left)
  tempy = parseInt(crossobj.style.top)
  wdt = parseInt(crossobj.style.width)
  hgt = parseInt(crossobj.style.height)
  dragapproved=true
  D.onmousemove=drag_dropB
  }
 }

 function stopB_drag() { dragapproved=false }

 //User pref
 function SendPos(a,b)
 {
 c=Math.round(D.getElementById(a).style.left.replace(/[^0-9\.\-]/g,''));
 d=Math.round(D.getElementById(a).style.top.replace(/[^0-9\.\-]/g,''));
 c=Math.round(c/factorW); d=Math.round(d/factorH); 
 var ra="&rand="+Math.random();
 var bx='&'+b+'x'+'='+c;
 var by='&'+b+'y'+'='+d;
 window.open("Sys.php"+sId+bx+by+ra,"cadreSys");
 }

