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;
var pad,MovieScr,factorW,ScrWdt,ScrollWdt,factorH,ScrHgt,ScrollHgt,factorWH;

//function visb (){ if(D.getElementById("RszFulldoc"))D.getElementById("RszFulldoc").style.visibility='visible'; 
//if(D.getElementById("pop"))D.getElementById("pop").style.display='none'; 
//return true }; 
//window.onerror = visb;//for remote cache
//
var elMP=false;
var elBAF=false;
var elIMF;
var stop1;
var NbS=10;
var initY = 34;
var	Msg = 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() {	
	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.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}
//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='block';	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=='block') 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);
	}
//MP
 function mp_volOn() {if(elMP) elMP.Mute=false; } 
 function mp_volMute() {if(elMP) elMP.Mute=true; } 
 function mp_volM() {if(elMP) elMP.Mute=false;	currV = Math.min(-140, elMP.Volume);	elMP.Volume = Math.max(-10000, currV*2); }
 function mp_volP() {if(elMP) elMP.Mute=false;	currV = elMP.Volume;	elMP.Volume = Math.min(0, currV-(Math.min(currV/2,-60))); }
	function mp_fullscreen() {if(elMP) elMP.DisplaySize=3; } //not in use
 
	function mp_stopC(k) 
	{ 
	mp_volMute();
  if(isNS) elMP.stop; 
 	else elMP.Stop(); 
	sendF=mp_ShutDownC(k);
	setTimeout('sendF',500) }
	
	function mp_pause() 
	{ 
 	if(isNS) elMP.pause; 
 	else elMP.Pause(); 
	};
//end Common JG JV

//JV MP / extended to JG
 function mp_play(Url,k) { document.getElementById('BAF'+k).innerHTML='<OBJECT id="MediaPlayer" codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 type=application/x-oleobject standby="Loading Microsoft? Windows Media Player components..." classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 width="'+MovieScr+'" height="'+MovieScr+'" align="middle" style="zindex:5">'
  +' <PARAM NAME="AnimationatStart" VALUE="false">'
  +' <PARAM NAME="TransparentatStart" VALUE="true">'
  +' <PARAM NAME="AutoStart" VALUE="true">'
  +' <PARAM NAME="ShowControls" VALUE="false">'
  +' <PARAM NAME="FileName" VALUE="'+Url+'">'
  +' <embed type="application/x-mplayer2" src="../'+Url+'" style="zindex:15" pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&amp;sbp=mediaplayer&amp;ar=Media&amp;sba=Plugin&amp;" name="MediaPlayer" width="'+MovieScr+'" height="'+MovieScr+'" showcontrols="0" showdisplay="0" showstatusbar="0"></embed></OBJECT>';
 	elBAF.style.padding = pad; 
 	elBAF.style.width = MovieScr; 
 	elBAF.style.height = MovieScr; 
		elBAF.style.visibility = 'visible'; 
		elMP = D.getElementById('MediaPlayer');
 	elMP.style.visibility = 'visible'; 
		mp_msg(2,k);
		}

//Display JV
 function mp_ShutDownC(k) 
	{
  if(elBAF.style.visibility=='visible')
 	{
 	elMP.style.visibility='hidden';
  elImF.style.display='block'; 
 	elImF.style.visibility='visible';	
 	elBAF.style.visibility='hidden';	
  elBAF.innerHTML="";
 	elBAF.style.display='none'; 
 	}
		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='block'; 
 	mp_play(Url,k); 
 	}
 	else if(elBAF.style.visibility=='visible')
		if(!isNS)
  elMP.Play();
	} 
//end Display JV

//Firefox todo
 window.onload = function() 
	{
 	if(D.getElementById('MediaPlayer'))
  {
 	elMP = D.getElementById('MediaPlayer'); 
  	elMP.stop = function() 
  	{	
  	mp_volMute();elMP.controls.Stop();
 		}; 
 		elMP.pause = function() 
 		{	
 		elMP.Pause();
 		}; 
   elMP.play = function() 
 		{	
 		elMP.Play();
 		}; 
 	}
	}
//End Mp

//Msg
 function mp_msg(a,k)
 {
	Msg[1]='<nobr>First stop the current movie.';
	Msg[2]='<nobr>Download in process.';
	elMSG=D.getElementById("MSG");
	elMSG.innerHTML=Msg[a];
 MsgPosT = isNS ? pageYOffset+window.innerHeight-40 : D.body.scrollTop+D.body.clientHeight-40;
 elMSG.style.display='block'; 
	elMSG.style.position='absolute';
	elMSG.style.top=MsgPosT; 
 elMSG.style.visibility='visible';	
	window.setTimeout('elMSG.style.display="none"',4500); }

//dad
 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)
 nsy=e.y
 }
 function move(e)
 {
  if(dragswitch==1)
 	{
 	temp.moveBy(e.y-nsy)
 	return false
 	}
 }

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

 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");
//Styles
 function PGa(s){els=D.getElementById(s);els.style.color=c1;els.style.background=b1;setTimeout("PWa(s)",800)}
 function PWa(s){els=D.getElementById(s);els.style.color=c2;els.style.background=b2;setTimeout("PGa(s)",800)}
 function PGb(w){elw=D.getElementById(w);elw.style.color=c2;elw.style.background=b2;setTimeout("PWb(w)",1000)}
 function PWb(w){elw=D.getElementById(w);elw.style.color=c3;elw.style.background=b1;setTimeout("PGb(w)",800)}
 function PGc(v){elv=D.getElementById(v);elv.style.color=c2;elv.style.background=b2;setTimeout("PWc(v)",1100)}
 function PWc(v){elv=D.getElementById(v);elv.style.color=c3;elv.style.background=b1;setTimeout("PGc(v)",800)}
 function SpPromo(){n=10;for (i=0;i<n;i++){X=B+i;Y=X+'A';if(D.getElementById(Y)){z++;t=X;if(z==1){s=t+'A';PGa(s);}else if(z==2){w=t+'A';PGb(w);}else if(z>2){v=t+'A';PGc(v);}}}}
