(function(a){a.fn.easySlider=function(b){var c={prevId:"prevBtn",prevText:"&lsaquo;",nextId:"nextBtn",nextText:"&rsaquo;",prevPrjId:"pProject",prevPrjText:"&lsaquo; Previous Project",nextPrjId:"nProject",nextPrjText:"Next Project &rsaquo;",orientation:"",speed:500};var b=a.extend(c,b);return this.each(function(){obj=a(this);var y=a("li",obj).length;var u=obj.width();var q=obj.height();var r=y-1;var x=0;var l=(b.orientation=="vertical");var f="";var j=parseInt(xmlObj.currentProject);var v=parseInt(xmlObj.resultArray.length-1);a("ul",obj).css("width",y*u);if(!l){a("li",obj).css("float","left")}f+='<div id="controls">';f+='<span><a href="javascript:void(0);" id="'+b.prevPrjId+'">'+b.prevPrjText+'</a><a href="javascript:void(0);" id="'+b.nextPrjId+'">'+b.nextPrjText+"</a></span>";for(i=0;i<=r;i++){f+='<a class="numbers" href="'+window.location.href+'" id="btn'+i+'">'+(i+1)+"</a>"}f+='<a href="javascript:void(0);" id="'+b.prevId+'">'+b.prevText+'</a><a href="javascript:void(0);" id="'+b.nextId+'">'+b.nextText+'</a><a id="close" title="Close" href="javascript:void(0);">x</a>';f+="</div>";a(obj).after(f);for(i=0;i<=r;i++){a("#btn"+i).click(function(){ulNo=this.id.substring(3);g(ulNo);m()})}a("#"+b.nextId).click(function(){d("next");m()});a("#"+b.prevId).click(function(){d("prev");m()});a("#"+b.prevPrjId).click(function(){if(j>0){j--;o(j)}});a("#"+b.nextPrjId).click(function(){if(j<v){j++;o(j)}});a("#close").click(function(){closeDescription()});function d(h){if(h=="next"){x=(x>=r)?r:x+1}else{x=(x<=0)?0:x-1}if(!l){p=(x*u*-1);a("ul",obj).animate({marginLeft:p},b.speed)}else{p=(x*q*-1);a("ul",obj).animate({marginTop:p},b.speed)}}function g(h){x=parseInt(h);p=(x*u*-1);a("ul",obj).animate({marginLeft:p},b.speed)}function o(h){a("#slider").fadeOut("slow",n(h))}function n(h){newhash=window.location.hash;newhash=newhash.substring(0,newhash.lastIndexOf("/"));window.location.hash=newhash+"/"+h}function m(){if(y>1){a("#"+b.prevId).addClass("inactive");a("#"+b.prevId).show();a("#"+b.nextId).show()}else{a("#"+b.prevId).hide();a("#"+b.nextId).hide()}if(x<=0){a("#"+b.prevId).addClass("inactive");a("#"+b.nextId).removeClass("inactive")}else{if(x>=r){a("#"+b.nextId).addClass("inactive");a("#"+b.prevId).removeClass("inactive")}else{a("#"+b.prevId).removeClass("inactive");a("#"+b.nextId).removeClass("inactive")}}for(k=0;k<=r;k++){a("#btn"+k).removeClass("current")}a("#btn"+x).addClass("current")}function e(){a("#slider").hide();a("#slider").fadeIn("slow");m();if(v==0){a("#"+b.prevPrjId).hide();a("#"+b.nextPrjId).hide()}else{if(j==0){a("#"+b.prevPrjId).addClass("inactive");a("#"+b.nextPrjId).removeClass("inactive")}else{if(j==v){a("#"+b.nextPrjId).addClass("inactive");a("#"+b.prevPrjId).removeClass("inactive")}else{a("#"+b.nextPrjId).removeClass("inactive");a("#"+b.prevPrjId).removeClass("inactive")}}}}e()})}})(jQuery);