function toggleLayer(whichLayer)
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}


function doTracking()
{
	_qacct="p-7b1E-OoJSHHPk";
	quantserve();
	_uacct = "UA-1545911-2";
	urchinTracker();
}


if (document.images) {
     btn_code_on = new Image
     btn_code_off = new Image
	 btn_play_on = new Image
     btn_play_off = new Image
	 btn_report_on = new Image
     btn_report_off = new Image
	 btn_email_on = new Image
     btn_email_off = new Image
	 btn_getcode_on = new Image
     btn_getcode_off = new Image

     btn_code_on.src = '/include/images/downloadbox/btn_getcode_off.jpg'
     btn_code_off.src = '/include/images/downloadbox/btn_getcode_on.jpg'
	 btn_play_on.src = '/include/images/downloadbox/btn_download_off.jpg'
     btn_play_off.src = '/include/images/downloadbox/btn_download_on.jpg'
	 
	 btn_report_on.src = '/include/images/button_report_off.jpg'
     btn_report_off.src = '/include/images/button_report_on.jpg'
	 btn_email_on.src = '/include/images/button_email_off.jpg'
     btn_email_off.src = '/include/images/button_email_on.jpg'
	 btn_getcode_on.src = '/include/images/button_getcode_off.jpg'
     btn_getcode_off.src = '/include/images/button_getcode_on.jpg'

 }


function selectAll(theField) {
  var tempval=eval("document."+theField)
  tempval.focus()
  tempval.select()
}

//start cookie stuff
function togglePanel(){
	var panelState = getCookie('panelState');
	if(panelState == "closed"){
		setCookie('panelState','open','100');
	}else{
		setCookie('panelState','closed','100');
	}
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "panelState";
}

function setCookie(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
return "ok";
}


function addGame(c_name,value,expiredays){
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());

document.write(getCookie(c_name));
}

function updateGames(gameInfo){
	var flashMovie=getFlashMovieObject('account');
	flashMovie.SetVariable("/:myGame", gameInfo);
	flashMovie.Play();
}


function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function reloadPage(){
	window.location.reload();
}

function perpage(perpage){
	if(setCookie('viewpages',perpage,100) == "ok"){
		history.go(0);	
	}
	
	
	
	//window.location.reload();
}


/*
function themes(){
	var isset = getCookie('user_theme');
		if(isset == 'panelState'){
			setCookie('user_theme','default',200);
			
	}
}

themes();
*/

