/**
 * Unobtrusive scripting adapter for jQuery
 *
 * Requires jQuery 1.6.0 or later.
 * https://github.com/rails/jquery-ujs

 * Uploading file using rails.js
 * =============================
 *
 * By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
 * in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
 *
 * The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
 *
 * Ex:
 *     $('form').live('ajax:aborted:file', function(event, elements){
 *       // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
 *       // Returning false in this handler tells rails.js to disallow standard form submission
 *       return false;
 *     });
 *
 * The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
 *
 * Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
 * techniques like the iframe method to upload the file instead.
 *
 * Required fields in rails.js
 * ===========================
 *
 * If any blank required inputs (required="required") are detected in the remote form, the whole form submission
 * is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
 *
 * The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
 *
 * !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
 *    get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
 *
 * Ex:
 *     $('form').live('ajax:aborted:required', function(event, elements){
 *       // Returning false in this handler tells rails.js to submit the form anyway.
 *       // The blank required inputs are passed to this function in `elements`.
 *       return ! confirm("Would you like to submit the form with missing info?");
 *     });
 */
(function(a,b){var c;a.rails=c={linkClickSelector:"a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]",inputChangeSelector:"select[data-remote], input[data-remote], textarea[data-remote]",formSubmitSelector:"form",formInputClickSelector:"form input[type=submit], form input[type=image], form button[type=submit], form button:not(button[type])",disableSelector:"input[data-disable-with], button[data-disable-with], textarea[data-disable-with]",enableSelector:"input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled",requiredInputSelector:"input[name][required]:not([disabled]),textarea[name][required]:not([disabled])",fileInputSelector:"input:file",linkDisableSelector:"a[data-disable-with]",CSRFProtection:function(b){var c=a('meta[name="csrf-token"]').attr("content");c&&b.setRequestHeader("X-CSRF-Token",c)},fire:function(b,c,d){var e=a.Event(c);b.trigger(e,d);return e.result!==!1},confirm:function(a){return confirm(a)},ajax:function(b){return a.ajax(b)},handleRemote:function(d){var e,f,g,h=d.data("cross-domain")||null,i=d.data("type")||a.ajaxSettings&&a.ajaxSettings.dataType,j;if(c.fire(d,"ajax:before")){if(d.is("form")){e=d.attr("method"),f=d.attr("action"),g=d.serializeArray();var k=d.data("ujs:submit-button");k&&(g.push(k),d.data("ujs:submit-button",null))}else d.is(c.inputChangeSelector)?(e=d.data("method"),f=d.data("url"),g=d.serialize(),d.data("params")&&(g=g+"&"+d.data("params"))):(e=d.data("method"),f=d.attr("href"),g=d.data("params")||null);j={type:e||"GET",data:g,dataType:i,crossDomain:h,beforeSend:function(a,e){e.dataType===b&&a.setRequestHeader("accept","*/*;q=0.5, "+e.accepts.script);return c.fire(d,"ajax:beforeSend",[a,e])},success:function(a,b,c){d.trigger("ajax:success",[a,b,c])},complete:function(a,b){d.trigger("ajax:complete",[a,b])},error:function(a,b,c){d.trigger("ajax:error",[a,b,c])}},f&&(j.url=f),c.ajax(j)}},handleMethod:function(c){var d=c.attr("href"),e=c.data("method"),f=c.attr("target"),g=a("meta[name=csrf-token]").attr("content"),h=a("meta[name=csrf-param]").attr("content"),i=a('<form method="post" action="'+d+'"></form>'),j='<input name="_method" value="'+e+'" type="hidden" />';h!==b&&g!==b&&(j+='<input name="'+h+'" value="'+g+'" type="hidden" />'),f&&i.attr("target",f),i.hide().append(j).appendTo("body"),i.submit()},disableFormElements:function(b){b.find(c.disableSelector).each(function(){var b=a(this),c=b.is("button")?"html":"val";b.data("ujs:enable-with",b[c]()),b[c](b.data("disable-with")),b.prop("disabled",!0)})},enableFormElements:function(b){b.find(c.enableSelector).each(function(){var b=a(this),c=b.is("button")?"html":"val";b.data("ujs:enable-with")&&b[c](b.data("ujs:enable-with")),b.prop("disabled",!1)})},allowAction:function(a){var b=a.data("confirm"),d=!1,e;if(!b)return!0;c.fire(a,"confirm")&&(d=c.confirm(b),e=c.fire(a,"confirm:complete",[d]));return d&&e},blankInputs:function(b,c,d){var e=a(),f,g=c||"input,textarea";b.find(g).each(function(){f=a(this);if(d?f.val():!f.val())e=e.add(f)});return e.length?e:!1},nonBlankInputs:function(a,b){return c.blankInputs(a,b,!0)},stopEverything:function(b){a(b.target).trigger("ujs:everythingStopped"),b.stopImmediatePropagation();return!1},callFormSubmitBindings:function(c){var d=c.data("events"),e=!0;d!==b&&d.submit!==b&&a.each(d.submit,function(a,b){if(typeof b.handler=="function")return e=b.handler(b.data)});return e},disableElement:function(a){a.data("ujs:enable-with",a.html()),a.html(a.data("disable-with")),a.bind("click.railsDisable",function(a){return c.stopEverything(a)})},enableElement:function(a){a.data("ujs:enable-with")!==b&&(a.html(a.data("ujs:enable-with")),a.data("ujs:enable-with",!1)),a.unbind("click.railsDisable")}},a.ajaxPrefilter(function(a,b,d){a.crossDomain||c.CSRFProtection(d)}),a(c.linkDisableSelector).live("ajax:complete",function(){c.enableElement(a(this))}),a(c.linkClickSelector).live("click.rails",function(d){var e=a(this),f=e.data("method"),g=e.data("params");if(!c.allowAction(e))return c.stopEverything(d);e.is(c.linkDisableSelector)&&c.disableElement(e);if(e.data("remote")!==b){if((d.metaKey||d.ctrlKey)&&(!f||f==="GET")&&!g)return!0;c.handleRemote(e);return!1}if(e.data("method")){c.handleMethod(e);return!1}}),a(c.inputChangeSelector).live("change.rails",function(b){var d=a(this);if(!c.allowAction(d))return c.stopEverything(b);c.handleRemote(d);return!1}),a(c.formSubmitSelector).live("submit.rails",function(d){var e=a(this),f=e.data("remote")!==b,g=c.blankInputs(e,c.requiredInputSelector),h=c.nonBlankInputs(e,c.fileInputSelector);if(!c.allowAction(e))return c.stopEverything(d);if(g&&e.attr("novalidate")==b&&c.fire(e,"ajax:aborted:required",[g]))return c.stopEverything(d);if(f){if(h)return c.fire(e,"ajax:aborted:file",[h]);if(!a.support.submitBubbles&&c.callFormSubmitBindings(e)===!1)return c.stopEverything(d);c.handleRemote(e);return!1}setTimeout(function(){c.disableFormElements(e)},13)}),a(c.formInputClickSelector).live("click.rails",function(b){var d=a(this);if(!c.allowAction(d))return c.stopEverything(b);var e=d.attr("name"),f=e?{name:e,value:d.val()}:null;d.closest("form").data("ujs:submit-button",f)}),a(c.formSubmitSelector).live("ajax:beforeSend.rails",function(b){this==b.target&&c.disableFormElements(a(this))}),a(c.formSubmitSelector).live("ajax:complete.rails",function(b){this==b.target&&c.enableFormElements(a(this))})})(jQuery),function(){jQuery(function(){var a;a=$("#navigation ul").find("li.highlighted").parent(),a.parent().is("li")&&a.parent().find("ul:first").addClass("active-border").slideToggle(),$("#navigation ul > li").click(function(){var a;a=$(this).find("ul:first").is(":visible");if(!a){$(this).parent().find("> li ul:visible").slideToggle();return $(this).find("ul:first").stop(!0,!0).addClass("active-border").slideToggle()}});return $(".thumb",this).hover(function(){return $(".overlay",this).stop(!0,!0).slideDown("fast")},function(){return $(".overlay",this).stop(!0,!0).slideUp("fast")})})}.call(this),function(a){function d(b,c,d){var e=c.hash.slice(1),f=document.getElementById(e)||document.getElementsByName(e)[0];if(!!f){b&&b.preventDefault();var g=a(d.target);if(d.lock&&g.is(":animated")||d.onBefore&&d.onBefore.call(d,b,f,g)===!1)return;d.stop&&g.stop(!0);if(d.hash){var h=f.id==e?"id":"name",i=a("<a> </a>").attr(h,e).css({position:"absolute",top:a(window).scrollTop(),left:a(window).scrollLeft()});f[h]="",a("body").prepend(i),location=c.hash,i.remove(),f[h]=e}g.scrollTo(f,d).trigger("notify.serialScroll",[f])}}var b=location.href.replace(/#.*/,""),c=a.localScroll=function(b){a("body").localScroll(b)};c.defaults={duration:1e3,axis:"y",event:"click",stop:!0,target:window,reset:!0},c.hash=function(b){if(location.hash){b=a.extend({},c.defaults,b),b.hash=!1;if(b.reset){var e=b.duration;delete b.duration,a(b.target).scrollTo(0,b),b.duration=e}d(0,location,b)}},a.fn.localScroll=function(e){function f(){return!!this.href&&!!this.hash&&this.href.replace(this.hash,"")==b&&(!e.filter||a(this).is(e.filter))}e=a.extend({},c.defaults,e);return e.lazy?this.bind(e.event,function(b){var c=a([b.target,b.target.parentNode]).filter(f)[0];c&&d(b,c,e)}):this.find("a,area").filter(f).bind(e.event,function(a){d(a,this,e)}).end().end()}}(jQuery),function(a){function c(a){return typeof a=="object"?a:{top:a,left:a}}var b=a.scrollTo=function(b,c,e){a(window).scrollTo(b,c,e)};b.defaults={axis:"xy",duration:parseFloat(a.fn.jquery)>=1.3?0:1},b.window=function(b){return a(window)._scrollable()},a.fn._scrollable=function(){return this.map(function(){var b=this,c=!b.nodeName||a.inArray(b.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!c)return b;var e=(b.contentWindow||b).document||b.ownerDocument||b;return a.browser.safari||e.compatMode=="BackCompat"?e.body:e.documentElement})},a.fn.scrollTo=function(e,f,g){typeof f=="object"&&(g=f,f=0),typeof g=="function"&&(g={onAfter:g}),e=="max"&&(e=9e9),g=a.extend({},b.defaults,g),f=f||g.speed||g.duration,g.queue=g.queue&&g.axis.length>1,g.queue&&(f/=2),g.offset=c(g.offset),g.over=c(g.over);return this._scrollable().each(function(){function r(a){i.animate(o,f,g.easing,a&&function(){a.call(this,e,g)})}var h=this,i=a(h),l=e,m,o={},q=i.is("html,body");switch(typeof l){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(l)){l=c(l);break}l=a(l,this);case"object":if(l.is||l.style)m=(l=a(l)).offset()}a.each(g.axis.split(""),function(a,c){var d=c=="x"?"Left":"Top",e=d.toLowerCase(),f="scroll"+d,j=h[f],n=b.max(h,c);if(m)o[f]=m[e]+(q?0:j-i.offset()[e]),g.margin&&(o[f]-=parseInt(l.css("margin"+d))||0,o[f]-=parseInt(l.css("border"+d+"Width"))||0),o[f]+=g.offset[e]||0,g.over[e]&&(o[f]+=l[c=="x"?"width":"height"]()*g.over[e]);else{var p=l[e];o[f]=p.slice&&p.slice(-1)=="%"?parseFloat(p)/100*n:p}/^\d+$/.test(o[f])&&(o[f]=o[f]<=0?0:Math.min(o[f],n)),!a&&g.queue&&(j!=o[f]&&r(g.onAfterFirst),delete o[f])}),r(g.onAfter)}).end()},b.max=function(b,c){var e=c=="x"?"Width":"Height",f="scroll"+e;if(!a(b).is("html,body"))return b[f]-a(b)[e.toLowerCase()]();var g="client"+e,h=b.ownerDocument.documentElement,i=b.ownerDocument.body;return Math.max(h[f],i[f])-Math.min(h[g],i[g])}}(jQuery),function(a){var b=a.serialScroll=function(b){return a(window).serialScroll(b)};b.defaults={duration:1e3,axis:"x",event:"click",start:0,step:1,lock:!0,cycle:!0,constant:!0},a.fn.serialScroll=function(c){return this.each(function(){function u(a){if(!isNaN(a))return a;var b=t(),c;while((c=b.index(a))==-1&&a!=j)a=a.parentNode;return c}function t(){return a(k,j)}function s(){clearTimeout(o)}function r(){i.trigger("next.serialScroll")}function q(a,b){isNaN(b)||(a.data=b,b=j);var c=a.data,e,g=a.type,h=d.exclude?t().slice(0,-d.exclude):t(),k=h.length,n=h[c],p=d.duration;g&&a.preventDefault(),m&&(s(),o=setTimeout(r,d.interval));if(!n){e=c<0?0:k-1;if(l!=e)c=e;else{if(!d.cycle)return;c=k-e-1}n=h[c]}!n||d.lock&&i.is(":animated")||g&&d.onBefore&&d.onBefore(a,n,i,t(),c)===!1||(d.stop&&i.queue("fx",[]).stop(),d.constant&&(p=Math.abs(p/f*(l-c))),i.scrollTo(n,p,d).trigger("notify.serialScroll",[c]))}function p(a){a.data+=l,q(a,this)}var d=a.extend({},b.defaults,c),e=d.event,f=d.step,g=d.lazy,h=d.target?this:document,i=a(d.target||this,h),j=i[0],k=d.items,l=d.start,m=d.interval,n=d.navigation,o;g||(k=t()),d.force&&q({},l),a(d.prev||[],h).bind(e,-f,p),a(d.next||[],h).bind(e,f,p),j.ssbound||i.bind("prev.serialScroll",-f,p).bind("next.serialScroll",f,p).bind("goto.serialScroll",q),m&&i.bind("start.serialScroll",function(a){m||(s(),m=!0,r())}).bind("stop.serialScroll",function(){s(),m=!1}),i.bind("notify.serialScroll",function(a,b){var c=u(b);c>-1&&(l=c)}),j.ssbound=!0,d.jump&&(g?i:t()).bind(e,function(a){q(a,u(a.target))}),n&&(n=a(n,h).bind(e,function(a){a.data=Math.round(t().length/n.length)*n.index(this),q(a,this)}))})}}(jQuery),function(){$(document).ready(function(){var a,b,c,d,e,f,g,h,i;d=$("#how-slider .scrollContainer > div"),a=$("#how-slider .scrollContainer"),b=!0,b&&(d.css({"float":"left",position:"relative"}),a.css("width",((i=d[0])!=null?i.offsetWidth:void 0)*(d!=null?d.length:void 0))),e=$("#how-slider .scroll").css("overflow","hidden"),g=function(){return $(this).parents("ul:first").find("a").removeClass("selected").end().end().addClass("selected")},$("#how-slider .how-navigation").find("a").click(g),h=function(a){var b;b=$("#how-slider .how-navigation").find('a[href$="'+a.id+'"]').get(0);return g.call(b)},window.location.hash?h({id:window.location.hash.substr(1)}):$("ul.how-navigation a:first").click(),c=parseInt((b?a.css("paddingTop"):a.css("paddingLeft"))||0)*-1,f={target:e,items:d,navigation:".how-navigation a",axis:"xy",onAfter:h,offset:c,duration:500,easing:"swing"},$("#how-slider").serialScroll(f),$.localScroll(f),f.duration=1;return $.localScroll.hash(f)})}.call(this),function(){var a;window.onload=function(){return a()},jQuery(function(){var b;b=$("#screenshots");return $(window).resize(function(){if(b!=null)return a()})}),jQuery(function(){return $("ul#project_navigation li").hover(function(){return $("span",this).show()},function(){return $("span",this).hide()})}),a=function(){var a,b,c,d;a=$("#screenshots"),a.width($(window).width()-310),d=$("ul",a),c=$(".slider"),b=d.innerWidth()-a.outerWidth(),$(".scroll-bar").slider({min:0,max:b,stop:function(a,b){return d.animate({left:b.value*-1},940)},slide:function(a,b){return d.css("left",b.value*-1)}});return $(".slider-wrap").find(".ui-handle-helper-parent").width($(".slider-wrap").width()-$(".scroll-bar").find(".ui-slider-handle").width())}}.call(this)
