(function($){
//no prototype please
$(function(){
	if ($('body.cms-home').length) {
		themeHome();
	}
	
	if ($('.account-product-grid').length) themeAccountGrid();
	
	if ($('#twitter-container').length) {
		$.getScript("http://twitter.com/javascripts/blogger.js", function(){
			$.getScript("http://twitter.com/statuses/user_timeline/roammobility.json?callback=twitterCallback2&count=5");
		});
	}
	
	if ($('.twitter-message-share').length) twitterShare();
	
	ROAM.init();
});

function themeHome() {
	slideShow('.home-phone .home-phone-img');
}

function themeAccountGrid() {
	if ($('.account-product-grid.products').length) {
		$('.account-product-grid .grid-product').mouseover(function(){
			$(this).find('.description').show();
		})
		.mouseout(function(){
			$(this).find('.description').hide();
		});
	}
	
	if ($('.account-product-grid.plans').length) {
		$('.plan-types-nav a').click(function(e){
			e.preventDefault();
			var ix = $('.plan-types-nav a').index(this);
			$('.plan-types-nav a').removeClass('active').eq(ix).addClass('active');
			$('.account-product-grid').removeClass('active').eq(ix).addClass('active');
		});
	}
}

function slideShow(slide) {

	$(slide).css({opacity: 0.0, display: 'none'});
	
	$(slide+':first').css({opacity: 1.0, display: 'block'});
	
	setInterval(function(){gallery(slide);},8000);
	
}

function gallery(slide) {
	
	//if no IMGs have the show class, grab the first image
	var current = $(slide+'.show').length ?  $(slide+'.show') : $(slide+':first');

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? current.next() : $(slide+':first'));		
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0, display: 'block'})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
}

function next(slide) {
	
	var current = $(slide+'.show').length ?  $(slide+'.show') : $(slide+':first');

	var next = ((current.next().length) ? current.next() : $(slide+':first'));	
	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000)
	.css({display: 'block'});

	current.animate({opacity: 0.0}, 1000, function(){$(this).css({display: 'none'});})
	.removeClass('show');
	
}

function prev(slide) {
	
	var current = $(slide+'.show').length ?  $(slide+'.show') : $(slide+':last');

	var next = ((current.prev().length) ? current.prev() : $(slide+':last'));	
	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000)
	.css({display: 'block'});

	current.animate({opacity: 0.0}, 1000, function(){$(this).css({display: 'none'});})
	.removeClass('show');
	
}

function twitterShare() {
	$('.twitter-message-share').click(function(){
		var msg = encodeURIComponent($('.twitter-message').val());  
		var link = 'http://twitter.com/intent/tweet?text=' + msg; 
		window.open(link);
	});
	$('.twitter-message').click(function(){
		$(this).focus();
	});
}
})(jQuery);


var ROAM = (function($) {

	var list_items = "";

	function showItem(){
		var li_item = $(".day-selector li.selected .ds-content");
		li_item.show();
	}
	
	function initProductSlideshow(){
		if($('#product-slideshow').length){
			$('#product-slideshow').before('<ul id="product-slideshow-nav">').cycle({ 
			    fx:     'fade', 
			    speed:  'slow', 
			    timeout: 0, 
			    pager:  '#product-slideshow-nav', 
			     
			    // callback fn that creates a thumbnail to use as pager anchor 
			    pagerAnchorBuilder: function(idx, slide) { 
			    		var el = jQuery(slide);
			    		var slug = "breeze";
			    		if(jQuery(".cms-sim-card").length){
			    			slug = "sim";
			    		}else if(jQuery(".cms-liberty-hotspot").length){
			    			slug = "liberty";
			    		}
			    		
			        return '<li><a href="#"><img src="http://www.roammobility.com/skin/frontend/enterprise/roam/images/products/'+slug+'_'+el.attr("class")+'.jpg" width="66" height="50" /></a></li>'; 
			    } 
			});
		}
	}
	
	function addMap(){
		var m = $("#map");
		if(m.length){
			m.html('<iframe width="558" height="387" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.ca/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=1140+Homer+St.+Vancouver,+BC++V6B+2X6&amp;sll=49.891235,-97.15369&amp;sspn=47.801198,135.263672&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=1140+Homer+St,+Vancouver,+British+Columbia+V6B+2G2&amp;t=m&amp;z=17&amp;iwloc=near&amp;output=embed"></iframe>');
		}
	}

	return {
		init: function() {
			var slide_init = {
				    auto: false,
				    speed: 8000,
				    vertical: false,
				    pauseonmouseover : true,
				    featurediv: '.slider-items',
				    btnNext: ".button-si-next",
				    btnPrev: ".button-si-prev",
				    fade : true
				};
				
			if ($('body.cms-home').length) {
				slide_init.auto = true;
			}
				
				FarmerSlide.init(slide_init);
				
				initProductSlideshow();
				
				showItem();	
				addMap();
						
			
				jQuery("body").delegate(".day-selector > li > a", "click", function(){
					var el = $(this);
					var el_parent = el.parent();
					var lis = $(".day-selector > li");
					var li_item = $(".day-selector li.selected .ds-content");
					lis.removeClass("selected");
					el_parent.addClass("selected");					
					
					li_item.fadeOut("slow", function(){
						var p = el_parent.find(".ds-content");
						p.fadeIn("fast", function(){
						});						
					});
				});
				
				jQuery("a[rel^='details']").prettyPhoto({
					animationSpeed: 'normal',
					opacity: 0.70,
					show_title: false,
					social_tools: "",
					horizontal_padding: 0
				});
			
		}
	}
})(jQuery);




var FarmerSlide={fsdefaults:defaults={featurediv:"features",statusdiv:"status",statuscontainer:"carousel-status",statuscontainerlist:"status-list",selectclass:"selected",changelink:"ff-link",btnNext:"",btnPrev:"",btnGo:null,auto:5000,speed:500,vertical:false,circular:true,visible:1,pauseonmouseover:true,easing:"easeInOutQuad",fade:false},oMainTemplate:null,oFeatures:null,oStats:null,navClick:false,currItem:null,clickid:0,init:function(a){this.o=jQuery.extend({},this.fsdefaults,a);this.initSlide()},initSlide:function(){var a=this;this.oFeatures=jQuery(this.o.featurediv+" li");var f=a.getControls();a.setCarouselLink();var b=this.carouselEnd;var e=this.carouselEndIndex;var d=this.carouselStart;jQuery(this.o.featurediv).jCarouselLite({auto:a.o.auto,speed:a.o.speed,vertical:a.o.vertical,easing:a.o.easing,afterEnd:b,afterEndIndex:e,beforeStart:d,pauseonmouseover:a.o.pauseonmouseover,fade:a.o.fade,visible:a.o.visible,btnNext:a.o.btnNext,btnPrev:a.o.btnPrev,circular:a.o.circular,btnGo:f})},getControls:function(){var a=[];var d=this.oFeatures.length;for(var b=0;b<d;b++){a.push("."+this.o.statusdiv+"-"+b)}return a},drawStatus:function(f){var a=this;var d='<ul class="'+this.o.statuscontainerlist+'">';var g=jQuery(this.o.featurediv+" li").length;var e='<a href="javascript:void(0)"></a>';for(var b=0;b<g;b++){if(b==0){d+='<li class="'+a.o.selectclass+" status-"+b+'">'+e+"</li>"}else{d+='<li class="status-'+b+'">'+e+"</li>"}}d=d+"</ul>";jQuery("#"+f).html(d);this.oStats=jQuery("#"+f+" li");this.oStats.click(function(){})},setClick:function(a){a=jQuery(a);FarmerSlide.oStats.removeClass(FarmerSlide.o.selectclass);a.addClass(FarmerSlide.o.selectclass);FarmerSlide.navClick=true},carouselEndIndex:function(a){if(a>FarmerSlide.oFeatures.length){a=1}if(a==0){a=FarmerSlide.oFeatures.length}var b=(FarmerSlide.oStats[a-1]!==undefined)?FarmerSlide.oStats[a-1]:null;FarmerSlide.setClick(b)},carouselStart:function(a){},carouselEnd:function(a){a=jQuery(a);if(FarmerSlide.o.fade){FarmerSlide.currItem=a}else{var b=a.children("a");jQuery("#"+FarmerSlide.o.changelink).attr("href",b.attr("href"))}},setCarouselLink:function(){this.drawStatus(this.o.statuscontainer);var b=jQuery("#"+this.o.featurediv+" li");var a=jQuery(b[0]).children("a").attr("href");jQuery("#"+this.o.changelink).attr("href",a)},incrementStatus:function(d){var a=jQuery("#"+d+" li");for(var b=0;b<a.length;b++){a[b]=jQuery(a[b]);var c=(a[b].hasClass(this.o.selectclass))?true:false;if(c){a[b].removeClass(this.o.selectclass);if(b==(a.length-1)){jQuery(a[0]).addClass(this.o.selectclass)}else{jQuery(a[parseInt(b+1)]).addClass(this.o.selectclass)}break}}}};

/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Modified by FarmerDane to add Pausing, select stop, super fade and index status
 *
 * Version: 1.0.2
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
(function(e){function g(a,g){return parseInt(e.css(a[0],g))||0}e.fn.jCarouselLite=function(a){a=e.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:!1,auto:null,pauseonmouseover:!0,speed:200,easing:null,vertical:!1,fade:!1,circular:!0,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null,afterEndIndex:null},a||{});return this.each(function(){function r(){j(c+a.scroll)}function p(){return b.slice(c).slice(0,d)}function j(b){if(!k){a.beforeStart&&a.beforeStart.call(this,p());if(a.circular)b<= a.start-d-1?(f.css(m,-((h-2*d)*i)+"px"),c=b==a.start-d-1?h-2*d-1:h-2*d-a.scroll):b>=h-d+1?(f.css(m,-(d*i)+"px"),c=b==h-d+1?d+1:d+a.scroll):c=b;else{if(0>b||b>h-d)return;c=b}k=!0;if(a.fade){var g="left"==m?"left":"top";f.fadeTo(200,0.1,function(){f.css(g,-(c*i)).fadeTo(400,1)});a.afterEnd&&a.afterEnd.call(this,p());a.afterEndIndex&&a.afterEndIndex.call(this,c);k=!1}else f.animate("left"==m?{left:-(c*i)}:{top:-(c*i)},a.speed,a.easing,function(){a.afterEnd&&a.afterEnd.call(this,p());a.afterEndIndex&& a.afterEndIndex.call(this,c);k=!1});a.circular||(e(a.btnPrev+","+a.btnNext).removeClass("disabled"),e(0>c-a.scroll&&a.btnPrev||c+a.scroll>h-d&&a.btnNext||[]).addClass("disabled"))}return!1}var n=null,s=!1,k=!1,m=a.vertical?"top":"left",t=a.vertical?"height":"width",l=e(this),f=e("ul",l),o=e("li",f),q=o.size(),d=a.visible;a.circular&&(f.prepend(o.slice(q-d-1+1).clone()).append(o.slice(0,d).clone()),a.start+=d);var b=e("li",f),h=b.size(),c=a.start;l.css("visibility","visible");b.css({overflow:"hidden", "float":a.vertical?"none":"left"});f.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});l.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var i=a.vertical?b[0].offsetHeight+g(b,"marginTop")+g(b,"marginBottom"):b[0].offsetWidth+g(b,"marginLeft")+g(b,"marginRight"),o=i*h,q=i*d;b.css({width:b.width(),height:b.height()});f.css(t,o+"px").css(m,-(c*i));l.css(t,q+"px");a.btnPrev&&e(a.btnPrev).click(function(){return j(c-a.scroll)});a.btnNext&&e(a.btnNext).click(function(){a.beforeStart&& a.beforeStart.call(this,p());return j(c+a.scroll)});a.btnGo&&e.each(a.btnGo,function(b,c){e(c).click(function(){n&&(s=!0,clearInterval(n),k=!1);return j(a.circular?a.visible+b:b)})});a.mouseWheel&&l.mousewheel&&l.mousewheel(function(b,d){return 0<d?j(c-a.scroll):j(c+a.scroll)});a.auto&&(n=setInterval(r,a.auto+a.speed),a.pauseonmouseover&&e(this).hover(function(){k=!1;clearInterval(n)},function(){s||(n=setInterval(r,a.auto+a.speed))}))})}})(jQuery);


/***
 * Twitter JS v1.13.3
 * http://code.google.com/p/twitterjs/
 * Copyright (c) 2009 Remy Sharp / MIT License
 * $Date: 2011-07-04 15:40:40 +0100 (Mon, 04 Jul 2011) $
 */
 /*
  MIT (MIT-LICENSE.txt)
 */
typeof getTwitters!="function"&&function(){var a={},b=0;!function(a,b){function m(a){l=1;while(a=c.shift())a()}var c=[],d,e,f=!1,g=b.documentElement,h=g.doScroll,i="DOMContentLoaded",j="addEventListener",k="onreadystatechange",l=/^loade|c/.test(b.readyState);b[j]&&b[j](i,e=function(){b.removeEventListener(i,e,f),m()},f),h&&b.attachEvent(k,d=function(){/^c/.test(b.readyState)&&(b.detachEvent(k,d),m())}),a.domReady=h?function(a){self!=top?l?a():c.push(a):function(){try{g.doScroll("left")}catch(b){return setTimeout(function(){domReady(a)},50)}a()}()}:function(a){l?a():c.push(a)}}(a,document),window.getTwitters=function(c,d,e,f){b++,typeof d=="object"&&(f=d,d=f.id,e=f.count),e||(e=1),f?f.count=e:f={},!f.timeout&&typeof f.onTimeout=="function"&&(f.timeout=10),typeof f.clearContents=="undefined"&&(f.clearContents=!0),f.twitterTarget=c,typeof f.enableLinks=="undefined"&&(f.enableLinks=!0),a.domReady(function(a,b){return function(){function f(){a.target=document.getElementById(a.twitterTarget);if(!!a.target){var f={limit:e};f.includeRT&&(f.include_rts=!0),a.timeout&&(window["twitterTimeout"+b]=setTimeout(function(){twitterlib.cancel(),a.onTimeout.call(a.target)},a.timeout*1e3));var g="timeline";d.indexOf("#")===0&&(g="search"),d.indexOf("/")!==-1&&(g="list"),a.ignoreReplies&&(f.filter="-@"),twitterlib.cache(!0),twitterlib[g](d,f,function(b,d){var e=[],f=b.length>a.count?a.count:b.length;e=["<ul>"];for(var g=0;g<f;g++){b[g].time=twitterlib.time.relative(b[g].created_at);for(var h in b[g].user)b[g]["user_"+h]=b[g].user[h];a.template?e.push("<li>"+a.template.replace(/%([a-z_\-\.]*)%/ig,function(c,d){var e=b[g][d]+""||"";d=="text"&&(e=twitterlib.expandLinks(b[g])),d=="text"&&a.enableLinks&&(e=twitterlib.ify.clean(e));return e})+"</li>"):a.bigTemplate?e.push(twitterlib.render(b[g])):e.push(c(b[g]))}e.push("</ul>"),a.clearContents?a.target.innerHTML=e.join(""):a.target.innerHTML+=e.join(""),a.callback&&a.callback(b)})}}function c(b){var c=a.enableLinks?twitterlib.ify.clean(twitterlib.expandLinks(b)):twitterlib.expandLinks(b),d="<li>";a.prefix&&(d+='<li><span className="twitterPrefix">',d+=a.prefix.replace(/%(.*?)%/g,function(a,c){return b.user[c]}),d+=" </span></li>"),d+='<span className="twitterStatus">'+twitterlib.time.relative(b.created_at)+"</span> ",d+='<span className="twitterTime">'+b.text+"</span>",a.newwindow&&(d=d.replace(/<a href/gi,'<a target="_blank" href'));return d}typeof twitterlib!="function"?setTimeout(function(){var a=document.createElement("script");a.onload=a.onreadystatechange=f,a.src="https://github.com/remy/twitterlib/raw/master/twitterlib.min.js";var b=document.head||document.getElementsByTagName("head")[0];b.insertBefore(a,b.firstChild)},0):f()}}(f,b))}}();

/*!
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2010 M. Alsup
 * Version: 2.9999 (13-NOV-2011)
 * Dual licensed under the MIT and GPL licenses.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.3.2 or later
 */
(function(c,d){var b="2.9999";if(c.support==d){c.support={opacity:!(c.browser.msie)}}function g(t){c.fn.cycle.debug&&f(t)}function f(){window.console&&console.log&&console.log("[cycle] "+Array.prototype.join.call(arguments," "))}c.expr[":"].paused=function(t){return t.cyclePause};c.fn.cycle=function(u,t){var v={s:this.selector,c:this.context};if(this.length===0&&u!="stop"){if(!c.isReady&&v.s){f("DOM not ready, queuing slideshow");c(function(){c(v.s,v.c).cycle(u,t)});return this}f("terminating; zero elements found by selector"+(c.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var z=l(this,u,t);if(z===false){return}z.updateActivePagerLink=z.updateActivePagerLink||c.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=this.cyclePause=0;var A=c(this);var B=z.slideExpr?c(z.slideExpr,this):A.children();var x=B.get();var w=r(A,B,x,z,v);if(w===false){return}if(x.length<2){f("terminating; too few slides: "+x.length);return}var y=w.continuous?10:m(x[w.currSlide],x[w.nextSlide],w,!w.backwards);if(y){y+=(w.delay||0);if(y<10){y=10}g("first timeout: "+y);this.cycleTimeout=setTimeout(function(){n(x,w,0,!z.backwards)},y)}})};function k(t,w,v){var x=c(t).data("cycle.opts");var u=!!t.cyclePause;if(u&&x.paused){x.paused(t,x,w,v)}else{if(!u&&x.resumed){x.resumed(t,x,w,v)}}}function l(t,w,u){if(t.cycleStop==d){t.cycleStop=0}if(w===d||w===null){w={}}if(w.constructor==String){switch(w){case"destroy":case"stop":var y=c(t).data("cycle.opts");if(!y){return false}t.cycleStop++;if(t.cycleTimeout){clearTimeout(t.cycleTimeout)}t.cycleTimeout=0;y.elements&&c(y.elements).stop();c(t).removeData("cycle.opts");if(w=="destroy"){s(y)}return false;case"toggle":t.cyclePause=(t.cyclePause===1)?0:1;x(t.cyclePause,u,t);k(t);return false;case"pause":t.cyclePause=1;k(t);return false;case"resume":t.cyclePause=0;x(false,u,t);k(t);return false;case"prev":case"next":var y=c(t).data("cycle.opts");if(!y){f('options not found, "prev/next" ignored');return false}c.fn.cycle[w](y);return false;default:w={fx:w}}return w}else{if(w.constructor==Number){var v=w;w=c(t).data("cycle.opts");if(!w){f("options not found, can not advance slide");return false}if(v<0||v>=w.elements.length){f("invalid slide index: "+v);return false}w.nextSlide=v;if(t.cycleTimeout){clearTimeout(t.cycleTimeout);t.cycleTimeout=0}if(typeof u=="string"){w.oneTimeFx=u}n(w.elements,w,1,v>=w.currSlide);return false}}return w;function x(A,B,z){if(!A&&B===true){var C=c(z).data("cycle.opts");if(!C){f("options not found, can not resume");return false}if(z.cycleTimeout){clearTimeout(z.cycleTimeout);z.cycleTimeout=0}n(C.elements,C,1,!C.backwards)}}}function e(t,u){if(!c.support.opacity&&u.cleartype&&t.style.filter){try{t.style.removeAttribute("filter")}catch(v){}}}function s(t){if(t.next){c(t.next).unbind(t.prevNextEvent)}if(t.prev){c(t.prev).unbind(t.prevNextEvent)}if(t.pager||t.pagerAnchorBuilder){c.each(t.pagerAnchors||[],function(){this.unbind().remove()})}t.pagerAnchors=null;if(t.destroy){t.destroy(t)}}function r(D,R,A,z,K){var t;var I=c.extend({},c.fn.cycle.defaults,z||{},c.metadata?D.metadata():c.meta?D.data():{});var G=c.isFunction(D.data)?D.data(I.metaAttr):null;if(G){I=c.extend(I,G)}if(I.autostop){I.countdown=I.autostopCount||A.length}var v=D[0];D.data("cycle.opts",I);I.$cont=D;I.stopCount=v.cycleStop;I.elements=A;I.before=I.before?[I.before]:[];I.after=I.after?[I.after]:[];if(!c.support.opacity&&I.cleartype){I.after.push(function(){e(this,I)})}if(I.continuous){I.after.push(function(){n(A,I,0,!I.backwards)})}i(I);if(!c.support.opacity&&I.cleartype&&!I.cleartypeNoBg){a(R)}if(D.css("position")=="static"){D.css("position","relative")}if(I.width){D.width(I.width)}if(I.height&&I.height!="auto"){D.height(I.height)}if(I.startingSlide!=d){I.startingSlide=parseInt(I.startingSlide,10);if(I.startingSlide>=A.length||I.startSlide<0){I.startingSlide=0}else{t=true}}else{if(I.backwards){I.startingSlide=A.length-1}else{I.startingSlide=0}}if(I.random){I.randomMap=[];for(var P=0;P<A.length;P++){I.randomMap.push(P)}I.randomMap.sort(function(T,w){return Math.random()-0.5});if(t){for(var N=0;N<A.length;N++){if(I.startingSlide==I.randomMap[N]){I.randomIndex=N}}}else{I.randomIndex=1;I.startingSlide=I.randomMap[1]}}else{if(I.startingSlide>=A.length){I.startingSlide=0}}I.currSlide=I.startingSlide||0;var C=I.startingSlide;R.css({position:"absolute",top:0,left:0}).hide().each(function(w){var T;if(I.backwards){T=C?w<=C?A.length+(w-C):C-w:A.length-w}else{T=C?w>=C?A.length-(w-C):C-w:A.length-w}c(this).css("z-index",T)});c(A[C]).css("opacity",1).show();e(A[C],I);if(I.fit){if(!I.aspect){if(I.width){R.width(I.width)}if(I.height&&I.height!="auto"){R.height(I.height)}}else{R.each(function(){var T=c(this);var w=(I.aspect===true)?T.width()/T.height():I.aspect;if(I.width&&T.width()!=I.width){T.width(I.width);T.height(I.width/w)}if(I.height&&T.height()<I.height){T.height(I.height);T.width(I.height*w)}})}}if(I.center&&((!I.fit)||I.aspect)){R.each(function(){var w=c(this);w.css({"margin-left":I.width?((I.width-w.width())/2)+"px":0,"margin-top":I.height?((I.height-w.height())/2)+"px":0})})}if(I.center&&!I.fit&&!I.slideResize){R.each(function(){var w=c(this);w.css({"margin-left":I.width?((I.width-w.width())/2)+"px":0,"margin-top":I.height?((I.height-w.height())/2)+"px":0})})}var J=I.containerResize&&!D.innerHeight();if(J){var B=0,H=0;for(var M=0;M<A.length;M++){var u=c(A[M]),S=u[0],F=u.outerWidth(),Q=u.outerHeight();if(!F){F=S.offsetWidth||S.width||u.attr("width")}if(!Q){Q=S.offsetHeight||S.height||u.attr("height")}B=F>B?F:B;H=Q>H?Q:H}if(B>0&&H>0){D.css({width:B+"px",height:H+"px"})}}var y=false;if(I.pause){D.hover(function(){y=true;this.cyclePause++;k(v,true)},function(){y&&this.cyclePause--;k(v,true)})}if(o(I)===false){return false}var x=false;z.requeueAttempts=z.requeueAttempts||0;R.each(function(){var V=c(this);this.cycleH=(I.fit&&I.height)?I.height:(V.height()||this.offsetHeight||this.height||V.attr("height")||0);this.cycleW=(I.fit&&I.width)?I.width:(V.width()||this.offsetWidth||this.width||V.attr("width")||0);if(V.is("img")){var T=(c.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var W=(c.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var U=(c.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var w=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(T||W||U||w){if(K.s&&I.requeueOnImageNotLoaded&&++z.requeueAttempts<100){f(z.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){c(K.s,K.c).cycle(z)},I.requeueTimeout);x=true;return false}else{f("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}}}return true});if(x){return false}I.cssBefore=I.cssBefore||{};I.cssAfter=I.cssAfter||{};I.cssFirst=I.cssFirst||{};I.animIn=I.animIn||{};I.animOut=I.animOut||{};R.not(":eq("+C+")").css(I.cssBefore);c(R[C]).css(I.cssFirst);if(I.timeout){I.timeout=parseInt(I.timeout,10);if(I.speed.constructor==String){I.speed=c.fx.speeds[I.speed]||parseInt(I.speed,10)}if(!I.sync){I.speed=I.speed/2}var L=I.fx=="none"?0:I.fx=="shuffle"?500:250;while((I.timeout-I.speed)<L){I.timeout+=I.speed}}if(I.easing){I.easeIn=I.easeOut=I.easing}if(!I.speedIn){I.speedIn=I.speed}if(!I.speedOut){I.speedOut=I.speed}I.slideCount=A.length;I.currSlide=I.lastSlide=C;if(I.random){if(++I.randomIndex==A.length){I.randomIndex=0}I.nextSlide=I.randomMap[I.randomIndex]}else{if(I.backwards){I.nextSlide=I.startingSlide==0?(A.length-1):I.startingSlide-1}else{I.nextSlide=I.startingSlide>=(A.length-1)?0:I.startingSlide+1}}if(!I.multiFx){var O=c.fn.cycle.transitions[I.fx];if(c.isFunction(O)){O(D,R,I)}else{if(I.fx!="custom"&&!I.multiFx){f("unknown transition: "+I.fx,"; slideshow terminating");return false}}}var E=R[C];if(!I.skipInitializationCallbacks){if(I.before.length){I.before[0].apply(E,[E,E,I,true])}if(I.after.length){I.after[0].apply(E,[E,E,I,true])}}if(I.next){c(I.next).bind(I.prevNextEvent,function(){return h(I,1)})}if(I.prev){c(I.prev).bind(I.prevNextEvent,function(){return h(I,0)})}if(I.pager||I.pagerAnchorBuilder){q(A,I)}j(I,A);return I}function i(t){t.original={before:[],after:[]};t.original.cssBefore=c.extend({},t.cssBefore);t.original.cssAfter=c.extend({},t.cssAfter);t.original.animIn=c.extend({},t.animIn);t.original.animOut=c.extend({},t.animOut);c.each(t.before,function(){t.original.before.push(this)});c.each(t.after,function(){t.original.after.push(this)})}function o(z){var x,v,u=c.fn.cycle.transitions;if(z.fx.indexOf(",")>0){z.multiFx=true;z.fxs=z.fx.replace(/\s*/g,"").split(",");for(x=0;x<z.fxs.length;x++){var y=z.fxs[x];v=u[y];if(!v||!u.hasOwnProperty(y)||!c.isFunction(v)){f("discarding unknown transition: ",y);z.fxs.splice(x,1);x--}}if(!z.fxs.length){f("No valid transitions named; slideshow terminating.");return false}}else{if(z.fx=="all"){z.multiFx=true;z.fxs=[];for(p in u){v=u[p];if(u.hasOwnProperty(p)&&c.isFunction(v)){z.fxs.push(p)}}}}if(z.multiFx&&z.randomizeEffects){var w=Math.floor(Math.random()*20)+30;for(x=0;x<w;x++){var t=Math.floor(Math.random()*z.fxs.length);z.fxs.push(z.fxs.splice(t,1)[0])}g("randomized fx sequence: ",z.fxs)}return true}function j(u,t){u.addSlide=function(w,x){var v=c(w),y=v[0];if(!u.autostopCount){u.countdown++}t[x?"unshift":"push"](y);if(u.els){u.els[x?"unshift":"push"](y)}u.slideCount=t.length;if(u.random){u.randomMap.push(u.slideCount-1);u.randomMap.sort(function(A,z){return Math.random()-0.5})}v.css("position","absolute");v[x?"prependTo":"appendTo"](u.$cont);if(x){u.currSlide++;u.nextSlide++}if(!c.support.opacity&&u.cleartype&&!u.cleartypeNoBg){a(v)}if(u.fit&&u.width){v.width(u.width)}if(u.fit&&u.height&&u.height!="auto"){v.height(u.height)}y.cycleH=(u.fit&&u.height)?u.height:v.height();y.cycleW=(u.fit&&u.width)?u.width:v.width();v.css(u.cssBefore);if(u.pager||u.pagerAnchorBuilder){c.fn.cycle.createPagerAnchor(t.length-1,y,c(u.pager),t,u)}if(c.isFunction(u.onAddSlide)){u.onAddSlide(v)}else{v.hide()}}}c.fn.cycle.resetState=function(u,t){t=t||u.fx;u.before=[];u.after=[];u.cssBefore=c.extend({},u.original.cssBefore);u.cssAfter=c.extend({},u.original.cssAfter);u.animIn=c.extend({},u.original.animIn);u.animOut=c.extend({},u.original.animOut);u.fxFn=null;c.each(u.original.before,function(){u.before.push(this)});c.each(u.original.after,function(){u.after.push(this)});var v=c.fn.cycle.transitions[t];if(c.isFunction(v)){v(u.$cont,c(u.elements),u)}};function n(z,t,y,B){if(y&&t.busy&&t.manualTrump){g("manualTrump in go(), stopping active transition");c(z).stop(true,true);t.busy=0}if(t.busy){g("transition active, ignoring new tx request");return}var w=t.$cont[0],E=z[t.currSlide],C=z[t.nextSlide];if(w.cycleStop!=t.stopCount||w.cycleTimeout===0&&!y){return}if(!y&&!w.cyclePause&&!t.bounce&&((t.autostop&&(--t.countdown<=0))||(t.nowrap&&!t.random&&t.nextSlide<t.currSlide))){if(t.end){t.end(t)}return}var A=false;if((y||!w.cyclePause)&&(t.nextSlide!=t.currSlide)){A=true;var x=t.fx;E.cycleH=E.cycleH||c(E).height();E.cycleW=E.cycleW||c(E).width();C.cycleH=C.cycleH||c(C).height();C.cycleW=C.cycleW||c(C).width();if(t.multiFx){if(B&&(t.lastFx==d||++t.lastFx>=t.fxs.length)){t.lastFx=0}else{if(!B&&(t.lastFx==d||--t.lastFx<0)){t.lastFx=t.fxs.length-1}}x=t.fxs[t.lastFx]}if(t.oneTimeFx){x=t.oneTimeFx;t.oneTimeFx=null}c.fn.cycle.resetState(t,x);if(t.before.length){c.each(t.before,function(F,G){if(w.cycleStop!=t.stopCount){return}G.apply(C,[E,C,t,B])})}var u=function(){t.busy=0;c.each(t.after,function(F,G){if(w.cycleStop!=t.stopCount){return}G.apply(C,[E,C,t,B])});if(!w.cycleStop){D()}};g("tx firing("+x+"); currSlide: "+t.currSlide+"; nextSlide: "+t.nextSlide);t.busy=1;if(t.fxFn){t.fxFn(E,C,t,u,B,y&&t.fastOnEvent)}else{if(c.isFunction(c.fn.cycle[t.fx])){c.fn.cycle[t.fx](E,C,t,u,B,y&&t.fastOnEvent)}else{c.fn.cycle.custom(E,C,t,u,B,y&&t.fastOnEvent)}}}else{D()}if(A||t.nextSlide==t.currSlide){t.lastSlide=t.currSlide;if(t.random){t.currSlide=t.nextSlide;if(++t.randomIndex==z.length){t.randomIndex=0;t.randomMap.sort(function(G,F){return Math.random()-0.5})}t.nextSlide=t.randomMap[t.randomIndex];if(t.nextSlide==t.currSlide){t.nextSlide=(t.currSlide==t.slideCount-1)?0:t.currSlide+1}}else{if(t.backwards){var v=(t.nextSlide-1)<0;if(v&&t.bounce){t.backwards=!t.backwards;t.nextSlide=1;t.currSlide=0}else{t.nextSlide=v?(z.length-1):t.nextSlide-1;t.currSlide=v?0:t.nextSlide+1}}else{var v=(t.nextSlide+1)==z.length;if(v&&t.bounce){t.backwards=!t.backwards;t.nextSlide=z.length-2;t.currSlide=z.length-1}else{t.nextSlide=v?0:t.nextSlide+1;t.currSlide=v?z.length-1:t.nextSlide-1}}}}if(A&&t.pager){t.updateActivePagerLink(t.pager,t.currSlide,t.activePagerClass)}function D(){var F=0,G=t.timeout;if(t.timeout&&!t.continuous){F=m(z[t.currSlide],z[t.nextSlide],t,B);if(t.fx=="shuffle"){F-=t.speedOut}}else{if(t.continuous&&w.cyclePause){F=10}}if(F>0){w.cycleTimeout=setTimeout(function(){n(z,t,0,!t.backwards)},F)}}}c.fn.cycle.updateActivePagerLink=function(t,v,u){c(t).each(function(){c(this).children().removeClass(u).eq(v).addClass(u)})};function m(y,w,x,v){if(x.timeoutFn){var u=x.timeoutFn.call(y,y,w,x,v);while(x.fx!="none"&&(u-x.speed)<250){u+=x.speed}g("calculated timeout: "+u+"; speed: "+x.speed);if(u!==false){return u}}return x.timeout}c.fn.cycle.next=function(t){h(t,1)};c.fn.cycle.prev=function(t){h(t,0)};function h(w,v){var z=v?1:-1;var u=w.elements;var y=w.$cont[0],x=y.cycleTimeout;if(x){clearTimeout(x);y.cycleTimeout=0}if(w.random&&z<0){w.randomIndex--;if(--w.randomIndex==-2){w.randomIndex=u.length-2}else{if(w.randomIndex==-1){w.randomIndex=u.length-1}}w.nextSlide=w.randomMap[w.randomIndex]}else{if(w.random){w.nextSlide=w.randomMap[w.randomIndex]}else{w.nextSlide=w.currSlide+z;if(w.nextSlide<0){if(w.nowrap){return false}w.nextSlide=u.length-1}else{if(w.nextSlide>=u.length){if(w.nowrap){return false}w.nextSlide=0}}}}var t=w.onPrevNextEvent||w.prevNextClick;if(c.isFunction(t)){t(z>0,w.nextSlide,u[w.nextSlide])}n(u,w,1,v);return false}function q(u,v){var t=c(v.pager);c.each(u,function(w,x){c.fn.cycle.createPagerAnchor(w,x,t,u,v)});v.updateActivePagerLink(v.pager,v.startingSlide,v.activePagerClass)}c.fn.cycle.createPagerAnchor=function(y,v,A,x,u){var B;if(c.isFunction(u.pagerAnchorBuilder)){B=u.pagerAnchorBuilder(y,v);g("pagerAnchorBuilder("+y+", el) returned: "+B)}else{B='<a href="#">'+(y+1)+"</a>"}if(!B){return}var w=c(B);if(w.parents("body").length===0){var z=[];if(A.length>1){A.each(function(){var E=w.clone(true);c(this).append(E);z.push(E[0])});w=c(z)}else{w.appendTo(A)}}u.pagerAnchors=u.pagerAnchors||[];u.pagerAnchors.push(w);var C=function(H){H.preventDefault();u.nextSlide=y;var G=u.$cont[0],F=G.cycleTimeout;if(F){clearTimeout(F);G.cycleTimeout=0}var E=u.onPagerEvent||u.pagerClick;if(c.isFunction(E)){E(u.nextSlide,x[u.nextSlide])}n(x,u,1,u.currSlide<y)};if(/mouseenter|mouseover/i.test(u.pagerEvent)){w.hover(C,function(){})}else{w.bind(u.pagerEvent,C)}if(!/^click/.test(u.pagerEvent)&&!u.allowPagerClickBubble){w.bind("click.cycle",function(){return false})}var D=u.$cont[0];var t=false;if(u.pauseOnPagerHover){w.hover(function(){t=true;D.cyclePause++;k(D,true,true)},function(){t&&D.cyclePause--;k(D,true,true)})}};c.fn.cycle.hopsFromLast=function(w,v){var u,t=w.lastSlide,x=w.currSlide;if(v){u=x>t?x-t:w.slideCount-t}else{u=x<t?t-x:t+w.slideCount-x}return u};function a(v){g("applying clearType background-color hack");function u(w){w=parseInt(w,10).toString(16);return w.length<2?"0"+w:w}function t(y){for(;y&&y.nodeName.toLowerCase()!="html";y=y.parentNode){var w=c.css(y,"background-color");if(w&&w.indexOf("rgb")>=0){var x=w.match(/\d+/g);return"#"+u(x[0])+u(x[1])+u(x[2])}if(w&&w!="transparent"){return w}}return"#ffffff"}v.each(function(){c(this).css("background-color",t(this))})}c.fn.cycle.commonReset=function(z,x,y,u,v,t){c(y.elements).not(z).hide();if(typeof y.cssBefore.opacity=="undefined"){y.cssBefore.opacity=1}y.cssBefore.display="block";if(y.slideResize&&u!==false&&x.cycleW>0){y.cssBefore.width=x.cycleW}if(y.slideResize&&v!==false&&x.cycleH>0){y.cssBefore.height=x.cycleH}y.cssAfter=y.cssAfter||{};y.cssAfter.display="none";c(z).css("zIndex",y.slideCount+(t===true?1:0));c(x).css("zIndex",y.slideCount+(t===true?0:1))};c.fn.cycle.custom=function(F,z,t,w,y,u){var E=c(F),A=c(z);var v=t.speedIn,D=t.speedOut,x=t.easeIn,C=t.easeOut;A.css(t.cssBefore);if(u){if(typeof u=="number"){v=D=u}else{v=D=1}x=C=null}var B=function(){A.animate(t.animIn,v,x,function(){w()})};E.animate(t.animOut,D,C,function(){E.css(t.cssAfter);if(!t.sync){B()}});if(t.sync){B()}};c.fn.cycle.transitions={fade:function(u,v,t){v.not(":eq("+t.currSlide+")").css("opacity",0);t.before.push(function(y,w,x){c.fn.cycle.commonReset(y,w,x);x.cssBefore.opacity=0});t.animIn={opacity:1};t.animOut={opacity:0};t.cssBefore={top:0,left:0}}};c.fn.cycle.ver=function(){return b};c.fn.cycle.defaults={activePagerClass:"activeSlide",after:null,allowPagerClickBubble:false,animIn:null,animOut:null,aspect:false,autostop:0,autostopCount:0,backwards:false,before:null,center:null,cleartype:!c.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,metaAttr:"cycle",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,skipInitializationCallbacks:false,slideExpr:null,slideResize:1,speed:1000,speedIn:null,speedOut:null,startingSlide:d,sync:1,timeout:4000,timeoutFn:null,updateActivePagerLink:null,width:null}})(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-2010 M. Alsup
 * Version:	 2.73
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function(a){a.fn.cycle.transitions.none=function(c,d,b){b.fxFn=function(g,e,f,h){a(e).show();a(g).hide();h()}};a.fn.cycle.transitions.fadeout=function(c,d,b){d.not(":eq("+b.currSlide+")").css({display:"block",opacity:1});b.before.push(function(k,i,j,f,g,e){a(k).css("zIndex",j.slideCount+(!e===true?1:0));a(i).css("zIndex",j.slideCount+(!e===true?0:1))});b.animIn.opacity=1;b.animOut.opacity=0;b.cssBefore.opacity=1;b.cssBefore.display="block";b.cssAfter.zIndex=0};a.fn.cycle.transitions.scrollUp=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssBefore.top=b;c.cssBefore.left=0;c.cssFirst.top=0;c.animIn.top=0;c.animOut.top=-b};a.fn.cycle.transitions.scrollDown=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssFirst.top=0;c.cssBefore.top=-b;c.cssBefore.left=0;c.animIn.top=0;c.animOut.top=b};a.fn.cycle.transitions.scrollLeft=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst.left=0;c.cssBefore.left=b;c.cssBefore.top=0;c.animIn.left=0;c.animOut.left=0-b};a.fn.cycle.transitions.scrollRight=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst.left=0;c.cssBefore.left=-b;c.cssBefore.top=0;c.animIn.left=0;c.animOut.left=b};a.fn.cycle.transitions.scrollHorz=function(c,d,b){c.css("overflow","hidden").width();b.before.push(function(h,f,g,e){if(g.rev){e=!e}a.fn.cycle.commonReset(h,f,g);g.cssBefore.left=e?(f.cycleW-1):(1-f.cycleW);g.animOut.left=e?-h.cycleW:h.cycleW});b.cssFirst.left=0;b.cssBefore.top=0;b.animIn.left=0;b.animOut.top=0};a.fn.cycle.transitions.scrollVert=function(c,d,b){c.css("overflow","hidden");b.before.push(function(h,f,g,e){if(g.rev){e=!e}a.fn.cycle.commonReset(h,f,g);g.cssBefore.top=e?(1-f.cycleH):(f.cycleH-1);g.animOut.top=e?h.cycleH:-h.cycleH});b.cssFirst.top=0;b.cssBefore.left=0;b.animIn.top=0;b.animOut.left=0};a.fn.cycle.transitions.slideX=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW});b.cssBefore.left=0;b.cssBefore.top=0;b.cssBefore.width=0;b.animIn.width="show";b.animOut.width=0};a.fn.cycle.transitions.slideY=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH});b.cssBefore.left=0;b.cssBefore.top=0;b.cssBefore.height=0;b.animIn.height="show";b.animOut.height=0};a.fn.cycle.transitions.shuffle=function(e,f,d){var c,b=e.css("overflow","visible").width();f.css({left:0,top:0});d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true)});if(!d.speedAdjusted){d.speed=d.speed/2;d.speedAdjusted=true}d.random=0;d.shuffle=d.shuffle||{left:-b,top:15};d.els=[];for(c=0;c<f.length;c++){d.els.push(f[c])}for(c=0;c<d.currSlide;c++){d.els.push(d.els.shift())}d.fxFn=function(m,j,l,g,i){if(l.rev){i=!i}var h=i?a(m):a(j);a(j).css(l.cssBefore);var k=l.slideCount;h.animate(l.shuffle,l.speedIn,l.easeIn,function(){var o=a.fn.cycle.hopsFromLast(l,i);for(var q=0;q<o;q++){i?l.els.push(l.els.shift()):l.els.unshift(l.els.pop())}if(i){for(var r=0,n=l.els.length;r<n;r++){a(l.els[r]).css("z-index",n-r+k)}}else{var s=a(m).css("z-index");h.css("z-index",parseInt(s,10)+1+k)}h.animate({left:0,top:0},l.speedOut,l.easeOut,function(){a(i?this:m).hide();if(g){g()}})})};a.extend(d.cssBefore,{display:"block",opacity:1,top:0,left:0})};a.fn.cycle.transitions.turnUp=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=e.cycleH;f.animIn.height=e.cycleH;f.animOut.width=e.cycleW});b.cssFirst.top=0;b.cssBefore.left=0;b.cssBefore.height=0;b.animIn.top=0;b.animOut.height=0};a.fn.cycle.transitions.turnDown=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH;f.animOut.top=g.cycleH});b.cssFirst.top=0;b.cssBefore.left=0;b.cssBefore.top=0;b.cssBefore.height=0;b.animOut.height=0};a.fn.cycle.transitions.turnLeft=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=e.cycleW;f.animIn.width=e.cycleW});b.cssBefore.top=0;b.cssBefore.width=0;b.animIn.left=0;b.animOut.width=0};a.fn.cycle.transitions.turnRight=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW;f.animOut.left=g.cycleW});a.extend(b.cssBefore,{top:0,left:0,width:0});b.animIn.left=0;b.animOut.width=0};a.fn.cycle.transitions.zoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false,true);f.cssBefore.top=e.cycleH/2;f.cssBefore.left=e.cycleW/2;a.extend(f.animIn,{top:0,left:0,width:e.cycleW,height:e.cycleH});a.extend(f.animOut,{width:0,height:0,top:g.cycleH/2,left:g.cycleW/2})});b.cssFirst.top=0;b.cssFirst.left=0;b.cssBefore.width=0;b.cssBefore.height=0};a.fn.cycle.transitions.fadeZoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false);f.cssBefore.left=e.cycleW/2;f.cssBefore.top=e.cycleH/2;a.extend(f.animIn,{top:0,left:0,width:e.cycleW,height:e.cycleH})});b.cssBefore.width=0;b.cssBefore.height=0;b.animOut.opacity=0};a.fn.cycle.transitions.blindX=function(d,e,c){var b=d.css("overflow","hidden").width();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.width=f.cycleW;g.animOut.left=h.cycleW});c.cssBefore.left=b;c.cssBefore.top=0;c.animIn.left=0;c.animOut.left=b};a.fn.cycle.transitions.blindY=function(d,e,c){var b=d.css("overflow","hidden").height();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.height=f.cycleH;g.animOut.top=h.cycleH});c.cssBefore.top=b;c.cssBefore.left=0;c.animIn.top=0;c.animOut.top=b};a.fn.cycle.transitions.blindZ=function(e,f,d){var c=e.css("overflow","hidden").height();var b=e.width();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h);h.animIn.height=g.cycleH;h.animOut.top=i.cycleH});d.cssBefore.top=c;d.cssBefore.left=b;d.animIn.top=0;d.animIn.left=0;d.animOut.top=c;d.animOut.left=b};a.fn.cycle.transitions.growX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=this.cycleW/2;f.animIn.left=0;f.animIn.width=this.cycleW;f.animOut.left=0});b.cssBefore.top=0;b.cssBefore.width=0};a.fn.cycle.transitions.growY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=this.cycleH/2;f.animIn.top=0;f.animIn.height=this.cycleH;f.animOut.top=0});b.cssBefore.height=0;b.cssBefore.left=0};a.fn.cycle.transitions.curtainX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true,true);f.cssBefore.left=e.cycleW/2;f.animIn.left=0;f.animIn.width=this.cycleW;f.animOut.left=g.cycleW/2;f.animOut.width=0});b.cssBefore.top=0;b.cssBefore.width=0};a.fn.cycle.transitions.curtainY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false,true);f.cssBefore.top=e.cycleH/2;f.animIn.top=0;f.animIn.height=e.cycleH;f.animOut.top=g.cycleH/2;f.animOut.height=0});b.cssBefore.height=0;b.cssBefore.left=0};a.fn.cycle.transitions.cover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h);if(i=="right"){h.cssBefore.left=-b}else{if(i=="up"){h.cssBefore.top=c}else{if(i=="down"){h.cssBefore.top=-c}else{h.cssBefore.left=b}}}});e.animIn.left=0;e.animIn.top=0;e.cssBefore.top=0;e.cssBefore.left=0};a.fn.cycle.transitions.uncover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h,true,true,true);if(i=="right"){h.animOut.left=b}else{if(i=="up"){h.animOut.top=-c}else{if(i=="down"){h.animOut.top=c}else{h.animOut.left=-b}}}});e.animIn.left=0;e.animIn.top=0;e.cssBefore.top=0;e.cssBefore.left=0};a.fn.cycle.transitions.toss=function(e,f,d){var b=e.css("overflow","visible").width();var c=e.height();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true);if(!h.animOut.left&&!h.animOut.top){a.extend(h.animOut,{left:b*2,top:-c/2,opacity:0})}else{h.animOut.opacity=0}});d.cssBefore.left=0;d.cssBefore.top=0;d.animIn.left=0};a.fn.cycle.transitions.wipe=function(s,m,e){var q=s.css("overflow","hidden").width();var j=s.height();e.cssBefore=e.cssBefore||{};var g;if(e.clip){if(/l2r/.test(e.clip)){g="rect(0px 0px "+j+"px 0px)"}else{if(/r2l/.test(e.clip)){g="rect(0px "+q+"px "+j+"px "+q+"px)"}else{if(/t2b/.test(e.clip)){g="rect(0px "+q+"px 0px 0px)"}else{if(/b2t/.test(e.clip)){g="rect("+j+"px "+q+"px "+j+"px 0px)"}else{if(/zoom/.test(e.clip)){var o=parseInt(j/2,10);var f=parseInt(q/2,10);g="rect("+o+"px "+f+"px "+o+"px "+f+"px)"}}}}}}e.cssBefore.clip=e.cssBefore.clip||g||"rect(0px 0px 0px 0px)";var k=e.cssBefore.clip.match(/(\d+)/g);var u=parseInt(k[0],10),c=parseInt(k[1],10),n=parseInt(k[2],10),i=parseInt(k[3],10);e.before.push(function(w,h,t){if(w==h){return}var d=a(w),b=a(h);a.fn.cycle.commonReset(w,h,t,true,true,false);t.cssAfter.display="block";var r=1,l=parseInt((t.speedIn/13),10)-1;(function v(){var y=u?u-parseInt(r*(u/l),10):0;var z=i?i-parseInt(r*(i/l),10):0;var A=n<j?n+parseInt(r*((j-n)/l||1),10):j;var x=c<q?c+parseInt(r*((q-c)/l||1),10):q;b.css({clip:"rect("+y+"px "+x+"px "+A+"px "+z+"px)"});(r++<=l)?setTimeout(v,13):d.css("display","none")})()});a.extend(e.cssBefore,{display:"block",opacity:1,top:0,left:0});e.animIn={left:0};e.animOut={left:0}}})(jQuery);

/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 3.1.3
------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:'3.1.3'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:5000,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'pp_default',horizontal_padding:20,hideflash:false,wmode:'opaque',autoplay:true,modal:false,deeplinking:true,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},ie6_fallback:true,markup:'<div class="pp_pic_holder"> \
      <div class="ppt">&nbsp;</div> \
      <div class="pp_top"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
      <div class="pp_content_container"> \
       <div class="pp_left"> \
       <div class="pp_right"> \
        <div class="pp_content"> \
         <div class="pp_loaderIcon"></div> \
         <div class="pp_fade"> \
          <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
          <div class="pp_hoverContainer"> \
           <a class="pp_next" href="#">next</a> \
           <a class="pp_previous" href="#">previous</a> \
          </div> \
          <div id="pp_full_res"></div> \
          <div class="pp_details"> \
           <div class="pp_nav"> \
            <a href="#" class="pp_arrow_previous">Previous</a> \
            <p class="currentTextHolder">0/0</p> \
            <a href="#" class="pp_arrow_next">Next</a> \
           </div> \
           <p class="pp_description"></p> \
           <div class="pp_social">{pp_social}</div> \
           <a class="pp_close" href="#">Close</a> \
          </div> \
         </div> \
        </div> \
       </div> \
       </div> \
      </div> \
      <div class="pp_bottom"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
     </div> \
     <div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \
        <a href="#" class="pp_arrow_previous">Previous</a> \
        <div> \
         <ul> \
          {gallery} \
         </ul> \
        </div> \
        <a href="#" class="pp_arrow_next">Next</a> \
       </div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline">{content}</div>',custom_markup:'',social_tools:'<div class="twitter"><a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div><div class="facebook"><iframe src="http://www.facebook.com/plugins/like.php?locale=en_US&href={location_href}&amp;layout=button_count&amp;show_faces=true&amp;width=500&amp;action=like&amp;font&amp;colorscheme=light&amp;height=23" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:500px; height:23px;" allowTransparency="true"></iframe></div>'},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});};$.prettyPhoto.initialize=function(){settings=pp_settings;if(settings.theme=='pp_default')settings.horizontal_padding=16;if(settings.ie6_fallback&&$.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));if(pp_images.length>30)settings.overlay_gallery=false;set_position=jQuery.inArray($(this).attr('href'),pp_images);rel_index=(isSet)?set_position:$("a[rel^='"+theRel+"']").index($(this));_build_overlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;_build_overlay(event.target);}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if(settings.deeplinking)
setHashtag();if(settings.social_tools){facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));$pp_pic_holder.find('.pp_social').html(facebook_like_link);}
if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());if(pp_descriptions[set_position]!=""){$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));}else{$pp_pic_holder.find('.pp_description').hide();}
movie_width=(parseFloat(getParam('width',pp_images[set_position])))?getParam('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(getParam('height',pp_images[set_position])))?getParam('height',pp_images[set_position]):settings.default_height.toString();percentBased=false;if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');imgPreloader="";skipInjection=false;switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=getParam('v',pp_images[set_position]);if(movie_id==""){movie_id=pp_images[set_position].split('youtu.be/');movie_id=movie_id[1];if(movie_id.indexOf('?')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('?'));if(movie_id.indexOf('&')>0)
movie_id=movie_id.substr(0,movie_id.indexOf('&'));}
movie='http://www.youtube.com/embed/'+movie_id;(getParam('rel',pp_images[set_position]))?movie+="?rel="+getParam('rel',pp_images[set_position]):movie+="?rel=1";if(settings.autoplay)movie+="&autoplay=1";toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'ajax':doresize=false;pp_dimensions=_fitToViewport(movie_width,movie_height);doresize=true;skipInjection=true;$.get(pp_images[set_position],function(responseHTML){toInject=settings.inline_markup.replace(/{content}/g,responseHTML);$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();});break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().append('<br clear="all" />').css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader&&!skipInjection){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0)set_position=$(pp_images).size()-1;}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1)set_position=0;}else{set_position=direction;};rel_index=set_position;if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage)currentGalleryPage=0;}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0)currentGalleryPage=totalPage;}else{currentGalleryPage=direction;};slide_speed=(direction=='next'||direction=='previous')?settings.animation_speed:0;slide_to=currentGalleryPage*(itemsPerPage*itemWidth);$pp_gallery.find('ul').animate({left:-slide_to},slide_speed);};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){if($pp_overlay.is(":animated"))return;$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed,iframe[src*=youtube],iframe[src*=vimeo]').css('visibility','visible');$(this).remove();$(window).unbind('scroll.prettyphoto');clearHashtag();settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$ppt.fadeTo(settings.animation_speed,1);$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand').hide();}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);if((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight)){_fitToViewport(pp_containerWidth,pp_containerHeight)};};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+(settings.horizontal_padding*2),contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().addClass(settings.theme).width(width).appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)||itemSrc.match(/youtu\.be/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bajax=true\b/i)){return'ajax';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;if(contentHeight>windowHeight)
return;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){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};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"&&(settings.ie6_fallback&&!($.browser.msie&&parseInt($.browser.version)==6))){itemWidth=52+5;navWidth=(settings.theme=="facebook"||settings.theme=="pp_default")?50:30;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').hide();}else{$pp_gallery.find('.pp_arrow_next,.pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth;fullGalleryWidth=pp_images.length*itemWidth;$pp_gallery.css('margin-left',-((galleryWidth/2)+(navWidth/2))).find('div:first').width(galleryWidth+5).find('ul').width(fullGalleryWidth).find('li.selected').removeClass('selected');goToPage=(Math.floor(set_position/itemsPerPage)<totalPage)?Math.floor(set_position/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_gallery_li.filter(':eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');}}
function _build_overlay(caller){if(settings.social_tools)
facebook_like_link=settings.social_tools.replace('{location_href}',encodeURIComponent(location.href));settings.markup=settings.markup.replace('{pp_social}',(settings.social_tools)?facebook_like_link:'');$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';img_src='';}else{classname='';img_src=pp_images[i];}
toInject+="<li class='"+classname+"'><a href='#'><img src='"+img_src+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_gallery=$('.pp_pic_holder .pp_gallery'),$pp_gallery_li=$pp_gallery.find('li');$pp_gallery.find('.pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_gallery.find('.pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_gallery_li.each(function(i){$(this).find('a').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};if(!pp_alreadyInitialized&&getHashtag()){pp_alreadyInitialized=true;hashIndex=getHashtag();hashRel=hashIndex;hashIndex=hashIndex.substring(hashIndex.indexOf('/')+1,hashIndex.length-1);hashRel=hashRel.substring(0,hashRel.indexOf('/'));setTimeout(function(){$("a[rel^='"+hashRel+"']:eq("+hashIndex+")").trigger('click');},50);}
return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function getHashtag(){url=location.href;hashtag=(url.indexOf('#!')!=-1)?decodeURI(url.substring(url.indexOf('#!')+2,url.length)):false;return hashtag;};function setHashtag(){if(typeof theRel=='undefined')return;location.hash='!'+theRel+'/'+rel_index+'/';};function clearHashtag(){url=location.href;hashtag=(url.indexOf('#!details'))?true:false;if(hashtag)location.hash="!details";}
function getParam(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);var pp_alreadyInitialized=false;
