/*******************
 * GENERAL
 ******************/
function showDiv(divname,wording) {
    $('#more-' + divname).fadeIn();
    $('#' + divname + '-dots').hide();
    $("#show-" + divname + "-link").html('<a href="javascript:hideDiv(\'' + divname + '\',\'' + wording + '\');">hide ' + wording + '</a> &uarr;');
}
function hideDiv(divname,wording) {
    $('#more-' + divname).fadeOut();
    $('#' + divname + '-dots').show();
    $("#show-" + divname + "-link").html('<a href="javascript:showDiv(\'' + divname + '\',\'' + wording + '\');">more ' + wording + '</a> &darr;');
}

function openVirtualBook(){
	var backDiv = $('<div id="backDiv">').html('&nbsp;').click(function(){
			$('#backDiv').remove();
			$('#virtualBookIframe').hide();
		});
	$(document.body).append(backDiv);
	var left = (document.body.clientWidth - 760)/2 + "px";
	$('#virtualBookIframe').css('left',left).show();
}

function closeVirtualBook(){
	$('#backDiv').remove();
	$('#virtualBookIframe').hide();
}


function changeStatus(e){
	if($('#basket td:first').length){
		if(confirm('Proceeding with this offer will clear your shopping basket - do you wish to continue?')){
			document.location.href = $(e.target).attr('href');
			return false;
		}else{
			return false;
		}
	}else{
		document.location.href = $(e.target).attr('href');
	}
}


(function($){
	$.fn.defaultInputText = function(which,options){
		options = $.extend({
			cssClass:'gray',
			object:this.get(0)
		}, options || {});
		
		
		// register events
		$(this).focus(_onFocus).blur(_onBlur);
		
		// add clear to form
		$(this).parents('form:first').submit(_clearFromForm);
		
		if($(this).get(0).value.length == 0){
			$(this).addClass(options.cssClass).val(which);
		}
				
		function _onFocus(){
			if(this.value==which){
				$(this).removeClass(options.cssClass).val('');
			}
		};
		
		function _onBlur(){
			 if(this.value==which || this.value.length == 0){
				$(this).addClass(options.cssClass).val(which);
			}
		};
		
		function _clearFromForm(){
			if(options.object.value==which){
				options.object.value='';
			}
		}
		
	};
	
	$.fn.logClicks = function(){
		$(this).click(function(e){
			var data = {};
			var bookCode = $(this).parents('[bookCode]:first').attr('bookCode');
			var ipAddress = $('#ipAddress').text();
			if(ipAddress=="81.144.150.226" || ipAddress=="81.144.150.228" || ipAddress=="192.168.1.123")
				return true;
			//console.log(WEBROOT);			

			data['data[Click][editorial_id]'] = $(this).parents('[editorial_id]:first').attr('editorial_id');
			data['data[Click][bookCode]'] = bookCode;
			data['data[Click][url]'] = $(this).attr('href');
			
			if(data['data[Click][url]']!='#' && data['data[Click][url]']!=undefined && data['data[Click][bookCode]']!=undefined)
				$.post('http://'+WEBROOT+'clicks/record',data);
//			return false;
		});
	};
	
})(jQuery);





// Version 1.0 - October 19, 2007
// Requires http://jquery.com version 1.2.1

(function($) {
	$.fn.biggerlink = function(options) {

		// Default settings
		var settings = {
			hoverclass:'hover', // class added to parent element on hover
			clickableclass:'hot', // class added to parent element with behaviour
			follow: true	// follow link? Set to false for js popups
		};
		if(options) {
			$.extend(settings, options);
		}
		$(this).filter(function(){
			 return $('a',this).length > 0;

		}).addClass(settings.clickableclass).each(function(i){
		
			// Add title of first link with title to parent
			$(this).attr('title', $('a[title]:first',this).attr('title'));
			
			// hover and trigger contained anchor event on click
			$(this)
			.mouseover(function(){
				window.status = $('a:first',this).attr('href');
				$(this).addClass(settings.hoverclass);
			})
			.mouseout(function(){
				window.status = '';
				$(this).removeClass(settings.hoverclass);
			})
			.bind('click',function(){
				$(this).find('a:first').trigger('click');
			})
			
			// triggerable events on anchor itself
			
			.find('a').bind('focus',function(){
				$(this).parents('.'+ settings.clickableclass).addClass(settings.hoverclass);
			}).bind('blur',function(){
				$(this).parents('.'+ settings.clickableclass).removeClass(settings.hoverclass);
			}).end()
			
			.find('a:first').bind('click',function(e){
				if(settings.follow == true)
				{
					window.location = this.href;
				}
				e.stopPropagation(); // stop event bubbling to parent
			}).end()
			
			.find('a',this).not(':first').bind('click',function(){
				$(this).parents('.'+ settings.clickableclass).find('a:first').trigger('click');
				return false;
			});
		});
		return this;
	};
})(jQuery);


jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // NOTE Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};



/*
 * jQuery Cycle Plugin (core engine only)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.99 (12-MAR-2011)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.3.2 or later
 */
(function($){var ver="2.99";if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){$.fn.cycle.debug&&log(s);}function log(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "));}$.expr[":"].paused=function(el){return el.cyclePause;};$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.backwards);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,!opts.backwards);},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,!options.backwards);}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,!opts.backwards);});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.cssAfter=opts.cssAfter||{};opts.cssFirst=opts.cssFirst||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);$($slides[first]).css(opts.cssFirst);if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="none"?0:opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length){opts.after[0].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$s.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=0;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){opts.busy=0;$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing("+fx+"); currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.backwards);},ms);}}$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while(opts.fx!="none"&&(t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,1);};$.fn.cycle.prev=function(opts){advance(opts,0);};function advance(opts,moveForward){var val=moveForward?1:-1;var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,moveForward);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v&&v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();if(typeof opts.cssBefore.opacity=="undefined"){opts.cssBefore.opacity=1;}opts.cssBefore.display="block";if(opts.slideResize&&w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(opts.slideResize&&h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,function(){cb();});};$l.animate(opts.animOut,speedOut,easeOut,function(){$l.css(opts.cssAfter);if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0};opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,autostop:0,autostopCount:0,backwards:false,before:null,cleartype:!$.support.opacity,cleartypeNoBg:false,containerResize:1,continuous:0,cssAfter:null,cssBefore:null,delay:0,easeIn:null,easeOut:null,easing:null,end:null,fastOnEvent:0,fit:0,fx:"fade",fxFn:null,height:"auto",manualTrump:true,next:null,nowrap:0,onPagerEvent:null,onPrevNextEvent:null,pager:null,pagerAnchorBuilder:null,pagerEvent:"click.cycle",pause:0,pauseOnPagerHover:0,prev:null,prevNextEvent:"click.cycle",random:0,randomizeEffects:1,requeueOnImageNotLoaded:true,requeueTimeout:250,rev:0,shuffle:null,slideExpr:null,slideResize:1,speed:1000,speedIn:null,speedOut:null,startingSlide:0,sync:1,timeout:4000,timeoutFn:null,updateActivePagerLink:null};})(jQuery);
(function(d){d.fn.bxSlider=function(a){function O(){if(a.mode=="horizontal"||a.mode=="vertical"){var g=K(c,0,a.moveSlideQty,"backward");d.each(g,function(){e.prepend(d(this))});g=K(c,0,c.length+a.moveSlideQty-1-(c.length-a.displaySlideQty),"forward");a.infiniteLoop&&d.each(g,function(){e.append(d(this))})}}function P(){a.auto?a.infiniteLoop?a.autoDirection=="next"?q=setInterval(function(){h.goToNextSlide(!1)},a.pause):a.autoDirection=="prev"&&(q=setInterval(function(){h.goToPreviousSlide(!1)},a.pause)):
a.autoDirection=="next"?q=setInterval(function(){b+=a.moveSlideQty;b>r&&(b%=c.length);h.goToSlide(b,!1)},a.pause):a.autoDirection=="prev"&&(q=setInterval(function(){b-=a.moveSlideQty;b<0&&(negativeOffset=b%c.length,b=negativeOffset==0?0:c.length+negativeOffset);h.goToSlide(b,!1)},a.pause)):a.ticker&&(a.tickerSpeed*=10,d(".pager",i).each(function(){m+=d(this).width();n+=d(this).height()}),a.tickerDirection=="prev"&&a.mode=="horizontal"?e.css("left","-"+(m+v)+"px"):a.tickerDirection=="prev"&&a.mode==
"vertical"&&e.css("top","-"+(n+w)+"px"),a.mode=="horizontal"?(A=parseInt(e.css("left")),o(A,m,a.tickerSpeed)):a.mode=="vertical"&&(B=parseInt(e.css("top")),o(B,n,a.tickerSpeed)),a.tickerHover&&Q())}function o(g,b,c){a.mode=="horizontal"?a.tickerDirection=="next"?e.animate({left:"-="+b+"px"},c,"linear",function(){e.css("left",g);o(g,m,a.tickerSpeed)}):a.tickerDirection=="prev"&&e.animate({left:"+="+b+"px"},c,"linear",function(){e.css("left",g);o(g,m,a.tickerSpeed)}):a.mode=="vertical"&&(a.tickerDirection==
"next"?e.animate({top:"-="+b+"px"},c,"linear",function(){e.css("top",g);o(g,n,a.tickerSpeed)}):a.tickerDirection=="prev"&&e.animate({top:"+="+b+"px"},c,"linear",function(){e.css("top",g);o(g,n,a.tickerSpeed)}))}function R(){i.find(".bx-window").hover(function(){j&&h.stopShow(!1)},function(){j&&h.startShow(!1)})}function Q(){e.hover(function(){j&&h.stopTicker(!1)},function(){j&&h.startTicker(!1)})}function I(){c.not(":eq("+b+")").fadeTo(a.speed,0).css("zIndex",98);c.eq(b).css("zIndex",99).fadeTo(a.speed,
1,function(){f=!1;jQuery.browser.msie&&c.eq(b).get(0).style.removeAttribute("filter");a.onAfterSlide(b,c.length,c.eq(b))})}function s(g){a.pagerType=="full"&&a.pager?(d("a",p).removeClass(a.pagerActiveClass),d("a",p).eq(g).addClass(a.pagerActiveClass)):a.pagerType=="short"&&a.pager&&d(".bx-pager-current",p).html(b+1)}function S(g,b,c,e){var f=d('<a href="" class="bx-next"></a>'),x=d('<a href="" class="bx-prev"></a>');g=="text"?f.html(b):f.html('<img src="'+b+'" />');c=="text"?x.html(e):x.html('<img src="'+
e+'" />');a.prevSelector?d(a.prevSelector).append(x):i.append(x);a.nextSelector?d(a.nextSelector).append(f):i.append(f);f.click(function(){h.goToNextSlide();return!1});x.click(function(){h.goToPreviousSlide();return!1})}function L(b){var e=c.length;a.moveSlideQty>1&&(e=c.length%a.moveSlideQty!=0?Math.ceil(c.length/a.moveSlideQty):c.length/a.moveSlideQty);var f="";if(a.buildPager)for(b=0;b<e;b++)f+=a.buildPager(b,c.eq(b*a.moveSlideQty));else if(b=="full")for(b=1;b<=e;b++)f+='<a href="" class="pager-link pager-'+
b+'">'+b+"</a>";else b=="short"&&(f='<span class="bx-pager-current">'+(a.startingSlide+1)+"</span> "+a.pagerShortSeparator+' <span class="bx-pager-total">'+c.length+"<span>");a.pagerSelector?(d(a.pagerSelector).append(f),p=d(a.pagerSelector)):(e=d('<div class="bx-pager"></div>'),e.append(f),a.pagerLocation=="top"?i.prepend(e):a.pagerLocation=="bottom"&&i.append(e),p=d(".bx-pager",i));p.children().click(function(){if(a.pagerType=="full"){var b=p.children().index(this);a.moveSlideQty>1&&(b*=a.moveSlideQty);
h.goToSlide(b)}return!1})}function D(){var g=d("img",c.eq(b)).attr("title");g!=""?a.captionsSelector?d(a.captionsSelector).html(g):d(".bx-captions",i).html(g):a.captionsSelector?d(a.captionsSelector).html("&nbsp;"):d(".bx-captions",i).html("&nbsp;")}function T(b,c,e,f){k=d('<a href="" class="bx-start"></a>');E=b=="text"?c:'<img src="'+c+'" />';F=e=="text"?f:'<img src="'+f+'" />';a.autoControlsSelector?d(a.autoControlsSelector).append(k):(i.append('<div class="bx-auto"></div>'),d(".bx-auto",i).html(k));
k.click(function(){a.ticker?d(this).hasClass("stop")?h.stopTicker():d(this).hasClass("start")&&h.startTicker():d(this).hasClass("stop")?h.stopShow(!0):d(this).hasClass("start")&&h.startShow(!0);return!1})}function G(){!a.infiniteLoop&&a.hideControlOnEnd&&(b==H?d(".bx-prev",i).hide():d(".bx-prev",i).show(),b==r?d(".bx-next",i).hide():d(".bx-next",i).show())}function u(a,b){if(b=="left")var c=d(".pager",i).eq(a).position().left;else if(b=="top")c=d(".pager",i).eq(a).position().top;return c}function K(a,
b,c,e){var f=[],h=c,i=!1;e=="backward"&&(a=d.makeArray(a),a.reverse());for(;h>0;)d.each(a,function(a){if(h>0)i?(f.push(d(this).clone()),h--):a==b&&(i=!0,f.push(d(this).clone()),h--);else return!1});return f}var a=d.extend({mode:"horizontal",infiniteLoop:!0,hideControlOnEnd:!1,controls:!0,speed:500,easing:"swing",pager:!1,pagerSelector:null,pagerType:"full",pagerLocation:"bottom",pagerShortSeparator:"/",pagerActiveClass:"pager-active",nextText:"next",nextImage:"",nextSelector:null,prevText:"prev",
prevImage:"",prevSelector:null,captions:!1,captionsSelector:null,auto:!1,autoDirection:"next",autoControls:!1,autoControlsSelector:null,autoStart:!0,autoHover:!1,autoDelay:0,pause:3E3,startText:"start",startImage:"",stopText:"stop",stopImage:"",ticker:!1,tickerSpeed:5E3,tickerDirection:"next",tickerHover:!1,wrapperClass:"bx-wrapper",startingSlide:0,displaySlideQty:1,moveSlideQty:1,randomStart:!1,onBeforeSlide:function(){},onAfterSlide:function(){},onLastSlide:function(){},onFirstSlide:function(){},
onNextSlide:function(){},onPrevSlide:function(){},buildPager:null},a),h=this,e="",c="",i="",y="",M="",z="",J="",N="",p="",q="",k="",E="",F="",j=!0,t=0,l=0,b=0,v=0,w=0,m=0,n=0,A=0,B=0,f=!1,H=0,r=c.length-1;this.goToSlide=function(g,d){if(!f){f=!0;b=g;a.onBeforeSlide(b,c.length,c.eq(b));typeof d=="undefined"&&(d=!0);d&&a.auto&&h.stopShow(!0);slide=g;if(slide==H)a.onFirstSlide(b,c.length,c.eq(b));if(slide==r)a.onLastSlide(b,c.length,c.eq(b));a.mode=="horizontal"?e.animate({left:"-"+u(slide,"left")+"px"},
a.speed,a.easing,function(){f=!1;a.onAfterSlide(b,c.length,c.eq(b))}):a.mode=="vertical"?e.animate({top:"-"+u(slide,"top")+"px"},a.speed,a.easing,function(){f=!1;a.onAfterSlide(b,c.length,c.eq(b))}):a.mode=="fade"&&I();G();a.moveSlideQty>1&&(g=Math.floor(g/a.moveSlideQty));s(g);D()}};this.goToNextSlide=function(g){typeof g=="undefined"&&(g=!0);g&&a.auto&&h.stopShow(!0);if(a.infiniteLoop)f||(f=!0,d=!1,b+=a.moveSlideQty,b>r&&(b%=c.length,d=!0),a.onNextSlide(b,c.length,c.eq(b)),a.onBeforeSlide(b,c.length,
c.eq(b)),a.mode=="horizontal"?e.animate({left:"-="+a.moveSlideQty*z+"px"},a.speed,a.easing,function(){f=!1;d&&e.css("left","-"+u(b,"left")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode=="vertical"?e.animate({top:"-="+a.moveSlideQty*l+"px"},a.speed,a.easing,function(){f=!1;d&&e.css("top","-"+u(b,"top")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode=="fade"&&I(),a.moveSlideQty>1?s(Math.ceil(b/a.moveSlideQty)):s(b),D());else if(!f){var d=!1;b+=a.moveSlideQty;b<=r?(G(),a.onNextSlide(b,c.length,
c.eq(b)),h.goToSlide(b)):b-=a.moveSlideQty}};this.goToPreviousSlide=function(g){typeof g=="undefined"&&(g=!0);g&&a.auto&&h.stopShow(!0);if(a.infiniteLoop)f||(f=!0,C=!1,b-=a.moveSlideQty,b<0&&(negativeOffset=b%c.length,b=negativeOffset==0?0:c.length+negativeOffset,C=!0),a.onPrevSlide(b,c.length,c.eq(b)),a.onBeforeSlide(b,c.length,c.eq(b)),a.mode=="horizontal"?e.animate({left:"+="+a.moveSlideQty*z+"px"},a.speed,a.easing,function(){f=!1;C&&e.css("left","-"+u(b,"left")+"px");a.onAfterSlide(b,c.length,
c.eq(b))}):a.mode=="vertical"?e.animate({top:"+="+a.moveSlideQty*l+"px"},a.speed,a.easing,function(){f=!1;C&&e.css("top","-"+u(b,"top")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode=="fade"&&I(),a.moveSlideQty>1?s(Math.ceil(b/a.moveSlideQty)):s(b),D());else if(!f){var C=!1;b-=a.moveSlideQty;b<0&&(b=0,a.hideControlOnEnd&&d(".bx-prev",i).hide());G();a.onPrevSlide(b,c.length,c.eq(b));h.goToSlide(b)}};this.goToFirstSlide=function(a){typeof a=="undefined"&&(a=!0);h.goToSlide(H,a)};this.goToLastSlide=
function(){if(typeof a=="undefined")var a=!0;h.goToSlide(r,a)};this.getCurrentSlide=function(){return b};this.getSlideCount=function(){return c.length};this.stopShow=function(b){clearInterval(q);typeof b=="undefined"&&(b=!0);b&&a.autoControls&&(k.html(E).removeClass("stop").addClass("start"),j=!1)};this.startShow=function(b){typeof b=="undefined"&&(b=!0);P();b&&a.autoControls&&(k.html(F).removeClass("start").addClass("stop"),j=!0)};this.stopTicker=function(b){e.stop();typeof b=="undefined"&&(b=!0);
b&&a.ticker&&(k.html(E).removeClass("stop").addClass("start"),j=!1)};this.startTicker=function(b){if(a.mode=="horizontal"){if(a.tickerDirection=="next")var b=parseInt(e.css("left")),d=m+b+c.eq(0).width();else a.tickerDirection=="prev"&&(b=-parseInt(e.css("left")),d=b-c.eq(0).width());var f=d*a.tickerSpeed/m;o(A,d,f)}else a.mode=="vertical"&&(a.tickerDirection=="next"?(d=parseInt(e.css("top")),d=n+d+c.eq(0).height()):a.tickerDirection=="prev"&&(d=-parseInt(e.css("top")),d-=c.eq(0).height()),f=d*a.tickerSpeed/
n,o(B,d,f),typeof b=="undefined"&&(b=!0),b&&a.ticker&&(k.html(F).removeClass("start").addClass("stop"),j=!0))};this.initShow=function(){e=d(this);e.clone();c=e.children();i="";y=e.children(":first");M=y.width();t=0;z=y.outerWidth();l=0;J=y.outerWidth()*a.displaySlideQty;N=y.outerHeight()*a.displaySlideQty;f=!1;p="";w=v=b=0;F=E=k=q="";j=!0;H=B=A=n=m=0;r=c.length-1;c.each(function(){d(this).outerHeight()>l&&(l=d(this).outerHeight());d(this).outerWidth()>t&&(t=d(this).outerWidth())});if(a.randomStart){var g=
Math.floor(Math.random()*c.length);b=g;v=z*(a.moveSlideQty+g);w=l*(a.moveSlideQty+g)}else b=a.startingSlide,v=z*(a.moveSlideQty+a.startingSlide),w=l*(a.moveSlideQty+a.startingSlide);O(a.startingSlide);a.mode=="horizontal"?(e.wrap('<div class="'+a.wrapperClass+'" style="width:'+J+'px; position:relative;"></div>').wrap('<div class="bx-window" style="position:relative; overflow:hidden; width:'+J+'px;"></div>').css({width:"999999px",position:"relative",left:"-"+v+"px"}),e.children().css({width:M,"float":"left",
listStyle:"none"}),i=e.parent().parent(),c.addClass("pager")):a.mode=="vertical"?(e.wrap('<div class="'+a.wrapperClass+'" style="width:'+t+'px; position:relative;"></div>').wrap('<div class="bx-window" style="width:'+t+"px; height:"+N+'px; position:relative; overflow:hidden;"></div>').css({height:"999999px",position:"relative",top:"-"+w+"px"}),e.children().css({listStyle:"none",height:l}),i=e.parent().parent(),c.addClass("pager")):a.mode=="fade"&&(e.wrap('<div class="'+a.wrapperClass+'" style="width:'+
t+'px; position:relative;"></div>').wrap('<div class="bx-window" style="height:'+l+"px; width:"+t+'px; position:relative; overflow:hidden;"></div>'),e.children().css({listStyle:"none",position:"absolute",top:0,left:0,zIndex:98}),i=e.parent().parent(),c.not(":eq("+b+")").fadeTo(0,0),c.eq(b).css("zIndex",99));a.captions&&a.captionsSelector==null&&i.append('<div class="bx-captions"></div>');a.pager&&!a.ticker&&(a.pagerType=="full"?L("full"):a.pagerType=="short"&&L("short"));if(a.controls)a.nextImage!=
""?(nextContent=a.nextImage,nextType="image"):(nextContent=a.nextText,nextType="text"),a.prevImage!=""?(prevContent=a.prevImage,prevType="image"):(prevContent=a.prevText,prevType="text"),S(nextType,nextContent,prevType,prevContent);if(a.auto||a.ticker){if(a.autoControls)a.startImage!=""?(startContent=a.startImage,startType="image"):(startContent=a.startText,startType="text"),a.stopImage!=""?(stopContent=a.stopImage,stopType="image"):(stopContent=a.stopText,stopType="text"),T(startType,startContent,
stopType,stopContent);a.autoStart?setTimeout(function(){h.startShow(!0)},a.autoDelay):h.stopShow(!0);a.autoHover&&!a.ticker&&R()}a.moveSlideQty>1?s(Math.ceil(b/a.moveSlideQty)):s(b);G();a.captions&&D();a.onAfterSlide(b,c.length,c.eq(b))};this.destroyShow=function(){clearInterval(q);d(".bx-next, .bx-prev, .bx-pager, .bx-auto",i).remove();e.unwrap().unwrap().removeAttr("style");e.children().removeAttr("style").not(".pager").remove();c.removeClass("pager")};this.reloadShow=function(){h.destroyShow();
h.initShow()};this.each(function(){h.initShow()});return this};jQuery.fx.prototype.cur=function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return parseFloat(jQuery.css(this.elem,this.prop))}})(jQuery);
// ColorBox v1.3.17.1 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function bc(b){if(!T){O=b,_(a.extend(J,a.data(O,e))),x=a(O),P=0,J.rel!=="nofollow"&&(x=a("."+X).filter(function(){var b=a.data(this,e).rel||this.rel;return b===J.rel}),P=x.index(O),P===-1&&(x=x.add(O),P=x.length-1));if(!R){R=S=!0,q.show();if(J.returnFocus)try{O.blur(),a(O).one(k,function(){try{this.focus()}catch(a){}})}catch(c){}p.css({opacity:+J.opacity,cursor:J.overlayClose?"pointer":"auto"}).show(),J.w=Z(J.initialWidth,"x"),J.h=Z(J.initialHeight,"y"),W.position(0),n&&y.bind("resize."+o+" scroll."+o,function(){p.css({width:y.width(),height:y.height(),top:y.scrollTop(),left:y.scrollLeft()})}).trigger("resize."+o),ba(g,J.onOpen),I.add(C).hide(),H.html(J.close).show()}W.load(!0)}}function bb(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;J.slideshow&&x[1]?(d=function(){E.text(J.slideshowStop).unbind(c).bind(i,function(){if(P<x.length-1||J.loop)a=setTimeout(W.next,J.slideshowSpeed)}).bind(h,function(){clearTimeout(a)}).one(c+" "+j,e),q.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,J.slideshowSpeed)},e=function(){clearTimeout(a),E.text(J.slideshowStart).unbind([i,h,j,c].join(" ")).one(c,d),q.removeClass(b+"on").addClass(b+"off")},J.slideshowAuto?d():e()):q.removeClass(b+"off "+b+"on")}function ba(b,c){c&&c.call(O),a.event.trigger(b)}function _(b){for(var c in b)a.isFunction(b[c])&&c.substring(0,2)!=="on"&&(b[c]=b[c].call(O));b.rel=b.rel||O.rel||"nofollow",b.href=b.href||a(O).attr("href"),b.title=b.title||O.title,typeof b.href=="string"&&(b.href=a.trim(b.href))}function $(a){return J.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a)}function Z(a,b){b=b==="x"?y.width():y.height();return typeof a=="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function Y(c,d){var e=b.createElement("div");c&&(e.id=f+c),e.style.cssText=d||"";return a(e)}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:!1},e="colorbox",f="cbox",g=f+"_open",h=f+"_load",i=f+"_complete",j=f+"_cleanup",k=f+"_closed",l=f+"_purge",m=a.browser.msie&&!a.support.opacity,n=m&&a.browser.version<7,o=f+"_IE6",p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={},K,L,M,N,O,P,Q,R,S,T,U,V,W,X=f+"Element";W=a.fn[e]=a[e]=function(b,c){var f=this,g;if(!f[0]&&f.selector)return f;b=b||{},c&&(b.onComplete=c);if(!f[0]||f.selector===undefined)f=a("<a/>"),b.open=!0;f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(X)}),g=b.open,a.isFunction(g)&&(g=g.call(f)),g&&bc(f[0]);return f},W.init=function(){y=a(c),q=Y().attr({id:e,"class":m?f+(n?"IE6":"IE"):""}),p=Y("Overlay",n?"position:absolute":"").hide(),r=Y("Wrapper"),s=Y("Content").append(z=Y("LoadedContent","width:0; height:0; overflow:hidden"),B=Y("LoadingOverlay").add(Y("LoadingGraphic")),C=Y("Title"),D=Y("Current"),F=Y("Next"),G=Y("Previous"),E=Y("Slideshow").bind(g,bb),H=Y("Close")),r.append(Y().append(Y("TopLeft"),t=Y("TopCenter"),Y("TopRight")),Y(!1,"clear:left").append(u=Y("MiddleLeft"),s,v=Y("MiddleRight")),Y(!1,"clear:left").append(Y("BottomLeft"),w=Y("BottomCenter"),Y("BottomRight"))).children().children().css({"float":"left"}),A=Y(!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(p,q.append(r,A)),s.children().hover(function(){a(this).addClass("hover")},function(){a(this).removeClass("hover")}).addClass("hover"),K=t.height()+w.height()+s.outerHeight(!0)-s.height(),L=u.width()+v.width()+s.outerWidth(!0)-s.width(),M=z.outerHeight(!0),N=z.outerWidth(!0),q.css({"padding-bottom":K,"padding-right":L}).hide(),F.click(function(){W.next()}),G.click(function(){W.prev()}),H.click(function(){W.close()}),I=F.add(G).add(D).add(E),s.children().removeClass("hover"),p.click(function(){J.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;R&&J.escKey&&b===27&&(a.preventDefault(),W.close()),R&&J.arrowKey&&x[1]&&(b===37?(a.preventDefault(),G.click()):b===39&&(a.preventDefault(),F.click()))})},W.remove=function(){q.add(p).remove(),a("."+X).removeData(e).removeClass(X)},W.position=function(a,c){function g(a){t[0].style.width=w[0].style.width=s[0].style.width=a.style.width,B[0].style.height=B[1].style.height=s[0].style.height=u[0].style.height=v[0].style.height=a.style.height}var d,e=0,f=0;q.hide(),J.fixed&&!n?q.css({position:"fixed"}):(e=y.scrollTop(),f=y.scrollLeft(),q.css({position:"absolute"})),J.right!==!1?f+=Math.max(y.width()-J.w-N-L-Z(J.right,"x"),0):J.left!==!1?f+=Z(J.left,"x"):f+=Math.max(y.width()-J.w-N-L,0)/2,J.bottom!==!1?e+=Math.max(b.documentElement.clientHeight-J.h-M-K-Z(J.bottom,"y"),0):J.top!==!1?e+=Z(J.top,"y"):e+=Math.max(b.documentElement.clientHeight-J.h-M-K,0)/2,q.show(),d=q.width()===J.w+N&&q.height()===J.h+M?0:a,r[0].style.width=r[0].style.height="9999px",q.dequeue().animate({width:J.w+N,height:J.h+M,top:e,left:f},{duration:d,complete:function(){g(this),S=!1,r[0].style.width=J.w+N+L+"px",r[0].style.height=J.h+M+K+"px",c&&c()},step:function(){g(this)}})},W.resize=function(a){if(R){a=a||{},a.width&&(J.w=Z(a.width,"x")-N-L),a.innerWidth&&(J.w=Z(a.innerWidth,"x")),z.css({width:J.w}),a.height&&(J.h=Z(a.height,"y")-M-K),a.innerHeight&&(J.h=Z(a.innerHeight,"y"));if(!a.innerHeight&&!a.height){var b=z.wrapInner("<div style='overflow:auto'></div>").children();J.h=b.height(),b.replaceWith(b.children())}z.css({height:J.h}),W.position(J.transition==="none"?0:J.speed)}},W.prep=function(b){function h(b){W.position(b,function(){function o(){m&&q[0].style.removeAttribute("filter")}var b,d,g,h,j=x.length,k,n;!R||(n=function(){clearTimeout(V),B.hide(),ba(i,J.onComplete)},m&&Q&&z.fadeIn(100),C.html(J.title).add(z).show(),j>1?(typeof J.current=="string"&&D.html(J.current.replace(/\{current\}/,P+1).replace(/\{total\}/,j)).show(),F[J.loop||P<j-1?"show":"hide"]().html(J.next),G[J.loop||P?"show":"hide"]().html(J.previous),b=P?x[P-1]:x[j-1],g=P<j-1?x[P+1]:x[0],J.slideshow&&E.show(),J.preloading&&(h=a.data(g,e).href||g.href,d=a.data(b,e).href||b.href,h=a.isFunction(h)?h.call(g):h,d=a.isFunction(d)?d.call(b):d,$(h)&&(a("<img/>")[0].src=h),$(d)&&(a("<img/>")[0].src=d))):I.hide(),J.iframe?(k=a("<iframe/>").addClass(f+"Iframe")[0],J.fastIframe?n():a(k).one("load",n),k.name=f+ +(new Date),k.src=J.href,J.scrolling||(k.scrolling="no"),m&&(k.frameBorder=0,k.allowTransparency="true"),a(k).appendTo(z).one(l,function(){k.src="//about:blank"})):n(),J.transition==="fade"?q.fadeTo(c,1,o):o(),y.bind("resize."+f,function(){W.position(0)}))})}function g(){J.h=J.h||z.height(),J.h=J.mh&&J.mh<J.h?J.mh:J.h;return J.h}function d(){J.w=J.w||z.width(),J.w=J.mw&&J.mw<J.w?J.mw:J.w;return J.w}if(!!R){var c=J.transition==="none"?0:J.speed;y.unbind("resize."+f),z.remove(),z=Y("LoadedContent").html(b),z.hide().appendTo(A.show()).css({width:d(),overflow:J.scrolling?"auto":"hidden"}).css({height:g()}).prependTo(s),A.hide(),a(Q).css({"float":"none"}),n&&a("select").not(q.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(j,function(){this.style.visibility="inherit"}),J.transition==="fade"?q.fadeTo(c,0,function(){h(0)}):h(c)}},W.load=function(b){var c,d,g=W.prep;S=!0,Q=!1,O=x[P],b||_(a.extend(J,a.data(O,e))),ba(l),ba(h,J.onLoad),J.h=J.height?Z(J.height,"y")-M-K:J.innerHeight&&Z(J.innerHeight,"y"),J.w=J.width?Z(J.width,"x")-N-L:J.innerWidth&&Z(J.innerWidth,"x"),J.mw=J.w,J.mh=J.h,J.maxWidth&&(J.mw=Z(J.maxWidth,"x")-N-L,J.mw=J.w&&J.w<J.mw?J.w:J.mw),J.maxHeight&&(J.mh=Z(J.maxHeight,"y")-M-K,J.mh=J.h&&J.h<J.mh?J.h:J.mh),c=J.href,V=setTimeout(function(){B.show()},100),J.inline?(Y().hide().insertBefore(a(c)[0]).one(l,function(){a(this).replaceWith(z.children())}),g(a(c))):J.iframe?g(" "):J.html?g(J.html):$(c)?(a(Q=new Image).addClass(f+"Photo").error(function(){J.title=!1,g(Y("Error").text("This image could not be loaded"))}).load(function(){var a;Q.onload=null,J.scalePhotos&&(d=function(){Q.height-=Q.height*a,Q.width-=Q.width*a},J.mw&&Q.width>J.mw&&(a=(Q.width-J.mw)/Q.width,d()),J.mh&&Q.height>J.mh&&(a=(Q.height-J.mh)/Q.height,d())),J.h&&(Q.style.marginTop=Math.max(J.h-Q.height,0)/2+"px"),x[1]&&(P<x.length-1||J.loop)&&(Q.style.cursor="pointer",Q.onclick=function(){W.next()}),m&&(Q.style.msInterpolationMode="bicubic"),setTimeout(function(){g(Q)},1)}),setTimeout(function(){Q.src=c},1)):c&&A.load(c,J.data,function(b,c,d){g(c==="error"?Y("Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!S&&x[1]&&(P<x.length-1||J.loop)&&(P=P<x.length-1?P+1:0,W.load())},W.prev=function(){!S&&x[1]&&(P||J.loop)&&(P=P?P-1:x.length-1,W.load())},W.close=function(){R&&!T&&(T=!0,R=!1,ba(j,J.onCleanup),y.unbind("."+f+" ."+o),p.fadeTo(200,0),q.stop().fadeTo(300,0,function(){q.add(p).css({opacity:1,cursor:"auto"}).hide(),ba(l),z.remove(),setTimeout(function(){T=!1,ba(k,J.onClosed)},1)}))},W.element=function(){return a(O)},W.settings=d,U=function(a){a.button!==0&&typeof a.button!="undefined"||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),bc(this))},a.fn.delegate?a(b).delegate("."+X,"click",U):a("."+X).live("click",U),a(W.init)})(jQuery,document,this)
