/* $.preloadImages */
(function($) {
	var cache = [];
	// Arguments are image paths relative to the current page.
	$.preloadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
			var cacheImage = document.createElement('img');
			cacheImage.src = arguments[i];
			cache.push(cacheImage);
		}
	}
})(jQuery);

/**
 * 	$.easyListSplitter 1.0.2
 * 
 *  http://www.madeincima.eu/samples/jquery/easyListSplitter/scripts/jquery.easyListSplitter.js
 *  

	$('.your-list-class-name').easyListSplitter({ 
			colNumber: 3,
			direction: 'horizontal'
	});
	
 * 
 * gzip	Packer 3.1	shrink, privateVars
 * 
 */
var j=1;(function(a){a.fn.easyListSplitter=function(g){var h={colNumber:2,direction:'vertical'};this.each(function(){var m=a(this);var b=a.extend(h,g);var k=a(this).children('li').size();var f=Math.ceil(k/b.colNumber);var l=a(this).attr('class');for(i=1;i<=b.colNumber;i++){if(i==1){a(this).addClass('listCol1').wrap('<div class="listContainer'+j+'"></div>')}else if(a(this).is('ul')){a(this).parents('.listContainer'+j).append('<ul class="listCol'+i+'"></ul>')}else{a(this).parents('.listContainer'+j).append('<ol class="listCol'+i+'"></ol>')}a('.listContainer'+j+' > ul,.listContainer'+j+' > ol').addClass(l)}var e=0;var d=1;var c=0;if(b.direction=='vertical'){a(this).children('li').each(function(){e=e+1;if(e>f*(b.colNumber-1)){a(this).parents('.listContainer'+j).find('.listCol'+b.colNumber).append(this)}else{if(e<=(f*d)){a(this).parents('.listContainer'+j).find('.listCol'+d).append(this)}else{a(this).parents('.listContainer'+j).find('.listCol'+(d+1)).append(this);d=d+1}}});a('.listContainer'+j).find('ol,ul').each(function(){if(a(this).children().size()==0){a(this).remove()}})}else{a(this).children('li').each(function(){c=c+1;if(c<=b.colNumber){a(this).parents('.listContainer'+j).find('.listCol'+c).append(this)}else{c=1;a(this).parents('.listContainer'+j).find('.listCol'+c).append(this)}})}a('.listContainer'+j).find('ol:last,ul:last').addClass('last');j=j+1})}})(jQuery);

/**
 * jquery.tools 1.1.2 - The missing UI library for the Web
 * tools.tabs-1.0.4, tools.tabs.slideshow-1.0.2, tools.tabs.history-1.0.2, tools.tooltip-1.1.2, tools.tooltip.slide-1.0.0, tools.tooltip.dynamic-1.0.1, tools.scrollable-1.1.2, tools.scrollable.circular-0.5.1, tools.scrollable.autoscroll-1.0.1, tools.scrollable.navigator-1.0.2, tools.scrollable.mousewheel-1.0.1, tools.overlay-1.1.2, tools.overlay.gallery-1.0.0, tools.overlay.apple-1.0.1, tools.expose-1.0.5
 * jquery.event.wheel.js
 */
(function(d){d.tools=d.tools||{};d.tools.tabs={version:"1.0.4",conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",api:false,rotate:false},addEffect:function(e,f){c[e]=f}};var c={"default":function(f,e){this.getPanes().hide().eq(f).show();e.call()},fade:function(g,e){var f=this.getConf(),j=f.fadeOutSpeed,h=this.getPanes();if(j){h.fadeOut(j)}else{h.hide()}h.eq(g).fadeIn(f.fadeInSpeed,e)},slide:function(f,e){this.getPanes().slideUp(200);this.getPanes().eq(f).slideDown(400,e)},ajax:function(f,e){this.getPanes().eq(0).load(this.getTabs().eq(f).attr("href"),e)}};var b;d.tools.tabs.addEffect("horizontal",function(f,e){if(!b){b=this.getPanes().eq(0).width()}this.getCurrentPane().animate({width:0},function(){d(this).hide()});this.getPanes().eq(f).animate({width:b},function(){d(this).show();e.call()})});function a(g,h,f){var e=this,j=d(this),i;d.each(f,function(k,l){if(d.isFunction(l)){j.bind(k,l)}});d.extend(this,{click:function(k,n){var o=e.getCurrentPane();var l=g.eq(k);if(typeof k=="string"&&k.replace("#","")){l=g.filter("[href*="+k.replace("#","")+"]");k=Math.max(g.index(l),0)}if(f.rotate){var m=g.length-1;if(k<0){return e.click(m,n)}if(k>m){return e.click(0,n)}}if(!l.length){if(i>=0){return e}k=f.initialIndex;l=g.eq(k)}if(k===i){return e}n=n||d.Event();n.type="onBeforeClick";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}c[f.effect].call(e,k,function(){n.type="onClick";j.trigger(n,[k])});n.type="onStart";j.trigger(n,[k]);if(n.isDefaultPrevented()){return}i=k;g.removeClass(f.current);l.addClass(f.current);return e},getConf:function(){return f},getTabs:function(){return g},getPanes:function(){return h},getCurrentPane:function(){return h.eq(i)},getCurrentTab:function(){return g.eq(i)},getIndex:function(){return i},next:function(){return e.click(i+1)},prev:function(){return e.click(i-1)},bind:function(k,l){j.bind(k,l);return e},onBeforeClick:function(k){return this.bind("onBeforeClick",k)},onClick:function(k){return this.bind("onClick",k)},unbind:function(k){j.unbind(k);return e}});g.each(function(k){d(this).bind(f.event,function(l){e.click(k,l);return false})});if(location.hash){e.click(location.hash)}else{if(f.initialIndex===0||f.initialIndex>0){e.click(f.initialIndex)}}h.find("a[href^=#]").click(function(k){e.click(d(this).attr("href"),k)})}d.fn.tabs=function(i,f){var g=this.eq(typeof f=="number"?f:0).data("tabs");if(g){return g}if(d.isFunction(f)){f={onBeforeClick:f}}var h=d.extend({},d.tools.tabs.conf),e=this.length;f=d.extend(h,f);this.each(function(l){var j=d(this);var k=j.find(f.tabs);if(!k.length){k=j.children()}var m=i.jquery?i:j.children(i);if(!m.length){m=e==1?d(i):j.parent().find(i)}g=new a(k,m,f);j.data("tabs",g)});return f.api?g:this}})(jQuery);
(function(b){var a=b.tools.tabs;a.plugins=a.plugins||{};a.plugins.slideshow={version:"1.0.2",conf:{next:".forward",prev:".backward",disabledClass:"disabled",autoplay:false,autopause:true,interval:3000,clickable:true,api:false}};b.prototype.slideshow=function(e){var f=b.extend({},a.plugins.slideshow.conf),c=this.length,d;e=b.extend(f,e);this.each(function(){var p=b(this),m=p.tabs(),i=b(m),o=m;b.each(e,function(t,u){if(b.isFunction(u)){m.bind(t,u)}});function n(t){return c==1?b(t):p.parent().find(t)}var s=n(e.next).click(function(){m.next()});var q=n(e.prev).click(function(){m.prev()});var h,j,l,g=false;b.extend(m,{play:function(){if(h){return}var t=b.Event("onBeforePlay");i.trigger(t);if(t.isDefaultPrevented()){return m}g=false;h=setInterval(m.next,e.interval);i.trigger("onPlay");m.next()},pause:function(){if(!h){return m}var t=b.Event("onBeforePause");i.trigger(t);if(t.isDefaultPrevented()){return m}h=clearInterval(h);l=clearInterval(l);i.trigger("onPause")},stop:function(){m.pause();g=true},onBeforePlay:function(t){return m.bind("onBeforePlay",t)},onPlay:function(t){return m.bind("onPlay",t)},onBeforePause:function(t){return m.bind("onBeforePause",t)},onPause:function(t){return m.bind("onPause",t)}});if(e.autopause){var k=m.getTabs().add(s).add(q).add(m.getPanes());k.hover(function(){m.pause();j=clearInterval(j)},function(){if(!g){j=setTimeout(m.play,e.interval)}})}if(e.autoplay){l=setTimeout(m.play,e.interval)}else{m.stop()}if(e.clickable){m.getPanes().click(function(){m.next()})}if(!m.getConf().rotate){var r=e.disabledClass;if(!m.getIndex()){q.addClass(r)}m.onBeforeClick(function(u,t){if(!t){q.addClass(r)}else{q.removeClass(r);if(t==m.getTabs().length-1){s.addClass(r)}else{s.removeClass(r)}}})}});return e.api?d:this}})(jQuery);
(function(d){var a=d.tools.tabs;a.plugins=a.plugins||{};a.plugins.history={version:"1.0.2",conf:{api:false}};var e,b;function c(f){if(f){var g=b.contentWindow.document;g.open().close();g.location.hash=f}}d.fn.onHash=function(g){var f=this;if(d.browser.msie&&d.browser.version<"8"){if(!b){b=d("<iframe/>").attr("src","javascript:false;").hide().get(0);d("body").append(b);setInterval(function(){var i=b.contentWindow.document,j=i.location.hash;if(e!==j){d.event.trigger("hash",j);e=j}},100);c(location.hash||"#")}f.bind("click.hash",function(h){c(d(this).attr("href"))})}else{setInterval(function(){var j=location.hash;var i=f.filter("[href$="+j+"]");if(!i.length){j=j.replace("#","");i=f.filter("[href$="+j+"]")}if(i.length&&j!==e){e=j;d.event.trigger("hash",j)}},100)}d(window).bind("hash",g);return this};d.fn.history=function(g){var h=d.extend({},a.plugins.history.conf),f;g=d.extend(h,g);this.each(function(){var j=d(this).tabs(),i=j.getTabs();if(j){f=j}i.onHash(function(k,l){if(!l||l=="#"){l=j.getConf().initialIndex}j.click(l)});i.click(function(k){location.hash=d(this).attr("href").replace("#","")})});return g.api?f:this}})(jQuery);
(function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function a(o,m){var r=this,p=b(this),d=!m.vertical,e=o.children(),k=0,i;if(!c){c=r}b.each(m,function(s,t){if(b.isFunction(t)){p.bind(s,t)}});if(e.length>1){e=b(m.items,o)}function l(t){var s=b(t);return m.globalNav?s:o.parent().find(t)}o.data("finder",l);var f=l(m.prev),h=l(m.next),g=l(m.prevPage),n=l(m.nextPage);b.extend(r,{getIndex:function(){return k},getClickIndex:function(){var s=r.getItems();return s.index(s.filter("."+m.activeClass))},getConf:function(){return m},getSize:function(){return r.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/m.size)},getPageIndex:function(){return Math.ceil(k/m.size)},getNaviButtons:function(){return f.add(h).add(g).add(n)},getRoot:function(){return o},getItemWrap:function(){return e},getItems:function(){return e.children(m.item)},getVisibleItems:function(){return r.getItems().slice(k,k+m.size)},seekTo:function(s,w,t){if(s<0){s=0}if(k===s){return r}if(b.isFunction(w)){t=w}if(s>r.getSize()-m.size){return m.loop?r.begin():this.end()}var u=r.getItems().eq(s);if(!u.length){return r}var v=b.Event("onBeforeSeek");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}if(w===undefined||b.isFunction(w)){w=m.speed}function x(){if(t){t.call(r,s)}p.trigger("onSeek",[s])}if(d){e.animate({left:-u.position().left},w,m.easing,x)}else{e.animate({top:-u.position().top},w,m.easing,x)}c=r;k=s;v=b.Event("onStart");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}f.add(g).toggleClass(m.disabledClass,s===0);h.add(n).toggleClass(m.disabledClass,s>=r.getSize()-m.size);return r},move:function(u,t,s){i=u>0;return this.seekTo(k+u,t,s)},next:function(t,s){return this.move(1,t,s)},prev:function(t,s){return this.move(-1,t,s)},movePage:function(w,v,u){i=w>0;var s=m.size*w;var t=k%m.size;if(t>0){s+=(w>0?-t:m.size-t)}return this.move(s,v,u)},prevPage:function(t,s){return this.movePage(-1,t,s)},nextPage:function(t,s){return this.movePage(1,t,s)},setPage:function(t,u,s){return this.seekTo(t*m.size,u,s)},begin:function(t,s){i=false;return this.seekTo(0,t,s)},end:function(t,s){i=true;var u=this.getSize()-m.size;return u>0?this.seekTo(u,t,s):r},reload:function(){p.trigger("onReload");return r},focus:function(){c=r;return r},click:function(u){var v=r.getItems().eq(u),s=m.activeClass,t=m.size;if(u<0||u>=r.getSize()){return r}if(t==1){if(m.loop){return r.next()}if(u===0||u==r.getSize()-1){i=(i===undefined)?true:!i}return i===false?r.prev():r.next()}if(t==2){if(u==k){u--}r.getItems().removeClass(s);v.addClass(s);return r.seekTo(u,time,fn)}if(!v.hasClass(s)){r.getItems().removeClass(s);v.addClass(s);var x=Math.floor(t/2);var w=u-x;if(w>r.getSize()-t){w=r.getSize()-t}if(w!==u){return r.seekTo(w)}}return r},bind:function(s,t){p.bind(s,t);return r},unbind:function(s){p.unbind(s);return r}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(s,t){r[t]=function(u){return r.bind(t,u)}});f.addClass(m.disabledClass).click(function(){r.prev()});h.click(function(){r.next()});n.click(function(){r.nextPage()});if(r.getSize()<m.size){h.add(n).addClass(m.disabledClass)}g.addClass(m.disabledClass).click(function(){r.prevPage()});var j=m.hoverClass,q="keydown."+Math.random().toString().substring(10);r.onReload(function(){if(j){r.getItems().hover(function(){b(this).addClass(j)},function(){b(this).removeClass(j)})}if(m.clickable){r.getItems().each(function(s){b(this).unbind("click.scrollable").bind("click.scrollable",function(t){if(b(t.target).is("a")){return}return r.click(s)})})}if(m.keyboard){b(document).unbind(q).bind(q,function(t){if(t.altKey||t.ctrlKey){return}if(m.keyboard!="static"&&c!=r){return}var u=m.keyboardSteps;if(d&&(t.keyCode==37||t.keyCode==39)){r.move(t.keyCode==37?-u:u);return t.preventDefault()}if(!d&&(t.keyCode==38||t.keyCode==40)){r.move(t.keyCode==38?-u:u);return t.preventDefault()}return true})}else{b(document).unbind(q)}});r.reload()}b.fn.scrollable=function(d){var e=this.eq(typeof d=="number"?d:0).data("scrollable");if(e){return e}var f=b.extend({},b.tools.scrollable.conf);d=b.extend(f,d);d.keyboardSteps=d.keyboardSteps||d.size;this.each(function(){e=new a(b(this),d);b(this).data("scrollable",e)});return d.api?e:this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.circular={version:"0.5.1",conf:{api:false,clonedClass:"cloned"}};b.fn.circular=function(e){var d=b.extend({},a.plugins.circular.conf),c;b.extend(d,e);this.each(function(){var i=b(this).scrollable(),n=i.getItems(),k=i.getConf(),f=i.getItemWrap(),j=0;if(i){c=i}if(n.length<k.size){return false}n.slice(0,k.size).each(function(o){b(this).clone().appendTo(f).click(function(){i.click(n.length+o)}).addClass(d.clonedClass)});var l=b.makeArray(n.slice(-k.size)).reverse();b(l).each(function(o){b(this).clone().prependTo(f).click(function(){i.click(-o-1)}).addClass(d.clonedClass)});var m=f.children(k.item);var h=k.hoverClass;if(h){m.hover(function(){b(this).addClass(h)},function(){b(this).removeClass(h)})}function g(o){var p=m.eq(o);if(k.vertical){f.css({top:-p.position().top})}else{f.css({left:-p.position().left})}}g(k.size);b.extend(i,{move:function(s,r,p,q){var u=j+s+k.size;var t=u>i.getSize()-k.size;if(u<=0||t){var o=j+k.size+(t?-n.length:n.length);g(o);u=o+s}if(q){m.removeClass(k.activeClass).eq(u+Math.floor(k.size/2)).addClass(k.activeClass)}if(u===j+k.size){return self}return i.seekTo(u,r,p)},begin:function(p,o){return this.seekTo(k.size,p,o)},end:function(p,o){return this.seekTo(n.length,p,o)},click:function(p,r,q){if(!k.clickable){return self}if(k.size==1){return this.next()}var s=p-j,o=k.activeClass;s-=Math.floor(k.size/2);return this.move(s,r,q,true)},getIndex:function(){return j},setPage:function(p,q,o){return this.seekTo(p*k.size+k.size,q,o)},getPageAmount:function(){return Math.ceil(n.length/k.size)},getPageIndex:function(){if(j<0){return this.getPageAmount()-1}if(j>=n.length){return 0}var o=(j+k.size)/k.size-1;return o},getVisibleItems:function(){var o=j+k.size;return m.slice(o,o+k.size)}});i.onStart(function(p,o){j=o-k.size;return false});i.getNaviButtons().removeClass(k.disabledClass)});return d.api?c:this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.autoscroll={version:"1.0.1",conf:{autoplay:true,interval:3000,autopause:true,steps:1,api:false}};b.fn.autoscroll=function(d){if(typeof d=="number"){d={interval:d}}var e=b.extend({},a.plugins.autoscroll.conf),c;b.extend(e,d);this.each(function(){var g=b(this).scrollable();if(g){c=g}var i,f,h=true;g.play=function(){if(i){return}h=false;i=setInterval(function(){g.move(e.steps)},e.interval);g.move(e.steps)};g.pause=function(){i=clearInterval(i)};g.stop=function(){g.pause();h=true};if(e.autopause){g.getRoot().add(g.getNaviButtons()).hover(function(){g.pause();clearInterval(f)},function(){if(!h){f=setTimeout(g.play,e.interval)}})}if(e.autoplay){setTimeout(g.play,e.interval)}});return e.api?c:this}})(jQuery);
(function(b){var a=b.tools.scrollable;a.plugins=a.plugins||{};a.plugins.navigator={version:"1.0.2",conf:{navi:".navi",naviItem:null,activeClass:"active",indexed:false,api:false,idPrefix:null}};b.fn.navigator=function(d){var e=b.extend({},a.plugins.navigator.conf),c;if(typeof d=="string"){d={navi:d}}d=b.extend(e,d);this.each(function(){var i=b(this).scrollable(),f=i.getRoot(),l=f.data("finder").call(null,d.navi),g=null,k=i.getNaviButtons();if(i){c=i}i.getNaviButtons=function(){return k.add(l)};function j(){if(!l.children().length||l.data("navi")==i){l.empty();l.data("navi",i);for(var m=0;m<i.getPageAmount();m++){l.append(b("<"+(d.naviItem||"a")+"/>"))}g=l.children().each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()});if(d.indexed){o.text(n)}if(d.idPrefix){o.attr("id",d.idPrefix+n)}})}else{g=d.naviItem?l.find(d.naviItem):l.children();g.each(function(n){var o=b(this);o.click(function(p){i.setPage(n);return p.preventDefault()})})}g.eq(0).addClass(d.activeClass)}i.onStart(function(o,n){var m=d.activeClass;g.removeClass(m).eq(i.getPageIndex()).addClass(m)});i.onReload(function(){j()});j();var h=g.filter("[href="+location.hash+"]");if(h.length){i.move(g.index(h))}});return d.api?c:this}})(jQuery);

/* ColorBox v1.3.14 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+ */
/**
 * REW Hack Added
 * 
if (!percent) {
	if (img.width < settings.mw) {
		percent = (img.width - settings.mw) / img.width;
		tw = img.width - (img.width * percent);
		th = img.height - (img.height * percent);
		if (tw <= settings.mw && th <= settings.mh) {
			setResize();
		}
	}
	if (img.height < settings.mh) {
		percent = (img.height - settings.mh) / img.height;
		tw = img.width - (img.width * percent);
		th = img.height - (img.height * percent);
		if (tw <= settings.mw && th <= settings.mh) {
			setResize();
		}								
	}	
}
* 
* gzip	Packer 3.1	shrink, privateVars
* 
*/
(function(c,bk){var bd={transition:"elastic",speed:300,width:false,initialWidth:"600",innerWidth:false,maxWidth:false,height:false,initialHeight:"450",innerHeight:false,maxHeight:false,scalePhotos:true,scrolling:true,inline:false,html:false,iframe:false,photo:false,href:false,title:false,rel:false,opacity:0.9,preloading:true,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:false,returnFocus:true,loop:true,slideshow:false,slideshowAuto:true,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:false,onLoad:false,onComplete:false,onCleanup:false,onClosed:false,overlayClose:true,escKey:true,arrowKey:true},u='colorbox',m='cbox',be=m+'_0',R=m+'_1',S=m+'_2',N=m+'_3',bf=m+'_4',O=m+'_5',bg=m+'_6',F=c.browser.msie&&!c.support.opacity,T=F&&c.browser.version<7,P=m+'_7',x,o,C,v,U,V,W,X,l,r,p,H,I,Y,Z,J,K,L,ba,D,E,y,z,q,j,a,w,G,Q=false,g,M=m+'Element';function h(b,f){b=b?' id="'+m+b+'"':'';f=f?' style="'+f+'"':'';return c('<div'+b+f+'/>')}function t(b,f){f=f==='x'?r.width():r.height();return(typeof b==='string')?Math.round((/%/.test(b)?(f/100)*parseInt(b,10):parseInt(b,10))):b}function bb(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function bh(b){for(var f in b){if(c.isFunction(b[f])&&f.substring(0,2)!=='on'){b[f]=b[f].call(q)}}b.rel=b.rel||q.rel||'nofollow';b.href=b.href||c(q).attr('href');b.title=b.title||q.title;return b}function A(b,f){if(f){f.call(q)}c.event.trigger(b)}function bl(){var b,f=m+"Slideshow_",i="click."+m,k,n,d;if(a.slideshow&&l[1]){k=function(){J.text(a.slideshowStop).unbind(i).bind(S,function(){if(j<l.length-1||a.loop){b=setTimeout(g.next,a.slideshowSpeed)}}).bind(R,function(){clearTimeout(b)}).one(i+' '+N,n);o.removeClass(f+"off").addClass(f+"on");b=setTimeout(g.next,a.slideshowSpeed)};n=function(){clearTimeout(b);J.text(a.slideshowStart).unbind([S,R,N,i].join(' ')).one(i,k);o.removeClass(f+"on").addClass(f+"off")};if(a.slideshowAuto){k()}else{n()}}}function bi(f){if(!Q){q=f;a=bh(c.extend({},c.data(q,u)));l=c(q);j=0;if(a.rel!=='nofollow'){l=c('.'+M).filter(function(){var b=c.data(this,u).rel||this.rel;return(b===a.rel)});j=l.index(q);if(j===-1){l=l.add(q);j=l.length-1}}if(!w){w=G=true;o.show();if(a.returnFocus){try{q.blur();c(q).one(bf,function(){try{this.focus()}catch(e){}})}catch(e){}}x.css({"opacity":+a.opacity,"cursor":a.overlayClose?"pointer":"auto"}).show();a.w=t(a.initialWidth,'x');a.h=t(a.initialHeight,'y');g.position(0);if(T){r.bind('resize.'+P+' scroll.'+P,function(){x.css({width:r.width(),height:r.height(),top:r.scrollTop(),left:r.scrollLeft()})}).trigger('scroll.'+P)}A(be,a.onOpen);Z.add(L).add(K).add(J).add(Y).hide();ba.html(a.close).show()}g.load(true)}}g=c.fn[u]=c[u]=function(b,f){var i=this,k;if(!i[0]&&i.selector){return i}b=b||{};if(f){b.onComplete=f}if(!i[0]||i.selector===undefined){i=c('<a/>');b.open=true}i.each(function(){c.data(this,u,c.extend({},c.data(this,u)||bd,b));c(this).addClass(M)});k=b.open;if(c.isFunction(k)){k=k.call(i)}if(k){bi(i[0])}return i};g.init=function(){r=c(bk);o=h().attr({id:u,'class':F?m+'IE':''});x=h("Overlay",T?'position:absolute':'').hide();C=h("Wrapper");v=h("Content").append(p=h("LoadedContent",'width:0;height:0;overflow:hidden'),I=h("LoadingOverlay").add(h("LoadingGraphic")),Y=h("Title"),Z=h("Current"),K=h("Next"),L=h("Previous"),J=h("Slideshow").bind(be,bl),ba=h("Close"));C.append(h().append(h("TopLeft"),U=h("TopCenter"),h("TopRight")),h(false,'clear:left').append(V=h("MiddleLeft"),v,W=h("MiddleRight")),h(false,'clear:left').append(h("BottomLeft"),X=h("BottomCenter"),h("BottomRight"))).children().children().css({'float':'left'});H=h(false,'position:absolute; width:9999px; visibility:hidden; display:none');c('body').prepend(x,o.append(C,H));v.children().hover(function(){c(this).addClass('hover')},function(){c(this).removeClass('hover')}).addClass('hover');D=U.height()+X.height()+v.outerHeight(true)-v.height();E=V.width()+W.width()+v.outerWidth(true)-v.width();y=p.outerHeight(true);z=p.outerWidth(true);o.css({"padding-bottom":D,"padding-right":E}).hide();K.click(g.next);L.click(g.prev);ba.click(g.close);v.children().removeClass('hover');c('.'+M).live('click',function(b){if(!((b.button!==0&&typeof b.button!=='undefined')||b.ctrlKey||b.shiftKey||b.altKey)){b.preventDefault();bi(this)}});x.click(function(){if(a.overlayClose){g.close()}});c(document).bind("keydown",function(b){if(w&&a.escKey&&b.keyCode===27){b.preventDefault();g.close()}if(w&&a.arrowKey&&!G&&l[1]){if(b.keyCode===37&&(j||a.loop)){b.preventDefault();L.click()}else if(b.keyCode===39&&(j<l.length-1||a.loop)){b.preventDefault();K.click()}}})};g.remove=function(){o.add(x).remove();c('.'+M).die('click').removeData(u).removeClass(M)};g.position=function(f,i){var k,n=Math.max(document.documentElement.clientHeight-a.h-y-D,0)/2+r.scrollTop(),d=Math.max(r.width()-a.w-z-E,0)/2+r.scrollLeft();k=(o.width()===a.w+z&&o.height()===a.h+y)?0:f;C[0].style.width=C[0].style.height="9999px";function s(b){U[0].style.width=X[0].style.width=v[0].style.width=b.style.width;I[0].style.height=I[1].style.height=v[0].style.height=V[0].style.height=W[0].style.height=b.style.height}o.dequeue().animate({width:a.w+z,height:a.h+y,top:n,left:d},{duration:k,complete:function(){s(this);G=false;C[0].style.width=(a.w+z+E)+"px";C[0].style.height=(a.h+y+D)+"px";if(i){i()}},step:function(){s(this)}})};g.resize=function(b){if(w){b=b||{};if(b.width){a.w=t(b.width,'x')-z-E}if(b.innerWidth){a.w=t(b.innerWidth,'x')}p.css({width:a.w});if(b.height){a.h=t(b.height,'y')-y-D}if(b.innerHeight){a.h=t(b.innerHeight,'y')}if(!b.innerHeight&&!b.height){var f=p.wrapInner("<div style='overflow:auto'></div>").children();a.h=f.height();f.replaceWith(f.children())}p.css({height:a.h});g.position(a.transition==="none"?0:a.speed)}};g.prep=function(bm){if(!w){return}var bn,bc=a.transition==="none"?0:a.speed;r.unbind('resize.'+m);p.remove();p=h('LoadedContent').html(bm);function bo(){a.w=a.w||p.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}function bp(){a.h=a.h||p.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}p.hide().appendTo(H.show()).css({width:bo(),overflow:a.scrolling?'auto':'hidden'}).css({height:bp()}).prependTo(v);H.hide();c('#'+m+'Photo').css({cssFloat:'none',marginLeft:'auto',marginRight:'auto'});if(T){c('select').not(o.find('select')).filter(function(){return this.style.visibility!=='hidden'}).css({'visibility':'hidden'}).one(N,function(){this.style.visibility='inherit'})}function bj(f){var i,k,n,d,s=l.length,B=a.loop;g.position(f,function(){function b(){if(F){o[0].style.filter=false}}if(!w){return}if(F){if(bn){p.fadeIn(100)}}p.show();A(bg);Y.show().html(a.title);if(s>1){if(typeof a.current==="string"){Z.html(a.current.replace(/\{current\}/,j+1).replace(/\{total\}/,s)).show()}K[(B||j<s-1)?"show":"hide"]().html(a.next);L[(B||j)?"show":"hide"]().html(a.previous);i=j?l[j-1]:l[s-1];n=j<s-1?l[j+1]:l[0];if(a.slideshow){J.show()}if(a.preloading){d=c.data(n,u).href||n.href;k=c.data(i,u).href||i.href;d=c.isFunction(d)?d.call(n):d;k=c.isFunction(k)?k.call(i):k;if(bb(d)){c('<img/>')[0].src=d}if(bb(k)){c('<img/>')[0].src=k}}}I.hide();if(a.transition==='fade'){o.fadeTo(bc,1,function(){b()})}else{b()}r.bind('resize.'+m,function(){g.position(0)});A(S,a.onComplete)})}if(a.transition==='fade'){o.fadeTo(bc,0,function(){bj(0)})}else{bj(bc)}};g.load=function(k){var n,d,s,B=g.prep;G=true;q=l[j];if(!k){a=bh(c.extend({},c.data(q,u)))}A(O);A(R,a.onLoad);a.h=a.height?t(a.height,'y')-y-D:a.innerHeight&&t(a.innerHeight,'y');a.w=a.width?t(a.width,'x')-z-E:a.innerWidth&&t(a.innerWidth,'x');a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=t(a.maxWidth,'x')-z-E;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=t(a.maxHeight,'y')-y-D;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;I.show();if(a.inline){h().hide().insertBefore(c(n)[0]).one(O,function(){c(this).replaceWith(p.children())});B(c(n))}else if(a.iframe){o.one(bg,function(){var b=c("<iframe name='"+new Date().getTime()+"' frameborder=0"+(a.scrolling?"":" scrolling='no'")+(F?" allowtransparency='true'":'')+" style='width:100%; height:100%; border:0; display:block;'/>");b[0].src=a.href;b.appendTo(p).one(O,function(){b[0].src='//about:blank'})});B(" ")}else if(a.html){B(a.html)}else if(bb(n)){d=new Image();d.onload=function(){var b;d.onload=null;d.id=m+'Photo';c(d).css({border:'none',display:'block',cssFloat:'left'});if(a.scalePhotos){s=function(){d.height-=d.height*b;d.width-=d.width*b};if(a.mw&&d.width>a.mw){b=(d.width-a.mw)/d.width;s()}if(a.mh&&d.height>a.mh){b=(d.height-a.mh)/d.height;s()}if(!b){if(d.width<a.mw){b=(d.width-a.mw)/d.width;tw=d.width-(d.width*b);th=d.height-(d.height*b);if(tw<=a.mw&&th<=a.mh){s()}}if(d.height<a.mh){b=(d.height-a.mh)/d.height;tw=d.width-(d.width*b);th=d.height-(d.height*b);if(tw<=a.mw&&th<=a.mh){s()}}}}if(a.h){d.style.marginTop=Math.max(a.h-d.height,0)/2+'px'}if(l[1]&&(j<l.length-1||a.loop)){c(d).css({cursor:'pointer'}).click(g.next)}if(F){d.style.msInterpolationMode='bicubic'}setTimeout(function(){B(d)},1)};setTimeout(function(){d.src=n},1)}else if(n){H.load(n,function(b,f,i){B(f==='error'?'Request unsuccessful: '+i.statusText:c(this).children())})}};g.next=function(){if(!G){j=j<l.length-1?j+1:0;g.load()}};g.prev=function(){if(!G){j=j?j-1:l.length-1;g.load()}};g.close=function(){if(w&&!Q){Q=true;w=false;A(N,a.onCleanup);r.unbind('.'+m+' .'+P);x.fadeTo('fast',0);o.stop().fadeTo('fast',0,function(){A(O);p.remove();o.add(x).css({'opacity':1,cursor:'auto'}).hide();setTimeout(function(){Q=false;A(bf,a.onClosed)},1)})}};g.element=function(){return c(q)};g.settings=bd;c(g.init)}(jQuery,this));

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* $.masonry */
(function($){

	//Finding min and max values in array from http://snippets.dzone.com/posts/show/769
	Array.prototype.min = function(){ return Math.min.apply({},this) };
	Array.prototype.max = function(){ return Math.max.apply({},this) };

	$.fn.masonry = function() {
		this.each(function() {

			var wall = $(this);

			if ( wall.children().length > 0 ) { // check if the element has anything in it

				if( wall.children('.masonryWrap').length == 0 ) {      // checks if the masonryWrap div is already there
					wall.wrapInner('<div class=\"masonryWrap\"></div>');
				}
				var mWrap = wall.children('.masonryWrap');

				var brick = mWrap.children();
				var brickW = brick.outerWidth(true);
				var colCount = Math.floor( mWrap.width() / brickW ) ;

				var colH=new Array();
				for ( i=0; i < colCount; i++) {
					colH[ i ] =  0 ;
				}

				mWrap.css({ position: 'relative' });

				brick.css({
						float: 'none',
						position: 'absolute',
						display: 'block'
					})
					.each(function(){
						for ( i=colCount-1; i > -1; i-- ) {
							if ( colH[ i ] == colH.min() ) {
								var thisCol = i;
							}
						}
						$(this).css({
							top: colH[ thisCol ],
							left: brickW * thisCol
						});
						colH[ thisCol ] += $(this).outerHeight(true);
					});

				mWrap.height( colH.max() );
			}

			return this;
		});
	};
})(jQuery);

// HTML Truncator for jQuery
// by Henrik Nyh <http://henrik.nyh.se> 2008-02-28.
// Free to modify and redistribute with credit.
(function($) {

  var trailing_whitespace = true;

  $.fn.truncate = function(options) {

    var opts = $.extend({}, $.fn.truncate.defaults, options);

    $(this).each(function() {

      var content_length = $.trim(squeeze($(this).text())).length;
      if (content_length <= opts.max_length)
        return;  // bail early if not overlong

      var actual_max_length = opts.max_length - opts.more.length - 3;  // 3 for " ()"
      var truncated_node = recursivelyTruncate(this, actual_max_length);
      var full_node = $(this).hide();

      truncated_node.insertAfter(full_node);

      findNodeForMore(truncated_node).append(' (<a href="#show more content">'+opts.more+'</a>)');
      findNodeForLess(full_node).append(' (<a href="#show less content">'+opts.less+'</a>)');

      truncated_node.find('a:last').click(function() {
        truncated_node.hide(); full_node.show(); return false;
      });
      full_node.find('a:last').click(function() {
        truncated_node.show(); full_node.hide(); return false;
      });

    });
  }
  // Note that the " (more)" bit counts towards the max length ��� so a max
  // length of 10 would truncate "1234567890" to "12 (��?more)".
  $.fn.truncate.defaults = {
    max_length: 100,
    more: 'more',
    less: 'less'
  };
  function recursivelyTruncate(node, max_length) {
    return (node.nodeType == 3) ? truncateText(node, max_length) : truncateNode(node, max_length);
  }
  function truncateNode(node, max_length) {
    var node = $(node);
    var new_node = node.clone().empty();
    var truncatedChild;
    node.contents().each(function() {
      var remaining_length = max_length - new_node.text().length;
      if (remaining_length == 0) return;  // breaks the loop
      truncatedChild = recursivelyTruncate(this, remaining_length);
      if (truncatedChild) new_node.append(truncatedChild);
    });
    return new_node;
  }
  function truncateText(node, max_length) {
    var text = squeeze(node.data);
    if (trailing_whitespace)  // remove initial whitespace if last text
      text = text.replace(/^ /, '');  // node had trailing whitespace.
    trailing_whitespace = !!text.match(/ $/);
    var text = text.slice(0, max_length);
    // Ensure HTML entities are encoded
    // http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb
    text = $('<div/>').text(text).html();
    return text;
  }
  // Collapses a sequence of whitespace into a single space.
  function squeeze(string) {
    return string.replace(/\s+/g, ' ');
  }
  // Finds the last, innermost block-level element
  function findNodeForMore(node) {
    var $node = $(node);
    var last_child = $node.children(":last");
    if (!last_child) return node;
    var display = last_child.css('display');
    if (!display || display=='inline') return $node;
    return findNodeForMore(last_child);
  };
  // Finds the last child if it's a p; otherwise the parent
  function findNodeForLess(node) {
    var $node = $(node);
    var last_child = $node.children(":last");
    if (last_child && last_child.is('p')) return last_child;
    return node;
  };
})(jQuery);

/**
 * jQuery.fn.rewImgSizer
 * version 1.2
 * COPYRIGHT 2010
 *
 * Usage: $('img').rewImgSizer({});
 *
 * Options:
 *
 * scale : Ratio (e.g 1.25)
 * align: 'top left', 'top center', 'top right', 'center', 'center right', 'center left', 'bottom right', 'bottom center' or 'bottom left'
 * scale: 'scale', 'crop', 'fit' or 'none'
 * noUpscale: bollean (true or false)
 * onBeforeShow:
 * onAfterShow:
 *
**/
jQuery.fn.rewImgSizer = function(options) {

	var $self = this;

	var defaults = {
		method: 'crop',
		scale: 1,
		align: 'center',
		effect: 'fadeIn',
		noUpScale: false,
		onBeforeShow: function(){},
		onAfterShow: function(){}
	};

	var options = $.extend(defaults, options);

	$self.resize = function ($img) {

	    $self.show();

		/* photo
		----------------------------------------------------------- */

		var pho_vsize = 1;
		var pho_hsize = 1;
		var pho_width = $img.width();
		var pho_heigh = $img.height();

		// Steve: Generate both to prevent square images
//		if (pho_width > pho_heigh) {
			pho_vsize = Math.round((pho_width / pho_heigh) * 100) / 100;
//		} else{
			pho_hsize = Math.round((pho_heigh / pho_width) * 100) / 100;
//		}

		/* canvas
		----------------------------------------------------------- */

		$can = $img.parent();

		var can_vsize = 1;
		var can_hsize = 1;
		var can_width = $can.width();
		var can_heigh = $can.height();

		// Steve: Generate both to prevent square images
//		if (can_width > can_heigh) {
			can_vsize = Math.round((can_width / can_heigh) * 100) / 100;
//		} else{
			can_hsize = Math.round((can_heigh / can_width) * 100) / 100;
//		}

		/* store in case we want to revert */
		oldmethod = options.method;

		if (options.noUpScale) {
			if(pho_width < can_width && pho_heigh < can_heigh) {
				options.method = 'none';
			}

		}

		/* ect.
		----------------------------------------------------------- */
		//$img.attr('title', 'photo height=' + pho_hsize + '; photo width=' + pho_vsize + '; canvas height=' + can_hsize + '; canvas width=' + can_vsize);

		if (options.method == 'crop') {

			if (pho_hsize > can_hsize) {
				$img.width(can_width);
				$img.height($img.width() * pho_hsize);
			} else if (pho_vsize > can_vsize) {
				$img.height(can_heigh);
				$img.width($img.height() * pho_vsize);
			} else {
				// square 1:1
				$img.width(can_width);
				$img.height($img.width() * pho_hsize);
			}

		} else if (options.method == 'fit') {

			$img.height(can_heigh);
			$img.width(can_width);

		} else if (options.method == 'scale') {

			if (pho_hsize > can_hsize) {
				$img.height(can_heigh);
			} else if (pho_vsize > can_vsize) {
				$img.width(can_width);
			} else {
				// square 1:1
				if (can_hsize > can_vsize) {
					$img.width(can_width);
				} else {
					$img.height(can_heigh);
				}
			}

		} else {

			/* no resize */

		}

		/* SCALE OPTION */
		if (options.scale) {
			sImgH = $img.height() * options.scale;
			sImgW = $img.width() * options.scale;
			$img.width(sImgW);
			$img.height(sImgH);
		}

		$img.css({position:'absolute', left: ''});

		switch (options.align) {

			case 'center':
    			$img.css('top', -($img.height() - can_heigh) / 2 + 'px');
    			$img.css('left', -($img.width() - can_width) / 2 + 'px');
			break;

			case 'top left':
    			$img.css({'top': 0, 'left': 0});
			break;

			case 'top center':
    			$img.css('top', 0);
    			$img.css('left', -($img.width() - can_width) / 2 + 'px');
			break;

			case 'top right':
    			$img.css('top', 0);
    			$img.css('right', 0);
			break;

			case 'center right':
    			$img.css('top', -($img.height() - can_heigh) / 2 + 'px');
    			$img.css('right', 0);
			break;

			case 'center left':
    			$img.css('top', -($img.height() - can_heigh) / 2 + 'px');
    			$img.css('left', 0);
			break;

			case 'bottom right':
    			$img.css('bottom', 0);
    			$img.css('right', 0);
			break;

			case 'bottom center':
    			$img.css('bottom', 0);
    			$img.css('left', -($img.width() - can_width) / 2 + 'px');
			break;

			case 'bottom left':
    			$img.css('bottom', 0);
    			$img.css('left', 0);
			break;

		}

		$img.hide();

		//showImage();

		//function showImage() {
			options.onBeforeShow.call(this);
			$img.fadeIn('slow', options.onAfterShow.call(this));
		//}

		options.method = oldmethod;

	};

    jQuery(this).each(function (i) {

		$img = $(this);
		$img.css({position: 'absolute', left: '-999em'});

		var orgSrc = this.src;
		if (!$.browser.msie) {
			this.src = ""; //ie will do funky things if this is here (show the image as an X, only show half of the image, etc)
		}
		$(this).bind('load', function(){
		    $(this).unbind('load');
			$self.resize($(this));
		});
		if (!$.browser.msie) {
			this.src = orgSrc; //needed for potential cached images
		} else if (this.complete || this.complete === undefined) {
			this.src = orgSrc;
			$(this).trigger('load');
		}

	});

	// allow jQuery chaining
	return this;

};


(function($){

	/* rewIDX_SLIDES */
	$.fn.rewIDX_SLIDES = function(options) {
        return this.each(function() {
            $.innerfade(this, options);
        });
    };

    $.innerfade = function(container, options) {
        var settings = {
            'speed':            'slow',
            'timeout':          5000,
            'order':			'sequential'
        };
        if (options) $.extend(settings, options);

        var elements = $(container).children();

        if (elements.length > 1) {
            $(container).css('position', 'relative');
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
            };
			setTimeout(function() {
				$.innerfade.next(elements, settings, 1, 0);
			}, settings.timeout);
			$(elements[0]).show();
        }
    };

    $.innerfade.next = function(elements, settings, current, last) {

		if(settings.order == 'random') { elements[current] = elements.get(Math.random()*elements.length())}

		$(elements[last]).fadeOut(settings.speed);
		$(elements[current]).fadeIn(settings.speed, function(){});
		$(elements[current]).find('img').not('.resized').rewIDX_IMGCANVAS({'method':'crop'});

		if ((current + 1) < elements.length) {
			current = current + 1;
			last = current - 1;
		} else {
			current = 0;
			last = elements.length - 1;
		}

        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

	/* rewIDX_IMGCANVAS */
	jQuery.fn.rewIDX_IMGCANVAS = function(options) {
		var $self = $(this);
		var defaults = {
			method: 'crop',
			align: 'center'
		};
		var options = $.extend(defaults, options);
		jQuery(this).each(function(i) {

			$self.resize = function ($img) {

				/* the canvas */
				$imgCanvas 	= $img.parent();
				$imgCanvasW	= $imgCanvas.width();
				$imgCanvasH	= $imgCanvas.height();

				if($imgCanvasW > $imgCanvasH) {
					$imgCanvasAspect = 'landscape';
					$imgCanvasRatioH = 1;
					$imgCanvasRatioV = Math.round(($imgCanvasW / $imgCanvasH) * 100) / 100;
				} else {
					$imgCanvasAspect = 'portrait';
					$imgCanvasRatioV = 1;
					$imgCanvasRatioH = Math.round(($imgCanvasH / $imgCanvasW) * 100) / 100;
				}

				/* the image */
				$img		= $('img', $imgCanvas);
				$imgW		= $img.width();
				$imgH		= $img.height();
				if($imgW > $imgH) {
					$imgAspect = 'landscape';
					$imgRatioH = 1;
					$imgRatioV = Math.round(($imgW / $imgH) * 100) / 100;
				} else {
					$imgAspect = 'portrait';
					$imgRatioH = 1;
					$imgRatioV = Math.round(($imgW / $imgH) * 100) / 100;
				}

				if(options.method == 'crop'){

						if($imgRatioV > $imgCanvasRatioV) {

							$img.height($imgCanvasH);
							$img.width($img.height() * $imgRatioV);

						} else {

							$img.width($imgCanvasW);
							$img.height($img.width() * Math.round(($imgH / $imgW) * 100) / 100);

						}


						/* recheck and adjust size. easiest this way */
						if($img.height() < $imgCanvasH) {
							$img.height($imgCanvasH);
							$img.width($imgCanvasH * $imgRatioV);
						}

				} else if (options.method == 'scale') {

						if($imgRatioV > $imgCanvasRatioV) {

							$img.width($imgCanvasW);
							$img.height($img.width() * Math.round(($imgH / $imgW) * 100) / 100);

						} else {

							$img.height($imgCanvasH);
							$img.height($img.width() * Math.round(($imgH / $imgW) * 100) / 100);

						}

						/* recheck and adjust size. easiest this way */
						if($img.width() > $imgCanvasW) {
							$img.width($imgCanvasW);
							$img.height($imgCanvasW * Math.round(($imgH / $imgW) * 100) / 100);
						}

				}

				/* SCALE OPTION */
				if (options.scale) {
					sImgH = $img.height() * options.scale;
					sImgW = $img.width() * options.scale;
					$img.width(sImgW); $img.height(sImgH);
				}

				$imgCanvas.css({position: 'relative'});
				$img.css({position: 'absolute'});

				/* ALIGN OPTION */
				switch (options.align) {

					case 'center':
						$img.css('top', -($img.height() - $imgCanvasH) / 2 + 'px');
						$img.css('left', -($img.width() - $imgCanvasW) / 2 + 'px');
					break;

					case 'top left':
						$img.css({'top': 0, 'left': 0});
					break;

					case 'top center':
						$img.css('top', 0);
						$img.css('left', -($img.width() - $imgCanvasW) / 2 + 'px');
					break;

					case 'top right':
						$img.css('top', 0);
						$img.css('right', 0);
					break;

					case 'center right':
						$img.css('top', -($img.height() - $imgCanvasH) / 2 + 'px');
						$img.css('right', 0);
					break;

					case 'center left':
						$img.css('top', -($img.height() - $imgCanvasH) / 2 + 'px');
						$img.css('left', 0);
					break;

					case 'bottom right':
						$img.css('bottom', 0);
						$img.css('right', 0);
					break;

					case 'bottom center':
						$img.css('bottom', 0);
						$img.css('left', -($img.width() - $imgCanvasW) / 2 + 'px');
					break;

					case 'bottom left':
						$img.css('bottom', 0);
						$img.css('left', 0);
					break;

				}

				$img.addClass('resized');

			}

			jQuery(this).each(function (i) {

				$img = $(this);

				var orgSrc = this.src;

				if (!$.browser.msie) {
					this.src = ""; //ie will do funky things if this is here (show the image as an X, only show half of the image, etc)
				}
				$(this).bind('load', function(){
					$(this).unbind('load');
					if($(this).parent().height() > 0) {
						$self.resize($(this));
					}
				});
				if (!$.browser.msie) {
					this.src = orgSrc; //needed for potential cached images
				} else if (this.complete || this.complete === undefined) {
					this.src = orgSrc;
					$(this).trigger('load');
				}

			});

			return this;

		});

	};

})(jQuery);

/**
 * $.splitList
 */
(function($) {
    $.fn.splitList = function(options) {
        var defaults = { itemsPerColumn: 10 };
        var opts = $.extend($.fn.splitList.defaults, options);
        this.each(function() {
            var ul = this;
            var li = $(ul).children("li");
            $(ul).empty();
            for (var i = 0; i < opts.itemsPerColumn; i++) $(ul).append(li[i]);
            var curUl = ul;
            $(curUl).css("float", "left");
            for (var i = 1; i < li.length / opts.itemsPerColumn; i++) {
                var newUl = document.createElement("ul");
                for (var j = opts.itemsPerColumn * i; j < (opts.itemsPerColumn * i) + opts.itemsPerColumn; j++) $(newUl).append(li[j]);
                $(newUl).attr('class', $(curUl).attr('class')).css("float", "left");
                $(curUl).after(newUl);
                curUl = newUl;
            }
        });
    };
})(jQuery);

/*
 * jQuery UI Position 1.8.5
 *
 * 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/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.scrollTo&&d.document){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j=
{top:b.of.pageY,left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/
2;if(b.at[1]==="bottom")j.top+=k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+parseInt(c.curCSS(this,"marginRight",true))||0,w=m+q+parseInt(c.curCSS(this,"marginBottom",true))||0,i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]===
"center")i.top-=m/2;i.left=parseInt(i.left);i.top=parseInt(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();
b.left=d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];
b.left+=a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=
c(b),g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
