var gameid = 0;

window.addEvent('domready', function() {
	if(window.ie) {
		$$('.liquidHeader').each(function(element) {
			element.getChildren().each(function(elementChild){
				if(elementChild.className=='liquidHeaderText') {
					var thisSize = elementChild.getSize()
					if(thisSize.size.x<=129) {
						var newPadding = 129-thisSize.size.x;
						var fx = new Fx.Styles(elementChild, {wait:false});
						fx.start({ 'padding-right': newPadding});
					}
				}
			});
		});
	}
	if($('info-text')) {
		var slide = new Fx.Styles($('info-text'), {duration: 1500, transition: Fx.Transitions.Quad.easeIn});
		slide.start({
			'top': [-200, 188]
		});
		(function(){
			slide.start({
				'top': [188, -200]
			});	
		}).delay(15000);
	}
/*
	if($('headerLogin')) {
		new Ajax('http://www.gamesxl.com/includes/login.php', {
			method: 'get',
			data: 'loc='+window.location,
			update: $('headerLogin'),
			evalScripts:true
		}).request();
	}
	if($('leftLowerBlock')) {
		new Ajax('http://www.gamesxl.com/includes/vote_rating.php', {
			method: 'get',
			data: 'id='+gameid,
			update: $('leftLowerBlock'),
			evalScripts:true
		}).request();
	}
	if($('incomingDiv')) {
		new Ajax('http://www.elkspel.nl/includes/incoming.php', {
			method: 'get',
			data: $('incomingDiv').title,
			update: $('incomingDiv'),
			evalScripts:true
		}).request();
	}
*/
	var toolTip = new Tips($$('.gameToolTip'), {
		initialize:function(){
			this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
		},
		onShow: function(toolTip) {
			this.fx.start(1);
		},
		onHide: function(toolTip) {
			this.fx.start(0);
		}
	});
});

function bookmark(url, title) {
	if (document.all) {
		window.external.AddFavorite(url, title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(title, url, "")
	}
}

function rategame(rating,gameid) {
	var outURL = "http://www.gamesxl.com/includes/vote.php?do=vote&rating="+rating+"&gameid="+gameid;
	window.hiddenframe.location.href = outURL;
}

function newsletters(sign) {
	var email = document.getElementById("email");
	var outURL = "http://www.gamesxl.com/includes/newsletter.php?email="+email.value+"&sign="+sign;
	window.hiddenframe.location.href = outURL;
}

function addtomygames(gameid) {
	var outURL = "http://www.gamesxl.com/includes/mygames.php?do=add&gameid="+gameid;
	document.getElementById('mygameshref').innerHTML = 'Game saved in \'<a onclick="parent.location=\'http://www.gamesxl.com/mygames.html\'" href="http://www.gamesxl.com/mygames.html">My Games</a>\'&nbsp;<img src="http://www.gamesxl.com/images/iconSaved.gif" />';
	window.hiddenframe.location.href = outURL;
}
function removefrommygames(gameid,mygames) {
	var outURL = "http://www.gamesxl.com/includes/mygames.php?do=remove&gameid="+gameid;
	window.hiddenframe.location.href = outURL;
	if (mygames != undefined && mygames == true) {
		setTimeout("window.location = window.location;", 500);
	}
}

