var 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,ScrBarWdt,ScrBarHgt,SzBefore, isFF = (navigator.userAgent.indexOf("Firefox") > -1)  ? 1 : 0, isNS = (navigator.appName == "Netscape") ? 1 : 0;

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

ecranW=screen.width;
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)
var DocHgt;
var MovieScr=factor*165;
var divh=hgt=wdt=195*factor;
var pad=14*factor;
	if(isNS){wdt=hgt=155*factor}
	
//function visb (){ D.getElementById("RszFulldoc").style.visibility='visible'; D.getElementById("pop").style.display='none'; return true }; 
//window.onerror = visb;//for remote chache

 function AreaFormat()
 {
	D.body.style.overflow='hidden';
	D.body.scroll='no';
 }

 function AreaResize()
 {
 var ScrollWdt=D.body.scrollWidth;
 var ScrollHgt=D.body.scrollHeight;
 var DocHgt=ScrollHgt;
  if(isNS)  
  {
  var ScrWdt=window.innerWidth;
  var ScrHgt=window.innerHeight-1;
 	}
 	else
  {
  var ScrWdt=D.body.clientWidth;
  var ScrHgt=D.body.clientHeight;
 	}
 var factorW = ScrWdt/ScrollWdt;
 var factorH = ScrHgt/ScrollHgt;
 var factorWH = Math.min(factorW,factorH);
	 if(factorWH > 1)
		var factorWH = Math.min(factorWH,1.1);

 ScrBarHgt = ScrHgt-((50+50+70+30)*factorH)-56;//div
 VerBarHgt = ScrHgt-((50)*factorH)-56;//td
	SmBar = ScrBarHgt - 20*factorH;
	SmBar=Math.max(SmBar,1);

 n = D.all.length-numb;
	namList="";
  for (i=0;i<n;i++)
  {
		si=0;
		nam=D.all(i).id;
   if(nam)
   {
			elalli=D.getElementById(nam);
				if(nam.indexOf("Fws")>-1)
    {
    val=nam.replace(/[^0-9]/g,'');
 			 if(val>0)
 				elalli.style.width=val*factor;
    }
 		 else if(nam.indexOf("Fhs")>-1)
    {
    val=nam.replace(/[^0-9]/g,'');
 			 if(val>0)
 				elalli.style.height=val*factor;
    }
 		 else if(nam.indexOf("SmBar")>-1)
    {
				elalli.style.height=SmBar;
				elalli.style.width='100%';
				elalli.style.right=4;
    }
			 else if(nam.indexOf("Sep")>-1)
    LaliPT(nam,ecranH);
    else 
    {
  		namIm=D.all(i).name;
 				if(namIm && nam==namIm+"A")
      {
  					if(D.getElementById(namIm))
    			elalli=D.getElementById(namIm);
						 if(elalli.width>0)
  					elalli.style.width=elalli.width*factor;
						 if(elalli.height>0)
  					elalli.style.height=elalli.height*factor;
 					}//if(namIm==
    }//else
			}//if(nam
  }//for

//DALL
 elalli=D.getElementById("RszFulldoc");
	 if(elalli)
		{
  val=elalli.style.fontSize;
  val=val.replace(/[^0-9]/g,'');
		elalli.style.fontSize=(val*factor)+"%";
		}

	LaliH('MainScrBarDiv',ScrBarHgt);
	LaliH('MainVertBarTD',VerBarHgt);
	LaliH('MainVertBarTDR',VerBarHgt);

  if(D.getElementById("MainVertBarTD"))
		{
 	D.getElementById("MainVertBarTD").style.height=VerBarHgt;
  D.getElementById("MainVertBarTDR").style.height=VerBarHgt;
  }
	
  Dh=D.location.hash;
		if(Dh.indexOf("#")>-1)
		{
 	 if(Dh.length>1)
  	D.location.href=Dh;
  }

  if(elalli)//fulldoc
		{
  elalli.style.zIndex=3;
  elalli.style.visibility='visible';
		}
  if(isFF)//Netscape & ie are OK here, Firefox only
		{
  SzBefore=document.body.scrollHeight;
 	window.setInterval('chkSz(SzBefore)',2000);
		}

	//Todo
	MScrMidPt = ((ScrBarHgt-238)*factor)/6;
  if(D.getElementById("MainScrBarDiv"))
  D.getElementById("MainScrBarDiv").style.top=MScrMidPt;
	 if(D.getElementById("ButMenu"))
		{
		D.getElementById("ButMenu").style.top=MScrMidPt;
		D.getElementById("ButMenu").style.width=100*factor;
		}
 }//End function AreaResize

 function NSResize() {	
	window.history.go(0);	 
	b=D.URL;	
 	if(isFF)
 	window.open(b,'_self'); 
	}

 function LaliW(a,c) { if(D.getElementById(a)) { c=Math.max(c,1); D.getElementById(a).style.width = c } }
 function LaliH(a,c) { if(D.getElementById(a)) { 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.height = 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}

//CC
	function CCl(v,SId){if(SId==undefined)q=b+c+R;else q=SId;cadreSys.location.href=v+q;}
//Open windows
 function WLC(F,C){window.open(F,C)}
 function WLH(F){window.open(F,'_blank')}
	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);}
	
	function chkSz(SzBefore)
	{
 var SzNow=document.body.scrollHeight;
	 if(SzNow != SzBefore)
 	{
 	top.location.href='index.php';
 	}
	}

var cols = new Array("#FFFFFF","#CCFFFF","#FFFF99","#CCFFFF","#FFCCFF","#FFCCFF")
var numb=Math.round(500*(ecranW/1024));

 function NostraSky()
	{
	j=0;
 tx="";
  for (i=0; i <numb ; i++)
  {
 	x=Math.floor((Math.random()+.01)*98)+"%"
 	y=Math.floor((Math.random()+.05)*90)+"%"
 	wi=Math.floor(Math.random()*2.5);
 	col="#FFFFFF";
 	colId=Math.floor(Math.random()*5);
 	col=cols[colId];
  nam="rr"+i;
  document.write("<div id='"+nam+"' style='position:absolute; left:"+x+";top:"+y+";width:"+wi+";height:"+wi+";background-color:"+col+"'><span></span></div>");
  }
 window.setInterval("blinSiz()",90)
 window.setInterval("blinSiz()",150)
	}

 function blinSiz()
	{
	j=Math.floor(Math.random()*numb);
	colId=Math.floor(Math.random()*5);
	col=cols[colId];
 sId="rr"+j;
	 if(D.getElementById(sId))
		{
		elsi=D.getElementById(sId);
 	siz = elsi.style.width;
  	siz = Math.floor(Math.random()*2.5);
			elsi.style.width=siz;
		 elsi.style.height=siz;
  elsi.style.backgroundColor=col;
 	j=0;
 	}
	}

//dad
var dragswitch=0
var nsx, nsy, nstemp

 function drag_drop(name)
 {
  if (!ns4)
  return
 temp=eval(name)
 temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
 temp.onmousedown=down
 temp.onmousemove=move
 temp.onmouseup=up
 }

 function down(e)
 {
 temp.captureEvents(Event.MOUSEMOVE)
 nsx=e.x
 nsy=e.y
 }
 function move(e)
 {
  if(dragswitch==1)
 	{
 	temp.moveBy(e.x-nsx,e.y-nsy)
 	return false
 	}
 }

 function up()
 {
 temp.releaseEvents(Event.MOUSEMOVE)
 }

//drag drop function for ie4+ and NS6////
/////////////////////////////////
 function drag_drop(e)
 {
  if (ie4&&dragapproved)
  {
//  crossobj.style.left=tempx+event.clientX-offsetx//LR: no x here
  crossobj.style.top=tempy+event.clientY-offsety
  return false
  }
  else if (ns6&&dragapproved)
 	{
  crossobj.style.left=tempx+e.clientX-offsetx+"px"
  crossobj.style.top=tempy+e.clientY-offsety+"px"
  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")
 	{
  offsetx=ie4? event.clientX : e.clientX
  offsety=ie4? event.clientY : e.clientY
 	tempx=parseInt(crossobj.style.left)
 	tempy=parseInt(crossobj.style.top)
 	dragapproved=true
 	D.onmousemove=drag_drop
  }
 }
D.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

 function hide_box()
 {
  if (ie4||ns6)
  {
  crossobj.style.visibility="hidden"
  D.getElementById('pop_content').style.visibility="hidden"
  }
  else if (ns4)
 	{
  D.pop.visibility="hide"
 	D.pop_content.visibility="hide"
 	}
	setTimeout("show_box()",30000);
 }


 function show_box()
 {
 crossobj.style.visibility="visible"
 D.getElementById('pop_content').style.visibility="visible"
 }

 function centrePopNoScroll(url,largeur,hauteur)
 { 
 var gauche = (screen.width - largeur)/2
 var haut = (screen.height - hauteur)/2 
 window.open(url,"","width="+largeur+",height="+hauteur+",left="+gauche+",top="+haut+",scrollbars=no")	
 }
	
