/**
 * jQuery Slide Menu
 * -----------------
 * Version 0.3 - 7/1/2011
 * Copyright (c) 2011 Chris Nanney
 * http://cnanney.com/journal/code/creating-apples-new-slide-menu-with-jQuery/
 *
 * Licensed under MIT
 * http://www.opensource.org/licenses/mit-license.php
 */
var slideMenu=function(k){function g(c,d){d<c&&l(d,c);d>c&&m(d,c);b.active=c;jQuery(a.controls+" a.active").removeClass("active");jQuery(a.controls+" a:eq("+b.active+")").addClass("active")}function h(c,d){if(d!=!1)b.count=jQuery(a.div+" ul:eq("+c+") li").length,b.count>0&&(jQuery(a.div+" ul:eq("+c+") li:eq(0)").offset().left>b.middle&&jQuery(a.div+" ul:eq("+c+") li").css("left","-"+(b.c_w+a.x)+"px"),jQuery(a.div+" ul:eq("+c+") li").each(function(d){b.x=b.c_w/2+b.count/2*a.x-a.x*d;jQuery(a.div+" ul:eq("+
c+") li:eq("+(b.count-d-1)+")").delay((d+2)*a.delay).animate({left:"+="+b.x},a.speed,a.easing,function(){if(d+1==b.count)b.animating=!1})}))}function i(c,d){if(d!=!1)b.count=jQuery(a.div+" ul:eq("+c+") li").length,b.count>0&&(jQuery(a.div+" ul:eq("+c+") li:eq(0)").offset().left<b.middle&&jQuery(a.div+" ul:eq("+c+") li").css("left","0"),jQuery(a.div+" ul:eq("+c+") li").each(function(c){b.x=b.c_w/2+b.count/2*a.x-a.x*c;jQuery(this).delay((c+1)*a.delay).animate({left:"-="+b.x},a.speed,a.easing,function(){if(c+
1==b.count)b.animating=!1})}))}function l(c,d){b.animating=!0;b.count=jQuery(a.div+" ul:eq("+c+") li").length;b.count>0?jQuery(a.div+" ul:eq("+c+") li").each(function(c){b.x=jQuery(this).offset().left-b.c_o.left+a.x;var f=c+1==b.count?!0:!1;jQuery(this).delay((c+1)*a.delay).animate({left:"-="+b.x},a.speed,function(){i(d,f)})}):i(d,!0)}function m(c,d){b.animating=!0;b.count=jQuery(a.div+" ul:eq("+c+") li").length;b.count>0?jQuery(a.div+" ul:eq("+c+") li").each(function(c){b.x=b.c_w-jQuery(this).offset().left+
b.c_o.left;var f=c+1==b.count?!0:!1;jQuery(this).delay((b.count-c)*a.delay).animate({left:"+="+b.x},a.speed,function(){h(d,f)})}):h(d,!0)}var j={div:"#menu-container",controls:"#menu-controls",loader:!1,x:150,y:150,start:0,speed:300,delay:60,easing:"",easeIn:"",preloadAll:!1},a=k||{},f;for(f in j)a[f]=f in a?a[f]:j[f];if(!jQuery.easing.hasOwnProperty(a.easing)&&a.easing!="")a.easing="easeOutBounce";if(!jQuery.easing.hasOwnProperty(a.easeIn)&&a.easeIn!="")a.easeIn="easeOutBack";if(!jQuery.easing.hasOwnProperty("easeOutBounce"))a.easing=
a.easeIn="";var b={middle:jQuery(document).width()/2,active:a.start,c_w:jQuery(a.div).width(),c_o:jQuery(a.div).offset(),count:0,x:0,s_l:jQuery(a.div+" ul:eq("+a.start+") li").length,animating:!1,loading:{},loop_started:!1};this.switchTo=function(a){g(a,b.active)};jQuery(a.div+" ul:eq("+a.start+") li").animate({left:"-="+(b.c_w/2+a.x/2)+"px",top:-a.y},0);jQuery(a.preloadAll==!1?a.div+" ul:eq("+a.start+") img":a.div+" img").each(function(a){b.loading[a]=!0;b.loop_started=!0;jQuery(this).load(function(){delete b.loading[a]});
this.complete&&jQuery(this).trigger("load")});jQuery(a.controls+" a").click(function(a){a.preventDefault();b.animating==!1&&g(jQuery(this).data("target"),b.active)});window.onresize=function(){b.middle=jQuery(document).width()/2;b.c_o=jQuery(a.div).offset()};var n=setInterval(function(){var c=0;for(e in b.loading)c++;b.loop_started==!0&&c==0&&(clearInterval(n),a.loader!=!1&&a.loader!=""&&jQuery(a.loader).hide(),jQuery(a.div+" ul:eq("+a.start+") li").each(function(c){b.x=a.x/2+b.s_l/2*a.x-a.x*(c+1);
jQuery(this).delay(a.delay).animate({left:"-="+b.x,top:0},a.speed,a.easeIn)}))},50)};
