/*!
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2009 M. Alsup
 * Version: 2.72 (09-SEP-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.6 or later
 *
 * Originally based on the work of:
 *	1) Matt Oakes
 *	2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
 *	3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
 */
;(function($) {

var ver = '2.72';

// if $.support is not defined (pre jQuery 1.3) add what I need
if ($.support == undefined) {
	$.support = {
		opacity: !($.browser.msie)
	};
}

function debug(s) {
	if ($.fn.cycle.debug)
		log(s);
}		
function log() {
	if (window.console && window.console.log)
		window.console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
	//$('body').append('<div>'+Array.prototype.join.call(arguments,' ')+'</div>');
};

// the options arg can be...
//   a number  - indicates an immediate transition should occur to the given slide index
//   a string  - 'stop', 'pause', 'resume', or the name of a transition effect (ie, 'fade', 'zoom', etc)
//   an object - properties to control the slideshow
//
// the arg2 arg can be...
//   the name of an fx (only used in conjunction with a numeric value for 'options')
//   the value true (only used in conjunction with a options == 'resume') and indicates
//	 that the resume should occur immediately (not wait for next timeout)

$.fn.cycle = function(options, arg2) {
	var o = { s: this.selector, c: this.context };

	// in 1.3+ we can fix mistakes with the ready state
	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;
		}
		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
		return this;
	}

	// iterate the matched nodeset
	return this.each(function() {
		var opts = handleArguments(this, options, arg2);
		if (opts === false)
			return;

		// stop existing slideshow for this container (if there is one)
		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(opts2.currSlide, opts2.nextSlide, opts2, !opts2.rev);

		// if it's an auto slideshow, kick it off
		if (startTime) {
			startTime += (opts2.delay || 0);
			if (startTime < 10)
				startTime = 10;
			debug('first timeout: ' + startTime);
			this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts2.rev)}, startTime);
		}
	});
};

// process the args that were passed to the plugin fn
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 'stop':
			cont.cycleStop++; // callbacks look for change
			if (cont.cycleTimeout)
				clearTimeout(cont.cycleTimeout);
			cont.cycleTimeout = 0;
			$(cont).removeData('cycle.opts');
			return false;
		case 'pause':
			cont.cyclePause = 1;
			return false;
		case 'resume':
			cont.cyclePause = 0;
			if (arg2 === true) { // resume now!
				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, 1);
			}
			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) {
		// go to the requested slide
		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 removeFilter(el, opts) {
	if (!$.support.opacity && opts.cleartype && el.style.filter) {
		try { el.style.removeAttribute('filter'); }
		catch(smother) {} // handle old opera versions
	}
};

// one-time initialization
function buildOptions($cont, $slides, els, options, o) {
	// support metadata plugin (v1.0 and v2.0)
	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] : [];
	opts.after.unshift(function(){ opts.busy=0; });

	// push some after callbacks
	if (!$.support.opacity && opts.cleartype)
		opts.after.push(function() { removeFilter(this, opts); });
	if (opts.continuous)
		opts.after.push(function() { go(els,opts,0,!opts.rev); });

	saveOriginalOpts(opts);

	// clearType corrections
	if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
		clearTypeFix($slides);

	// container requires non-static position so that slides can be position within
	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);

	// if random, mix up the slide array
	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 = 0;
		opts.startingSlide = opts.randomMap[0];
	}
	else if (opts.startingSlide >= els.length)
		opts.startingSlide = 0; // catch bogus input
	opts.currSlide = opts.startingSlide = opts.startingSlide || 0;
	var first = opts.startingSlide;

	// set position and zIndex on all the slides
	$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
		var z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
		$(this).css('z-index', z)
	});

	// make sure first slide is visible
	$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
	removeFilter(els[first], opts);

	// stretch slides
	if (opts.fit && opts.width)
		$slides.width(opts.width);
	if (opts.fit && opts.height && opts.height != 'auto')
		$slides.height(opts.height);

	// stretch container
	var reshape = opts.containerResize && !$cont.innerHeight();
	if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
		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;
			if (!h) h = e.offsetHeight;
			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;

	// apparently a lot of people use image slideshows without height/width attributes on the images.
	// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
	var requeue = false;
	options.requeueAttempts = options.requeueAttempts || 0;
	$slides.each(function() {
		// try to get height/width of each slide
		var $el = $(this);
		this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
		this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();

		if ( $el.is('img') ) {
			// sigh..  sniffing, hacking, shrugging...  this crappy hack tries to account for what browsers do when
			// an image is being downloaded and the markup did not include sizing info (height/width attributes);
			// there seems to be some "default" sizes used in this situation
			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);
			// don't requeue for images that are still loading but have a valid size
			if (loadingIE || loadingFF || loadingOp || loadingOther) {
				if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
					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; // break each loop
				}
				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.animIn = opts.animIn || {};
	opts.animOut = opts.animOut || {};

	$slides.not(':eq('+first+')').css(opts.cssBefore);
	if (opts.cssFirst)
		$($slides[first]).css(opts.cssFirst);

	if (opts.timeout) {
		opts.timeout = parseInt(opts.timeout);
		// ensure that timeout and speed settings are sane
		if (opts.speed.constructor == String)
			opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
		if (!opts.sync)
			opts.speed = opts.speed / 2;
		while((opts.timeout - opts.speed) < 250) // sanitize timeout
			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) {
		opts.nextSlide = opts.currSlide;
		if (++opts.randomIndex == els.length)
			opts.randomIndex = 0;
		opts.nextSlide = opts.randomMap[opts.randomIndex];
	}
	else
		opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;

	// run transition init fn
	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;
		}
	}

	// fire artificial events
	var e0 = $slides[first];
	if (opts.before.length)
		opts.before[0].apply(e0, [e0, e0, opts, true]);
	if (opts.after.length > 1)
		opts.after[1].apply(e0, [e0, e0, opts, true]);

	if (opts.next)
		$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1)});
	if (opts.prev)
		$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1)});
	if (opts.pager)
		buildPager(els,opts);

	exposeAddSlide(opts, els);

	return opts;
};

// save off original opts so we can restore after clearing state
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;
	// look for multiple effects
	if (opts.fx.indexOf(',') > 0) {
		opts.multiFx = true;
		opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
		// discard any bogus effect names
		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 we have an empty list then we threw everything away!
		if (!opts.fxs.length) {
			log('No valid transitions named; slideshow terminating.');
			return false;
		}
	}
	else if (opts.fx == 'all') {  // auto-gen the list of transitions
		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) {
		// munge the fxs array to make effect selection random
		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;
};

// provide a mechanism for adding slides after the slideshow has started
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); // shuffle needs this
		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')
			$slides.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)
			$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);

		if ($.isFunction(opts.onAddSlide))
			opts.onAddSlide($s);
		else
			$s.hide(); // default behavior
	};
}

// reset internal state; we do this on every pass in order to support multiple effects
$.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); });

	// re-init
	var init = $.fn.cycle.transitions[fx];
	if ($.isFunction(init))
		init(opts.$cont, $(opts.elements), opts);
};

// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
function go(els, opts, manual, fwd) {
	// opts.busy is true if we're in the middle of an animation
	if (manual && opts.busy && opts.manualTrump) {
		// let manual transitions requests trump active ones
		$(els).stop(true,true);
		opts.busy = false;
	}
	// don't begin another timeout-based transition if there is one active
	if (opts.busy)
		return;

	var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];

	// stop cycling if we have an outstanding stop request
	if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
		return;

	// check to see if we should stop cycling based on autostop options
	if (!manual && !p.cyclePause &&
		((opts.autostop && (--opts.countdown <= 0)) ||
		(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
		if (opts.end)
			opts.end(opts);
		return;
	}

	// if slideshow is paused, only transition on a manual trigger
	if (manual || !p.cyclePause) {
		var fx = opts.fx;
		// keep trying to get the slide size if we don't have it yet
		curr.cycleH = curr.cycleH || $(curr).height();
		curr.cycleW = curr.cycleW || $(curr).width();
		next.cycleH = next.cycleH || $(next).height();
		next.cycleW = next.cycleW || $(next).width();

		// support multiple transition types
		if (opts.multiFx) {
			if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length)
				opts.lastFx = 0;
			fx = opts.fxs[opts.lastFx];
			opts.currFx = fx;
		}

		// one-time fx overrides apply to:  $('div').cycle(3,'zoom');
		if (opts.oneTimeFx) {
			fx = opts.oneTimeFx;
			opts.oneTimeFx = null;
		}

		$.fn.cycle.resetState(opts, fx);

		// run the before callbacks
		if (opts.before.length)
			$.each(opts.before, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});

		// stage the after callacks
		var after = function() {
			$.each(opts.after, function(i,o) {
				if (p.cycleStop != opts.stopCount) return;
				o.apply(next, [curr, next, opts, fwd]);
			});
		};

		if (opts.nextSlide != opts.currSlide) {
			// get ready to perform the transition
			opts.busy = 1;
			if (opts.fxFn) // fx function provided?
				opts.fxFn(curr, next, opts, after, fwd);
			else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
				$.fn.cycle[opts.fx](curr, next, opts, after);
			else
				$.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent);
		}

		// calculate the next slide
		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];
		}
		else { // sequence
			var roll = (opts.nextSlide + 1) == els.length;
			opts.nextSlide = roll ? 0 : opts.nextSlide+1;
			opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
		}

		if (opts.pager)
			$.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide);
	}

	// stage the next transtion
	var ms = 0;
	if (opts.timeout && !opts.continuous)
		ms = getTimeout(curr, next, opts, fwd);
	else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
		ms = 10;
	if (ms > 0)
		p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.rev) }, ms);
};

// invoked after transition
$.fn.cycle.updateActivePagerLink = function(pager, currSlide) {
	$(pager).find('a').removeClass('activeSlide').filter('a:eq('+currSlide+')').addClass('activeSlide');
};

// calculate timeout value for current transition
function getTimeout(curr, next, opts, fwd) {
	if (opts.timeoutFn) {
		// call user provided calc fn
		var t = opts.timeoutFn(curr,next,opts,fwd);
		while ((t - opts.speed) < 250) // sanitize timeout
			t += opts.speed;
		debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
		if (t !== false)
			return t;
	}
	return opts.timeout;
};

// expose next/prev function, caller must pass in state
$.fn.cycle.next = function(opts) { advance(opts, opts.rev?-1:1); };
$.fn.cycle.prev = function(opts) { advance(opts, opts.rev?1:-1);};

// advance slide forward or back
function advance(opts, val) {
	var els = opts.elements;
	var p = opts.$cont[0], timeout = p.cycleTimeout;
	if (timeout) {
		clearTimeout(timeout);
		p.cycleTimeout = 0;
	}
	if (opts.random && val < 0) {
		// move back to the previously display slide
		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) {
		if (++opts.randomIndex == els.length)
			opts.randomIndex = 0;
		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;
		}
	}

	if ($.isFunction(opts.prevNextClick))
		opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]);
	go(els, opts, 1, val>=0);
	return false;
};

function buildPager(els, opts) {
	var $p = $(opts.pager);
	$.each(els, function(i,o) {
		$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
	});
   $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide);
};

$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
	var a;
	if ($.isFunction(opts.pagerAnchorBuilder))
		a = opts.pagerAnchorBuilder(i,el);
	else
		a = '<a href="#">'+(i+1)+'</a>';
		
	if (!a)
		return;
	var $a = $(a);
	// don't reparent if anchor is in the dom
	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);
			});
			$a = $(arr);
		}
		else {
			$a.appendTo($p);
		}
	}

	$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;
		}
		if ($.isFunction(opts.pagerClick))
			opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
		go(els,opts,1,opts.currSlide < i); // trigger the trans
		return false;
	});
	
	if (opts.pagerEvent != 'click')
		$a.click(function(){return false;}); // supress click
	
	if (opts.pauseOnPagerHover)
		$a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; } );
};

// helper fn to calculate the number of slides between the current and the next
$.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;
};

// fix clearType problems in ie6 by setting an explicit bg color
// (otherwise text slides look horrible during a fade transition)
function clearTypeFix($slides) {
	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.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)); });
};

// reset common props before the next transition
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
	$(opts.elements).not(curr).hide();
	opts.cssBefore.opacity = 1;
	opts.cssBefore.display = 'block';
	if (w !== false && next.cycleW > 0)
		opts.cssBefore.width = next.cycleW;
	if (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));
};

// the actual fn for effecting a transition
$.fn.cycle.custom = function(curr, next, opts, cb, 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, cb)};
	$l.animate(opts.animOut, speedOut, easeOut, function() {
		if (opts.cssAfter) $l.css(opts.cssAfter);
		if (!opts.sync) fn();
	});
	if (opts.sync) fn();
};

// transition definitions - only fade is defined here, transition pack defines the rest
$.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; };

// override these globally if you like (they are all optional)
$.fn.cycle.defaults = {
	fx:			  'fade', // name of transition effect (or comma separated names, ex: fade,scrollUp,shuffle)
	timeout:	   4000,  // milliseconds between slide transitions (0 to disable auto advance)
	timeoutFn:	 null,  // callback for determining per-slide timeout value:  function(currSlideElement, nextSlideElement, options, forwardFlag)
	continuous:	   0,	  // true to start next transition immediately after current one completes
	speed:		   1000,  // speed of the transition (any valid fx speed value)
	speedIn:	   null,  // speed of the 'in' transition
	speedOut:	   null,  // speed of the 'out' transition
	next:		   null,  // selector for element to use as click trigger for next slide
	prev:		   null,  // selector for element to use as click trigger for previous slide
	prevNextClick: null,  // callback fn for prev/next clicks:	function(isNext, zeroBasedSlideIndex, slideElement)
	prevNextEvent:'click',// event which drives the manual transition to the previous or next slide
	pager:		   null,  // selector for element to use as pager container
	pagerClick:	   null,  // callback fn for pager clicks:	function(zeroBasedSlideIndex, slideElement)
	pagerEvent:	  'click', // name of event which drives the pager navigation
	pagerAnchorBuilder: null, // callback fn for building anchor links:  function(index, DOMelement)
	before:		   null,  // transition callback (scope set to element to be shown):	 function(currSlideElement, nextSlideElement, options, forwardFlag)
	after:		   null,  // transition callback (scope set to element that was shown):  function(currSlideElement, nextSlideElement, options, forwardFlag)
	end:		   null,  // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
	easing:		   null,  // easing method for both in and out transitions
	easeIn:		   null,  // easing for "in" transition
	easeOut:	   null,  // easing for "out" transition
	shuffle:	   null,  // coords for shuffle animation, ex: { top:15, left: 200 }
	animIn:		   null,  // properties that define how the slide animates in
	animOut:	   null,  // properties that define how the slide animates out
	cssBefore:	   null,  // properties that define the initial state of the slide before transitioning in
	cssAfter:	   null,  // properties that defined the state of the slide after transitioning out
	fxFn:		   null,  // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
	height:		  'auto', // container height
	startingSlide: 0,	  // zero-based index of the first slide to be displayed
	sync:		   1,	  // true if in/out transitions should occur simultaneously
	random:		   0,	  // true for random, false for sequence (not applicable to shuffle fx)
	fit:		   0,	  // force slides to fit container
	containerResize: 1,	  // resize container to fit largest slide
	pause:		   0,	  // true to enable "pause on hover"
	pauseOnPagerHover: 0, // true to pause when hovering over pager link
	autostop:	   0,	  // true to end slideshow after X transitions (where X == slide count)
	autostopCount: 0,	  // number of transitions (optionally used with autostop to define X)
	delay:		   0,	  // additional delay (in ms) for first transition (hint: can be negative)
	slideExpr:	   null,  // expression for selecting slides (if something other than all children is required)
	cleartype:	   !$.support.opacity,  // true if clearType corrections should be applied (for IE)
	cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
	nowrap:		   0,	  // true to prevent slideshow from wrapping
	fastOnEvent:   0,	  // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
	randomizeEffects: 1,  // valid when multiple effects are used; true to make the effect sequence random
	rev:		   0,	 // causes animations to transition in reverse
	manualTrump:   true,  // causes manual transition to stop an active transition instead of being ignored
	requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
	requeueTimeout: 250   // ms delay for requeue
};

})(jQuery);


/*!
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version:	 2.72
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($) {

//
// These functions define one-time slide initialization for the named
// transitions. To save file size feel free to remove any of these that you
// don't need.
//
$.fn.cycle.transitions.none = function($cont, $slides, opts) {
	opts.fxFn = function(curr,next,opts,after){
		$(next).show();
		$(curr).hide();
		after();
	};
}

// scrollUp/Down/Left/Right
$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var h = $cont.height();
	opts.cssBefore ={ top: h, left: 0 };
	opts.cssFirst = { top: 0 };
	opts.animIn	  = { top: 0 };
	opts.animOut  = { top: -h };
};
$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var h = $cont.height();
	opts.cssFirst = { top: 0 };
	opts.cssBefore= { top: -h, left: 0 };
	opts.animIn	  = { top: 0 };
	opts.animOut  = { top: h };
};
$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var w = $cont.width();
	opts.cssFirst = { left: 0 };
	opts.cssBefore= { left: w, top: 0 };
	opts.animIn	  = { left: 0 };
	opts.animOut  = { left: 0-w };
};
$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push($.fn.cycle.commonReset);
	var w = $cont.width();
	opts.cssFirst = { left: 0 };
	opts.cssBefore= { left: -w, top: 0 };
	opts.animIn	  = { left: 0 };
	opts.animOut  = { left: w };
};
$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
	$cont.css('overflow','hidden').width();
	opts.before.push(function(curr, next, opts, fwd) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
		opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
	});
	opts.cssFirst = { left: 0 };
	opts.cssBefore= { top: 0 };
	opts.animIn   = { left: 0 };
	opts.animOut  = { top: 0 };
};
$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
	$cont.css('overflow','hidden');
	opts.before.push(function(curr, next, opts, fwd) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
		opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
	});
	opts.cssFirst = { top: 0 };
	opts.cssBefore= { left: 0 };
	opts.animIn   = { top: 0 };
	opts.animOut  = { left: 0 };
};

// slideX/slideY
$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$(opts.elements).not(curr).hide();
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.animIn.width = next.cycleW;
	});
	opts.cssBefore = { left: 0, top: 0, width: 0 };
	opts.animIn	 = { width: 'show' };
	opts.animOut = { width: 0 };
};
$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$(opts.elements).not(curr).hide();
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.animIn.height = next.cycleH;
	});
	opts.cssBefore = { left: 0, top: 0, height: 0 };
	opts.animIn	 = { height: 'show' };
	opts.animOut = { height: 0 };
};

// shuffle
$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
	var i, w = $cont.css('overflow', 'visible').width();
	$slides.css({left: 0, top: 0});
	opts.before.push(function(curr,next,opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
	});
	// only adjust speed once!
	if (!opts.speedAdjusted) {
		opts.speed = opts.speed / 2; // shuffle has 2 transitions
		opts.speedAdjusted = true;
	}
	opts.random = 0;
	opts.shuffle = opts.shuffle || {left:-w, top:15};
	opts.els = [];
	for (i=0; i < $slides.length; i++)
		opts.els.push($slides[i]);

	for (i=0; i < opts.currSlide; i++)
		opts.els.push(opts.els.shift());

	// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
	opts.fxFn = function(curr, next, opts, cb, fwd) {
		var $el = fwd ? $(curr) : $(next);
		$(next).css(opts.cssBefore);
		var count = opts.slideCount;
		$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
			var hops = $.fn.cycle.hopsFromLast(opts, fwd);
			for (var k=0; k < hops; k++)
				fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
			if (fwd) {
				for (var i=0, len=opts.els.length; i < len; i++)
					$(opts.els[i]).css('z-index', len-i+count);
			}
			else {
				var z = $(curr).css('z-index');
				$el.css('z-index', parseInt(z)+1+count);
			}
			$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
				$(fwd ? this : curr).hide();
				if (cb) cb();
			});
		});
	};
	opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
};

// turnUp/Down/Left/Right
$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.cssBefore.top = next.cycleH;
		opts.animIn.height = next.cycleH;
	});
	opts.cssFirst  = { top: 0 };
	opts.cssBefore = { left: 0, height: 0 };
	opts.animIn	   = { top: 0 };
	opts.animOut   = { height: 0 };
};
$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssFirst  = { top: 0 };
	opts.cssBefore = { left: 0, top: 0, height: 0 };
	opts.animOut   = { height: 0 };
};
$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.cssBefore.left = next.cycleW;
		opts.animIn.width = next.cycleW;
	});
	opts.cssBefore = { top: 0, width: 0  };
	opts.animIn	   = { left: 0 };
	opts.animOut   = { width: 0 };
};
$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.animIn.width = next.cycleW;
		opts.animOut.left = curr.cycleW;
	});
	opts.cssBefore = { top: 0, left: 0, width: 0 };
	opts.animIn	   = { left: 0 };
	opts.animOut   = { width: 0 };
};

// zoom
$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,false,true);
		opts.cssBefore.top = next.cycleH/2;
		opts.cssBefore.left = next.cycleW/2;
		opts.animIn	   = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
		opts.animOut   = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 };
	});
	opts.cssFirst = { top:0, left: 0 };
	opts.cssBefore = { width: 0, height: 0 };
};

// fadeZoom
$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,false);
		opts.cssBefore.left = next.cycleW/2;
		opts.cssBefore.top = next.cycleH/2;
		opts.animIn	= { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
	});
	opts.cssBefore = { width: 0, height: 0 };
	opts.animOut  = { opacity: 0 };
};

// blindX
$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
	var w = $cont.css('overflow','hidden').width();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.width = next.cycleW;
		opts.animOut.left   = curr.cycleW;
	});
	opts.cssBefore = { left: w, top: 0 };
	opts.animIn = { left: 0 };
	opts.animOut  = { left: w };
};
// blindY
$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
	var h = $cont.css('overflow','hidden').height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssBefore = { top: h, left: 0 };
	opts.animIn = { top: 0 };
	opts.animOut  = { top: h };
};
// blindZ
$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
	var h = $cont.css('overflow','hidden').height();
	var w = $cont.width();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		opts.animIn.height = next.cycleH;
		opts.animOut.top   = curr.cycleH;
	});
	opts.cssBefore = { top: h, left: w };
	opts.animIn = { top: 0, left: 0 };
	opts.animOut  = { top: h, left: w };
};

// growX - grow horizontally from centered 0 width
$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true);
		opts.cssBefore.left = this.cycleW/2;
		opts.animIn = { left: 0, width: this.cycleW };
		opts.animOut = { left: 0 };
	});
	opts.cssBefore = { width: 0, top: 0 };
};
// growY - grow vertically from centered 0 height
$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false);
		opts.cssBefore.top = this.cycleH/2;
		opts.animIn = { top: 0, height: this.cycleH };
		opts.animOut = { top: 0 };
	});
	opts.cssBefore = { height: 0, left: 0 };
};

// curtainX - squeeze in both edges horizontally
$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,false,true,true);
		opts.cssBefore.left = next.cycleW/2;
		opts.animIn = { left: 0, width: this.cycleW };
		opts.animOut = { left: curr.cycleW/2, width: 0 };
	});
	opts.cssBefore = { top: 0, width: 0 };
};
// curtainY - squeeze in both edges vertically
$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,false,true);
		opts.cssBefore.top = next.cycleH/2;
		opts.animIn = { top: 0, height: next.cycleH };
		opts.animOut = { top: curr.cycleH/2, height: 0 };
	});
	opts.cssBefore = { left: 0, height: 0 };
};

// cover - curr slide covered by next slide
$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
	var d = opts.direction || 'left';
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts);
		if (d == 'right')
			opts.cssBefore.left = -w;
		else if (d == 'up')
			opts.cssBefore.top = h;
		else if (d == 'down')
			opts.cssBefore.top = -h;
		else
			opts.cssBefore.left = w;
	});
	opts.animIn = { left: 0, top: 0};
	opts.animOut = { opacity: 1 };
	opts.cssBefore = { top: 0, left: 0 };
};

// uncover - curr slide moves off next slide
$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
	var d = opts.direction || 'left';
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
		if (d == 'right')
			opts.animOut.left = w;
		else if (d == 'up')
			opts.animOut.top = -h;
		else if (d == 'down')
			opts.animOut.top = h;
		else
			opts.animOut.left = -w;
	});
	opts.animIn = { left: 0, top: 0 };
	opts.animOut = { opacity: 1 };
	opts.cssBefore = { top: 0, left: 0 };
};

// toss - move top slide and fade away
$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
	var w = $cont.css('overflow','visible').width();
	var h = $cont.height();
	opts.before.push(function(curr, next, opts) {
		$.fn.cycle.commonReset(curr,next,opts,true,true,true);
		// provide default toss settings if animOut not provided
		if (!opts.animOut.left && !opts.animOut.top)
			opts.animOut = { left: w*2, top: -h/2, opacity: 0 };
		else
			opts.animOut.opacity = 0;
	});
	opts.cssBefore = { left: 0, top: 0 };
	opts.animIn = { left: 0 };
};

// wipe - clip animation
$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
	var w = $cont.css('overflow','hidden').width();
	var h = $cont.height();
	opts.cssBefore = opts.cssBefore || {};
	var clip;
	if (opts.clip) {
		if (/l2r/.test(opts.clip))
			clip = 'rect(0px 0px '+h+'px 0px)';
		else if (/r2l/.test(opts.clip))
			clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
		else if (/t2b/.test(opts.clip))
			clip = 'rect(0px '+w+'px 0px 0px)';
		else if (/b2t/.test(opts.clip))
			clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
		else if (/zoom/.test(opts.clip)) {
			var top = parseInt(h/2);
			var left = parseInt(w/2);
			clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
		}
	}

	opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';

	var d = opts.cssBefore.clip.match(/(\d+)/g);
	var t = parseInt(d[0]), r = parseInt(d[1]), b = parseInt(d[2]), l = parseInt(d[3]);

	opts.before.push(function(curr, next, opts) {
		if (curr == next) return;
		var $curr = $(curr), $next = $(next);
		$.fn.cycle.commonReset(curr,next,opts,true,true,false);
		opts.cssAfter.display = 'block';

		var step = 1, count = parseInt((opts.speedIn / 13)) - 1;
		(function f() {
			var tt = t ? t - parseInt(step * (t/count)) : 0;
			var ll = l ? l - parseInt(step * (l/count)) : 0;
			var bb = b < h ? b + parseInt(step * ((h-b)/count || 1)) : h;
			var rr = r < w ? r + parseInt(step * ((w-r)/count || 1)) : w;
			$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
			(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
		})();
	});
	opts.cssBefore = { display: 'block', opacity: 1, top: 0, left: 0 };
	opts.animIn	   = { left: 0 };
	opts.animOut   = { left: 0 };
};

})(jQuery);

/* ------------------------------------------------------------------------
 * Class: prettyLoader
 * Use: A unified solution for AJAX loader
 * Author: Stephane Caron (http://www.no-margin-for-errors.com)
 * Version: 1.0.1
 * ------------------------------------------------------------------------- */

(function($){$.prettyLoader={version:'1.0.1'};$.prettyLoader=function(settings){settings=jQuery.extend({animation_speed:'fast',bind_to_ajax:true,delay:false,loader:'/images/prettyLoader/ajax-loader.gif',offset_top:13,offset_left:10},settings);scrollPos=_getScroll();imgLoader=new Image();imgLoader.onerror=function(){alert('Preloader image cannot be loaded. Make sure the path is correct in the settings and that the image is reachable.');};imgLoader.src=settings.loader;if(settings.bind_to_ajax)
jQuery(document).ajaxStart(function(){$.prettyLoader.show()}).ajaxStop(function(){$.prettyLoader.hide()});$.prettyLoader.positionLoader=function(e){e=e?e:window.event;cur_x=(e.clientX)?e.clientX:cur_x;cur_y=(e.clientY)?e.clientY:cur_y;left_pos=cur_x+settings.offset_left+scrollPos['scrollLeft'];top_pos=cur_y+settings.offset_top+scrollPos['scrollTop'];$('.prettyLoader').css({'top':top_pos,'left':left_pos});}
$.prettyLoader.show=function(delay){if($('.prettyLoader').size()>0)return;scrollPos=_getScroll();$('<div></div>').addClass('prettyLoader').addClass('prettyLoader_'+settings.theme).appendTo('body').hide();if($.browser.msie&&$.browser.version==6)
$('.prettyLoader').addClass('pl_ie6');$('<img />').attr('src',settings.loader).appendTo('.prettyLoader');$('.prettyLoader').fadeIn(settings.animation_speed);$(document).bind('click',$.prettyLoader.positionLoader);$(document).bind('mousemove',$.prettyLoader.positionLoader);$(window).scroll(function(){scrollPos=_getScroll();$(document).triggerHandler('mousemove');});delay=(delay)?delay:settings.delay;if(delay){setTimeout(function(){$.prettyLoader.hide()},delay);}};$.prettyLoader.hide=function(){$(document).unbind('click',$.prettyLoader.positionLoader);$(document).unbind('mousemove',$.prettyLoader.positionLoader);$(window).unbind('scroll');$('.prettyLoader').fadeOut(settings.animation_speed,function(){$(this).remove();});};function _getScroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};return this;};})(jQuery);


if(typeof window.console==="undefined")window.console={};
if(typeof window.console.emulated==="undefined"){if(typeof window.console.log==="function")window.console.hasLog=true;else{if(typeof window.console.log==="undefined")window.console.log=function(){};window.console.hasLog=false}if(typeof window.console.debug==="function")window.console.hasDebug=true;else{if(typeof window.console.debug==="undefined")window.console.debug=!window.console.hasLog?function(){}:function(){for(var c=["console.debug:"],a=0;a<arguments.length;a++)c.push(arguments[a]);window.console.log.apply(window.console,
c)};window.console.hasDebug=false}if(typeof window.console.warn==="function")window.console.hasWarn=true;else{if(typeof window.console.warn==="undefined")window.console.warn=!window.console.hasLog?function(){}:function(){for(var c=["console.warn:"],a=0;a<arguments.length;a++)c.push(arguments[a]);window.console.log.apply(window.console,c)};window.console.hasWarn=false}if(typeof window.console.error==="function")window.console.hasError=true;else{if(typeof window.console.error==="undefined")window.console.error=
function(){var c="An error has occured.";if(window.console.hasLog){c=["console.error:"];for(var a=0;a<arguments.length;a++)c.push(arguments[a]);window.console.log.apply(window.console,c);c="An error has occured. More information is available in your browser's javascript console."}for(a=0;a<arguments.length;++a){if(typeof arguments[a]!=="string")break;c+="\n"+arguments[a]}if(typeof Error!=="undefined")throw Error(c);else throw c;};window.console.hasError=false}if(typeof window.console.trace==="function")window.console.hasTrace=
true;else{if(typeof window.console.trace==="undefined")window.console.trace=function(){window.console.error("console.trace does not exist")};window.console.hasTrace=false}window.console.emulated=true}String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.strip=String.prototype.strip||function(c,a){c=String(c);var b=this;if(c.length){a||0||(c=c.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));b=b.replace(eval("/^"+c+"+|"+c+"+$/g"),"")}return String(b)};
String.prototype.stripLeft=String.prototype.stripLeft||function(c,a){c=String(c);var b=this;if(c.length){a||0||(c=c.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));b=b.replace(eval("/^"+c+"+/g"),"")}return String(b)};String.prototype.stripRight=String.prototype.stripRight||function(c,a){c=String(c);var b=this;if(c.length){a||0||(c=c.replace(/([\[\]\(\)\^\$\.\?\|\/\\])/g,"\\$1"));b=b.replace(eval("/"+c+"+$/g"),"")}return String(b)};
String.prototype.toInt=String.prototype.toInt||function(){return parseInt(this,10)};String.prototype.wrap=String.prototype.wrap||function(c,a){return c+this+a};String.prototype.wrapSelection=String.prototype.wrapSelection||function(c,a,b,d){if(typeof b==="undefined"||b===null)b=this.length;if(typeof d==="undefined"||d===null)d=this.length;return this.substring(0,b)+c+this.substring(b,d)+a+this.substring(d)};
String.prototype.toSlug=String.prototype.toSlug||function(){return this.toLowerCase().replace(/[\s_]/g,"-").replace(/[^-a-z0-9]/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")};
String.prototype.queryStringToJSON=String.prototype.queryStringToJSON||function(){var c=String(this);c=c.substring(c.indexOf("?")+1);c=c.replace(/\+/g,"%20");if(c.substring(0,1)==="{"&&c.substring(c.length-1)==="}")return eval(decodeURIComponent(c));c=c.split(/\&(amp\;)?/);for(var a={},b=0,d=c.length;b<d;++b){var e=c[b]||null;if(e!==null){e=e.split("=");if(e!==null){var f=e[0]||null;if(f!==null)if(typeof e[1]!=="undefined"){e=e[1];f=decodeURIComponent(f);e=decodeURIComponent(e);try{e=eval(e)}catch(g){}var h=
f.split(".");if(h.length===1)a[f]=e;else{var i="",j="";$.each(h,function(n,m){i+='["'+m.replace(/"/g,'\\"')+'"]';jsonCLOSUREGLOBAL=a;j="if ( typeof jsonCLOSUREGLOBAL"+i+' === "undefined" ) jsonCLOSUREGLOBAL'+i+" = {}";eval(j);a=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL});jsonCLOSUREGLOBAL=a;valueCLOSUREGLOBAL=e;j="jsonCLOSUREGLOBAL"+i+" = valueCLOSUREGLOBAL";eval(j);a=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL;delete valueCLOSUREGLOBAL}}}}}return a};
(function(c){c.fn.binder=c.fn.binder||function(a,b,d){var e=c(this);if(d)e.bind(a,b,d);else{d=b;e.bind(a,d)}return e};c.fn.once=c.fn.once||function(a,b,d){var e=c(this);if(d){e.unbind(a,d);e.bind(a,b,d)}else{d=b;e.unbind(a,d);e.bind(a,d)}return e};c.fn.enter=c.fn.enter||function(a,b){return c(this).binder("enter",a,b)};c.event.special.enter=c.event.special.enter||{setup:function(){c(this).bind("keypress",c.event.special.enter.handler)},teardown:function(){c(this).unbind("keypress",c.event.special.enter.handler)},
handler:function(a){c(this);if(a.keyCode===13){a.type="enter";c.event.handle.apply(this,[a]);return true}}};c.fn.cancel=c.fn.cancel||function(a,b){return c(this).binder("cancel",a,b)};c.event.special.cancel=c.event.special.cancel||{setup:function(){c(this).bind("keyup",c.event.special.cancel.handler)},teardown:function(){c(this).unbind("keyup",c.event.special.cancel.handler)},handler:function(a){c(this);var b=a.keyCode===27;if((typeof a.DOM_VK_ESCAPE==="undefined"?false:a.DOM_VK_ESCAPE)||b){a.type=
"cancel";c.event.handle.apply(this,[a]);return true}}};c.fn.lastclick=c.fn.lastclick||function(a,b){return c(this).binder("lastclick",a,b)};c.event.special.lastclick=c.event.special.lastclick||{setup:function(){c(this).bind("click",c.event.special.lastclick.handler)},teardown:function(){c(this).unbind("click",c.event.special.lastclick.handler)},handler:function(a){var b=function(){var d=c(this),e=d.data("lastclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("lastclick-timeout",e)};(function(d){var e=
this;b.call(e);var f=c(e);f.data("lastclick-clicks",(f.data("lastclick-clicks")||0)+1);var g=setTimeout(function(){var h=f.data("lastclick-clicks");b.apply(e,[d]);f.data("lastclick-clicks",0);d.type="lastclick";c.event.handle.apply(e,[d,h])},500);f.data("lastclick-timeout",g)}).apply(this,[a])}};c.fn.firstclick=c.fn.firstclick||function(a,b){return c(this).binder("firstclick",a,b)};c.event.special.firstclick=c.event.special.firstclick||{setup:function(){c(this).bind("click",c.event.special.firstclick.handler)},
teardown:function(){c(this).unbind("click",c.event.special.firstclick.handler)},handler:function(a){var b=function(){var d=c(this),e=d.data("firstclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("firstclick-timeout",e)};(function(d){var e=this;b.call(e);var f=c(e);f.data("firstclick-clicks",(f.data("firstclick-clicks")||0)+1);if(f.data("firstclick-clicks")===1){d.type="firstclick";c.event.handle.apply(e,[d])}var g=setTimeout(function(){b.apply(e,[d]);f.data("firstclick-clicks",0)},500);f.data("firstclick-timeout",
g)}).apply(this,[a])}};c.fn.singleclick=c.fn.singleclick||function(a,b){return c(this).binder("singleclick",a,b)};c.event.special.singleclick=c.event.special.singleclick||{setup:function(){c(this).bind("click",c.event.special.singleclick.handler)},teardown:function(){c(this).unbind("click",c.event.special.singleclick.handler)},handler:function(a){var b=function(){var d=c(this),e=d.data("singleclick-timeout")||false;e&&clearTimeout(e);e=false;d.data("singleclick-timeout",e)};(function(d){var e=this;
b.call(e);var f=c(e);f.data("singleclick-clicks",(f.data("singleclick-clicks")||0)+1);var g=setTimeout(function(){var h=f.data("singleclick-clicks");b.apply(e,[d]);f.data("singleclick-clicks",0);if(h===1){d.type="singleclick";c.event.handle.apply(e,[d])}},500);f.data("singleclick-timeout",g)}).apply(this,[a])}}})(jQuery);
(function(c){c.fn.opacityFix=c.fn.opacityFix||function(){var a=c(this),b=a.css("background-color");if(b&&b!=="rgba(0, 0, 0, 0)")return this;for(var d=a;d.inDOM();){d=d.parent();if((b=d.css("background-color"))&&b!=="rgba(0, 0, 0, 0)"){a.css("background-color",b);break}}return this};c.fn.parentsAndSelf=c.fn.parentsAndSelf||function(a){return c(this).parents(a).andSelf().filter(a)};c.fn.findAndSelf=c.fn.findAndSelf||function(a){return c(this).find(a).andSelf().filter(a)};c.fn.firstInput=c.fn.firstInput||
function(){return c(this).findAndSelf(":input").filter(":first")};c.fn.choose=c.fn.choose||function(a){var b=c(this);if(typeof a==="undefined")a=b.val();else if(b.val()!==a)return this;switch(true){case this.is("option"):b.parents("select:first").choose(a);break;case b.is(":checkbox"):b.attr("checked",true);break;case b.is(":radio"):b.attr("checked",true);break;case b.is("select"):b.val(a);break;default:break}return this};c.fn.unchoose=c.fn.unchoose||function(){var a=c(this);switch(true){case a.is("option"):a.parents(":select:first").unchoose();
break;case a.is(":checkbox"):a.attr("checked",false);break;case a.is(":radio"):a.attr("checked",false);break;case a.is("select"):a.val(a.find("option:first").val());break;default:break}return this};c.fn.wouldSubmit=c.fn.wouldSubmit||function(){var a=c(this).findAndSelf(":input"),b=true;if(!a.length||!(a.attr("name")||0)||a.is(":radio,:checkbox")&&!a.is(":selected,:checked"))b=false;return b};c.fn.values=c.fn.values||function(){var a={};c(this).findAndSelf(":input").each(function(){var b=c(this),d=
b.attr("name")||null,e=b.val();if(!b.wouldSubmit())return true;if(d.indexOf("[]")!==-1){if(typeof a[d]==="undefined")a[d]=[];a[d].push(e)}else a[d]=e});return a};c.fn.submitForm=c.fn.submitForm||function(){var a=c(this);a.parentsAndSelf("form:first").trigger("submit");return a};c.fn.inDOM=c.fn.inDOM||function(){var a=c(this).parent().parent();return a.size()&&(a.height()||a.width())};c.fn.valWrap=c.fn.valWrap||function(a,b){var d=c(this);return d.val(d.val().wrap(a,b))};c.fn.valWrapSelection=c.fn.valWrapSelection||
function(a,b,d,e){var f=c(this),g=f.get(0);a=a||"";b=b||"";if(d||e)f.val(f.val().wrapSelection(a,b,d,e));else{d=g.selectionStart;e=g.selectionEnd;if(document.selection){g.focus();d=document.selection.createRange();d.text=a+d.text+b}else{var h=g.scrollTop;f.val(f.val().wrapSelection(a,b,d,e));g.focus();g.selectionStart=d+a.length;g.selectionEnd=e+a.length;g.scrollTop=h}}return f};c.fn.giveFocus=c.fn.giveFocus||function(){c(this).findAndSelf(":input:visible:first").focus();return this};c.fn.giveTarget=
c.fn.giveTarget||function(){var a=c(this);c(".target").removeClass("target");a.addClass("target");return this};c.fn.highlight=c.fn.highlight||function(a){return c(this).effect("highlight",{},a||3E3)};c.fn.htmlAndSelf=c.fn.htmlAndSelf||function(){return c(this).attr("outerHTML")};c.fn.preventDefaultOnClick=c.fn.preventDefaultOnClick||function(){return c(this).click(function(a){a.preventDefault();return false})};c.fn.attemptTypeChangeTo=c.fn.attemptTypeChangeTo||function(a){var b=c(this),d=false,e=
b.get(0),f=e.type;if(a===f)d=true;else if(b.is("input"))if(!c.browser.msie){e.type=a;if(e.type!==f)d=true}return d}})(jQuery);
(function(c){c.prepareObject=c.prepareObject||function(a,b){var d={};c.extend(d,a||{});c.intercept(true,d,b);var e=arguments;e[0]=e[1]="$.prepareObject.skipValue";c.each(e,function(f,g){if(g==="$.prepareObject.skipValue")return true;c.intercept(true,d,g)});return d};c.intercept=c.intercept||function(){var a=arguments,b,d=false,e=false;if(typeof a[0]==="boolean"){d=a[0];a[0]="$.intercept.skipValue";if(typeof a[1]==="boolean"){e=a[1];a[1]="$.intercept.skipValue";if(e)b={};else{b=a[2];a[2]="$.intercept.skipValue"}}else{b=
a[1];a[1]="$.intercept.skipValue"}}else{b=a[0];a[0]="$.intercept.skipValue"}var f={};c.each(b,function(g){f[g]=true});d?c.each(a,function(g,h){if(h==="$.intercept.skipValue")return true;c.each(h,function(i,j){if(typeof f[i]==="undefined")return true;if(typeof j==="object"&&!(j.test||0))c.extend(b[i],j||{});else b[i]=j})}):c.each(a,function(g,h){c.each(h,function(i,j){if(typeof f[i]==="undefined")return true;if(typeof j==="object"&&!(j.test||0))c.intercept(true,b[i],j);else b[i]=j})});return b};c.promise=
c.promise||function(a){var b=a.object||this;if(typeof b[a.handlers]==="undefined")b[a.handlers]=[];if(typeof b[a.flag]==="undefined")b[a.flag]=false;var d=b[a.handlers],e=b[a.flag],f=a.arguments[0];switch(typeof f){case "boolean":e=b[a.flag]=f;case "undefined":if(e&&d.length){c.each(d,function(g,h){h.call(b)});b[a.handlers]=[]}break;case "function":e?f.call(b):b[a.handlers].push(f);break;default:window.console.error("Unknown arguments for $.promise",[this,arguments]);break}return e}})(jQuery);
(function(c){if(c.ScrollTo)window.console.warn("$.ScrollTo has already been defined...");else{c.ScrollTo={config:{duration:400,easing:"swing",callback:undefined,durationMode:"each"},configure:function(a){c.extend(c.ScrollTo.config,a||{});return this},scroll:function(a,b){var d=c.ScrollTo,e=a.pop(),f=e.$container,g=e.$target;e=c("<span/>").css({position:"absolute",top:"0px",left:"0px"});var h=f.css("position");f.css("position","relative");e.appendTo(f);var i=e.offset().top;g=g.offset().top-i;e.remove();
f.css("position",h);f.animate({scrollTop:g+"px"},b.duration,b.easing,function(j){if(a.length===0)typeof b.callback==="function"&&b.callback.apply(this,[j]);else d.scroll(a,b);return true});return true},fn:function(a){var b=c.ScrollTo,d=c(this);if(d.length===0)return this;var e=d.parent(),f=[];for(config=c.extend({},b.config,a);e.length===1&&!e.is("body");){a=e.get(0);if(e.css("overflow-y")!=="visible"&&a.scrollHeight!==a.clientHeight){f.push({$container:e,$target:d});d=e}e=e.parent()}f.push({$container:c(c.browser.msie?
"html":"body"),$target:d});if(config.durationMode==="all")config.duration/=f.length;b.scroll(f,config);return this},construct:function(a){var b=c.ScrollTo;c.fn.ScrollTo=b.fn;b.config=c.extend(b.config,a);return this}};c.ScrollTo.construct()}})(jQuery);
(function(c){if(c.History)window.console.warn("$.History has already been defined...");else{c.History={options:{debug:false},state:"",$window:null,$iframe:null,handlers:{generic:[],specific:{}},extractHash:function(a){return a.replace(/^[^#]*#/,"").replace(/^#+|#+$/,"")},getState:function(){return c.History.state},setState:function(a){var b=c.History;a=b.extractHash(a);b.state=a;return b.state},getHash:function(){return c.History.extractHash(window.location.hash||location.hash)},setHash:function(a){a=
c.History.extractHash(a);if(typeof window.location.hash!=="undefined"){if(window.location.hash!==a)window.location.hash=a}else if(location.hash!==a)location.hash=a;return a},go:function(a){var b=c.History;a=b.extractHash(a);var d=b.getHash(),e=b.getState();if(a!==d)b.setHash(a);else{a!==e&&b.setState(a);b.trigger()}return true},hashchange:function(){var a=c.History,b=a.getHash();a.go(b);return true},bind:function(a,b){var d=c.History;if(b){if(typeof d.handlers.specific[a]==="undefined")d.handlers.specific[a]=
[];d.handlers.specific[a].push(b)}else{b=a;d.handlers.generic.push(b)}return true},trigger:function(a){var b=c.History;if(typeof a==="undefined")a=b.getState();var d,e,f,g;if(typeof b.handlers.specific[a]!=="undefined"){g=b.handlers.specific[a];d=0;for(e=g.length;d<e;++d){f=g[d];f(a)}}g=b.handlers.generic;d=0;for(e=g.length;d<e;++d){f=g[d];f(a)}return true},construct:function(){var a=c.History;c(document).ready(function(){a.domReady()});return true},configure:function(a){var b=c.History;b.options=
c.extend(b.options,a);return true},domReadied:false,domReady:function(){var a=c.History;if(!a.domRedied){a.domRedied=true;a.$window=c(window);a.$window.bind("hashchange",this.hashchange);setTimeout(a.hashchangeLoader,200);return true}},nativeSupport:function(a){a=a||c.browser;var b=a.version,d=parseInt(b,10),e=b.split(/[^0-9]/g);b=parseInt(e[0],10);var f=parseInt(e[1],10);e=parseInt(e[2],10);var g=false;if((a.msie||0)&&d>=8)g=true;else if((a.webkit||0)&&d>=528)g=true;else if(a.mozilla)if(b>1)g=true;
else{if(b===1)if(f>9)g=true;else if(f===9)if(e>=2)g=true}else if(a.opera)if(b>10)g=true;else if(b===10)if(f>=60)g=true;return g},hashchangeLoader:function(){var a=c.History;if(a.nativeSupport())a.getHash()&&a.$window.trigger("hashchange");else{var b;if(c.browser.msie){a.$iframe=c('<iframe id="jquery-history-iframe" style="display: none;"></$iframe>').prependTo(document.body)[0];a.$iframe.contentWindow.document.open();a.$iframe.contentWindow.document.close();var d=false;b=function(){var e=a.getHash(),
f=a.getState(),g=a.extractHash(a.$iframe.contentWindow.document.location.hash);if(f!==e){if(!d){a.$iframe.contentWindow.document.open();a.$iframe.contentWindow.document.close();a.$iframe.contentWindow.document.location.hash=e}d=false;a.$window.trigger("hashchange")}else if(f!==g){d=true;a.setHash(g)}}}else b=function(){var e=a.getHash();a.getState()!==e&&a.$window.trigger("hashchange")};setInterval(b,200)}return true}};c.History.construct()}})(jQuery);
(function(c){c(document.body).addClass("js");if(c.Ajaxy)window.console.warn("$.Ajaxy has already been defined...");else{c.Ajaxy={options:{root_url:"",base_url:"",relative_url:"",request_match:false,no_log_class:"ajaxy-no_log",redirect:false,relative_as_base:true,support_text:true,analytics:true,auto_ajaxify:true,auto_ajaxify_documentReady:true,auto_sparkle_documentReady:true,add_sparkle_extension:true,scrollto_content:false,scrollto_options:{duration:800,easing:"swing"},anchor_param_name:"anchor",
track_all_anchors:false,track_all_internal_links:false,debug:true,aliases:[["","/"]],Controllers:{}},defaults:{Controller:{classname:null,selector:null,matches:null,controller:null,response:null,request:null,error:null,refresh:null},Action:{propagate:true,action:null,state:null,State:null,controller:null,Controller:null,forward:function(){window.console.error("Ajaxy.Action.forward: Forward never defined.",[this,arguments]);window.console.trace()},trigger:function(){window.console.error("Ajaxy.Action.trigger: Trigger never defined.",
[this,arguments]);window.console.trace()},stopPropagation:function(){this.propagate=false},preventDefault:function(){this.propagate=false},documentReady:function(a,b){var d=c.Ajaxy;if(typeof b!=="object")b={};var e={};switch(this.action){case "refresh":e.auto_ajaxify_documentReady=e.auto_sparkle_documentReady=false;break;default:break}e=c.extend(true,{},e,b);return d.stateCompleted(this.State,a,e)}},State:{mode:null,el:null,isLink:false,isForm:false,anchor:"",querystring:"",state:"",hash:"",location:"",
locationShort:"",raw:{anchor:"",querystring:"",hash:"",state:"",location:"",locationShort:""},vanilla:{anchor:"",querystring:"",hash:"",state:"",location:"",locationShort:""},clean:{anchor:"",querystring:"",hash:"",state:"",location:"",locationShort:""},controller:null,Request:{url:null,data:{}},Response:{callback:null,data:{}},Error:{callback:null,data:{}},User:{data:{}}}},isConstructed:false,aliases:{},postpone:false,Controllers:{},States:{},ignoredStates:{},currentState:{},ajaxQueue:[],data:{},
redirected:false,get:function(a){var b=c.Ajaxy;if(typeof b.data[a]!=="undefined")return b.data[a]},set:function(a,b){var d=c.Ajaxy;if(typeof b==="undefined")typeof a==="object"&&d.data.extend(true,a);else d.data[a]=b},ensureString:function(a){var b="";switch(typeof a){case "number":case "string":b=String(a);break;default:b=""}return b},extractRelativeUrl:function(a,b){var d=c.Ajaxy;if(typeof b==="undefined")b=true;a=d.ensureString(a);d=a.stripLeft(d.options.root_url).stripLeft(d.options.base_url);
if(b&&d==="/")d="";return d},extractState:function(a){return c.Ajaxy.extractRelativeUrl(a,false)},extractHash:function(a){a=c.Ajaxy.extractState(a);if((a=a.match(/^([^#?]*)/)||"")&&a.length||false===2)a=a[1]||"";return a},extractAnchor:function(a){var b=c.Ajaxy;a=b.extractState(a);b=b.options.anchor_param_name;var d=a.replace(/[^#]+#/g,"#").match(/#+([^#\?]*)/)||"";if(d&&d.length||false===2)d=d[1]||"";if(d===a)d="";if(!d)if((d=a.match(RegExp(b+"=([a-zA-Z0-9-_]+)"))||"")&&d.length||false===2)d=d[1]||
"";return d},extractQuerystring:function(a){a=c.Ajaxy.extractState(a);if((a=a.match(/\?(.*)$/)||"")&&a.length||false===2)a=a[1]||"";return a},track:function(a){var b=c.Ajaxy;if(typeof pageTracker!=="undefined"){var d=a.vanilla.locationShort;b.options.debug&&window.console.debug("Ajaxy.track",[this,arguments],[d]);pageTracker._trackPageview(d)}return true},matches:function(a,b){var d=c.Ajaxy,e=false;switch(typeof a){case "function":case "object":if(a.test){e=a.test(b);break}case "array":c.each(a,function(f,
g){if(e=d.matches(g,b))return false});break;case "number":case "string":e=String(a)===b;break}return e},match:function(a){var b=c.Ajaxy,d=false;c.each(b.Controllers,function(e,f){if(b.matches(f.matches||false,a)){d=e;return false}});return d},getController:function(a,b){var d=c.Ajaxy,e=undefined,f=typeof(a||undefined);if((f==="number"||f==="string")&&typeof d.Controllers[a]!=="undefined")e=d.Controllers[a];else if(f==="object"&&typeof a.controller==="string")e=d.getController(a.controller,b);else if(b)e=
c.extend(true,{},d.defaults.Controller);else if(b!==false){window.console.error("Ajaxy.getController: Controller does not exist",[this,arguments]);window.console.trace()}return e},getControllerAction:function(a,b,d){var e=undefined,f=c.Ajaxy.getController(a,false);if(typeof f==="undefined"){if(d!==false){window.console.error("Ajaxy.getControllerAction: Controller does not exist",[this,arguments]);window.console.trace()}}else{var g=typeof(f[b]||undefined);if(g==="function"||g==="object")e=f[b];else if(d!==
false){window.console.error("Ajaxy.getControllerAction: Controller Action does not exist",[this,arguments]);window.console.trace()}}return e},bind:function(){return c.Ajaxy.addControllers.apply(this,arguments)},addController:function(a,b){var d=c.Ajaxy;if(typeof b==="undefined"&&typeof a==="object")b=a;else if(typeof a==="string"&&typeof b==="function")b={controller:a,response:b};else if(typeof a==="string"&&typeof b==="object"){if(typeof b.controller==="undefined")b.controller=a}else{window.console.error("Ajaxy.addController: Unknown Controller Format",
[this,arguments]);window.console.trace()}if(typeof d.Controllers[b.controller]!=="undefined"){window.console.error("Ajaxy.addController: Controller ["+b.controller+"] has already been bound.",[this,arguments],[b]);window.console.trace();return false}b=c.prepareObject(d.defaults.Controller,b);if(!b.selector&&b.classname)b.selector="."+b.classname;d.Controllers[b.controller]=b;d.options.auto_ajaxify&&d.ajaxifyController(b);return b},addControllers:function(a){var b=c.Ajaxy;if(typeof a==="object"&&typeof a.controller===
"string")window.console.warn("Ajaxy.addControllers: It seems you intended to call addController instead.",[this,arguments]);else if(typeof a==="object"||typeof a==="array")c.each(a,function(d,e){b.addController(d,e)});return true},getState:function(a,b,d){var e=c.Ajaxy;a=e.extractState((a||{}).state||a);var f=undefined,g=typeof(a||undefined);if((g==="number"||g==="string")&&typeof e.States[a]!=="undefined")f=e.States[a];else if(b)f=e.createState(a);else if(b!==false)if(d){window.console.error("Ajaxy.getState: State does not exist",
[this,arguments]);window.console.trace()}f&&e.rebuildState(f);return f},createState:function(a){var b=c.Ajaxy;a=b.extractState((a||{}).state||a);State=c.extend(true,{},b.defaults.State,{state:a});b.rebuildState(State);return State},buildState:function(a){var b=c.Ajaxy;b.options.debug&&window.console.debug("Ajaxy.buildState:",[this,arguments]);if(typeof a==="string")a={url:a};var d=b.getState(false,true);c.extend(true,d,a);if(!(d.state||0)&&(d.url||0))d.state=b.extractState(d.url);if(!d.state)d.state=
"/";if(d.el){var e=c(d.el);if(e.is("form")){d.isForm=true;d.isLink=false}else if(e.is("a")){d.isForm=false;d.isLink=true}else window.console.warn("Ajaxy.buildState: Unknown element type passed.",[this,arguments],[d.el]);delete e}b.rebuildState(d);if(d.anchor===d.state||d.anchor===d.hash)d.anchor="";if(!(d.hash||0)&&!d.raw.querystring&&(d.anchor||0)){d.hash=b.currentState.hash||"";d.querystring=d.raw.querystring;b.rebuildState(d)}if(!d.state||!d.hash&&!d.raw.querystring)window.console.warn("Ajaxy.go: No state or (hash and querystring).",
[this,arguments],[d]);if(!d.mode)d.mode=d.isLink&&b.postpone?d.anchor&&!d.raw.querystring&&d.hash===b.options.relative_url?"ignore":"postpone":d.isForm?"silent":"default";return d},rebuildState:function(a){var b=c.Ajaxy,d=b.extractState(a.state),e=b.ensureString(a.hash)||b.extractHash(d),f=b.ensureString(a.anchor)||b.extractAnchor(d);d=b.ensureString(a.querystring)||b.extractQuerystring(d);var g=b.options.base_url,h=b.options.root_url;b=b.options.anchor_param_name;if(f){var i=d.queryStringToJSON();
i.anchor=f;d=unescape(c.param(i));delete i}a.anchor=f;a.querystring=d;a.hash=e;a.state=e+(d?"?"+d:"");a.locationShort=g+"#"+a.state;a.location=h+a.locationShort;a.raw.anchor="";a.raw.querystring=a.querystring.replace(RegExp("&?"+b+"=[a-zA-Z0-9-_]+","gi"),"").replace(/^&+/g,"");a.raw.hash=a.hash;a.raw.state=a.hash+(a.raw.querystring?"?"+a.raw.querystring:"");a.raw.locationShort=g+(a.raw.state?"#"+a.raw.state:"");a.raw.location=h+a.raw.locationShort;a.vanilla.anchor=a.anchor;a.vanilla.querystring=a.raw.querystring;
a.vanilla.hash=a.vanilla.anchor;a.vanilla.state=a.vanilla.anchor;a.vanilla.locationShort=g+a.raw.hash+(a.vanilla.querystring?"?"+a.vanilla.querystring:"")+(a.vanilla.anchor?"#"+a.vanilla.anchor:"");a.vanilla.location=h+a.vanilla.locationShort;a.clean.anchor="";a.clean.querystring=a.raw.querystring;a.clean.hash="";a.clean.state="";a.clean.locationShort=g+a.hash+(a.clean.querystring?"?"+a.clean.querystring:"");a.clean.location=h+a.clean.locationShort;return a},storeState:function(a){var b=c.Ajaxy,d=
true;d=typeof(a||undefined);b.rebuildState(a);if(d==="object"&&typeof a.state==="string")d=b.States[a.state]=a;else{window.console.error("Ajaxy.storeState: Unknown State Format",[this,arguments]);window.console.trace();d=false}return d},statesEquivalent:function(a,b){var d=c.Ajaxy,e=false;if(a.isForm||b.isForm)e=false;else if(a.state)c.each(d.aliases[a.hash]||[a.hash],function(f,g){if(g===b.hash&&a.raw.querystring===b.raw.querystring){e=true;return false}});return e},stateCompleted:function(a,b,d){var e=
c.Ajaxy;if(typeof a!=="object")a={};if(!(b instanceof jQuery)||!b.length)b=c(document.body);if(typeof d!=="object")d={};d=c.extend({},e.options,d);if(d.auto_sparkle_documentReady&&c.Sparkle){if(d.add_sparkle_extension)d.auto_ajaxify_documentReady=false;b.sparkle()}d.auto_ajaxify_documentReady&&b.ajaxify();if(e=a.anchor||false){a.anchor=false;c("#"+e).giveTarget().ScrollTo(d.scrollto_options)}else d.scrollto_content&&!b.is("body")&&b.ScrollTo(d.scrollto_options);return true},refresh:function(){return c.Ajaxy.go(c.History.getHash())},
go:function(a){var b=c.Ajaxy,d=c.History;b.options.debug&&window.console.debug("Ajaxy.go:",[this,arguments]);var e=b.buildState(a);b.storeState(e);switch(e.mode){case "silent":b.stateChange(e.state);break;case "ignore":b.ignoredStates[e.vanilla.state]=e;document.location=e.vanilla.location;break;case "postpone":document.location=e.location;break;case "default":default:d.go(e.state);break}return true},trigger:function(a,b,d){var e=c.Ajaxy;e.options.debug&&window.console.debug("Ajaxy.trigger: ",[this,
arguments]);var f=true;if(!a){window.console.warn("Ajaxy.trigger: No controller was passed, reset to _generic.",[this,arguments]);a="_generic"}var g=e.getController(a),h=e.getControllerAction(a,b,false),i=e.getState(d,true);d=i.state||undefined;if(typeof g==="undefined"){window.console.error("Ajaxy.trigger: Controller does not exist",[this,arguments]);window.console.trace();a!=="_generic"&&e.trigger("_generic","error",i);return false}if(typeof h==="undefined")if(b==="refresh"){window.console.warn("Ajaxy.trigger: Controller Action ["+
a+"].["+b+"] does not exist. Defaulting to ["+a+"].["+b+"] Action.",[this,arguments]);return e.trigger(a,"response",i)}else{if(a==="_generic"){window.console.error("Ajaxy.trigger: Controller Action ["+a+"].["+b+"] does not exist.",[this,arguments]);window.console.trace()}else{window.console.warn("Ajaxy.trigger: Controller Action ["+a+"].["+b+"] does not exist. Defaulting to [_generic].["+b+"] Action.",[this,arguments]);e.trigger("_generic",b,i)}return false}g=c.extend(true,{},e.defaults.Action,{action:b,
controller:a,Controller:g,state:d,State:i});g.forward=g.trigger=function(j,n,m){e.options.debug&&window.console.debug("Ajaxy.Action.trigger:",[this,arguments]);j=j||a;n=n||b;m=m||d;e.trigger(j,n,m);return true};h.apply(g,[]);if(g.propagate===false)f=false;f&&a!=="_generic"&&g.forward("_generic");return true},request:function(a){var b=c.Ajaxy,d=c.History;b.options.debug&&window.console.debug("Ajaxy.request:",[this,arguments]);var e=false,f=b.options.request_match instanceof RegExp&&!b.options.request_match.test(a),
g=typeof b.ignoredStates[a]!=="undefined";if(f||g){b.options.debug&&window.console.debug("Ajaxy.request: We are an ignored state",[this,arguments],[a]);return true}delete f;delete g;var h=b.getState(a,true);if(b.redirected!==false)b.redirected=false;else{c(".target").removeClass("target");if(b.statesEquivalent(h,b.currentState)){h.controller=b.currentState.controller;h.Request=b.currentState.Request;h.Response=b.currentState.Response;h.Error=b.currentState.Error;b.currentState=h;b.storeState(h);b.trigger(h.controller,
"refresh",b.currentState);b.options.debug&&window.console.debug("Ajaxy.request: There has been no considerable change",[this,arguments],[b.currentState,h,a]);return true}b.ajaxQueue.push(a);if(b.ajaxQueue.length!==1)return false;b.options.analytics&&b.track(h);b.currentState=h;f=h.controller||b.match(a)||undefined;h.controller=f;h.Request.url=h.Request.url||h.clean.location;b.storeState(h);b.trigger(f,"request");f={data:h.Request.data,url:h.Request.url,type:"post",success:function(k){b.options.debug&&
window.console.debug("Ajaxy.request.success:",[this,arguments]);k=c.extend(true,{},b.defaults.State.Response.data,k);k.Ajaxy=k.Ajaxy||{};if(k.Ajaxy.redirected){var l=b.extractState(k.Ajaxy.redirected.to);b.redirected={status:true,from:a,to:l};d.go(l)}b.ajaxQueue.shift();if((l=b.ajaxQueue.pop())&&l!==a){b.ajaxQueue=[];b.stateChange(l);return false}h.Response.data=k;h.Error.data={};l=k.controller||h.controller||null;if(l===null){l="_generic";window.console.warn("Ajaxy.request.success.controller: The controller was unable to be determined, defaulted to _generic.",
[this,arguments],[k.controller,h.controller])}if(h.Response.callback)if(h.Response.callback.apply(h,arguments)||l==="callback")return true;return b.trigger(l,"response",h)},error:function(k,l,q,p){b.options.debug&&window.console.debug("Ajaxy.request.error:",[this,arguments]);p||(p={responseText:k.responseText.trim()||false});b.ajaxQueue.shift();var o=b.ajaxQueue.pop();if(o&&o!==a){b.ajaxQueue=[];b.stateChange(o);return false}h.Request.XMLHttpRequest=k;h.Response.data=p;h.Error.data={};o=p.controller||
h.controller||null;if(o===null){o="_generic";window.console.warn("Ajaxy.request.error.controller: The controller was unable to be determined, defaulted to _generic.",[this,arguments],[p.controller,h.controller])}if(h.Error.callback)if(h.Error.callback.apply(h,arguments)||o==="callback")return true;return b.trigger(o,"error",h)},complete:function(k){b.options.debug&&window.console.debug("Ajaxy.request.complete:",[this,arguments]);h.Request.XMLHttpRequest=k}};if(h.isForm){var i=c(h.el);if(i.attr("enctype")===
"multipart/form-data"){e="ajaxy_form_iframe_"+Math.floor(Math.random()*99999);var j=c('<iframe style="display:none" src="about:blank" id="'+e+'" name="'+e+'" >').appendTo("body").hide(),n=c('<input type="hidden" name="ajax" value="true"/>').appendTo(i),m=c('<input type="hidden" name="Ajaxy[form]" value="true"/>').appendTo(i);j.bind("load",function(){if((this.document||this.currentDocument||this.contentWindow.document).location.href==="about:blank")return true;var k=j.contents().find(".response").val(),
l=false;try{l=c.parseJSON(k)}catch(q){window.console.error("Ajaxy.request.form: Invalid Response.",[this,arguments],[k])}l?request.success(l):request.error(l);i.removeAttr("target");j.remove();n.remove();m.remove()});i.attr("target",e);i.submit();g=i.values();f.data=c.extend(true,f.data,g||{});e=true}else{g=i.values();f.data=c.extend(true,f.data,g||{})}}g=true;h.Request=f;e||(g=b.ajax(f));return g}},ajax:function(a){var b=c.Ajaxy;b.options.debug&&window.console.debug("Ajaxy.ajax:",[this,arguments]);
var d={};d.success=a.success||function(){b.options.debug&&window.console.debug("Ajaxy.ajax.callbacks.success:",[this,arguments]);c(".error").empty()};d.error=a.error||function(f,g,h){b.options.debug&&window.console.debug("Ajaxy.ajax.callbacks.error:",[this,arguments]);c(".error").html(h)};d.complete=a.complete||function(){b.options.debug&&window.console.debug("Ajaxy.ajax.callbacks.complete:",[this,arguments])};delete a.success;delete a.error;delete a.complete;var e={type:"post",dataType:b.options.support_text?
"text":"json"};c.extend(true,e,a);e.success=function(f,g){b.options.debug&&window.console.debug("Ajaxy.ajax.request.success:",[this,arguments]);var h={};if(typeof f!=="object"&&b.options.support_text&&f)try{h=c.parseJSON(f)}catch(i){h=b.htmlCompat(f);var j=c(h),n=j.find("#ajaxy-head"),m=j.find("#ajaxy-body"),k=j.find("#ajaxy-title");j=j.find("#ajaxy-controller");k=k.length?k.text():"";n=n.length?n.htmlAndSelf():"";var l=m.length?m.htmlAndSelf():"";m=m.length?m.html():h;h={controller:j.length?j.text().trim():
null,responseText:f,html:h,title:k,head:n,body:l,content:m}}else h=f;b.options.debug&&window.console.debug("Ajaxy.ajax.success:",[this,arguments]);if(typeof h.controller==="undefined"&&(typeof h.success!=="undefined"&&!h.success||typeof h.error!=="undefined"&&h.error))return d.error.apply(this,[null,g,h.error||true,h]);return d.success.apply(this,[h,g])};e.error=function(f,g,h){b.options.debug&&window.console.debug("Ajaxy.ajax.request.error:",[this,arguments]);var i=f.responseText||false;if(i)i=i.trim();
i||(i=false);var j={error:h||true,responseText:i};if(i)try{j=c.parseJSON(i)}catch(n){}finally{return this.success.apply(this,[j,g])}return d.error.apply(this,[f,g,h,j])};return c.ajax(e)},configure:function(a){var b=c.Ajaxy,d=c.History;a=a||{};if(typeof a!=="object")window.console.error("Ajaxy.configure: Invalid Options Passed",[this,arguments]);else{var e;if(typeof a.Controllers==="object"){e=a.Controllers;delete a.Controllers}else if(typeof a.controllers==="object"){e=a.controllers;delete a.controllers}else{e=
a;a={}}b.options=c.extend(true,b.options,a.options||a);b.options.root_url=(b.options.root_url||document.location.protocol.toString()+"//"+document.location.hostname.toString()).replace(/\/+$/,"")+"/";b.options.base_url=b.options.base_url||"";b.options.relative_url=b.extractState(b.options.relative_url||document.location.pathname.toString());if(b.options.relative_as_base)if(b.options.base_url.length===0){b.options.base_url=b.options.relative_url;b.options.relative_url=""}b.options.root_url=b.options.root_url.replace(/\/+$/,
"");b.options.base_url=b.options.base_url.replace(/\/+$/,"");b.options.relative_url=b.extractRelativeUrl(b.options.relative_url);if(b.options.root_url==="/")b.options.root_url="";if(b.options.base_url==="/")b.options.base_url="";if(b.options.relative_url==="/")b.options.relative_url="";if(b.options.request_match===true){var f=[];b.options.root_url&&f.push("^"+b.options.root_url+b.options.base_url);b.options.base_url&&f.push("^"+b.options.base_url);f.push("^/");b.options.request_match=RegExp(f.join("|"),
"i");delete f}b.options.debug&&window.console.debug("Ajaxy.configure:",[this,arguments]);if(b.options.relative_url&&b.options.relative_url!==null)if(b.options.redirect===true){f=b.options.root_url+b.options.base_url+"#"+b.options.relative_url;if(d=d.getHash())f+="?anchor="+d;document.location=f}else if(b.options.redirect==="postpone")b.postpone=true;else if(b.options.redirect==="disable"){b.addAjaxy=b.ajaxify=b.bind=function(){};c(function(){c(".ajaxy").removeAjaxy()})}b.aliases=[];c.each(b.options.aliases,
function(g,h){c.each(h,function(i,j){b.aliases[j]=h})});b.addControllers(e);b.onConfigured(true);return true}},construct:function(){var a=c.Ajaxy,b=c.History;if(!a.isConstructed){a.isConstructed=true;b.bind(function(d){return a.stateChange(d)});c.Sparkle&&c.Sparkle.addExtension("ajaxy",function(){c(this).ajaxify()});c.fn.ajaxy=a.fn.ajaxify;c.each(a.fn,function(d,e){c.fn[d]=e});c(function(){a.onDocumentReady(true)});a.onReady(function(){a.options.auto_ajaxify&&c("body").ajaxify()});a.onConfigured(function(){a.onDocumentReady(function(){a.onReady(true)})});
return true}},ajaxifyController:function(a){var b=c.Ajaxy.getController(a);if(b&&(b.selector||0))c(function(){c(b.selector).data("ajaxy-controller",a).addAjaxy()});return true},fn:{ajaxify:function(){var a=c.Ajaxy,b=c(this);c.each(a.Controllers,function(f){a.ajaxifyController(f)});if(a.options.track_all_internal_links){var d=b.findAndSelf("a[href^=/],a[href^=./]");if(a.options.root_url){var e=c("a[href^="+a.options.root_url+"]");d=d.add(e);delete e}d=d.filter(":not(.ajaxy,.no-ajaxy)").addClass("ajaxy");
delete d}a.options.track_all_anchors&&b.findAndSelf("a[href^=#]:not(.ajaxy,.no-ajaxy)").addClass("ajaxy");b.addAjaxy();return b},addAjaxy:function(a){var b=c.Ajaxy,d=c(this);d.is("form,a")&&d.addClass("ajaxy");if(a){a=b.getController(a);a.classname&&d.addClass(a.classname)}d.findAndSelf("a.ajaxy:not(.ajaxy-has)").addClass("ajaxy-has").once("click",b.ajaxifyHelpers.a);d.findAndSelf("form.ajaxy:not(.ajaxy-has)").addClass("ajaxy-has").once("submit",b.ajaxifyHelpers.form);return d},removeAjaxy:function(a){var b=
c.Ajaxy,d=c(this);a=c.extend({permanently:true},a);var e=d.findAndSelf("a.ajaxy").removeClass("ajaxy ajaxy-has").unbind("click",b.ajaxifyHelpers.a);b=d.findAndSelf("form.ajaxy").removeClass("ajaxy ajaxy-has").unbind("submit",b.ajaxifyHelpers.form);a.permanently&&e.add(b).addClass("no-ajaxy");return d}},ajaxifyHelpers:{a:function(a){var b=c.Ajaxy,d=c(this),e=b.extractRelativeUrl(d.attr("href")).replace(/^\/?\.\//,"/"),f=b.extractState(e);e=b.extractAnchor(e);if("/"+e===f||e===f)e="";var g=!d.hasClass(b.options.no_log_class);
d=d.data("ajaxy-controller")||null;b.go({state:f,controller:d,log:g,anchor:e,el:this});a.stopPropagation();a.preventDefault();return false},form:function(a){var b=c.Ajaxy,d=c(this),e=d.attr("disabled");if(e=e||e==="false")return false;if(d.attr("target"))return true;d=b.extractRelativeUrl(d.attr("action")).replace(/^\/?\.\//,"/");d=b.extractState(d);b.go({state:d,el:this});a.stopPropagation();a.preventDefault();return false}},htmlCompat:function(a){return String(a).replace(/<\!DOCTYPE[^>]*>/i,"").replace(/<(html|head|body|title|meta)/gi,
'<div id="ajaxy-$1"').replace(/<\/(html|head|body|title|meta)/gi,"</div")},stateChange:function(a){c.Ajaxy.request(a)},onConfigured:function(){return c.promise({object:this,handlers:"onConfiguredHandlers",flag:"isConfigured",arguments:arguments})},onDocumentReady:function(){return c.promise({object:this,handlers:"onDocumentReadyHandlers",flag:"isDocumentReady",arguments:arguments})},onReady:function(){return c.promise({object:this,handlers:"onReadyHandlers",flag:"isReady",arguments:arguments})}};
c.Ajaxy.construct()}})(jQuery);



$(document).ready(function(){

	$('.zzThumb.captionfull').live('hover',
		function() {
			
			$(this).find('.cover').stop().animate({opacity:1},400);
		},
		function() {
			$(this).find('.cover').stop().animate({opacity:0},400);
		}
	);
	
	
});// doc ready
	
		
	
	


