var DocHgt,D=document,d=D.links,P="Promo",B="Rebate",z=0,c1="#FFD525",c2="#000000",b1="#000000",b2="#FFFF00",c3="#FF0000",a="Auxiliary/FileCounter.php?filename=",a2="Auxiliary/GameCounter.php?V=",b=D.URL,c="&Refer=",R=D.referrer,ie4=D.all,ns4=D.layers,ns6=D.getElementById&&!D.all,dragswitch=0,nsy, nstemp,si=15, isFF = (navigator.userAgent.indexOf("Firefox") > -1)  ? 1 : 0, isNS = (navigator.appName == "Netscape") ? 1 : 0, isOP = (navigator.userAgent.indexOf("Opera") > -1)  ? 1 : 0, isSF = (navigator.userAgent.indexOf("Safari") > -1)  ? 1 : 0, isNotAuto = ( isFF || isNS || isSF), FlPlayer="off", DBlock = isNS ?  'table-cell' : 'block',htp='http://', htpw='http://www', hts='https://',tmp,DHTo, DHFrom="0";
var pad,MovieScr,factorW,ScrWdt,ScrollWdt,factorH,ScrHgt,ScrollHgt,factorWH;

 function visb() { return true }; 
window.onerror = visb;//for Goo improper remote cache + Goo bar line 435 js bug


var elMP=false;
var elBAF=false;
var elIMF;
var stop1;
var NbS=10;
var initY = 34;
var Msg = new Array;
var Help = new Array;
var n,i,Url;

var ecranW=screen.width;
var ecranH=screen.height;
WHratio = ecranW/ecranH;
var factor = (WHratio>0) ? Math.max( Math.min( Math.round( ( (ecranW/1024) + ( (1.333-WHratio) / 2.666) ) * 100  ) /100, 1.05), 0.5) : 1;// /100, 1.2)

 function NSResize() {
   if(isNotAuto)  {
   Ma = "Ma="+Math.random(); 
   Ha = D.location.hash; 
   DU=D.URL.replace(/Ma=(.*)|#(.*)/g,'');  
   if(DU.indexOf("\?")>-1) s="&"; 
   else s="?"; 
   h=(DU+s+Ma+Ha).replace(s+s,s);
  window.top.location.href=h;
  }
  else
  window.history.go(0);
 }

 function LaliW(a,c) { if(D.getElementById(a) && c>0) { c=Math.max(c,1); D.getElementById(a).style.width = c } }
 function LaliH(a,c) { if(D.getElementById(a) && c>0) { c=Math.max(c,1); D.getElementById(a).style.height = c } }
 function LaliF(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.fontSize = c } }
 function LaliMT(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.marginTop = c } }
 function LaliPT(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.paddingTop = c } }
 function LaliBo(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.bottom = c } }
 function LaliX(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.overflowX = c } }
 function LaliVA(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.verticalAlign = c } }
 function LaliAl(a,c) { if(D.getElementById(a)) { D.getElementById(a).style.align = c } }
//Styles
 function MOC(a,b){D.getElementById(a).style.color=b}
 function MOB(a,b){D.getElementById(a).style.borderColor=b}
 function BBC(a,bc,bk){eli=D.getElementById(a);eli.style.borderColor=bc;eli.style.backgroundColor=bk}
//JV Cat & Desc
 function MTMenuHov(a){a.style.color='#FFFCCC';}
 function MTMenuOut(a){a.style.color='#CCCCCC'}
 function STMenuHov(a){a.style.border='solid #99CCFF 2px';a.style.padding=0;a.style.backgroundColor='#663333'}
 function STMenuOut(a){a.style.border='';a.style.padding=2;a.style.backgroundColor=''}
 function CCl(v,SId){if(SId==undefined)q=b+c+R;else q=SId;cadreSys.location.href=v+q;}
 function CCWO(a2,SId,Dom){CCl(a2,SId);window.location.href=Dom+"Description.php?V="+SId;}
//Open windows
 function WLC(F,C){window.open(F,C)}
 function WLH(F){window.open(F,'_blank')}

 
var isNSIe;//Netscape 8 bugs on IE display mode. Todo: complete isNSIe condition.
 function DHash(Dh)
 {
  if(Dh.length < 2)
  Dh='#Im0';
 window.location.hash=Dh; 
  if(isNSIe)//conditional to NS for IE only
  {
   //if( Dh == "SiteInfo" )
   //do domething here
   D.getElementById('error').scrollTop=0;//error that breaks NSIE 40 seconds long useless computation. Resumes at onerror vis.
  }
  if( Dh == "ScrInf" ) //conditional to NS for IE only
  window.location.hash='#Im0'; 
 }
 
 //windows
 function OWB(F,Wid,Hei){window.open(F,'_blank','toolbar=no,menubar=no,resizable=yes,status=yes,top=5,width='+Wid+',height='+Hei+',scrollbars=yes')}
//Misc
 function BackF(){window.history.go(-1);}
 function CtLk(){L=D.links.length;D.write(L);}
//Display
 function hideBox(){ D.getElementById("pop_content").style.display='none'; D.getElementById("pop").style.height=24*factor; if(SBox=="Open") { window.open('Sys.php'+sId+'&SB=Close','cadreSys'); SBox="Close" } }
 function showBox() { D.getElementById("pop_content").style.display=DBlock; D.getElementById('pop').style.height=D.getElementById("Cs").scrollHeight ; window.open('Sys.php'+sId+'&SB=Open','cadreSys'); window.clearInterval(stop1); }
 function shoHid() { if(D.getElementById("pop_content").style.display==DBlock) hideBox(); else showBox();}
 function showBoxIb(hpop)
 {
 si+=5;
 D.getElementById('pop').style.height=si;
  if(si >= hpop)
  {
  window.clearInterval(stop1);
  showBox(hpop);
  }
 }
 function showBoxI(hpop)
 {
// hpop=hpop*factor;
// D.getElementById('pop').style.height=24*factor;
// D.getElementById('pop').style.visibility='visible';
//  if( SBox != "Close" )
//  stop1 = window.setInterval('showBoxIb(hpop)',20);
 }
//end Common JG JV

 function fl_showC(k,Url)
 {
 var n=D.forms.length, j=0, f=-1, ValSrc=false;
  if(D.getElementById("LogoCtlC1"+k+"A"))
  ValSrc = (D.getElementById("LogoCtlC1"+k+"A").src.indexOf("MovieFlash\.gif")>-1);
  for(i=0; i<n; i++)
  {
   if(D.forms.item(i))//all forms
   {
   IsImg = ( D.forms.item(i).name.indexOf("MovieImg")>-1 )
   IsForm = ( D.forms.item(i).name.indexOf("MovieForm")>-1 )
    if( IsForm )
    {
     if(D.forms.item(i).elements[0].value==Url)
     { f=i; }//form id
    D.forms.item(i).elements[0].value='none';
    }
    if( IsImg || IsForm )
    {
    mp_ShutDownC(j);
    j++;
    }
   }
  }
  if(f>-1)
  {
  IsForm = ( D.forms.item(f).name.indexOf("MovieForm")>-1 )
   if( IsForm )
   {
   D.forms.item(f).elements[0].value=Url;
    if(Url!='none')
    FlPlayer="off";
   }
  }
  else if( ValSrc )
  FlPlayer="off";
  
  if(FlPlayer=="off")
  {
  elBAF=D.getElementById('BAF'+k);
  elImF=D.getElementById('ImF'+k);
  elImF.style.visibility='hidden'; 
  elImF.style.display='none'; 
  val=D.getElementById("ImgAmz"+k+"A").style.height.replace(/[^0-9\.]/g,'');
  flMovieScrH=Math.max(Math.round(val)+2,190*factorImWH);
  flMovieScrW=Math.round(flMovieScrH*1.2);
  elBAF.style.padding = 0;
  elBAF.style.height = flMovieScrH;
  elBAF.style.width = flMovieScrW;
  elBAF.style.backgroundColor = "transparent";
  elBAF.style.display=DBlock;
  elBAF.style.visibility = 'visible';
   if(D.getElementById("LogoCtlC1"+k+"A"))
   {
   D.getElementById("LogoCtlC1"+k+"A").src= "Auxiliary/icones/MovieFlashNo.gif";
   D.getElementById("LogoCtlC1"+k+"A").style.height = 23*factorImWH;
   D.getElementById("LogoCtlC1"+k+"A").style.width = 100*factorImWH;
   }
  FlPlayer = "on";
  mp_msg(2,k);
  fl_Play(k,Url);
  }
  else
  {
  FlPlayer="off";
  }
 }

 function fl_ShutDownC(k) { D.getElementById('BAF'+k).innerHTML = ""; FlPlayer="off"; }

 function fl_Play(k,Url)
 {
 D.getElementById('BAF'+k).innerHTML = '<object id="FlashPlayer'+k+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" style="padding:0;margin:0;visibility:visible" height="'+flMovieScrH+'" width="'+flMovieScrW+'" align="bottom">'
 +' <param name="movie" value="'+Url+'">'
 +' <param name="quality" value="high">'
 +' <param name="wmode" value="transparent">'
 +' <param name="bgcolor" value="#009900">'
 +' <embed src="'+Url+'" type="application/x-shockwave-flash" wmode="transparent" width="'+flMovieScrW+'" height="'+flMovieScrH+'"></embed></object>';
 }
 
//Display JV
 function mp_ShutDownC(k)
 {
 elBAF=D.getElementById('BAF'+k);
 elImF=D.getElementById('ImF'+k);
   if(D.getElementById("LogoCtlC1"+k+"A"))
   D.getElementById("LogoCtlC1"+k+"A").src = "Auxiliary/icones/MovieFlash.gif";
  if(D.getElementById('FlashPlayer'+k))
  elMP=D.getElementById('FlashPlayer'+k);
  else if(D.getElementById('MediaPlayer'+k))
  elMP=D.getElementById('MediaPlayer'+k);
//   alert("is "+elBAF.style.visibility)
  if(elBAF.style.visibility=='visible')
  {
  elMP.style.visibility='hidden';
  elImF.style.display=DBlock;
  elImF.style.visibility='visible';
  elBAF.style.visibility='hidden';
  elBAF.style.display='none';
  D.getElementById('BAF'+k).innerHTML = "";
  }
//  else
//  mp_msg(1,k);
 }

 function mp_showC(k,Url) 
 {
 elMP=D.getElementById('MediaPlayer');
 elBAF=D.getElementById('BAF'+k);
 elImF=D.getElementById('ImF'+k);
  if(elBAF.style.visibility!='visible' && elMP) 
  mp_msg(1); 
  else if(!elMP) 
  {
  elImF.style.visibility='hidden'; 
  elImF.style.display='none'; 
  elBAF.style.display=DBlock; 
  mp_play(Url,k); 
  }
  else if(elBAF.style.visibility=='visible')
  if(!isNS)
  elMP.Play();
 } 
//end Display JV

//Firefox todo
 window.onload = function() 
 {
 posAd();
  if (ns4) {document.captureEvents(Event.MOUSEMOVE);} 
 }

 function posAd()
 {
  if(D.getElementById("AdIpop"))
  {
  val = Math.floor(D.getElementById("AdIpop").style.width.replace(/[^0-9]/g,''));
  Ma = Math.random();
   if(val == undefined) val = 50;
  D.getElementById("AdIpop").style.left = (ScrWdt * ( 1 - (Ma * 0.05))) - (280*factorW) - 7 - val;
  D.getElementById("AdIpop").style.display = DBlock;
  }
 }

//Msg
 function mp_msg(a,k)
 {
 Msg[1]='<nobr>Arr&ecirc;tez le clip.';
 Msg[2]='<nobr>T&eacute;l&eacute;chargement.';
 Msg[3]='<nobr>Chargement en cours.';
 Msg[4]='<nobr>Augmentez la taille de votre navigateur.';
 Msg[5]='<nobr>Augmenter la taille utile de l&#039;&eacute;cran: touche F11.';
 Msg[6]='<nobr>Repositionnez les &eacute;l&eacute;ments: touche F5';
 Msg[7]='<nobr>';
 elMSG = D.getElementById("MSG");
 PvMsg = elMSG.innerHTML;
  if(PvMsg.indexOf(Msg[a])<0)
  {
  elMSG.innerHTML = PvMsg+" "+Msg[a];
  elMSG.style.display = DBlock; 
  }
  else
  elMSG.innerHTML = Msg[a];
 window.setTimeout('elMSG.innerHTML=""',4500); 
 }

//dad
 function down(e)
 {
 }

 function drag_drop(e)
 {
 var Blim = (isNS ? window.innerHeight : D.body.clientHeight)-(100*factor);

  if(dragapproved)
  {
  NbS=1
  dragapproved=false
   if (ie4)
   initY=event.clientY;
   else if (ns6)
   initY=e.clientY;
   if(initY<5)
   initY=5;
   else if(initY>Blim+25)
   initY=Blim;
   else
   dragapproved=true
  crossobj.style.top=tempy+initY-offsety;
  return false
  }
 }

 function initialize_drag(e)
 {
 crossobj = ns6 ? D.getElementById("pop") : D.all.pop
 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 != "dragbar")
  {
  firedobj=ns6 ? firedobj.parentNode : firedobj.parentElement
  }
  if (firedobj.id == "dragbar")
  {
  offsety = ie4 ? event.clientY : e.clientY
  tempy = parseInt(crossobj.style.top)
  dragapproved = true
  D.onmousemove = drag_drop
  }
 }
D.onmouseup=new Function("dragapproved=false");


