$(document).ready(function() {
  
//Animation Narrow-Game
  $(".narrow-game").hover(function() {
        $(this).find("img.preview-thumb").animate({ marginTop: "-10px" , marginBottom: "10px" }, 400);
        $(this).find("span.overlay").animate({ opacity: "0.3" , marginTop: "-10px" , marginBottom: "15px" }, 400);
		$(this).find('span.play-icon').stop(true, true).animate({opacity: 1, right: 68},400);
    },function(){
        $(this).find("img.preview-thumb").animate({ marginTop: "0" , marginBottom: "0" }, 300);
        $(this).find("span.overlay").animate({ opacity: "0" , marginTop: "0" , marginBottom: "0" }, 300);
		$(this).find('span.play-icon').stop(true, true).animate({opacity: 0, right: 0},300);
	});
	
//Animation Sidebar Li
    $(".widget-container li").hover(function() {
        $(this).animate({ marginRight: "5px" }, 200);
    },function(){
        $(this).animate({ marginRight: "0px" }, 200);
	});
	
//Favorite Panel
 	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	});	
		$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});		
	$(".fav-tab a").click(function () {
		$(".fav-tab a").toggle();
	});	
	
//ToolTip Function
	xOffset = 10; yOffset = 20;
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px").fadeIn("fast");		
    },
	function(){
		if (this.t) this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});	
	
	

		
//Reload Game
	$('#reload').click(function() {
		$("#game-swf").fadeOut(0,function(){
			$("#game-loading").fadeOut(0);
			$("#game-swf").fadeIn(0);
		});
	});

//Lights	
	$("#shadow").css("height", $(document).height()).hide();
	$(".lightSwitcher").click(function(){
		$("#game-swf embed").attr({wmode : "window"});
		$(".wmode").attr({value : "window"});
		$("#game-swf").hide();
		$("#shadow").fadeIn('slow');
		$("#game-swf").show();
	});
	$("#shadow").click(function(){
		if ($('#game-swf embed').attr('wmode') == "transparent" && $('.wmode').attr('value') == "transparent" ){
			$("#shadow").fadeOut('slow');
		}else{
			$("#game-swf embed").attr({wmode : "transparent"});
			$(".wmode").attr({value : "transparent"});
			$("#game-swf").hide();
			$("#shadow").fadeOut('slow');
			$("#game-swf").show();
		}
	});
	
});


//Full Screen Mod	
function launchwin(winurl,winname) {
	var newwin = window.open(
		winurl,
		winname,
		'width='+(screen.width - 10)+',height='+(screen.height - 30)+',screenX=0,screenY=0,directories=0,fullscreen=1,location=0,menubar=0,scrollbars=0,status=0,toolbar=0'
	);
}
