isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;

if ( ! isIE6 ) {

	function resize() {
		var foot = document.getElementById('footer');
		var footHeight = foot.offsetHeight;
		foot.style.marginTop = -footHeight+"px";
		document.getElementById('main').style.paddingBottom = footHeight+"px";
	}

	window.onload = resize;

}

$(document).ready(function(){

	$("ul.block_list_items li div.game_info").css("display","none");

	var speedtoggle = 400;
	var speedfade = 200;

	$("a.top_browse").click(function () {
		$(".active").removeClass("active");
		$(this).addClass("active");
		$(".top_items").hide();
		var content_show = $(this).attr("rel");
		$("#"+content_show).animate({ opacity: "show" }, speedfade);
	});
	
	$(".top_items a").click(function () {
		if( ! $(this).hasClass("selected") ) {
			$(".top_items a.selected").removeClass("selected");
			$(this).addClass("selected");
			$("#top_game li").slideUp();
			var game_show = $(this).attr("rel");
			$("#"+game_show).toggle(speedtoggle);
		}
		return false;
	});

	$("ul.block_list_items li div.rt").click(function () {
		if( ! $(this).parent().hasClass("selected") ) {
			$("ul.block_list_items li.selected").removeClass("selected");
			$(this).parent().addClass("selected");
			$("ul.block_list_items li div.game_info").slideUp();
			var game_data_show = $(this).attr("id");
			$(this).parent().find("div.game_info").toggle(speedtoggle);
		}
	});
	
	$('[id]').each(function () {
		var ident = $('[id='+this.id+']');
		if(ident.length > 1 && ident[0] == this) $('#'+this.id).remove();
	});

	$("a, li.size img, div.game_additional img").tooltip();
	
	window.api = $("div.new_games").scrollable().circular().autoscroll({
		autoplay: true,
		api: true,
		steps: 8,
		interval: 5000
	});
	
});
