jQuery(document).ready(function() {

	$('#winners').cycle({
		fx: 'fade',
		timeout: 3000
	});
	
	$('.latestwinnersbox').cycle({
		fx: 'fade',
		timeout: 3000
	});
	
	$('#gamenews').cycle({
		fx: 'fade',
		timeout: 4000
	});
	
	$('div#rightbox').localScroll();
	
	$('div#particles').click(
		function() {
			window.location = "index.php";
		}
	);
	
	$('img#subpagedownloadbutton').hover(
		function() {
			$(this).stop().animate({ width:178, marginLeft:-5, marginTop:-2 }, 200);
		}
		,
		function() {
			$(this).stop().animate({ width:168, marginLeft:0, marginTop:0 }, 200);
		}
	);

	
	$("#gamesmenu a").click(
		function() {
			$.ajax({
				url : "games-gamecategory.php?game_category=" + $(this).attr("rel"),
				success : function (data) {
					$("#gamesinfo").fadeOut(100, function() { $(this).html(data).fadeIn(); } );
					$("#gamesinfo").trigger("update");
				}
			});
		}
	);
	
	$("a.gamesidlink").live('click', function() {
			$.ajax({
				url : "games-gameinfo.php?game_id="+$(this).attr("rel"),
				success : function (data) {
					$("#gamesinfo").fadeOut(100, function(){ $(this).html(data).fadeIn(); } );
					$("#gamesinfo").trigger("update");
				}
			});
		}
	);
	
	$("ul#vipclasses li").hover(
		function(){
			var selector = $(this).attr("id");
			selector = selector.substr(3,3);
			$("div#vs_" + selector).fadeIn(300);
			$("div#vi_" + selector).show();
		}
		,
		function(){
			var selector = $(this).attr("id");
			selector = selector.substr(3,3);
			$("div#vs_" + selector).fadeOut(300);
			$("div#vi_" + selector).hide();
		}
	);
	
	$("span.promoreadmore").hover(
		function() {
			$(this).parent().parent().children(".promotooltip").fadeIn();
		}
		,
		function() {
			$(this).parent().parent().children(".promotooltip").fadeOut();
		}
	);
	
	$("div#floatingbox").floating();
	$("div#leftboxes").floating({
		targetX:"left"
	});
	
	$("div#closefloatingbox").click(
		function() {
			$("div#floatingbox").fadeOut();
		}
	);
	
	$("#instantplaybutton").popupWindow({ 		
		centerScreen: 1,
		width: 1000,
		scrollbars: 1
	});

	$("#downloadbottom").hover(
		function(){
			$(this).stop().animate({ 'width':'344px', 'margin-left':'-10px' });
		}
		,
		function(){
			$(this).stop().animate({ 'width':'324px', 'margin-left':'0px' });
		}
	);
	
});	