var NM={ROOT:"http://www.neesermueller.ch/",THEME:"http://www.neesermueller.ch/wp-content/themes/nm/",ELEMLINE:0,ELEMMINLINE:12,ELEMOPEN:0,ROWOPEN:"-1",MOBILE:0,init:function(){NM.setBrowser();if(navigator.platform.indexOf("android")>=0||navigator.platform.indexOf("iPhone")>=0||navigator.platform.indexOf("iPad")>=0)NM.MOBILE=1;$("h2").wrapInner("<span/>");$(".tooltip.hidden p").wrapInner("<span/>");$("article:not('.dummy') img").each(function(){NM.tooltip($(this))});NM.cycle($("#gallery"));$("div#content article, .tooltip").click(function(){document.location.hash=$(this).find("a").attr("rel");return false});$("#satellite, #buero").click(function(){$("#buero").fadeToggle()})},setBrowser:function(){$("body").addClass($.layout.name)},hashchange:function(){var a=location.hash.replace(/^#/,"");if(!a)a="";try{if(a){$("#buero").fadeOut(400);$("article.current a img").attr("src",$("article.current a img").attr("title"));$("article.current a img").attr("title","").parent().parent().removeClass("current");NM.ELEMOPEN=$("article:not('#work') .tooltip a[rel="+a+"]").parent().parent().index();$("article").eq(NM.ELEMOPEN).addClass("current");$("article.current a img").attr("title",$("article.current a img").attr("src")).attr("src",NM.THEME+"layout/images/current.png");NM.getWork(a);return false}}catch(b){alert("Fehler: "+b);return false}},tooltip:function(a){a.qtip({content:a.parent().parent().find("div.tooltip"),position:"topLeft",hide:{fixed:true},style:{border:0,padding:0,background:"transparent"}})},cycle:function(a){function c(a,b,c){var d=c.currSlide+1+"/"+c.slideCount;$("#control #imageCounter").html(d);if(c.slideCount<=1)$("#control a").hide()}function b(a,b,c){var d=$(b).actual("height");var e=$(b).actual("width");$("article#work").animate({height:d+"px"},730);$("article#work #gallery").animate({width:e+"px",height:d+"px"},730)}a.cycle({fx:"fade",random:false,timeout:0,speed:730,next:"#control #next, #gallery img",prev:"#control #prev",before:b,after:c})},getWork:function(a){$.ajax({type:"GET",url:NM.ROOT+a,data:"ajax=getWork",dataType:"html",error:function(a,b,c){},success:function(a){$("#content section").hide(730);if($("article#work div.wrap").size())NM.ELEMOPEN=NM.ELEMOPEN-1;var b=NM.ELEMOPEN;var c=parseInt(b/NM.ELEMLINE);var d=1;if(NM.ROWOPEN==parseInt(c)){if($("article#work div.wrap").size()){$("article#work div.wrap").fadeOut(730,function(){NM.insertWork(a,c)})}else{$("article#work").empty();NM.insertWork(a,c)}}else{if($("article#work div.wrap").size()){$("article#work div.wrap").fadeOut(730,function(){$("article#work").hide(730,function(){NM.removeWork();NM.insertWork(a,c)})})}else NM.insertWork(a,c)}},complete:function(){}})},insertWork:function(a,b){NM.ROWOPEN=parseInt(b);beforeElementId=NM.ROWOPEN>1&&NM.ROWOPEN<2?NM.ELEMLINE:parseInt(NM.ROWOPEN)*NM.ELEMLINE;if($("article#work").size()){$("article#work").empty();$("article").eq(beforeElementId).html(a)}else{$("article").eq(beforeElementId).before(innerShiv('<article id="work">'+a+"</article>"))}if(NM.ROWOPEN>0)$("article#work").css({marginTop:"20px"});NM.cycle($("#gallery"));NM.resize();NM.showWork()},showWork:function(){$("article#work").show(730,function(){$("article#work div.wrap").fadeIn(730)})},moveWork:function(){},hideWork:function(){},removeWork:function(){$("article#work").remove()},resize:function(){var a=$(window).width()-210;var b=$("#works").children().size();NM.ELEMLINE=parseInt(a/80);if(NM.ELEMLINE<NM.ELEMMINLINE)NM.ELEMLINE=NM.ELEMMINLINE;if(b<NM.ELEMLINE)NM.ELEMLINE=b;if(NM.ELEMLINE*80>880){$("#content").css({width:NM.ELEMLINE*80+"px"});$("article#work").css({width:NM.ELEMLINE*80+"px"})}if($(window).width()<1160)$("nav").css({width:"960px"});else $("nav").css({width:NM.ELEMLINE*80+"px"})}};$(document).ready(function(){NM.init();NM.resize();NM.hashchange()});$(window).smartresize(function(){if(NM.MOBILE==0){NM.removeWork();NM.resize();NM.hashchange()}});$(window).hashchange(function(){NM.hashchange()})
