/*!
 * (v) Compact labels plugin
 * Takes one option: labelOpacity [default: true] set to false to disable label opacity change on empty input focus
 */
(function($){$.fn.compactize=function(options){var defaults={labelOpacity:true};options=$.extend(defaults,options);return this.each(function(){var label=$(this),input=$('#'+label.attr('for'));input.focus(function(){if(options.labelOpacity){if(input.val()===''){label.css('opacity','0.5');}}else{label.hide();}});if(options.labelOpacity){input.keydown(function(){label.hide();label.css('opacity',1);});} input.blur(function(){if(input.val()===''){label.show();} if(options.labelOpacity){label.css('opacity',1);}});window.setTimeout(function(){label.toggle(input.val()==='');},50);});};})(jQuery);


/*!
 * (v) hrefID jQuery extention
 * returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);

/*!
 * (v) hrefID jQuery extention
 * returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);

/*
 * jQuery UI Effects 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||function(f,j){function l(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return m.transparent;return m[f.trim(c).toLowerCase()]}function r(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return l(b)}function n(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function o(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in s||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function t(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=r(b.elem,a);b.end=l(b.end);b.colorInit=
true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var m={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,
183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,
165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},p=["add","remove","toggle"],s={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=o(n.call(this)),q,u=e.attr("className");f.each(p,function(v,
i){c[i]&&e[i+"Class"](c[i])});q=o(n.call(this));e.attr("className",u);e.animate(t(h,q),a,b,function(){f.each(p,function(v,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?
f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.4",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==
null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();
var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});
c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments);a={options:a[1],duration:a[2],callback:a[3]};var b=f.effects[c];return b&&!f.fx.off?b.call(this,a):this},_show:f.fn.show,show:function(c){if(!c||
typeof c=="number"||f.fx.speeds[c])return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(!c||typeof c=="number"||f.fx.speeds[c])return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(!c||typeof c=="number"||f.fx.speeds[c]||typeof c=="boolean"||f.isFunction(c))return this.__toggle.apply(this,
arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,
a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+
b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,
10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*
a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,
a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,
a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+
b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
 * jQuery UI Effects Blind 1.8.4
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Blind
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","left"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,g);b.effects.removeWrapper(a);
c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
;

/**
* jCarouselLite
*
* @author Ganeshji Marwaha
* @author Karl Swedberg (modifications/enhancements)
*
* http://gmarwaha.com/jquery/jcarousellite/
*
* Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Version: 1.3
*/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(4($){$.I={1H:\'1.3\'};$.13.I=4(n){g o=$.21({},$.13.I.1x,n);h O.X(4(){g J=l,G=o.s?"1p":"E",W=o.s?"C":"D";g 9=$(O),c=9.20(\'c\'),H=c.16(\'a\'),U=H.V,v=o.u;o.j=1v.1s(o.j,H.V-1);5(o.A){c.1Z(H.L(U-v-1+1).14(w)).1S(H.L(0,v).14(w));o.j+=v}g a=c.16(\'a\'),8=a.V,7=o.j;9.6("1D","u");a.6({1g:o.s?"1f":\'u\',\'26\':o.s?"1h":"E"});c.6({1K:"0",1J:"0",1e:"1i","1I-1L-1M":"1h","z-N":"1"});9.6({1g:"1f",1e:"1i","z-N":"2",E:"1E"});g m=o.s?C(a):D(a);g 1j=m*8;g 1m=m*v;a.6({D:a.D(),C:a.C()});c.6(W,1j+"P").6(G,-(7*m));9.6(W,1m+"P");$.X([\'r\',\'t\'],4(N,p){5(o[p]){o[\'$\'+p]=$.1C(o[p])?o[p].S(9[0]):$(o[p]);o[\'$\'+p].1b(4(){g 1l=N==0?7-o.k:7+o.k;h y(1l)})}});5(!o.A){5(o.r&&o.j==0){o.$r.1k(o.F)}5(o.t&&o.j+o.u>=8){o.$t.1k(o.F)}}5(o.12){$.X(o.12,4(i,1d){$(1d).1b(4(){h y(o.A?o.u+i:i)})})}5(o.17&&9.15){9.15(4(e,d){h d>0?y(7-o.k):y(7+o.k)})}5(o.1u){g Z,T=0,q=1w(U,o);g M=4(){Z=1R(4(){5(!q||q>T){y(7+o.k);T++;M()}},o.1c+o.11)};M();$(1V).1o(\'1n\',4(K){1X(Z);$(K.1a).19(\'18\',w)}).1o(\'1A\',4(K){M();$(K.1a).19(\'18\',l)});5(o.1t){9.1B(4(){9.1z(\'1n\')}).1N(4(){9.1z(\'1A\')})}}4 Y(){h a.L(7).L(0,v)}4 y(b){5(!J){5(o.R){o.R.S(O,Y())}5(o.A){5(b<=o.j-v-1){c.6(G,-((8-(v*2))*m)+"P");7=b==o.j-v-1?8-(v*2)-1:8-(v*2)-o.k}B 5(b>=8-v+1){c.6(G,-((v)*m)+"P");7=b==8-v+1?v+1:v+o.k}B{7=b}}B{o.$r.1r(o.F,o.r&&b<=0);o.$t.1r(o.F,o.t&&b>8-v);5(b<0){7=0}B 5(b>8-v){7=8-v}B{7=b}}J=w;c.23(G=="E"?{E:-(7*m)}:{1p:-(7*m)},o.11,o.1q,4(){5(o.Q){o.Q.S(O,Y())}J=l})}h l}})};$.13.I.1x={r:x,t:x,F:\'22-1G\',12:x,17:l,11:1U,1q:x,1u:l,q:l,1c:1O,1t:w,s:l,A:w,u:3,j:0,k:1,R:x,Q:x};4 6(f,1y){h 1W($.6(f[0],1y),10)||0}4 D(f){h f[0].25+6(f,\'1Y\')+6(f,\'1T\')}4 C(f){h f[0].1Q+6(f,\'1P\')+6(f,\'1F\')}4 1w(8,n){h n.q&&(n.A?n.q:1v.1s(8,n.q))}})(24);',62,131,'||||function|if|css|curr|itemLength|div|li|to|ul|||el|var|return||start|scroll|false|liSize|options||btn|autoStop|btnPrev|vertical|btnNext|visible||true|null|go||circular|else|height|width|left|btnDisabledClass|animCss|tLi|jCarouselLite|running|event|slice|advancer|index|this|px|afterEnd|beforeStart|call|advanceCounter|tl|length|sizeCss|each|vis|setAutoAdvance||speed|btnGo|fn|clone|mousewheel|children|mouseWheel|paused|data|target|click|timeout|val|position|hidden|overflow|none|relative|ulSize|addClass|step|divSize|pauseCarousel|bind|top|easing|toggleClass|min|pause|auto|Math|iterations|defaults|prop|trigger|resumeCarousel|mouseenter|isFunction|visibility|0px|marginBottom|disabled|version|list|padding|margin|style|type|mouseleave|4000|marginTop|offsetHeight|setTimeout|append|marginRight|200|document|parseInt|clearTimeout|marginLeft|prepend|find|extend|button|animate|jQuery|offsetWidth|float'.split('|'),0,{}));



/*!
 * (v) Compact labels plugin
 * Takes one option: labelOpacity [default: true] set to false to disable label opacity change on empty input focus
 */
(function($){$.fn.compactize=function(options){var defaults={labelOpacity:true};options=$.extend(defaults,options);return this.each(function(){var label=$(this),input=$('#'+label.attr('for'));input.focus(function(){if(options.labelOpacity){if(input.val()===''){label.css('opacity','0.5');}}else{label.hide();}});if(options.labelOpacity){input.keydown(function(){label.hide();label.css('opacity',1);});} input.blur(function(){if(input.val()===''){label.show();} if(options.labelOpacity){label.css('opacity',1);}});window.setTimeout(function(){label.toggle(input.val()==='');},50);});};})(jQuery);



/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();


/*
 * jNice
 * version: 1.0 (11.26.08)
 * by Sean Mooney (sean@whitespace-creative.com) 
 * Examples at: http://www.whitespace-creative.com/jquery/jnice/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * And apply the jNice class to the form you want to style
**/
(function($){$.fn.jNice=function(options){var self=this;var safari=$.browser.safari;$(document).mousedown(checkExternalClick);return this.each(function(){$('input:submit, input:reset, input:button',this).each(ButtonAdd);$('button').focus(function(){$(this).addClass('jNiceFocus')}).blur(function(){$(this).removeClass('jNiceFocus')});$('input:text:visible, input:password',this).each(TextAdd);if(safari){$('.jNiceInputWrapper').each(function(){$(this).addClass('jNiceSafari').find('input').css('width',$(this).width()+11);});}$('input:checkbox',this).each(CheckAdd);$('input:radio',this).each(RadioAdd);$('select',this).each(function(index){SelectAdd(this,index);});$(this).bind('reset',function(){var action=function(){Reset(this);};window.setTimeout(action,10);});$('.jNiceHidden').css({opacity:0});});};var Reset=function(form){var sel;$('.jNiceSelectWrapper select',form).each(function(){sel=(this.selectedIndex<0)?0:this.selectedIndex;$('ul',$(this).parent()).each(function(){$('a:eq('+sel+')',this).click();});});$('a.jNiceCheckbox, a.jNiceRadio',form).removeClass('jNiceChecked');$('input:checkbox, input:radio',form).each(function(){if(this.checked){$('a',$(this).parent()).addClass('jNiceChecked');}});};var RadioAdd=function(){var $input=$(this).addClass('jNiceHidden').wrap('<span class="jRadioWrapper jNiceWrapper"></span>');var $wrapper=$input.parent();var $a=$('<span class="jNiceRadio"></span>');$wrapper.prepend($a);$a.click(function(){var $input=$(this).addClass('jNiceChecked').siblings('input').attr('checked',true);$('input:radio[name="'+$input.attr('name')+'"]').not($input).each(function(){$(this).attr('checked',false).siblings('.jNiceRadio').removeClass('jNiceChecked');});return false;});$input.click(function(){if(this.checked){var $input=$(this).siblings('.jNiceRadio').addClass('jNiceChecked').end();$('input:radio[name="'+$input.attr('name')+'"]').not($input).each(function(){$(this).attr('checked',false).siblings('.jNiceRadio').removeClass('jNiceChecked');});}}).focus(function(){$a.addClass('jNiceFocus');}).blur(function(){$a.removeClass('jNiceFocus');});if(this.checked){$a.addClass('jNiceChecked');}};var CheckAdd=function(){var $input=$(this).addClass('jNiceHidden').wrap('<span class="jNiceWrapper"></span>');var $wrapper=$input.parent().append('<span class="jNiceCheckbox"></span>');var $a=$wrapper.find('.jNiceCheckbox').click(function(){var $a=$(this);var input=$a.siblings('input')[0];if(input.checked===true){input.checked=false;$a.removeClass('jNiceChecked');}else{input.checked=true;$a.addClass('jNiceChecked');}return false;});$input.click(function(){if(this.checked){$a.addClass('jNiceChecked');}else{$a.removeClass('jNiceChecked');}}).focus(function(){$a.addClass('jNiceFocus');}).blur(function(){$a.removeClass('jNiceFocus');});if(this.checked){$('.jNiceCheckbox',$wrapper).addClass('jNiceChecked');}};var TextAdd=function(){var $input=$(this).addClass('jNiceInput').wrap('<div class="jNiceInputWrapper"><div class="jNiceInputInner"></div></div>');var $wrapper=$input.parents('.jNiceInputWrapper');$input.focus(function(){$wrapper.addClass('jNiceInputWrapper_hover');}).blur(function(){$wrapper.removeClass('jNiceInputWrapper_hover');});};var ButtonAdd=function(){var value=$(this).attr('value');$(this).replaceWith('<button id="'+this.id+'" name="'+this.name+'" type="'+this.type+'" class="'+this.className+'" value="'+value+'"><span><span>'+value+'</span></span>');};var SelectHide=function(){$('.jNiceSelectWrapper ul:visible').hide();};var checkExternalClick=function(event){if($(event.target).parents('.jNiceSelectWrapper').length===0){SelectHide();}};var SelectAdd=function(element,index){var $select=$(element);index=index||$select.css('zIndex')*1;index=(index)?index:0;$select.wrap($('<div class="jNiceWrapper"></div>').css({zIndex:100-index}));var width=$select.width();$select.addClass('jNiceHidden').after('<div class="jNiceSelectWrapper"><div><span class="jNiceSelectText"></span><span class="jNiceSelectOpen"></span></div><ul></ul></div>');var $wrapper=$(element).siblings('.jNiceSelectWrapper').css({width:width+'px'});$('.jNiceSelectText, .jNiceSelectWrapper ul',$wrapper).width(width-$('.jNiceSelectOpen',$wrapper).width());if($.browser.msie&&jQuery.browser.version<7){$select.after($('<iframe src="javascript:\'\';" marginwidth="0" marginheight="0" align="bottom" scrolling="no" tabIndex="-1" frameborder="0"></iframe>').css({height:$select.height()+4+'px'}));}SelectUpdate(element);$('div',$wrapper).click(function(){var $ul=$(this).siblings('ul');if($ul.css('display')=='none'){SelectHide();}$ul.slideToggle();var offSet=($('a.selected',$ul).offset().top-$ul.offset().top);$ul.animate({scrollTop:offSet});return false;});$select.keydown(function(e){var selectedIndex=this.selectedIndex;switch(e.keyCode){case 40:if(selectedIndex<this.options.length-1){selectedIndex+=1;}break;case 38:if(selectedIndex>0){selectedIndex-=1;}break;default:return;break;}$('ul a',$wrapper).removeClass('selected').eq(selectedIndex).addClass('selected');$('span:eq(0)',$wrapper).html($('option:eq('+selectedIndex+')',$select).attr('selected','selected').text());return false;}).focus(function(){$wrapper.addClass('jNiceFocus');}).blur(function(){$wrapper.removeClass('jNiceFocus');});};var SelectUpdate=function(element){var $select=$(element);var $wrapper=$select.siblings('.jNiceSelectWrapper');var $ul=$wrapper.find('ul').find('li').remove().end().hide();$('option',$select).each(function(i){$ul.append('<li><a href="#" index="'+i+'">'+this.text+'</a></li>');});$ul.find('a').click(function(){$('a.selected',$wrapper).removeClass('selected');$(this).addClass('selected');if($select[0].selectedIndex!=$(this).attr('index')&&$select[0].onchange){$select[0].selectedIndex=$(this).attr('index');$select[0].onchange();}$select[0].selectedIndex=$(this).attr('index');$('span:eq(0)',$wrapper).html($(this).html());$ul.hide();return false;});$('a:eq('+$select[0].selectedIndex+')',$ul).click();};var SelectRemove=function(element){var zIndex=$(element).siblings('.jNiceSelectWrapper').css('zIndex');$(element).css({zIndex:zIndex}).removeClass('jNiceHidden');$(element).siblings('.jNiceSelectWrapper').remove();};$.jNice={SelectAdd:function(element,index){SelectAdd(element,index);},SelectRemove:function(element){SelectRemove(element);},SelectUpdate:function(element){SelectUpdate(element);}};$(function(){$('form.jNice').jNice();});})(jQuery);

/*
 * Scripts
 *
 */
jQuery(function($) {

	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			}
		},
		ui : {
			tooltips : function(){
				$('div.gallery span.thumb img').each(function(){
					var el = $(this).parent().parent();
					$(this).data('tooltip','<strong>'+el.find('.title').text()+'</strong><br />'+el.find('.description').text()).removeAttr('alt');
					$(this).bind('mouseenter',function(){
						var offset = $(this).offset();
						var left   = offset.left - 10;
						var top    = offset.top + 75;

						$('body').append('<p id="gallery-tooltip"><span>'+ $(this).data('tooltip') +'</span></p>');
						$('#gallery-tooltip').css({ 'opacity': 1, 'left': left, 'top': top }).stop().animate({ 'marginTop': 12, opacity: 1 },300);
					}).bind('mouseleave',function(){
						$('#gallery-tooltip').remove();
					});
				});
			},
			gallery : {
				init : function(){
					var root      = this;

					root.$main    = $('div.gallery');
					root.$slider  = root.$main.find('div.side div.slide');
					root.$photo   = root.$main.find('div.main div.wrapper');
					root.$media   = root.$main.find('ul').hasClass('media-library');
					root.count    = root.$slider.find('ul li').size();

					// THUMBS
					root.thumbpages = Math.ceil(root.count/8);
					root.thumbwidth = root.$slider.parent().width();
					root.thumbpage  = 1;

					/* split lis */
					var $ul	= root.$slider.find('ul:first');
					for(var i = 0; i < root.thumbpages; i++){
						$ul.parent().append('<ul></ul>');
						$ul.find('li').slice(0,8).appendTo($ul.parent().find('ul:last'));
					}
					$ul.remove();

					/* correct slider width */
					root.$slider.width(root.thumbwidth*root.thumbpages);

					/* paging */
					root.$main.find('div.side').append('<ul class="index"><li class="prev" style="display: none;"><a href="#less">less</a></li><li class="next"><a href="#more">more</a></li></ul>');
					root.$thumbs = root.$main.find('div.side ul.index');
					root.$thumbs.find('a').click(function(){
						if($(this).parent().is('.next')){
							root.thumbs(root.thumbpage+1);
						} else {
							root.thumbs(root.thumbpage-1);
						}
						return false;
					});

					/* picture click */
					root.$slider.find('li').click(function(){
						var index = root.$slider.find('li').index($(this));
						root.show(index+1);
					}).find('img').hover(function(){
						$(this).addClass('over');
					},function(){
						$(this).removeClass('over');
					});

					// PAGING
					root.pagingpages	= Math.ceil((root.count-2)/(20-2));
					root.pagingwidth	= 468;
					root.pagingpage		= 1;

					/* inject code */
					var code = '<div class="pagination" style="display: none"><div class="pages-wrapper"><ul class="steps"><li class="prev"><a href="#prev">&laquo;</a></li><li class="next"><a href="#next">&raquo;</a></li></ul><div class="pages"><ul>';
					for(i = 0; i < root.count; i++){
						code += '<li' + (i === 0 ? ' class="active"' : '') + '><a href="#photo-' + (i+1) + '">' + (i+1) + '</a></li>';
					}
					code += '</ul></div></div></div>';
					root.$photo.after(code);

					/* click events */
					root.$paging = root.$main.find('div.main div.pagination div.pages-wrapper');
					root.$pagingslide = root.$paging.find('div.pages ul');

					root.$paging.parent().fadeIn(900);

					root.$paging.find('ul.steps a').click(function(){
						if($(this).parent().is('.next')){
							root.show(root.current+1);
						} else {
							root.show(root.current-1);
						}
						return false;
					});

					root.$paging.find('div.pages ul a').click(function(){
						root.show($(this).html());
						return false;
					});

					// FINISH UP
					root.$main.find('div.main').css('background','none');
					root.show(1);
				},
				show : function(num){
					var root = this;
					num = parseInt(num,10);
					if(num === root.current || root.$photo.is(':animated') || root.$slider.is(':animated') || num < 1 || num > root.count) {
						return false;
					}

					// mark as active
					var $current = root.$slider.find('li:eq('+(num-1)+')');

					root.$slider.find('li img.active').removeClass('active');
					$current.find('img').addClass('active');

					// show selected
					root.$photo.fadeOut(300,function(){						
						root.player(this, $current.html());
						$(this).fadeIn(300);
					});

					// slide to proper thumbs page
					var page = Math.ceil(num/8);
					root.thumbs(page);

					// change paging
					root.paging(num);

					// store current
					root.current = num;
				},
				player : function(el, data) {
					//regular gallery
					if (this.$media === false) {
						return $(el).html(data);	
					}

					data = $(data);
					var url = data.filter('.media').find('a').attr('href'),
						height = data.filter('.height').text(),
						width = data.filter('.width').text();

					var matches = url.match(/\.([a-z]{3})$/i);

					if (typeof matches[1] === 'undefined') {
						throw "Cannot determine file type";	
					}

					var type = matches[1].toLowerCase();

					//determine which player to use, by default flvplayer
					var player = this.flvplayer;
					switch (type) {
						case 'wmv':
							//handle with JV WMV player			
							player = this.wmvplayer;
							break;
						case 'swf':
							//embed as Flash file movie
							player = this.swfplayer;
							break;
					}

					player({ "url" : url, "height" : height, "width" : width, target : el });
				},
				swfplayer : function(params) {
					$(params.target).html('<div id="player-movie"/>');
					swfobject.embedSWF(params.url, 'player-movie', params.width, params.height, "9.0.115.0",'vendor/flvplayer/expressInstall.swf',{},{ wmode : 'transparent' });

					$('#player-movie').css({
						'top' : Math.floor((400 - params.height)/2), 
						'left' : Math.floor((600 - params.width)/2) 
					});
				},
				wmvplayer : function(params){
					var str = '<iframe src="wmvplayer.php?f=' + escape(params.url) + '&w='+params.width+'&h='+params.height+'" id="player-movie" height="'+params.height+'" width="'+params.width+'" scrolling="no"></iframe>';
					$(params.target).html(str);

					$('#player-movie').css({
						'top' : Math.floor((400 - params.height)/2), 
						'left' : Math.floor((600 - params.width)/2) 
					});					
				},
				flvplayer : function(opts) {
					var flashvars = {
						height : opts.height,
						width : opts.width,
						overstretch : 'true',
						usefullscreen : 'false',
						showdigits : 'false',
						autostart : 'true',
						skin : 'vendor/swfplayer/simple.swf',
						file : opts.url
					};

					var params = {
						allowfullscreen : "false",
						allowscriptaccess : "always",
						wmode : "opaque",
						allownetworking : "all"				
					};

					$(opts.target).html('<div id="player-movie" />');					
					swfobject.embedSWF('vendor/flvplayer/player.swf', 'player-movie', opts.width, opts.height, "9.0.115.0",'vendor/flvplayer/expressInstall.swf', flashvars, params);

					$('#player-movie').css({
						'top' : Math.floor((400 - opts.height)/2), 
						'left' : Math.floor((600 - opts.width)/2) 
					});					
				},
				thumbs : function(page){
					var root = this;

					// check for same page
					if(page === root.thumbpage) {
						return false;
					}

					// change page
					root.$slider.animate({'marginLeft': -1*(page-1)*root.thumbwidth},300);

					// update next/prev links
					if(page > 1) {
						root.$thumbs.find('li.prev').show();
					}
					if(page < root.thumbpages) {
						root.$thumbs.find('li.next').show();
					}
					if(page === 1) {
						root.$thumbs.find('li.prev').hide();
					}
					if(page === root.thumbpages) {
						root.$thumbs.find('li.next').hide();
					}

					// update page
					root.thumbpage = page;					
				},
				paging : function(num){
					var root = this;
					root.$paging.find('div.pages ul li:eq(' + (num-1) + ')').addClass('active').siblings('.active').removeClass('active');

					// animate
					var page = parseInt(Math.floor((num-2)/(20-2)),10)+1;
					if (page === 0) {
						page++;
					}
					if(page != root.pagingpage && page <= root.pagingpages){
						root.$pagingslide.animate({'marginLeft': -1*((page-1)*root.pagingwidth)},300);
						root.pagingpage = page;
					}

					// update next/prev links
					if(num > 1) {
						root.$paging.find('li.prev').show();
					}
					if(num < root.count) {
						root.$paging.find('li.next').show();
					}
					if(num === 1) {
						root.$paging.find('li.prev').hide();
					}
					if(num === root.count) {
						root.$paging.find('li.next').hide();
					}
				}
			}
		},

		tweaks : {

			cartBox : function(){

				if ($('#catCartSummary .cartSummaryItem').html() != 'Shopping cart is empty.') {
						var summary = $('#catCartSummary .cartSummaryItem').text().split(" ");
						//url = $('.cartSummaryLink').attr('href');
						$(".cartContents").html(summary[0]);

						jQuery("div#cart-a p span.cartHide, p#checkout-a").show();
				}

				if(jQuery("body.ecom").length > 0){
					jQuery("div#cart-a p span.cartHide, p#checkout-a").show();		
				}


			}, // end cartbox

			productDetail : function(){

			//if(document.location.href.indexOf("_product_") != -1){ // prod large view is different than list
			
			if(typeof(productDetailRewrite) !== 'undefined') {
			
				$(".main-a").attr("class","main-b");
				$(".aside-a").attr("class","aside aside-b");
				}


			if(document.location.href.indexOf("_catalog_") != -1){ // ditch related slider on cats
					$("#relatedProds").hide();
				}

				if(document.location.href.indexOf("prints") != -1){ // ditch related slider on cats
					$("#relatedProds").hide();
					//$("#breadcrumbs").hide();
				}

			if($("#realtedProdsHide").html() === ""){
					$("#relatedProds").hide();
				}

			// add dynamic slider name from prod {custom2}
			$(".prodCategoryName").html($("#prodCategory").html());

			// make slide h2 dynamic link from prod {custom3}
			$(".bar-a h2").find("a").attr("href",$("#catalogLink").html());

			// spit out featured prods 
			$(".slider-related .productfeaturelist").html($(".productfeaturelist").html());

			//freaking BC creates blank <li> for some reason:
			//$(".slider-related .productfeaturelist li:even").hide();




			}, // end productDetail

			homeBG : function(){

				$(".home #wrapper").attr("style","background:url("+$("#homeBackgroundImage").find("img").attr("src")+") no-repeat");
			}, // end homeBG

			loginPeepShow : function(){

			$("#btnLostPass").click(function(){
				$("#lostPass").slideToggle();
				return false;
			});


			$("#btnRegister").click(function(){
				$("#registerForm").slideToggle();
				return false;
			});


			},

			checkout : function(){
				// -----------------------------------------------------
				// This will copy over the shipping address value to the 
				// billing address.  Make sure the checkbox Id is "SameAsShipping"
				//
				// * Update - changed to check length and clear fields on unchecked
				// -----------------------------------------------------	
				$("#SameAsShipping").bind("change", function(e){

					var n = $("#SameAsShipping:checked").length;
						if(n === 0){

							$("#BillingAddress").val('');
							$("#BillingCity").val('');
							$("#BillingState").val('');
							$("#BillingZip").val('');
							$("#BillingPhone").val('');
						}else{


							$("#BillingAddress").val($("#ShippingAddress").val());
							$("#BillingCity").val($("#ShippingCity").val());
							$("#BillingState").val($("#ShippingState").val());
							$("#BillingZip").val($("#ShippingZip").val());
							$("#BillingPhone").val($("#ShippingPhone").val());
						}

				});

				if ($('input#Amount').val() === '0.00') {
					$('#PaymentMethodType_9').attr('checked','checked');
					$('#credit-card-information').css('display','none');    
				}
		},// end checkout

		checkoutTotal : function(){

			$("#order-summary-value").html("$"+$("#Amount").val());


			},

		catLink : function(){

				$(".item").each(function(){

					var link = $(this).find("h2 a").attr("href");

					$(this).find(".more a").attr("href",link);

				});

			},

			tweets : function(){
			  if ($('#tweets').size() === 0) { return;}

				$('#tweets').twit('trevorclark', {
				  limit: 5,
				  label: 'Twitter',
				  title: 'My tweets'
				});
			},

			noRightClick : function(){
				$(document).bind("contextmenu",function(e){
					return false;
				});	
			},

			gallery : function() {
				if(!$('#gallery').length) {
					return;
				}

				var $gallery = $('#gallery'),
					$dataList = $('#gallery .data'),
					$photoContainer = $('<div id="main-photo" />').prependTo($gallery),
					$items = $dataList.clone(),

					$prevPhotoButton = $('<button />', {
						'class' : 'prev',
						text : 'Previous photo',
						click : function(){
							rotatePrev();
							resetInterval();
							return false;
						}
					}).appendTo($photoContainer),

					$nextPhotoButton = $('<button />', {
						'class' : 'next',
						text : 'Next photo',
						click : function(){
							rotateNext();
							resetInterval();
							return false;
						}
					}).appendTo($photoContainer),

					/* Create gallery navigation */
					$galleryNav = $('<div class="gallery-nav" />');

					/* Slideshow view navigation */
					$galleryNav
						.html(
							'<p class="slideshow-nav">' + 
							'<span class="category"></span> | ' +
							'<button class="prev">Previous Photo</button> ' +
							'<span class="current">1</span> of <span class="max"></span> ' +
							'<button class="next">Next Photo</button>' +
							'| <a href="#" class="info">Info</a></p>'
						)
						.appendTo($gallery)
						.find('.prev').click(function(){
							$prevPhotoButton.click();

							return false;
						}).end()
						.find('.next').click(function(){
							$nextPhotoButton.click();

							return false;
						 }).end()
						.find('a.info').click(function(){
							if($gallery.is('.slideshow')) {
								$('.active .description', $photoContainer).toggle();
							}

							return false;
						});

				var slideshowNavCurrent = $('.slideshow-nav .current', $galleryNav),
					slideshowCategory = $('.category', $galleryNav).text($('li:first', $items).find('.category').text()),

					$toggleView = $(
						'<p class="toggle-gallery-view">' + 
							'<button class="slideshow"><span>Slideshow</span></button>' + 
							'<button class="thumbnails"><span>Thumbnails</span></button>' + 
						'</p>'
					).insertAfter('.gallery-nav'),

					$thumbnailsNav = $('<div class="thumbnails-nav"><ul></ul></div>'),

					carouselButtonNext = '',
					carouselButtonPrev = '',
					slideshowButtonPrev = '',
					slideshowButtonNext = '',

					runGallery = '';

				slideshowButtonPrev = $('.slideshow-nav .prev');
				slideshowButtonNext = $('.slideshow-nav .next');

				/* Show next photo */
				function rotateNext() {
					var $active = $items.find('.active'),
						$next = '';

					if(!$active.is(':last-child')) {
						$next = $active.next();
						$next.addClass('nextItem');

						$active
							.hide('blind', { direction: 'horizontal' }, 300, function() {
								$next.removeClass('nextItem').addClass('active');
								$(this)
									.removeClass('active')
										.find('.description').hide().end()
									.show();

								togglePrevNextButtons();
								updateStatus($('.active', $items).attr('id').replace(/item-/, ''));
							}, 'easeOutExpo');
					}
				}

				/* Show previous photo */
				function rotatePrev() {
					var $active = $items.find('.active'),
						$prev = '';

					if(!$active.is(':first-child')) {
						$prev = $active.prev();
						$active.addClass('nextItem').find('.description').hide();

						$prev
							.addClass('active')
							.hide()
							.show('blind', { direction: 'horizontal' }, 300, function() {
								$active.removeClass('active nextItem');

								togglePrevNextButtons();
								updateStatus(this.id.replace(/item-/, ''));
							}, 'easeOutExpo');
					}
				}

				/* Update gallery navigation */
				function updateStatus(index) {
					slideshowNavCurrent.text(index);

					$('.active', $thumbnailsNav).removeClass('active');
					$thumbnailsNav.find('a[href$=#item-' + index + ']').parent().addClass('active');
					slideshowCategory.text($('.active', $items).find('.category').text());
					checkCarouselPosition();
				}

				/* Show/hide prev/next photo buttons */
				function togglePrevNextButtons() {
					if($('.active', $items).is(':last-child')) {
						$nextPhotoButton.hide();
						slideshowButtonNext.hide();
					} else {
						$nextPhotoButton.show();
						slideshowButtonNext.show();
					}

					if($('.active', $items).is(':first-child')) {
						$prevPhotoButton.hide();
						slideshowButtonPrev.hide();
					} else {
						$prevPhotoButton.show();
						slideshowButtonPrev.show();
					}
				}

				$('li', $items).each(function(idx){
					this.id = 'item-' + (idx+1);
				});

				/* Switch between slideshow and thumbnails gallery view */
				$('button', $toggleView).click(function(){
					if(!$('span', this).is('.active')) {
						$gallery.removeClass().addClass(this.className);
						$('span', $toggleView).toggleClass('active');
						resetInterval();
					}
					return false;
				});

				/* Slideshow */

				$('.slideshow span', $toggleView).addClass('active');

				if(!$.browser.msie) {
					$prevPhotoButton.add($nextPhotoButton).hover(
						function(){ $(this).stop().animate({ opacity: 0 }, 300); },
						function(){	$(this).stop().animate({ opacity: 0.0 }, 300); }
					);
				}

				$items
					.find('.thumb').remove().end()
					.find('li:first').addClass('active').end()
					.removeClass('data').prependTo($photoContainer);

				/* Thumbnails */

				$('li', $items).each(function(index){
					$('<li><a href="#item-' + (index+1) + '">' + (index+1) + '</a></li>').appendTo($('ul', $thumbnailsNav));
				});

				$photoContainer.hover(
					function(){
						if($gallery.is('.thumbnails')) {
							$('.description', this).show();
						}
					},
					function(){
						if($gallery.is('.thumbnails')) {
							$('.description', this).hide();
						}
					}
				);

				$('li a', $dataList).each(function(index){
					$('li:eq(' + index + ') .thumb', $dataList).appendTo(this);
				});

				$thumbnailsNav
					.appendTo('<div class="carousel-wrap"></div>')
					.parent()
						.prepend('<button class="carousel-prev button-disabled">&larr;</button>')
						.append('<button class="carousel-next">&rarr;</button>')
						.find('li:first')
							.addClass('active')
						.end()
						.append($('li .thumb', $dataList))
						.find('.thumb')
							.wrapAll('<div class="thumbs"></div>')
							.end()
					.appendTo($galleryNav);

				$('.thumb', $galleryNav).each(function(){
					$(this).css('marginLeft', -parseInt($(this).width()/2, 10));
				});

				var carouselOffset = $('.carousel-wrap').offset().left,
					$thumbs = $('.thumbs', $gallery),
					itemOffset = parseInt($('li:first a', $thumbnailsNav).width()/2, 10),
					currentThumb = '';

				$(window).bind('resize', function(){
					carouselOffset = $('.carousel-wrap').offset().left;
				});

				/* Popup thumbnail */

				$('li a', $thumbnailsNav)
					.hover(
						function(){
							currentThumb = $thumbs.find('.thumb:eq(' + $(this).parent().index() + ')').show();
							currentThumb.css('left', $(this).offset().left + itemOffset - carouselOffset);
						},
						function(){
							currentThumb.hide();
						}
					)
					.click(function(){
						if($(this).parent().is('.active')) {
							return false;
						}

						resetInterval();

						var oldActive = $('.active', $items),
							newActive = $($(this).hrefId(), $items).addClass('nextItem');

						$('.active', $items)
							.hide('blind', { direction: 'horizontal' }, 300, function() {
								$(this)
									.removeClass('active')
									.show();

								newActive.removeClass('nextItem').addClass('active');

								$('.description', oldActive).hide();

								updateStatus(newActive.attr('id').replace(/item-/, ''));
							}, 'easeOutExpo');

						return false;
					});

				$thumbnailsNav.jCarouselLite({
					afterEnd: function() {				
						checkCarouselPosition();
					},
					btnNext: '.carousel-next',
					btnPrev: '.carousel-prev',
					circular: false,
					scroll: 10,
					speed: 350,
					visible: 10
				});

				carouselButtonNext = $('button.carousel-next');
				carouselButtonPrev = $('button.carousel-prev');

				var carouselLeft = $('.thumbnails-nav', $galleryNav).offset().left - carouselOffset,
					carouselRight = $('.thumbnails-nav', $galleryNav).width();

				function checkCarouselPosition() {
					var active = $('.thumbnails-nav li.active');
					if (active.length === 0) {
						return;
					} 

					if(parseInt(active.offset().left - carouselOffset, 10) >= carouselRight) {
						if(!$('button.carousel-next').is('.button-disabled')) {
							carouselButtonNext.click();	
						}

					} else if(parseInt(active.offset().left - carouselOffset, 10) < carouselLeft) {
						carouselButtonPrev.click();
					}
				}

				/* Run Gallery */
				$gallery.addClass('slideshow');
				$('.slideshow-nav .max', $galleryNav).text($('> li', $items).length);

				togglePrevNextButtons();

				function resetInterval() {
					clearInterval(runGallery);

					if($gallery.is('.slideshow')) {
						runGallery = setInterval(rotateNext, 7000);
					}
				}

				$('#main-photo ul li').each(function(){
					var img = $(this).find('img');
					$(this).find('span.full').css('backgroundImage','url('+img.attr('src')+')');
					img.remove();
				});

				resetInterval();

				// ADDON BC fix for link
				jQuery("div#gallery li").each(function(){
					// <span class="galleryLinkHolder">{tag_gallery link}</span>
					var link = jQuery(this).find(".galleryLinkHolder").html();
					jQuery(this).find("a.galleryLink").attr("href",link);				
				});

				/* list view
				<li>	
					<span class="description">
					Caption: <em>{tag_caption}</em><br />
					Category: <em class="category">{tag_category}</em><br />
					<a href="{tag_gallery link}">{tag_gallery link text}</a>
					<span class="galleryLinkHolder">{tag_gallery link}</span>
					</span>
					<span class="thumb"><img alt="" src="{tag_image_value}?action=thumbnail&amp;width=85&amp;height=61" /></span>
					<span class="full"><img alt="" width="850" height="607" src="{tag_image_value}" /></span>
				</li>

				*/




			}, // gallery

			nav : function() {
                                if($.browser.msie && parseInt($.browser.version, 10) === 6){
                                        $('#nav li').mouseenter(function() {
                                                $(this).find('> ul').show();
                                        }).mouseleave(function() {
                                                $(this).find('> ul').hide();
                                        });
                                }
                                if($.browser.opera){
                                        $('#nav ul').css('margin-bottom', 0);
                                }                         

			},


			labels : function(){
				$('form.newsletter-signup label').compactize();
			},// labels
			
			essaysLanding : function(){
				if(jQuery(".essay-landing").size === 0) {  return; }
				
				jQuery("div.essay-landing .categories-b .item:first,div.essay-landing .categories-b .item:nth-child(3)").css("margin-left","0px");
				
			}, // essaysLanding
			
			vimeoLauncher : function(){
				jQuery(".vimeo").click(function(){
												
												
				
					jQuery.fancybox({
							'padding':0,
							'autoScale':false,
							'transitionIn':'none',
							'transitionOut':'none',
							'title':this.title,
							'width':600,
							'height':398,
							'href':this.href.replace(new RegExp("([0-9])","i"),'http://vimeo.com/moogaloop.swf?clip_id=$i'),'type':'swf'
							});
					return false;
					
					
				});	
				
				
			} // vimeoLauncher




		}// end tweaks
	};

	Engine.utils.links();
	Engine.utils.mails();
	Engine.ui.gallery.init();
	Engine.ui.tooltips();

	Engine.tweaks.cartBox();
	Engine.tweaks.productDetail();
	//Engine.tweaks.homeBG();
	Engine.tweaks.loginPeepShow();
	Engine.tweaks.checkout();
	Engine.tweaks.checkoutTotal();
	Engine.tweaks.catLink();
	Engine.tweaks.tweets();
	Engine.tweaks.noRightClick();
	
	Engine.tweaks.essaysLanding();
	//Engine.tweaks.vimeoLauncher();

	Engine.tweaks.nav();
	Engine.tweaks.labels();
	Engine.tweaks.gallery();

	var img = $(".media img").attr("src");
	// $("ul.media").html("<img src='"+img+"' />");

	if($("#catBcrumb").length >0){
		$("#breadcrumbs").html($("#catBcrumb").html());
	}



});
