(function(b)
{
	function k(f)
	{
		return typeof f=="object"?f:{top:f,left:f}
	}

	var l=b.scrollTo=function(f,w,e)
	{
		b(window).scrollTo(f,w,e)
	};
	l.defaults=
	{
		axis:"xy",
		duration:parseFloat(b.fn.jquery)>=1.3?0:1
	};
	l.window=function()
	{
		return b(window)._scrollable()
	};
	b.fn._scrollable=function()
	{
		return this.map(function()
		{
			if(!(!this.nodeName||b.inArray(this.nodeName.toLowerCase(),["iframe","#document","html","body"])!=-1))return this;
			var f=(this.contentWindow||this).document||this.ownerDocument||this;return b.browser.safari||f.compatMode=="BackCompat"?f.body:f.documentElement
		})
	};
	b.fn.scrollTo=function(f,w,e)
	{
		if(typeof w=="object")
		{
			e=w;w=0
		}
		if(typeof e=="function") e=
		{
			onAfter:e
		};
		if(f=="max") f=9E9;
		e=b.extend({},l.defaults,e);
		w=w||e.speed||e.duration;
		e.queue=e.queue&&e.axis.length>1;
		if(e.queue) w/=2;
		e.offset=k(e.offset);
		e.over=k(e.over);
		return this._scrollable().each(function()
		{
			function A(B)
			{
				g.animate(u,w,e.easing,B&&function()
				{
					B.call(this,f,e)
				})
			}
			var m=this,g=b(m),n=f,C,u={},H=g.is("html,body");
			switch(typeof n)
			{
				case "number":
				case "string":
					if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(n))
					{
						n=k(n);
						break
					}
					n=b(n,this);
				case "object":
					if(n.is||n.style) C=(n=b(n)).offset()
			}
			b.each(e.axis.split(""),function(B,D)
			{
				var s=D=="x"?"Left":"Top",h=s.toLowerCase(),o="scroll"+s,x=m[o],I=l.max(m,D);
				if(C)
				{
					u[o]=C[h]+(H?0:x-g.offset()[h]);
					if(e.margin)
					{
						u[o]-=parseInt(n.css("margin"+s))||0;
						u[o]-=parseInt(n.css("border"+s+"Width"))||0}u[o]+=e.offset[h]||0;
						if(e.over[h]) u[o]+=n[D=="x"?"width":"height"]()*e.over[h]	}else{	s=n[h];
						u[o]=s.slice&&s.slice(-1)=="%"?parseFloat(s)/100*I:s}if(/^\d+$/.test(u[o]))u[o]=u[o]<=0?0:Math.min(u[o],I);
						if(!B&&e.queue)
						{
							x!=u[o]&&A(e.onAfterFirst);
							delete u[o]
						}
					});
					A(e.onAfter)}).end()
				};
				l.max=function(f,w){
					var e=w=="x"?"Width":"Height",A="scroll"+e;
					if(!b(f).is("html,body")) return f[A]-b(f)[e.toLowerCase()]();
					e="client"+e;
					var m=f.ownerDocument.documentElement,g=f.ownerDocument.body;
					return Math.max(m[A],g[A])-Math.min(m[e],g[e])
				}
				
				})(jQuery);
					
(function(b){function k(c,d){d=d==="x"?y.width():y.height();return typeof c==="string"?Math.round(c.match(/%/)?d/100*parseInt(c,10):parseInt(c,10)):c}function l(c){c=b.isFunction(c)?c.call(r):c;return a.photo||c.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)}function f(){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(r);a.rel=a.rel||r.rel;a.href=a.href||r.href;a.title=a.title||r.title}function w(c){r=c;a=b(r).data(e);f();if(a.rel&&a.rel!=="nofollow"){p=
b(".cboxElement").filter(function(){return(b(this).data(e).rel||this.rel)===a.rel});t=p.index(r);if(t<0){p=p.add(r);t=p.length-1}}else{p=b(r);t=0}if(!M){N=M=m;V=r;V.blur();b(document).bind("keydown.cbox_close",function(d){if(d.keyCode===27){d.preventDefault();g.close()}}).bind("keydown.cbox_arrows",function(d){if(p.length>1)if(d.keyCode===37){d.preventDefault();O.click()}else if(d.keyCode===39){d.preventDefault();P.click()}});a.overlayClose&&s.css({cursor:"pointer"}).one("click",g.close);b.event.trigger(u);
a.onOpen&&a.onOpen.call(r);s.css({opacity:a.opacity}).show();a.w=k(a.initialWidth,"x");a.h=k(a.initialHeight,"y");g.position(0);C&&y.bind("resize.cboxie6 scroll.cboxie6",function(){s.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("scroll.cboxie6")}W.add(O).add(P).add(E).add(X).hide();Y.html(a.close).show();g.slideshow();g.load()}var e="colorbox",A="hover",m=true,g,n=!b.support.opacity,C=n&&!window.XMLHttpRequest,u="cbox_open",H="cbox_load",B="cbox_complete",
D="resize.cbox_resize",s,h,o,x,I,Z,aa,ba,p,y,v,R,S,T,X,W,E,P,O,Y,J,K,F,G,r,V,t,a,M,N,ca={transition:"elastic",speed:350,width:false,height:false,innerWidth:false,innerHeight:false,initialWidth:"400",initialHeight:"400",maxWidth:false,maxHeight:false,scalePhotos:m,scrolling:m,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:m,current:"{current} of {total}",previous:"previous",next:"next",close:"close",open:false,overlayClose:m,slideshow:false,
slideshowAuto:m,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false};g=b.fn.colorbox=function(c,d){var q=this;if(!q.length)if(q.selector===""){q=b("<a/>");c.open=m}else return this;q.each(function(){var j=b.extend({},b(this).data(e)?b(this).data(e):ca,c);b(this).data(e,j).addClass("cboxElement");if(d)b(this).data(e).onComplete=d});c&&c.open&&w(q);return this};g.init=function(){function c(d){return b('<div id="cbox'+
d+'"/>')}y=b(window);h=b('<div id="colorbox"/>');s=c("Overlay").hide();o=c("Wrapper");x=c("Content").append(v=c("LoadedContent").css({width:0,height:0}),S=c("LoadingOverlay"),T=c("LoadingGraphic"),X=c("Title"),W=c("Current"),E=c("Slideshow"),P=c("Next"),O=c("Previous"),Y=c("Close"));o.append(b("<div/>").append(c("TopLeft"),I=c("TopCenter"),c("TopRight")),b("<div/>").append(Z=c("MiddleLeft"),x,aa=c("MiddleRight")),b("<div/>").append(c("BottomLeft"),ba=c("BottomCenter"),c("BottomRight"))).children().children().css({"float":"left"});
R=b("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");b("body").prepend(s,h.append(o,R));if(n){h.addClass("cboxIE");C&&s.css("position","absolute")}x.children().bind("mouseover mouseout",function(){b(this).toggleClass(A)}).addClass(A);J=I.height()+ba.height()+x.outerHeight(m)-x.height();K=Z.width()+aa.width()+x.outerWidth(m)-x.width();F=v.outerHeight(m);G=v.outerWidth(m);h.css({"padding-bottom":J,"padding-right":K}).hide();P.click(g.next);O.click(g.prev);Y.click(g.close);
x.children().removeClass(A);b(".cboxElement").live("click",function(d){if(d.button!==0&&typeof d.button!=="undefined")return m;else{w(this);return false}})};g.position=function(c,d){function q(L){I[0].style.width=ba[0].style.width=x[0].style.width=L.style.width;T[0].style.height=S[0].style.height=x[0].style.height=Z[0].style.height=aa[0].style.height=L.style.height}var j=y.height();j=Math.max(j-a.h-F-J,0)/2+y.scrollTop();var z=Math.max(document.documentElement.clientWidth-a.w-G-K,0)/2+y.scrollLeft();
c=h.width()===a.w+G&&h.height()===a.h+F?0:c;o[0].style.width=o[0].style.height="9999px";h.dequeue().animate({width:a.w+G,height:a.h+F,top:j,left:z},{duration:c,complete:function(){q(this);N=false;o[0].style.width=a.w+G+K+"px";o[0].style.height=a.h+F+J+"px";d&&d()},step:function(){q(this)}})};g.resize=function(c){function d(){a.w=a.w||v.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function q(){a.h=a.h||v.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}function j(Q){g.position(Q,function(){if(M){if(n){L&&
v.fadeIn(100);h[0].style.removeAttribute("filter")}if(a.iframe)v.append("<iframe id='cboxIframe'"+(a.scrolling?" ":"scrolling='no'")+" name='iframe_"+(new Date).getTime()+"' frameborder=0 src='"+a.href+"' "+(n?"allowtransparency='true'":"")+" />");v.show();X.show().html(a.title);if(p.length>1){W.html(a.current.replace(/\{current\}/,t+1).replace(/\{total\}/,p.length)).show();P.html(a.next).show();O.html(a.previous).show();a.slideshow&&E.show()}S.hide();T.hide();b.event.trigger(B);a.onComplete&&a.onComplete.call(r);
a.transition==="fade"&&h.fadeTo(U,1,function(){n&&h[0].style.removeAttribute("filter")});y.bind(D,function(){g.position(0)})}})}if(M){var z,L,U=a.transition==="none"?0:a.speed;y.unbind(D);if(c){v.remove();v=b('<div id="cboxLoadedContent"/>').html(c);v.hide().appendTo(R).css({width:d(),overflow:a.scrolling?"auto":"hidden"}).css({height:q()}).prependTo(x);b("#cboxPhoto").css({cssFloat:"none"});C&&b("select:not(#colorbox select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("cbox_cleanup",
function(){this.style.visibility="inherit"});a.transition==="fade"&&h.fadeTo(U,0,function(){j(0)})||j(U);if(a.preloading&&p.length>1){c=t>0?p[t-1]:p[p.length-1];z=t<p.length-1?p[t+1]:p[0];z=b(z).data(e).href||z.href;c=b(c).data(e).href||c.href;l(z)&&b("<img />").attr("src",z);l(c)&&b("<img />").attr("src",c)}}else setTimeout(function(){var Q=v.wrapInner("<div style='overflow:auto'></div>").children();a.h=Q.height();v.css({height:a.h});Q.replaceWith(Q.children());g.position(U)},1)}};g.load=function(){var c,
d,q,j=g.resize;N=m;r=p[t];a=b(r).data(e);f();b.event.trigger(H);a.onLoad&&a.onLoad.call(r);a.h=a.height?k(a.height,"y")-F-J:a.innerHeight?k(a.innerHeight,"y"):false;a.w=a.width?k(a.width,"x")-G-K:a.innerWidth?k(a.innerWidth,"x"):false;a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=k(a.maxWidth,"x")-G-K;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=k(a.maxHeight,"y")-F-J;a.mh=a.h&&a.h<a.mh?a.h:a.mh}c=a.href;S.show();T.show();if(a.inline){b('<div id="cboxInlineTemp" />').hide().insertBefore(b(c)[0]).bind(H+
" cbox_cleanup",function(){b(this).replaceWith(v.children())});j(b(c))}else if(a.iframe)j(" ");else if(a.html)j(a.html);else if(l(c)){d=new Image;d.onload=function(){var z;d.onload=null;d.id="cboxPhoto";b(d).css({margin:"auto",border:"none",display:"block",cssFloat:"left"});if(a.scalePhotos){q=function(){d.height-=d.height*z;d.width-=d.width*z};if(a.mw&&d.width>a.mw){z=(d.width-a.mw)/d.width;q()}if(a.mh&&d.height>a.mh){z=(d.height-a.mh)/d.height;q()}}if(a.h)d.style.marginTop=Math.max(a.h-d.height,
0)/2+"px";j(d);p.length>1&&b(d).css({cursor:"pointer"}).click(g.next);if(n)d.style.msInterpolationMode="bicubic"};d.src=c}else b("<div />").appendTo(R).load(c,function(z,L){L==="success"?j(this):j(b("<p>Request unsuccessful.</p>"))})};g.next=function(){if(!N){t=t<p.length-1?t+1:0;g.load()}};g.prev=function(){if(!N){t=t>0?t-1:p.length-1;g.load()}};g.slideshow=function(){function c(){E.text(a.slideshowStop).bind(B,function(){q=setTimeout(g.next,a.slideshowSpeed)}).bind(H,function(){clearTimeout(q)}).one("click",
function(){d();b(this).removeClass(A)});h.removeClass(j+"off").addClass(j+"on")}var d,q,j="cboxSlideshow_";E.bind("cbox_closed",function(){E.unbind();clearTimeout(q);h.removeClass(j+"off "+j+"on")});d=function(){clearTimeout(q);E.text(a.slideshowStart).unbind(B+" "+H).one("click",function(){c();q=setTimeout(g.next,a.slideshowSpeed);b(this).removeClass(A)});h.removeClass(j+"on").addClass(j+"off")};if(a.slideshow&&p.length>1)a.slideshowAuto?c():d()};g.close=function(){b.event.trigger("cbox_cleanup");
a.onCleanup&&a.onCleanup.call(r);M=false;b(document).unbind("keydown.cbox_close keydown.cbox_arrows");y.unbind(D+" resize.cboxie6 scroll.cboxie6");s.css({cursor:"auto"}).fadeOut("fast");h.stop(m,false).fadeOut("fast",function(){b("#colorbox iframe").attr("src","about:blank");v.remove();h.css({opacity:1});try{V.focus()}catch(c){}b.event.trigger("cbox_closed");a.onClosed&&a.onClosed.call(r)})};g.element=function(){return b(r)};g.settings=ca;b(g.init)})(jQuery);var tagRegex=/^[a-z0-9\&\-\_\.\s]+$/;
$(document).ready(function(){$("body").click(function(){closePopup()});$(".popup-trigger").click(function(){launchPopup($(this).attr("rel"));return false});$(".modal-trigger").click(function(){launchModalWindow($(this).attr("rel"));return false});$(".modal-close, #overlay").click(function(){closeModalWindow();return false});$("#ajax-spinner").ajaxStart(function(){$(this).fadeIn(300)}).ajaxStop(function(){$(this).fadeOut(300)});$("#customize-header").colorbox({width:"600px",inline:true,href:"#pop-theme-picker",
opacity:0.2});$("#changer a").mouseover(function(){switchStyleSheet(this.getAttribute("rel"));return false});$("#header-image-thumbs li a").click(function(){saveTheme(this);return false}).mouseover(function(){$("#header").css("background-image",$(this).find("img").attr("rel")=="reset"?"none":"url(" + url_website_image + "images/header_images/"+$(this).find("img").attr("rel")+")")});$.ajaxSetup({cache:true});$("#add-tag").focus(function(){tagEditFocusChange(this,true)}).blur(function(){tagEditFocusChange(this,false)}).keydown(function(b){return tagEditKeyPress(b)});
$("#tag-editor").click(function(){$("#add-tag").focus()});$("#tag-editor span.delete-tag").live("click",function(){deleteTag(this)});$("#tag-presets a").click(function(){commitTag($(this).text(),true);return false})});function formatString(b){for(i=1;i<arguments.length;i++)b=b.replace(new RegExp("\\{"+(i-1)+"\\}","g"),arguments[i]);return b}function launchPopup(b){$(".popup-trigger[rel='"+b+"']").toggleClass("active");$(".popup-menu[rel='"+b+"']").animate({opacity:"toggle"},100)}
function closePopup(){$(".popup-menu").fadeOut(100);$(".popup-trigger").removeClass("active")}function launchModalWindow(b){$("#"+b).fadeIn(200);$("#overlay").css("opacity",0.3).fadeIn(100)}function closeModalWindow(){$("div.modal-window, #overlay").fadeOut(200)}function tagEditFocusChange(b,k){if(k){$(b).val()=="Click here to add a tag."&&$(b).val("");$(b).addClass("active")}else $(b).val()==""&&$(b).removeClass("active").val("Click here to add a tag.")}
function tagEditKeyPress(b){if(b.which==27){$("#add-tag").val("").blur();return false}if(b.which==9||b.which==188||b.which==13){$("#add-tag").val()!=""&&commitTag($("#add-tag").val());return false}if(b.which==8&&$("#add-tag").val()==""){$("#tag-editor a.tag:last").remove();return false}return true}
function commitTag(b,k){var l=$("#tag-editor").height(),f=$.trim(b.toLowerCase());if(!$('#tag-editor .tag[rel="'+f+'"]').length&&tagRegex.test(f)){$("#add-tag").before('<a class="tag post-tag" rel="'+f+'">'+f+'<span class="delete-tag"></span></a>').val("");k&&$("#add-tag").blur();$("#tag-editor").height()!=l&&$.fn.colorbox.resize()}}function deleteTag(b){$(b).parent().remove()}function ajaxError(b){alert("Error received: "+b)}
function saveTheme(b)
{
	$.fn.colorbox.close();
	b=$(b).find("img").attr("rel")=="reset"?"empty":url_website_image + "images/header_images/"+$(b).find("img").attr("rel");
	eraseCookie("theme-image");
	createCookie("theme-image",b,365)
}
function switchStyleSheet(b)
{
	$("link[@rel*=style][title]").each(function(){
		this.disabled=true;
		if(this.getAttribute("title")==b) this.disabled=false
		});
	createCookie("style",b,365);
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}