function showHelpTip(a){$("#help").tipTip({activation:"click"}).trigger("click").unbind(".tipTip").removeData("tipTip").unbind("click");window.setTimeout('$("#tiptip_holder").fadeOut(500, function() {$("#help").tipTip({content:"'+a+'",activation:"hover"});});',6000)}function highlightNext(b,a,f){var h=b%16;if(h==0){h=16}if(b!=a){$("#pos"+h).animate({top:"-=10"},100).animate({top:"+=10"},400)}var g=(h-1)*312;if(clockwise){$("#spinner").css("background-position","0 -"+g+"px")}else{if(h==1){$("#spinner").css("background-position","0 0")}else{$("#spinner").css("background-position","0 -"+(4992-g)+"px")}}var e=a-b;var d=startingDelay;if(e<=f){d+=900-(e*Math.floor(900/f))}if(b==a){var c=1500;rewardPosition=h;animateReward(h);if(gotKey){openLock(h);c+=1000}window.setTimeout("showReward()",c)}else{window.setTimeout("highlightNext("+(b+1)+", "+a+", "+f+")",d)}}function animateReward(a){$("#pos"+a).css("z-index",2).animate({width:"+=60",height:"+=60",top:"-=30",left:"-=30"},200).animate({width:"-=40",height:"-=40",top:"+=20",left:"+=20"},300).animate({width:"+=30",height:"+=30",top:"-=15",left:"-=15"},300).animate({width:"-=20",height:"-=20",top:"+=10",left:"+=10"},400).animate({width:"+=10",height:"+=10",top:"-=5",left:"-=5"},400)}function openLock(b){var d=parseInt($("#key"+b).css("left"));var a=parseInt($("#key"+b).css("top"));var f=parseInt($(".unlockable").css("left"))+16;var c=parseInt($(".unlockable").css("top"))+16;var e=1000-parseInt(0.2*Math.sqrt(Math.pow(Math.abs(d-f),2)+Math.pow(Math.abs(a-c),2)));$("#key"+b).css("z-index",2).animate({left:parseInt(((f-d)/2)+d),top:parseInt(((c-a)/2)+a),width:80,height:80},parseInt(e/2),"linear").animate({left:f,top:c,width:10,height:10},parseInt(e/2),"linear").animate({width:80,height:80,left:f-35,top:c-35,opacity:0},400,"linear",function(){$("#key"+b).hide();$(".unlockable").addClass("open").removeClass("unlockable closed");if(gotLastKey){openExit()}})}function openExit(){$("#exitClosed").removeClass("enabled").addClass("disabled");$("#exitOpen").removeClass("disabled").addClass("enabled")}function showReward(){$.fancybox({href:"#reward",autoDimensions:false,width:340,height:"auto",overlayOpacity:0.6,showCloseButton:true,enableEscapeButton:false,hideOnOverlayClick:false,hideOnContentClick:false,padding:0,onStart:function(){$("#fancybox-outer").addClass("fancybox-outer-wheel")},onClosed:function(){$("#breadcrumbInfoText").fadeIn(1000);enableTips();$("#spinButton").fadeIn(600);$("#fancybox-outer").removeClass("fancybox-outer-wheel")}});$("#reward").find("div").bind("click",$.fancybox.close)}function enableTips(){$(".key, #locks div").addClass("tipTip").tipTip({content:keyTipText,enter:function(){$("#tiptip_content").removeClass()}});$("#exitClosed").tipTip({edgeOffset:-14,enter:function(){$("#tiptip_content").removeClass()}});$(".reward").each(function(){var a=$(this).find(".shopItemTipContent").html();if(a){$(this).addClass("shopItemTip");$(this).tipTip({content:a,keepAlive:true,enter:function(){$("#tiptip_content").removeClass();$("#tiptip_content").addClass("shopItemTipTip")},exit:function(){$("#tiptip_content").removeClass("shopItemTipTip")}})}else{var b=$(this).find(".nonShopItemTipContent").html();if(b){$(this).addClass("tipTip");$(this).tipTip({content:b,enter:function(){$("#tiptip_content").removeClass()}})}}})}function animation(){$(".reward").show();$("#spinnerBlank").fadeOut(2000,function(){$(".reward").css("z-index",2)});window.setTimeout("highlightNext(1, "+spinCount+", "+slowDownCount+")",3000)}function teaser(a,d){if(doTeaser){if(d>16){a++;d=1}if(a>3){a=1}var c=0;var b=0;$("#teaser"+a).find(".teaserPos"+d).each(function(){b=parseInt($(this).css("top"));c=parseInt($(this).css("left"));$(this).css({height:0,width:0,display:"block",left:c+20,top:b+20}).animate({width:"+=40",height:"+=40",top:"-=20",left:"-=20"},400).delay(800).animate({width:"-=40",height:"-=40",top:"+=20",left:"+=20"},400,function(){$(this).css({left:c,top:b})})});window.setTimeout("teaser("+a+", "+(d+1)+")",200)}}function reset(c,b){c.preventDefault();$("#tiptip_holder").fadeOut(500).remove();var a=b.attr("href");$("#breadcrumbInfoText").fadeOut(500);$(".reward").css("z-index",0);$("#pos"+rewardPosition).css("z-index",0).animate({width:"-=40",height:"-=40",top:"+=20",left:"+=20"},400,function(){$("#spinButton").fadeOut(500);$("#spinnerBlank").fadeIn(2000,function(){window.location=a})})}function start(c,b){c.preventDefault();var a=b.attr("href");doTeaser=false;$("#breadcrumbInfoText").fadeOut(500);if($("#teasers").find("img").is(":visible")){$("#teasers").fadeOut(500,function(){$("#spinButton").fadeOut(500,function(){window.location=a})})}else{$("#spinButton").fadeOut(500,function(){window.location=a})}};