// JavaScript Document
var gameTimer
var gameOffTimer
var gameDisplays=0;
var gameDivNotDone = true;



function game(onOff) {
	if (gameDivNotDone) {
		try{  
    		rdo = document.createElement('<div style="width:275px; height:72px; z-index:100; position:absolute; display:none;" id="gameBox"><a href="game.php"><img src="images/quick_game1.png" border="0" /></a></div>');  
		}
		catch(err){  
 			rdo = document.createElement('div');  
		}  
		rdo.setAttribute('id', 'gameBox');  
		rdo.style.width = 275;
		rdo.style.height = 72;
		rdo.style.position = "absolute";
		rdo.style.left = 0;
		rdo.style.display = 'none';
		rdo.style.top = 0;
		rdo.style.zIndex = 100;
		rdo.innerHTML = '<a href="game.php"><img src="images/quick_game1.png" border="0" /></a>';
		$('mainContent').appendChild(rdo);
		gameDivNotDone = false;
	}
	if (onOff == 1) {
		var leftSide=Math.floor(Math.random()*768);
		var theHeight2;
		if($('mainContent').clientHeight) {
			theHeight2=($('mainContent').clientHeight);
		}
		else if($('mainContent').offsetHeight) {
			theHeight2=($('mainContent').offsetHeight);
		}
		theHeight2 = theHeight2-100;
		var topSide=Math.floor(Math.random()*theHeight2);
		$('gameBox').style.left=leftSide+'px';
		$('gameBox').style.top=topSide+'px';
		new Effect.Appear('gameBox');
		gameDisplays=gameDisplays+1;
		clearTimeout(gameOffTimer);
		gameOffTimer=setTimeout("game(0)",6000);
	}
	else {
		if ($('gameBox').style.display != 'none' ) {
			new Effect.Fade('gameBox');
		}
		clearTimeout(gameTimer);
		var theDelay=(Math.round((Math.random()*9)+2))*60000;
		theDelay=theDelay+(gameDisplays*120000);
		//theDelay=2000;
		gameTimer=setTimeout("game(1)",theDelay);
	}
}
Event.observe(window, 'load', function() { game(0); });