/**
 * jQuery Galleriffic plugin
 *
 * Copyright (c) 2008 Trent Foley (http://trentacular.com)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Much thanks to primary contributer Ponticlaro (http://www.ponticlaro.com)
 */
 
 /*
 * In-Field Label jQuery Plugin
 * http://fuelyourcoding.com/scripts/infield.html
 *
 * Copyright (c) 2009 Doug Neiner
 * Dual licensed under the MIT and GPL licenses.
 * Uses the same license as jQuery, see:
 * http://docs.jquery.com/License
 *
 * @version 0.1
 */
 
 /*!
 * jQuery.LocalScroll
 * Copyright (c) 2007-2010 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 05/31/2010
 **/
 
 /**
 * jQuery.ScrollTo
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 */
 
 /**
 * jQuery Opacity Rollover plugin
 *
 * Copyright (c) 2009 Trent Foley (http://trentacular.com)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
 
 /*
 * Simple jQuery Form Validation Plugin
 * http://github.com/davist11/jQuery-Simple-Validate
 *
 * Copyright (c) 2010 Trevor Davis (http://trevordavis.net)
 * Dual licensed under the MIT and GPL licenses.
 * Uses the same license as jQuery, see:
 * http://jquery.org/license
 */
 
  /*
 * TipTip
 * Copyright 2010 Drew Wilson
 * code.drewwilson.com/entry/tiptip-jquery-plugin
 *
 * Version 1.3   -   Updated: Mar. 23, 2010
 *
 * This TipTip jQuery plug-in is dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 
 /**
 * jQuery Tools 1.2.5 Overlay - Overlay base. Extend it.
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/overlay/
 *
 * Since: March 2008
 * Date:    Wed Sep 22 06:02:10 2010 +0000 
 */
 
 /**
 * jQuery Tools 1.2.5 / Expose - Dim the lights
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/toolbox/expose.html
 *
 * Since: Mar 2010
 * Date:    Wed Sep 22 06:02:10 2010 +0000 
 */

(function(b){var d={};var a=0;b.galleriffic={version:"2.0.1",normalizeHash:function(e){return e.replace(/^.*#/,"").replace(/\?.*$/,"")},getImage:function(e){if(!e){return undefined}e=b.galleriffic.normalizeHash(e);return d[e]},gotoImage:function(f){var g=b.galleriffic.getImage(f);if(!g){return false}var e=g.gallery;e.gotoImage(g);return true},removeImageByHash:function(g,f){var h=b.galleriffic.getImage(g);if(!h){return false}var e=h.gallery;if(f&&f!=e){return false}return e.removeImageByIndex(h.index)}};var c={delay:3000,numThumbs:20,preloadAhead:40,enableTopPager:false,enableBottomPager:true,maxPagesToShow:7,imageContainerSel:"",captionContainerSel:"",controlsContainerSel:"",loadingContainerSel:"",renderSSControls:true,renderNavControls:true,playLinkText:"Play",pauseLinkText:"Pause",prevLinkText:"Previous",nextLinkText:"Next",nextPageLinkText:"Next &rsaquo;",prevPageLinkText:"&lsaquo; Prev",enableHistory:false,enableKeyboardNavigation:true,autoStart:false,syncTransitions:false,defaultTransitionDuration:1000,onSlideChange:undefined,onTransitionOut:undefined,onTransitionIn:undefined,onPageTransitionOut:undefined,onPageTransitionIn:undefined,onImageAdded:undefined,onImageRemoved:undefined};b.fn.galleriffic=function(g){b.extend(this,{version:b.galleriffic.version,isSlideshowRunning:false,slideshowTimeout:undefined,clickHandler:function(m,k){this.pause();if(!this.enableHistory){var l=b.galleriffic.normalizeHash(b(k).attr("href"));b.galleriffic.gotoImage(l);m.preventDefault()}},appendImage:function(k){this.addImage(k,false,false);return this},insertImage:function(l,k){this.addImage(l,false,true,k);return this},addImage:function(l,q,u,r){var s=(typeof l==="string")?b(l):l;var m=s.find("a.thumb");var n=m.attr("href");var t=m.attr("title");var p=s.find(".caption").remove();var o=m.attr("name");a++;if(!o||d[""+o]){o=a}if(!u){r=this.data.length}var k={title:t,slideUrl:n,caption:p,hash:o,gallery:this,index:r};if(u){this.data.splice(r,0,k);this.updateIndices(r)}else{this.data.push(k)}var v=this;if(!q){this.updateThumbs(function(){var w=v.find("ul.thumbs");if(u){w.children(":eq("+r+")").before(s)}else{w.append(s)}if(v.onImageAdded){v.onImageAdded(k,s)}})}d[""+o]=k;m.attr("rel","history").attr("href","#"+o).removeAttr("name").click(function(w){v.clickHandler(w,this)});return this},removeImageByIndex:function(k){if(k<0||k>=this.data.length){return false}var l=this.data[k];if(!l){return false}this.removeImage(l);return true},removeImageByHash:function(k){return b.galleriffic.removeImageByHash(k,this)},removeImage:function(l){var k=l.index;this.data.splice(k,1);delete d[""+l.hash];this.updateThumbs(function(){var m=e.find("ul.thumbs").children(":eq("+k+")").remove();if(e.onImageRemoved){e.onImageRemoved(l,m)}});this.updateIndices(k);return this},updateIndices:function(k){for(i=k;i<this.data.length;i++){this.data[i].index=i}return this},initializeThumbs:function(){this.data=[];var k=this;this.find("ul.thumbs > li").each(function(l){k.addImage(b(this),true,false)});return this},isPreloadComplete:false,preloadInit:function(){if(this.preloadAhead==0){return this}this.preloadStartIndex=this.currentImage.index;var k=this.getNextIndex(this.preloadStartIndex);return this.preloadRecursive(this.preloadStartIndex,k)},preloadRelocate:function(k){this.preloadStartIndex=k;return this},preloadRecursive:function(p,m){if(p!=this.preloadStartIndex){var k=this.getNextIndex(this.preloadStartIndex);return this.preloadRecursive(this.preloadStartIndex,k)}var l=this;var n=m-p;if(n<0){n=this.data.length-1-p+m}if(this.preloadAhead>=0&&n>this.preloadAhead){setTimeout(function(){l.preloadRecursive(p,m)},500);return this}var q=this.data[m];if(!q){return this}if(q.image){return this.preloadNext(p,m)}var o=new Image();o.onload=function(){q.image=this;l.preloadNext(p,m)};o.alt=q.title;o.src=q.slideUrl;return this},preloadNext:function(n,m){var k=this.getNextIndex(m);if(k==n){this.isPreloadComplete=true}else{var l=this;setTimeout(function(){l.preloadRecursive(n,k)},100)}return this},getNextIndex:function(l){var k=l+1;if(k>=this.data.length){k=0}return k},getPrevIndex:function(k){var l=k-1;if(l<0){l=this.data.length-1}return l},pause:function(){this.isSlideshowRunning=false;if(this.slideshowTimeout){clearTimeout(this.slideshowTimeout);this.slideshowTimeout=undefined}if(this.$controlsContainer){this.$controlsContainer.find("div.ss-controls a").removeClass().addClass("play").attr("title",this.playLinkText).attr("href","#play").html(this.playLinkText)}return this},play:function(){this.isSlideshowRunning=true;if(this.$controlsContainer){this.$controlsContainer.find("div.ss-controls a").removeClass().addClass("pause").attr("title",this.pauseLinkText).attr("href","#pause").html(this.pauseLinkText)}if(!this.slideshowTimeout){var k=this;this.slideshowTimeout=setTimeout(function(){k.ssAdvance()},this.delay)}return this},toggleSlideshow:function(){if(this.isSlideshowRunning){this.pause()}else{this.play()}return this},ssAdvance:function(){if(this.isSlideshowRunning){this.next(true)}return this},next:function(k,l){this.gotoIndex(this.getNextIndex(this.currentImage.index),k,l);return this},previous:function(k,l){this.gotoIndex(this.getPrevIndex(this.currentImage.index),k,l);return this},nextPage:function(l,p){var n=this.getCurrentPage();var m=this.getNumPages()-1;if(n<m){var o=n*this.numThumbs;var k=o+this.numThumbs;this.gotoIndex(k,l,p)}return this},previousPage:function(k,o){var m=this.getCurrentPage();if(m>0){var n=m*this.numThumbs;var l=n-this.numThumbs;this.gotoIndex(l,k,o)}return this},gotoIndex:function(l,k,m){if(!k){this.pause()}if(l<0){l=0}else{if(l>=this.data.length){l=this.data.length-1}}var n=this.data[l];if(!m&&this.enableHistory){b.historyLoad(String(n.hash))}else{this.gotoImage(n)}return this},gotoImage:function(l){var k=l.index;if(this.onSlideChange){this.onSlideChange(this.currentImage.index,k)}this.currentImage=l;this.preloadRelocate(k);this.refresh();return this},getDefaultTransitionDuration:function(k){if(k){return this.defaultTransitionDuration}return this.defaultTransitionDuration/2},refresh:function(){var k=this.currentImage;if(!k){return this}var o=k.index;if(this.$controlsContainer){this.$controlsContainer.find("div.nav-controls a.prev").attr("href","#"+this.data[this.getPrevIndex(o)].hash).end().find("div.nav-controls a.next").attr("href","#"+this.data[this.getNextIndex(o)].hash)}var r=this.$imageContainer.find("span.current").addClass("previous").removeClass("current");var q=0;if(this.$captionContainer){q=this.$captionContainer.find("span.current").addClass("previous").removeClass("current")}var n=this.syncTransitions&&k.image;var l=true;var s=this;var p=function(){l=false;r.remove();if(q){q.remove()}if(!n){if(k.image&&k.hash==s.data[s.currentImage.index].hash){s.buildImage(k,n)}else{if(s.$loadingContainer){s.$loadingContainer.show()}}}};if(r.length==0){p()}else{if(this.onTransitionOut){this.onTransitionOut(r,q,n,p)}else{r.fadeTo(this.getDefaultTransitionDuration(n),0,p);if(q){q.fadeTo(this.getDefaultTransitionDuration(n),0)}}}if(n){this.buildImage(k,n)}if(!k.image){var m=new Image();m.onload=function(){k.image=this;if(!l&&k.hash==s.data[s.currentImage.index].hash){s.buildImage(k,n)}};m.alt=k.title;m.src=k.slideUrl}this.relocatePreload=true;return this.syncThumbs()},buildImage:function(p,n){var m=this;var k=this.getNextIndex(p.index);var l=this.$imageContainer.append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="#'+this.data[k].hash+'" title="'+p.title+'">&nbsp;</a></span>').find("span.current").css("opacity","0");l.find("a").append(p.image).click(function(q){m.clickHandler(q,this)});var o=0;if(this.$captionContainer){o=this.$captionContainer.append('<span class="image-caption current"></span>').find("span.current").css("opacity","0").append(p.caption)}if(this.$loadingContainer){this.$loadingContainer.hide()}if(this.onTransitionIn){this.onTransitionIn(l,o,n)}else{l.fadeTo(this.getDefaultTransitionDuration(n),1);if(o){o.fadeTo(this.getDefaultTransitionDuration(n),1)}}if(this.isSlideshowRunning){if(this.slideshowTimeout){clearTimeout(this.slideshowTimeout)}this.slideshowTimeout=setTimeout(function(){m.ssAdvance()},this.delay)}return this},getCurrentPage:function(){return Math.floor(this.currentImage.index/this.numThumbs)},syncThumbs:function(){var l=this.getCurrentPage();if(l!=this.displayedPage){this.updateThumbs()}var k=this.find("ul.thumbs").children();k.filter(".selected").removeClass("selected");k.eq(this.currentImage.index).addClass("selected");return this},updateThumbs:function(k){var l=this;var m=function(){if(k){k()}l.rebuildThumbs();if(l.onPageTransitionIn){l.onPageTransitionIn()}else{l.show()}};if(this.onPageTransitionOut){this.onPageTransitionOut(m)}else{this.hide();m()}return this},rebuildThumbs:function(){var m=this.data.length>this.numThumbs;if(this.enableTopPager){var k=this.find("div.top");if(k.length==0){k=this.prepend('<div class="top pagination"></div>').find("div.top")}else{k.empty()}if(m){this.buildPager(k)}}if(this.enableBottomPager){var o=this.find("div.bottom");if(o.length==0){o=this.append('<div class="bottom pagination"></div>').find("div.bottom")}else{o.empty()}if(m){this.buildPager(o)}}var p=this.getCurrentPage();var q=p*this.numThumbs;var l=q+this.numThumbs-1;if(l>=this.data.length){l=this.data.length-1}var n=this.find("ul.thumbs");n.find("li").each(function(r){var s=b(this);if(r>=q&&r<=l){s.show()}else{s.hide()}});this.displayedPage=p;n.removeClass("noscript");return this},getNumPages:function(){return Math.ceil(this.data.length/this.numThumbs)},buildPager:function(m){var u=this;var l=this.getNumPages();var o=this.getCurrentPage();var s=o*this.numThumbs;var k=this.maxPagesToShow-1;var p=o-Math.floor((this.maxPagesToShow-1)/2)+1;if(p>0){var t=l-p;if(t<k){p=p-(k-t)}}if(p<0){p=0}if(o>0){var n=s-this.numThumbs;m.append('<a rel="history" href="#'+this.data[n].hash+'" title="'+this.prevPageLinkText+'">'+this.prevPageLinkText+"</a>")}if(p>0){this.buildPageLink(m,0,l);if(p>1){m.append('<span class="ellipsis">&hellip;</span>')}k--}while(k>0){this.buildPageLink(m,p,l);k--;p++}if(p<l){var r=l-1;if(p<r){m.append('<span class="ellipsis">&hellip;</span>')}this.buildPageLink(m,r,l)}var q=s+this.numThumbs;if(q<this.data.length){m.append('<a rel="history" href="#'+this.data[q].hash+'" title="'+this.nextPageLinkText+'">'+this.nextPageLinkText+"</a>")}m.find("a").click(function(v){u.clickHandler(v,this)});return this},buildPageLink:function(m,p,n){var l=p+1;var o=this.getCurrentPage();if(p==o){m.append('<span class="current">'+l+"</span>")}else{if(p<n){var k=p*this.numThumbs;m.append('<a rel="history" href="#'+this.data[k].hash+'" title="'+l+'">'+l+"</a>")}}return this}});b.extend(this,c,g);if(this.enableHistory&&!b.historyInit){this.enableHistory=false}if(this.imageContainerSel){this.$imageContainer=b(this.imageContainerSel)}if(this.captionContainerSel){this.$captionContainer=b(this.captionContainerSel)}if(this.loadingContainerSel){this.$loadingContainer=b(this.loadingContainerSel)}this.initializeThumbs();if(this.maxPagesToShow<3){this.maxPagesToShow=3}this.displayedPage=-1;this.currentImage=this.data[0];var e=this;if(this.$loadingContainer){this.$loadingContainer.hide()}if(this.controlsContainerSel){this.$controlsContainer=b(this.controlsContainerSel).empty();if(this.renderSSControls){if(this.autoStart){this.$controlsContainer.append('<div class="ss-controls"><a href="#pause" class="pause" title="'+this.pauseLinkText+'">'+this.pauseLinkText+"</a></div>")}else{this.$controlsContainer.append('<div class="ss-controls"><a href="#play" class="play" title="'+this.playLinkText+'">'+this.playLinkText+"</a></div>")}this.$controlsContainer.find("div.ss-controls a").click(function(k){e.toggleSlideshow();k.preventDefault();return false})}if(this.renderNavControls){this.$controlsContainer.append('<div class="nav-controls"><a class="prev" rel="history" title="'+this.prevLinkText+'">'+this.prevLinkText+'</a><a class="next" rel="history" title="'+this.nextLinkText+'">'+this.nextLinkText+"</a></div>").find("div.nav-controls a").click(function(k){e.clickHandler(k,this)})}}var f=!this.enableHistory||!location.hash;if(this.enableHistory&&location.hash){var h=b.galleriffic.normalizeHash(location.hash);var j=d[h];if(!j){f=true}}if(f){this.gotoIndex(0,false,true)}if(this.enableKeyboardNavigation){b(document).keydown(function(l){var k=l.charCode?l.charCode:l.keyCode?l.keyCode:0;switch(k){/*case 32:e.next();l.preventDefault();break;*/case 33:e.previousPage();l.preventDefault();break;case 34:e.nextPage();l.preventDefault();break;case 35:e.gotoIndex(e.data.length-1);l.preventDefault();break;case 36:e.gotoIndex(0);l.preventDefault();break;case 37:e.previous();l.preventDefault();break;case 39:e.next();l.preventDefault();break}})}if(this.autoStart){this.play()}setTimeout(function(){e.preloadInit()},1000);return this}})(jQuery);(function(a){var b={mouseOutOpacity:0.67,mouseOverOpacity:1,fadeSpeed:"fast",exemptionSelector:".selected"};a.fn.opacityrollover=function(d){a.extend(this,b,d);var c=this;function e(h,g){var f=a(h);if(c.exemptionSelector){f=f.not(c.exemptionSelector)}f.fadeTo(c.fadeSpeed,g)}this.css("opacity",this.mouseOutOpacity).hover(function(){e(this,c.mouseOverOpacity)},function(){e(this,c.mouseOutOpacity)});return this}})(jQuery);(function(c){var a=c.scrollTo=function(f,e,d){c(window).scrollTo(f,e,d)};a.defaults={axis:"xy",duration:parseFloat(c.fn.jquery)>=1.3?0:1};a.window=function(d){return c(window)._scrollable()};c.fn._scrollable=function(){return this.map(function(){var e=this,d=!e.nodeName||c.inArray(e.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1;if(!d){return e}var f=(e.contentWindow||e).document||e.ownerDocument||e;return c.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement})};c.fn.scrollTo=function(f,e,d){if(typeof e=="object"){d=e;e=0}if(typeof d=="function"){d={onAfter:d}}if(f=="max"){f=9000000000}d=c.extend({},a.defaults,d);e=e||d.speed||d.duration;d.queue=d.queue&&d.axis.length>1;if(d.queue){e/=2}d.offset=b(d.offset);d.over=b(d.over);return this._scrollable().each(function(){var m=this,k=c(m),l=f,j,g={},n=k.is("html,body");switch(typeof l){case"number":case"string":if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(l)){l=b(l);break}l=c(l,this);case"object":if(l.is||l.style){j=(l=c(l)).offset()}}c.each(d.axis.split(""),function(r,s){var t=s=="x"?"Left":"Top",v=t.toLowerCase(),q="scroll"+t,p=m[q],o=a.max(m,s);if(j){g[q]=j[v]+(n?0:p-k.offset()[v]);if(d.margin){g[q]-=parseInt(l.css("margin"+t))||0;g[q]-=parseInt(l.css("border"+t+"Width"))||0}g[q]+=d.offset[v]||0;if(d.over[v]){g[q]+=l[s=="x"?"width":"height"]()*d.over[v]}}else{var u=l[v];g[q]=u.slice&&u.slice(-1)=="%"?parseFloat(u)/100*o:u}if(/^\d+$/.test(g[q])){g[q]=g[q]<=0?0:Math.min(g[q],o)}if(!r&&d.queue){if(p!=g[q]){h(d.onAfterFirst)}delete g[q]}});h(d.onAfter);function h(o){k.animate(g,e,d.easing,o&&function(){o.call(this,f,d)})}}).end()};a.max=function(k,j){var h=j=="x"?"Width":"Height",e="scroll"+h;if(!c(k).is("html,body")){return k[e]-c(k)[h.toLowerCase()]()}var g="client"+h,f=k.ownerDocument.documentElement,d=k.ownerDocument.body;return Math.max(f[e],d[e])-Math.min(f[g],d[g])};function b(d){return typeof d=="object"?d:{top:d,left:d}}})(jQuery);
(function(d){var b=location.href.replace(/#.*/,"");var c=d.localScroll=function(e){d("body").localScroll(e)};c.defaults={duration:1000,axis:"y",event:"click",stop:true,target:window,reset:true};c.hash=function(e){if(location.hash){e=d.extend({},c.defaults,e);e.hash=false;if(e.reset){var f=e.duration;delete e.duration;d(e.target).scrollTo(0,e);e.duration=f}a(0,location,e)}};d.fn.localScroll=function(f){f=d.extend({},c.defaults,f);return f.lazy?this.bind(f.event,function(h){var g=d([h.target,h.target.parentNode]).filter(e)[0];if(g){a(h,g,f)}}):this.find("a,area").filter(e).bind(f.event,function(g){a(g,this,f)}).end().end();function e(){return !!this.href&&!!this.hash&&this.href.replace(this.hash,"")==b&&(!f.filter||d(this).is(f.filter))}};function a(m,k,h){var n=k.hash.slice(1),j=document.getElementById(n)||document.getElementsByName(n)[0];if(!j){return}if(m){m.preventDefault()}var g=d(h.target);if(h.lock&&g.is(":animated")||h.onBefore&&h.onBefore(m,j,g)===false){return}if(h.stop){g._scrollable().stop(true)}if(h.hash){var f=j.id==n?"id":"name",l=d("<a> </a>").attr(f,n).css({position:"absolute",top:d(window).scrollTop(),left:d(window).scrollLeft()});j[f]="";d("body").prepend(l);location=k.hash;l.remove();j[f]=n}g.scrollTo(j,h).trigger("notify.serialScroll",[j])}})(jQuery);(function(a){a.InFieldLabels=function(c,e,b){var d=this;d.$label=a(c);d.label=c;d.$field=a(e);d.field=e;d.$label.data("InFieldLabels",d);d.showing=true;d.init=function(){d.options=a.extend({},a.InFieldLabels.defaultOptions,b);if(d.$field.val()!=""){d.$label.hide();d.showing=false}d.$field.focus(function(){d.fadeOnFocus()}).blur(function(){d.checkForEmpty(true)}).bind("keydown.infieldlabel",function(f){d.hideOnChange(f)}).change(function(f){d.checkForEmpty()}).bind("onPropertyChange",function(){d.checkForEmpty()})};d.fadeOnFocus=function(){if(d.showing){d.setOpacity(d.options.fadeOpacity)}};d.setOpacity=function(f){d.$label.stop().animate({opacity:f},d.options.fadeDuration);d.showing=(f>0)};d.checkForEmpty=function(f){if(d.$field.val()==""){d.prepForShow();d.setOpacity(f?1:d.options.fadeOpacity)}else{d.setOpacity(0)}};d.prepForShow=function(f){if(!d.showing){d.$label.css({opacity:0}).show();d.$field.bind("keydown.infieldlabel",function(g){d.hideOnChange(g)})}};d.hideOnChange=function(f){if((f.keyCode==16)||(f.keyCode==9)){return}if(d.showing){d.$label.hide();d.showing=false}d.$field.unbind("keydown.infieldlabel")};d.init()};a.InFieldLabels.defaultOptions={fadeOpacity:0.5,fadeDuration:300};a.fn.inFieldLabels=function(b){return this.each(function(){var d=a(this).attr("for");if(!d){return}var c=a("input#"+d+"[type='text'],input#"+d+"[type='password'],textarea#"+d);if(c.length==0){return}(new a.InFieldLabels(this,c[0],b))})}})(jQuery);(function(a){a.fn.simpleValidate=function(b){var c=a.extend({},a.fn.simpleValidate.defaults,b);return this.each(function(){var d=a(this),f=a.meta?a.extend({},c,d.data()):c,e=f.errorText.search(/{label}/);d.bind("submit",function(h){var g=false;d.find(f.errorElement+"."+f.errorClass).remove();d.find(":input."+f.inputErrorClass).removeClass(f.inputErrorClass);d.find(":input.required").each(function(){var m=a(this),l=a.trim(m.val()),k=m.siblings("label").text().replace(f.removeLabelChar,""),j="";if(l===""){j=(e>-1)?j=f.errorText.replace("{label}",k):j=f.errorText;g=true}else{if(m.hasClass("email")){if(!(/^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/.test(l))){j=(e>-1)?j=f.emailErrorText.replace("{label}",k):j=f.emailErrorText;g=true}}}if(j!==""){m.addClass(f.inputErrorClass).after("<"+f.errorElement+' class="'+f.errorClass+'">'+j+"</"+f.errorElement+">")}});if(g){h.preventDefault()}else{if(f.completeCallback!==""){f.completeCallback(d);if(f.ajaxRequest){h.preventDefault()}}}})})};a.fn.simpleValidate.defaults={errorClass:"error",errorText:"{label} is a required field.",emailErrorText:"Please enter a valid {label}",errorElement:"strong",removeLabelChar:"*",inputErrorClass:"",completeCallback:"",ajaxRequest:false}})(jQuery);(function(a){a.fn.tipTip=function(c){var g={activation:"hover",keepAlive:false,maxWidth:"200px",edgeOffset:3,defaultPosition:"bottom",delay:400,fadeIn:200,fadeOut:200,attribute:"title",content:false,enter:function(){},exit:function(){}};var e=a.extend(g,c);if(a("#tiptip_holder").length<=0){var b=a('<div id="tiptip_holder" style="max-width:'+e.maxWidth+';"></div>');var d=a('<div id="tiptip_content"></div>');var f=a('<div id="tiptip_arrow"></div>');a("body").append(b.html(d).prepend(f.html('<div id="tiptip_arrow_inner"></div>')))}else{var b=a("#tiptip_holder");var d=a("#tiptip_content");var f=a("#tiptip_arrow")}return this.each(function(){var j=a(this);if(e.content){var m=e.content}else{var m=j.attr(e.attribute)}if(m!=""){if(!e.content){j.removeAttr(e.attribute)}var h=false;if(e.activation=="hover"){j.hover(function(){l()},function(){if(!e.keepAlive){k()}});if(e.keepAlive){b.hover(function(){},function(){k()})}}else{if(e.activation=="focus"){j.focus(function(){l()}).blur(function(){k()})}else{if(e.activation=="click"){j.click(function(){l();return false}).hover(function(){},function(){if(!e.keepAlive){k()}});if(e.keepAlive){b.hover(function(){},function(){k()})}}}}function l(){e.enter.call(this);d.html(m);b.hide().removeAttr("class").css("margin","0");f.removeAttr("style");var z=parseInt(j.offset()["top"]);var q=parseInt(j.offset()["left"]);var w=parseInt(j.outerWidth());var B=parseInt(j.outerHeight());var y=b.outerWidth();var t=b.outerHeight();var x=Math.round((w-y)/2);var p=Math.round((B-t)/2);var o=Math.round(q+x);var n=Math.round(z+B+e.edgeOffset);var u="";var D="";var v=Math.round(y-12)/2;if(e.defaultPosition=="bottom"){u="_bottom"}else{if(e.defaultPosition=="top"){u="_top"}else{if(e.defaultPosition=="left"){u="_left"}else{if(e.defaultPosition=="right"){u="_right"}}}}var s=(x+q)<parseInt(a(window).scrollLeft());var r=(y+q)>parseInt(a(window).width());if((s&&x<0)||(u=="_right"&&!r)||(u=="_left"&&q<(y+e.edgeOffset+5))){u="_right";D=Math.round(t-13)/2;v=-12;o=Math.round(q+w+e.edgeOffset);n=Math.round(z+p)}else{if((r&&x<0)||(u=="_left"&&!s)){u="_left";D=Math.round(t-13)/2;v=Math.round(y);o=Math.round(q-(y+e.edgeOffset+5));n=Math.round(z+p)}}var A=(z+B+e.edgeOffset+t+8)>parseInt(a(window).height()+a(window).scrollTop());var C=((z+B)-(e.edgeOffset+t+8))<0;if(A||(u=="_bottom"&&A)||(u=="_top"&&!C)){if(u=="_top"||u=="_bottom"){u="_top"}else{u=u+"_top"}D=t;n=Math.round(z-(t+5+e.edgeOffset))}else{if(C|(u=="_top"&&C)||(u=="_bottom"&&!A)){if(u=="_top"||u=="_bottom"){u="_bottom"}else{u=u+"_bottom"}D=-12;n=Math.round(z+B+e.edgeOffset)}}if(u=="_right_top"||u=="_left_top"){n=n+5}else{if(u=="_right_bottom"||u=="_left_bottom"){n=n-5}}if(u=="_left_top"||u=="_left_bottom"){o=o+5}f.css({"margin-left":v+"px","margin-top":D+"px"});b.css({"margin-left":o+"px","margin-top":n+"px"}).attr("class","tip"+u);if(h){clearTimeout(h)}h=setTimeout(function(){b.stop(true,true).fadeIn(e.fadeIn)},e.delay)}function k(){e.exit.call(this);if(h){clearTimeout(h)}b.fadeOut(e.fadeOut)}}})}})(jQuery);(function(c){c.tools=c.tools||{version:"1.2.5"};c.tools.overlay={addEffect:function(e,f,g){b[e]=[f,g]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!c.browser.msie||c.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var d=[],b={};c.tools.overlay.addEffect("default",function(h,g){var f=this.getConf(),e=c(window);if(!f.fixed){h.top+=e.scrollTop();h.left+=e.scrollLeft()}h.position=f.fixed?"fixed":"absolute";this.getOverlay().css(h).fadeIn(f.speed,g)},function(e){this.getOverlay().fadeOut(this.getConf().closeSpeed,e)});function a(h,n){var p=this,f=h.add(p),o=c(window),l,k,j,e=c.tools.expose&&(n.mask||n.expose),m=Math.random().toString().slice(10);if(e){if(typeof e=="string"){e={color:e}}e.closeOnClick=e.closeOnEsc=false}var g=n.target||h.attr("rel");k=g?c(g):null||h;if(!k.length){throw"Could not find Overlay: "+g}if(h&&h.index(k)==-1){h.click(function(q){p.load(q);return q.preventDefault()})}c.extend(p,{load:function(v){if(p.isOpened()){return p}var s=b[n.effect];if(!s){throw'Overlay: cannot find effect : "'+n.effect+'"'}if(n.oneInstance){c.each(d,function(){this.close(v)})}v=v||c.Event();v.type="onBeforeLoad";f.trigger(v);if(v.isDefaultPrevented()){return p}j=true;if(e){c(k).expose(e)}var u=n.top,t=n.left,q=k.outerWidth({margin:true}),r=k.outerHeight({margin:true});if(typeof u=="string"){u=u=="center"?Math.max((o.height()-r)/2,0):parseInt(u,10)/100*o.height()}if(t=="center"){t=Math.max((o.width()-q)/2,0)}s[0].call(p,{top:u,left:t},function(){if(j){v.type="onLoad";f.trigger(v)}});if(e&&n.closeOnClick){c.mask.getMask().one("click",p.close)}if(n.closeOnClick){c(document).bind("click."+m,function(w){if(!c(w.target).parents(k).length){p.close(w)}})}if(n.closeOnEsc){c(document).bind("keydown."+m,function(w){if(w.keyCode==27){p.close(w)}})}return p},close:function(q){if(!p.isOpened()){return p}q=q||c.Event();q.type="onBeforeClose";f.trigger(q);if(q.isDefaultPrevented()){return}j=false;b[n.effect][1].call(p,function(){q.type="onClose";f.trigger(q)});c(document).unbind("click."+m).unbind("keydown."+m);if(e){c.mask.close()}return p},getOverlay:function(){return k},getTrigger:function(){return h},getClosers:function(){return l},isOpened:function(){return j},getConf:function(){return n}});c.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(r,q){if(c.isFunction(n[q])){c(p).bind(q,n[q])}p[q]=function(s){if(s){c(p).bind(q,s)}return p}});l=k.find(n.close||".close");if(!l.length&&!n.close){l=c('<a class="close"></a>');k.prepend(l)}l.click(function(q){p.close(q)});if(n.load){p.load()}}c.fn.overlay=function(e){var f=this.data("overlay");if(f){return f}if(c.isFunction(e)){e={onBeforeLoad:e}}e=c.extend(true,{},c.tools.overlay.conf,e);this.each(function(){f=new a(c(this),e);d.push(f);c(this).data("overlay",f)});return e.api?f:this}})(jQuery);(function(b){b.tools=b.tools||{version:"1.2.5"};var e;e=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,onClose:null}};function f(){if(b.browser.msie){var l=b(document).height(),k=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l-k<20?k:l]}return[b(document).width(),b(document).height()]}function h(k){if(k){return k.call(b.mask)}}var j,d,c,a,g;b.mask={load:function(k,m){if(c){return this}if(typeof k=="string"){k={color:k}}k=k||a;a=k=b.extend(b.extend({},e.conf),k);j=b("#"+k.maskId);if(!j.length){j=b("<div/>").attr("id",k.maskId);b("body").append(j)}var l=f();j.css({position:"absolute",top:0,left:0,width:l[0],height:l[1],display:"none",opacity:k.startOpacity,zIndex:k.zIndex});if(k.color){j.css("backgroundColor",k.color)}if(h(k.onBeforeLoad)===false){return this}if(k.closeOnEsc){b(document).bind("keydown.mask",function(n){if(n.keyCode==27){b.mask.close(n)}})}if(k.closeOnClick){j.bind("click.mask",function(n){b.mask.close(n)})}b(window).bind("resize.mask",function(){b.mask.fit()});if(m&&m.length){g=m.eq(0).css("zIndex");b.each(m,function(){var n=b(this);if(!/relative|absolute|fixed/i.test(n.css("position"))){n.css("position","relative")}});d=m.css({zIndex:Math.max(k.zIndex+1,g=="auto"?0:g)})}j.css({display:"block"}).fadeTo(k.loadSpeed,k.opacity,function(){b.mask.fit();h(k.onLoad);c="full"});c=true;return this},close:function(){if(c){if(h(a.onBeforeClose)===false){return this}j.fadeOut(a.closeSpeed,function(){h(a.onClose);if(d){d.css({zIndex:g})}c=false});b(document).unbind("keydown.mask");j.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(c){var k=f();j.css({width:k[0],height:k[1]})}},getMask:function(){return j},isLoaded:function(k){return k?c=="full":c},getConf:function(){return a},getExposed:function(){return d}};b.fn.mask=function(k){b.mask.load(k);return this};b.fn.expose=function(k){b.mask.load(k,this);return this}})(jQuery);var page1=[206,53,0];var page2=[255,166,26];var page3=[150,181,62];var onMouseOutOpacity=0.6;function changeTheColor(e,g,c){var f=parseInt(((g[0]-e[0])*c)+e[0],10);var d=parseInt(((g[1]-e[1])*c)+e[1],10);var a=parseInt(((g[2]-e[2])*c)+e[2],10);var b="rgb("+f+","+d+","+a+")";$("#background").css("background-color",b)}function screenUpdate(){var a=$(document).scrollTop();var c=$("#services").offset().top;var b=$("#about_me").offset().top;if(a<=c){changeTheColor(page1,page2,(a/c))}else{if(a<=b){changeTheColor(page2,page3,((a-c)/(b-c)))}else{changeTheColor(page3,page3,1)}}if(a<=c-200){if(!($("#portfolio_link").hasClass("active"))){$("#portfolio_link").addClass("active");$("#services_link").removeClass();$("#about_me_link").removeClass()}}else{if(a<=b-200){if(!($("#services_link").hasClass("active"))){$("#portfolio_link").removeClass();$("#services_link").addClass("active");$("#about_me_link").removeClass()}}else{if(!($("#about_me_link").hasClass("active"))){$("#about_me_link").addClass("active");$("#portfolio_link").removeClass();$("#services_link").removeClass()}}}if($("#background_left_side").width()==700){$("#sidebar").css("margin-left","700px")}else{$("#sidebar").css("margin-left","66%")}if($(window).height()<=450){$("#sidebar").css({"padding-top":"60px","background-position":"40px -50px"})}else{$("#sidebar").css({"padding-top":"98px","background-position":"40px top"})}}$(window).resize(screenUpdate);$(window).scroll(screenUpdate);$(document).ready(function(){$("label").inFieldLabels();$("#contact_form label").css({color:"#000",position:"absolute",top:"5px",left:"3px"});$("#thumbs ul.thumbs li").opacityrollover({mouseOutOpacity:onMouseOutOpacity,mouseOverOpacity:1,fadeSpeed:"fast",exemptionSelector:".selected"});$("#thumbs").galleriffic({delay:6000,numThumbs:8,preloadAhead:-1,enableTopPager:false,enableBottomPager:true,maxPagesToShow:7,imageContainerSel:"#slideshow",controlsContainerSel:"",captionContainerSel:"#caption",loadingContainerSel:"",renderSSControls:true,renderNavControls:true,playLinkText:"Play",pauseLinkText:"Pause",prevLinkText:"Previous",nextLinkText:"Next",nextPageLinkText:"Next &rsaquo;",prevPageLinkText:"&lsaquo; Prev",enableHistory:false,enableKeyboardNavigation:true,autoStart:true,syncTransitions:false,defaultTransitionDuration:750,onSlideChange:function(b,a){this.find("ul.thumbs").children().eq(b).fadeTo("fast",onMouseOutOpacity).end().eq(a).fadeTo("fast",1)},onTransitionOut:undefined,onTransitionIn:undefined,onPageTransitionOut:function(a){this.fadeTo("fast",0,a)},onPageTransitionIn:function(){this.fadeTo("fast",1)},onImageAdded:undefined,onImageRemoved:undefined});jQuery(function(a){a("body").localScroll({stop:true,hash:true,axis:"yx",duration:1000})});$("[title]").tipTip({defaultPosition:"top",maxWidth:"300px",delay:100});$("#contact_form").simpleValidate({errorElement:"div",inputErrorClass:"wrong_input",errorText:"{label} non inserito!",emailErrorText:"{label} non valido!",ajaxRequest:true,completeCallback:function(a){var b=a.serialize();$.ajax({type:"POST",url:"php/contact.php",data:b,success:function(){$("#contact_form_wrapper").html("<div id='message'></div>");$("#message").html('<h2 style="border: none; margin: 0;">Messaggio inviato!</h2>').append("<p>Vi contatterò al più presto.</p>").hide().fadeIn(1500,function(){})}})}});$(".contact_link").overlay({color:"#ccc",top:"center",target:"#contact_form_wrapper",closeOnClick:true,mask:{color:"#ebecff",loadSpeed:200,opacity:0.8}});screenUpdate()});
