var i=1;
$(document).ready(function(){
	$('#most-popular-games .closemsg').html('click to close');
	$('.sidebars #center .views-row').hover(function(){$(this).css({'background-color':'#f2fbd6','font-weight':'bold','padding':'5px','border':'solid 1px #E3E57A'})},function(){$(this).css({'background-color':'#fff','font-weight':'normal','border':'none','padding':'6px'})});
	$('#center .download.views-row').hover(function(){$(this).css({'background-color':'#f2fbd6','font-weight':'bold','padding':'9px 12px','border':'solid 1px #E3E57A'})},function(){$(this).css({'background-color':'#fff','font-weight':'normal','border':'none','padding':'10px 13px'})});
	$('#most-popular-games .gamelisttop').click( function(){up();}).css({'cursor':'pointer'});
	$('#most-popular-games .collapsebot').click( function(){up();}).css({'cursor':'pointer'});	
	$('#most-popular-games span.closearrow').css({'background-position':'left 0'});
	$('#block-block-19 .content').prepend($('.gameplaypage div.voting'));
	
		// When a link is clicked( tabs on playpage)
		$("a.tab").click(function () {		
			// switch all tabs off
			$(".active").removeClass("active");
			// switch this tab on
			$(this).addClass("active");
			// slide all content up
			$(".tabbedcontent").hide();
			// slide this content up
			var content_show = $(this).attr("title");
			$("#"+content_show).show();
		});
});
function up(){ 
	if (i == 0) {
		i=1;
		$(this).addClass('down').removeClass('up');
		$('#most-popular-games .content').slideDown();
		$('#most-popular-games .closemsg').html('click to close');
		$('#most-popular-games span.closearrow').css({'background-position':'left 0'})
	}
	else{
		i=0;
		$(this).addClass('up').removeClass('down');
		$('#most-popular-games .content').slideUp();
		$('#most-popular-games .closemsg').html('click to open');
		$('#most-popular-games span.closearrow').css({'background-position':'right 0'})
	}
	}
function tabchange(){
	var tabtext=$('#playtabwrapper li.active dd').html();
	$('#playtabcontent').text(tabtext);
	}