/*
 * jQuery UI Effects 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||(function(d){d.effects={version:"1.7.1",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={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]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);;
/**
 * sfTestimonial
 *
 * @version: 1.1
 * @author SimpleFlame http://www.simpleflame.com/
 *
 * Settings
 *  nextClass   - optional class for the next link
 *  item        - selector matching single testimonial
 *  nextLabel   - text of the next link
 *  duration    - autorotate interval
 *  autorotate  - autorotate on/off switch
 *  activeClass - which testimonial should be displayed as the first active one
 */
(function($){var sfTestimonial=function(el,options){var defaults={nextClass:null,prevClass:null,item:'div.item',nextLabel:'Next',prevLabel:'Prev',duration:5000,autorotate:true,activeClass:'active'};this.options=$.extend(defaults,options);this.wrapper=$(el);this.items=this.wrapper.find(this.options.item);this.current=this.items.index('.'+this.options.activeClass);if(this.current<0){this.current=0;} this.items.hide().eq(this.current).show();this.buildNavigation();if(this.options.autorotate){this.autorotate();}};sfTestimonial.prototype.buildNavigation=function(){var buildNavItem=$.proxy(function(label,offset,className){var el=$('<a>',{'href':'#','text':label,click:$.proxy(function(e){e.preventDefault();this.cycle(offset);},this)});if(className){el.addClass(className);} return $('<li />').append(el);},this);var next=buildNavItem(this.options.nextLabel,1,this.options.nextClass),prev=buildNavItem(this.options.prevLabel,-1,this.options.prevClass);var ul=$('<ul class="nav" />').append(next,prev);this.wrapper.append(ul);};sfTestimonial.prototype.cycle=function(){var offset=arguments[0]||1;this.items.stop().eq(this.current).hide();this.current=this.current+offset;if(this.current===this.items.length){this.current=0;} else if(this.current===-1){this.current=this.items.length-1;} this.items.stop().eq(this.current).fadeIn();if(this.options.autorotate){this.autorotate();}};sfTestimonial.prototype.autorotate=function(){window.clearTimeout(this.timeout);this.timeout=window.setTimeout($.proxy(function(){this.cycle();},this),this.options.duration);};$.fn.sfTestimonial=function(){var options=arguments[0]||{};return this.each(function(){return new sfTestimonial(this,options);});};})(jQuery);

/**
 * SimpleFlame Content rotator
 * Version 1.0
 *
 * Available effects:
 *  - if UI effects have been added: 'blind', 'bounce', 'clip', 'drop', 'explode', 'fold', 'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide', 'transfer'
 *  - basic effects from $: fadeIn, fadeOut, show, hide, slideUp, slideDown
 * 
 * Settings:
 *  - item : selector for rotator item ( default : 'li' )
 *  - activeClass : active item indicator ( default : 'active' )
 *  - duration : duration cycle in miliseconds ( default : 5000 )
 *  - autorotate : bool ( default: true )
 *  - effectIn : effect triggered on showing new item  (default: fadeIn)
 *  - optionsIn : additional options used in show transitio (default: { })
 *  - speedIn' : effectIn speed	( default : normal )
 *  - effectOut' : effect triggered on hiding old item ( default : fadeOut )
 *  - optionsOut' : additional options used in hide transition ( default : {} )
 *  - speedOut' : effectOut speed ( default : normal )
 *  - random : bool - should items be randomized on page load ( default : false )
 */
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}('(6($){6 11(g){4 i=g.Z;8(i===0){S w}1m(--i){4 j=1e.1k(1e.H()*(i+1));4 1i=g[i];4 1g=g[j];g[i]=1g;g[j]=1i}}4 9=6(V,h){2.3={\'d\':\'L\',\'c\':\'O\',\'12\':1y,\'p\':m,\'q\':\'1t\',\'1d\':{},\'D\':\'W\',\'u\':\'1s\',\'15\':{},\'I\':\'W\',\'H\':w};$.1r(2.3,h);2.$b=$(V);2.Y()};9.l.Y=6(){2.$b.s(\'z-7\');2.$A=$(\'<1v 17="z-1w" />\');2.$b.1z(2.$A);2.$A.C(2.$b);2.$v=$(\'<1q 17="z-v" />\');2.$A.C(2.$v);2.$7=2.$b.1x(2.3.d);8(2.3.H===m){2.$7=2.$7.1A();11(2.$7);2.$b.C(2.$7)}2.$e=2.$7.B(2.$7.1p(\'.\'+2.3.c));8(2.$e<0){2.$e=0}4 5=2;2.$7.s(\'z-d\').16(6(B,d){4 t=$(\'<L><a 1n="#">\'+1o(B+1,10)+\'</a></L>\');5.$v.C(t);t.1f(\'a\').F(\'d\',d).1G(\'1S\',{5:5},5.t)});2.x(2.$e,m);8(2.3.p){2.p()}};9.l.t=6(J){J.1U();4 5=J.F.5;5.T();5.$U=m;4 n=5.$7.B($(2).F(\'d\'));5.x(n)};9.l.x=6(n){4 18=1B[1]||w;4 c=2.3.c;4 k=2.$7.Q(2.$e);4 f=2.$7.Q(n);4 N=6(){k.R(c)};4 E=6(){f.s(c).1j(\'1h\',10)};4 M=[\'1Q\',\'1V\',\'1X\',\'1Y\',\'1W\',\'1R\',\'1O\',\'1P\',\'1F\',\'1E\',\'1C\',\'1D\',\'1H\',\'1I\'];8(18===m){k.R(c).K();f.s(c).G()}o{8($.19(2.3.u,M)>-1){k.K(2.3.u,2.3.15,2.3.I,N)}o 8($.1a(k[2.3.u])){k[2.3.u](2.3.I,N)}o{1c"1b K 14"}f.1j(\'1h\',1L);8($.19(2.3.q,M)>-1){f.G(2.3.q,2.3.1d,2.3.D,E)}o 8($.1a(f[2.3.q])){f[2.3.q](2.3.D,E)}o{1c"1b G 14"}}2.$v.1f(\'a\').R(\'O\').Q(n).s(\'O\');2.$e=n};9.l.p=6(){2.$U=w;4 5=2;2.$b.1K(6(){5.T()});2.$b.1J(6(){5.P()});2.P()};9.l.P=6(){8(2.$U===m){S}4 5=2;2.$X=13.1N(6(){4 y=5.$e+1;8(y===5.$7.Z){y=0}5.x(y)},2.3.12)};9.l.T=6(){8(2.3.p){13.1T(2.$X)}};$.1l.9=6(h){h=h||{};S 2.16(6(){4 r=1u 9(2,h)})}})(1M);',62,123,'||this|settings|var|self|function|items|if|sfRotator||container|activeClass|item|current|newItem|myArray|options|||oldItem|prototype|true|position|else|autorotate|effectIn||addClass|trigger|effectOut|controls|false|activate|next|sf|wrapper|index|append|speedIn|onShow|data|show|random|speedOut|event|hide|li|effects|onHide|active|startAutorotate|eq|removeClass|return|stopAutorotate|rotationTerminated|el|normal|rotationInterval|build|length||fisherYates|duration|window|transition|optionsOut|each|class|instant|inArray|isFunction|Unsupported|throw|optionsIn|Math|find|tempj|zIndex|tempi|css|floor|fn|while|href|parseInt|filter|ul|extend|fadeOut|fadeIn|new|div|rotator|children|5000|before|detach|arguments|shake|size|scale|pulsate|bind|slide|transfer|mouseleave|mouseenter|100|jQuery|setInterval|highlight|puff|blind|fold|click|clearInterval|preventDefault|bounce|explode|clip|drop'.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(){if(input.val()===''){label.show();}},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);

/*!
 * Scripts
 *
 */
jQuery(function($) {
 
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				if($('link[href^="/Admin/ICE/bundles/"]').length == 0){
					 //only render cufon if inContextEditor is not running
					$('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);
						}
					});
				}
				
			}
		},
		tools : {
			labels : function(){
				$('#search-top label, .form-a label, .form-f label').compactize();
			},
			rotator :function(){
				$('#rotator-a').sfRotator();
			},
			testimonials :function(){
				$('#testimonials').sfTestimonial({
					nextLabel: 'Next',
					prevLabel: 'Previous',
					nextClass: 'next-bttn'
				});
			},
			fixes : function(){
				// selectors
				$('.comments-a .comment').eq(0).addClass('first-comment');
				
				// ie6
				if ($.browser.msie) {
					if ($.browser.version < 7) {
						// first-child
						$('#nav-foot ul li:first-child, .cols-a .row:first-child, .breadcrumb ul li:first-child, .box-links-home ul li:first-child').addClass('first-child');
					}
				}
			},
			blog : function(){
				// no comments/trackbacks + alternative
				var $comments = $('div.comments-a');
				$comments.each(function(){
					if($(this).find('div.comment').length == 0){
						var fixed = $(this).html().replace(/<\/h2>/i,'</h2><p class="empty">') + '</p>';
						$(this).html(fixed);
					} else {
						$(this).find('div.comment:odd').addClass('alt');
					}
				});
				
				// show/hide comments/trackbacks
				var $links = $('div.post-a p.info a.comments, div.post-a p.info a.trackbacks');
				$links.click(function(){
					$($(this).hrefId()).toggle();
					if($(this).is('.comments')) $($(this).hrefId()).next('div.add-comment-a:first').toggle();
					return false;
				});
				
				// single post (show trackbacks and comments)
				if($('div.post-a').length == 1){
					$('div.comments-a, div.add-comment-a').show();
				}
				
				// single page, hide pagination
				if($('.page-nav .pagination').length == 1){
					$('.page-nav').hide();
				}
			},
			
			fancyGallery : function(){
                        
                        
                         if(jQuery("td.photogalleryItem").length > 0){
                   
                              jQuery("td.photogalleryItem").each(function(){
                                   if(jQuery(this).find("a").length > 0 )     {                                        var link = jQuery(this).find("a").attr("href");
                                        var img = jQuery(this).find("img").attr("src");
                                        jQuery(this).html("<a href='"+link+"' class='fancybox' rel='Gallery'><img src='"+img+"'></a>");
                                   }
                                  
                              });
                          }
                        
						if(jQuery("a.fancybox").length > 0){
						
                         jQuery("a.fancybox").fancybox({
								'transitionIn'	: 'elastic',
								'transitionOut'	: 'elastic'
							});
						}
                        
                    } // fancyGallery
		}
	};

	Engine.utils.links();
	Engine.utils.mails();
	Engine.tools.labels();
	Engine.tools.fixes();
	Engine.tools.rotator();
	Engine.tools.testimonials();
	Engine.tools.blog();
	Engine.tools.fancyGallery();
	
});
