$(document).ready(function(){$(".nojs").remove();var dragdrop=true,crop=0.05,starty=1206,startx=1824,mousex=0,mousey=0,arrowy=-161,arrowx=-254,noupdate=false,animation={duration:3000,easing:"easeOutExpo",queue:false,complete:function(){noupdate=false;}},moveopts={innerObj:"#viewport #image",velFactor:25,intervalT:10,safeAreaX:400,safeAreaY:400,useArrows:true,arrowRightClass:".sideR",arrowLeftClass:".sideL",arrowTopClass:".sideT",arrowBottomClass:".sideB",activedArrClass:".sideActive"};if(document.referrer.indexOf("erdgaspokal.de")!=-1){$("#intro").hide();$("#viewport").show();$("#image").css({top:-starty,left:-startx});$("#overview").fadeIn(1000);$("#image").delay(1000).fadeIn(1000);if(!dragdrop){$("#viewport").overflowMe(moveopts);}else{$("#viewport").css("cursor","move").mapbox({mousewheel:false});}}else{$("#intro p").show();$("#intro .loading").fadeOut(1000,function(){$("#intro h2").delay(200).fadeIn(1000,function(){$("#intro").delay(2000).fadeOut(1000,function(){$("#viewport").show();$("#image").css({top:-starty,left:-startx});$("#overview").fadeIn(1000);$("#image").delay(1000).fadeIn(1000);if(!dragdrop){$("#viewport").overflowMe(moveopts);}else{$("#viewport").css("cursor","move").mapbox({mousewheel:false});}});});});}$(".iphonebutton").click(function(){$(".iphone").fadeToggle(500);});$(".ipadbutton").click(function(){$("ul#gallery").fadeToggle(500);$("ul#gallery li span").hide();$("ul#gallery li:last-child span").show();});if($("ul#gallery").children().length>1){$("ul#gallery li span").hide();$("ul#gallery li:last-child span").show();setInterval(function(){var target=$("#gallery li:last-child");target.children("span").fadeOut(1000);target.prev().children("span").fadeIn(1000);target.children("a").children("img").hide("slide",{direction:"left"},1000,function(){$(this).show().parent().parent().prependTo("#gallery");});},7000);}setInterval(function(){$(".tooltip:in-viewport").each(function(){$(this).delay(1500).fadeIn(1000);});$(".tooltip:out-viewport").each(function(){$(this).hide();});},1000);setInterval(function(){if(noupdate){return;}var pos_image=$("#image").position();$("#overview #cutout").height($(window).height()*crop).width($(window).width()*crop).css({top:(-pos_image.top*crop),left:(-pos_image.left*crop)});},1);$("#overview-toggle").click(function(event){event.stopPropagation();$("#overview").animate((($(this).hasClass("open"))?{top:arrowy,right:arrowx}:{top:-5,right:-5}),500);$(this).toggleClass("open");});$("#overview").click(function(event){var pos_y=event.pageY-($("#overview #cutout").height()/2),pos_x=event.pageX-this.offsetLeft-5-($("#overview #cutout").width()/2),max_y=$(this).height()-$("#overview #cutout").height()-1,max_x=$(this).width()-$("#overview #cutout").width()-2;if(pos_y<0){pos_y=0;}if(pos_y>max_y){pos_y=max_y;}if(pos_x<0){pos_x=0;}if(pos_x>max_x){pos_x=max_x;}$("#image").stop().animate({top:(pos_y/crop*-1),left:(pos_x/crop*-1)},animation);});$("#overview").dblclick(function(){$("#image").stop().animate({top:-starty,left:-startx},animation);});$("#overview #cutout").draggable({containment:"parent",scroll:false});$("#overview #cutout").draggable({start:function(event,ui){$(this).stop().clearQueue();$("#image").stop();noupdate=true;},stop:function(event,ui){var pos_thumb=$(this).position();pos_image=pos_thumb;pos_image.top=pos_thumb.top/crop*-1;pos_image.left=pos_thumb.left/crop*-1;$(this).clearQueue();$("#image").stop().animate({top:pos_image.top,left:pos_image.left},animation);}});});
