/*
	jQuery Coda-Slider v2.0 - http://www.ndoherty.biz/coda-slider
	Copyright (c) 2009 Niall Doherty
	This plugin available for use in all personal or commercial projects under both MIT and GPL licenses.
*/

$(function(){
	// Remove the coda-slider-no-js class from the body
	$("body").removeClass("coda-slider-no-js");
	// Preloader
	$(".coda-slider").children('.panel').hide().end().prepend('<p class="loading">Loading...<br /></p>');
});

var sliderCount = 1;

$.fn.codaSlider = function(settings) {

	settings = $.extend({
		autoHeight: false,
		autoHeightEaseDuration: 1000,
		autoHeightEaseFunction: "easeInOutExpo",
		autoSlide: false,
		autoSlideInterval: 7000,
		autoSlideStopWhenClicked: true,
		crossLinking: true,
		dynamicArrows: true,
		dynamicArrowLeftText: "<img src='/wp-content/themes/quinn/images/arrowL.png' />",
		dynamicArrowRightText: "<img src='/wp-content/themes/quinn/images/arrowR.png' />",
		dynamicTabs: true,
		dynamicTabsAlign: "right",
		dynamicTabsPosition: "bottom",
		externalTriggerSelector: "a.xtrig",
		firstPanelToLoad: 1,
		panelTitleSelector: "h2.title",
		slideEaseDuration: 1000,
		slideEaseFunction: "easeInOutExpo"
	}, settings);
	
	return this.each(function(){
		
		// Uncomment the line below to test your preloader
		// alert("Testing preloader");
		
		var slider = $(this);
		
		// If we need arrows
		if (settings.dynamicArrows) {
			slider.parent().addClass("arrows");
			slider.before('<div class="coda-nav-left" id="coda-nav-left-' + sliderCount + '"><a href="#">' + settings.dynamicArrowLeftText + '</a></div>');
			slider.after('<div class="coda-nav-right" id="coda-nav-right-' + sliderCount + '"><a href="#">' + settings.dynamicArrowRightText + '</a></div>');
		};
		
		var panelWidth = slider.find(".panel").width();
		var panelCount = slider.find(".panel").size();
		var panelContainerWidth = panelWidth*panelCount;
		var navClicks = 0; // Used if autoSlideStopWhenClicked = true
		
		// Surround the collection of panel divs with a container div (wide enough for all panels to be lined up end-to-end)
		$('.panel', slider).wrapAll('<div class="panel-container"></div>');
		// Specify the width of the container div (wide enough for all panels to be lined up end-to-end)
		$(".panel-container", slider).css({ width: panelContainerWidth });
		
		// Specify the current panel.
		// If the loaded URL has a hash (cross-linking), we're going to use that hash to give the slider a specific starting position...
		if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
			var currentPanel = parseInt(location.hash.slice(1));
			var offset = - (panelWidth*(currentPanel - 1));
			$('.panel-container', slider).css({ marginLeft: offset });
		// If that's not the case, check to see if we're supposed to load a panel other than Panel 1 initially...
		} else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) { 
			var currentPanel = settings.firstPanelToLoad;
			var offset = - (panelWidth*(currentPanel - 1));
			$('.panel-container', slider).css({ marginLeft: offset });
		// Otherwise, we'll just set the current panel to 1...
		} else { 
			var currentPanel = 1;
		};
			
		// Left arrow click
		$("#coda-nav-left-" + sliderCount + " a").click(function(){
			navClicks++;
			if (currentPanel == 1) {
				offset = - (panelWidth*(panelCount - 1));
				alterPanelHeight(panelCount - 1);
				currentPanel = panelCount;
				slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('li:last a').addClass('current');
			} else {
				currentPanel -= 1;
				alterPanelHeight(currentPanel - 1);
				offset = - (panelWidth*(currentPanel - 1));
				slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().prev().find('a').addClass('current');
			};
			$('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
			if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking)
			return false;
		});
			
		// Right arrow click
		$('#coda-nav-right-' + sliderCount + ' a').click(function(){
			navClicks++;
			if (currentPanel == panelCount) {
				offset = 0;
				currentPanel = 1;
				alterPanelHeight(0);
				slider.siblings('.coda-nav').find('a.current').removeClass('current').parents('ul').find('a:eq(0)').addClass('current');
			} else {
				offset = - (panelWidth*currentPanel);
				alterPanelHeight(currentPanel);
				currentPanel += 1;
				slider.siblings('.coda-nav').find('a.current').removeClass('current').parent().next().find('a').addClass('current');
			};
			$('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
			if (settings.crossLinking) { location.hash = currentPanel }; // Change the URL hash (cross-linking)
			return false;
		});
		
		// If we need a dynamic menu
		if (settings.dynamicTabs) {
			var dynamicTabs = '<div class="coda-nav" id="coda-nav-' + sliderCount + '"><ul></ul></div>';
			switch (settings.dynamicTabsPosition) {
				case "bottom":
					slider.parent().append(dynamicTabs);
					break;
				default:
					slider.parent().prepend(dynamicTabs);
					break;
			};
			ul = $('#coda-nav-' + sliderCount + ' ul');
			// Create the nav items
			$('.panel', slider).each(function(n) {
				ul.append('<li class="tab' + (n+1) + '"><a href="#' + (n+1) + '">' + $(this).find(settings.panelTitleSelector).text() + '</a></li>');												
			});
			navContainerWidth = slider.width() + slider.siblings('.coda-nav-left').width() + slider.siblings('.coda-nav-right').width();
			ul.parent().css({ width: navContainerWidth });
			switch (settings.dynamicTabsAlign) {
				case "center":
					ul.css({ width: ($("li", ul).width() + 2) * panelCount });
					break;
				case "right":
					ul.css({ float: 'right' });
					break;
			};
		};
			
		// If we need a tabbed nav
		$('#coda-nav-' + sliderCount + ' a').each(function(z) {
			// What happens when a nav link is clicked
			$(this).bind("click", function() {
				navClicks++;
				$(this).addClass('current').parents('ul').find('a').not($(this)).removeClass('current');
				offset = - (panelWidth*z);
				alterPanelHeight(z);
				currentPanel = z + 1;
				$('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
				if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified
			});
		});
		
		// External triggers (anywhere on the page)
		$(settings.externalTriggerSelector).each(function() {
			// Make sure this only affects the targeted slider
			if (sliderCount == parseInt($(this).attr("rel").slice(12))) {
				$(this).bind("click", function() {
					navClicks++;
					targetPanel = parseInt($(this).attr("href").slice(1));
					offset = - (panelWidth*(targetPanel - 1));
					alterPanelHeight(targetPanel - 1);
					currentPanel = targetPanel;
					// Switch the current tab:
					slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (targetPanel - 1) + ') a').addClass('current');
					// Slide
					$('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
					if (!settings.crossLinking) { return false }; // Don't change the URL hash unless cross-linking is specified
				});
			};
		});
			
		// Specify which tab is initially set to "current". Depends on if the loaded URL had a hash or not (cross-linking).
		if (settings.crossLinking && location.hash && parseInt(location.hash.slice(1)) <= panelCount) {
			$("#coda-nav-" + sliderCount + " a:eq(" + (location.hash.slice(1) - 1) + ")").addClass("current");
		// If there's no cross-linking, check to see if we're supposed to load a panel other than Panel 1 initially...
		} else if (settings.firstPanelToLoad != 1 && settings.firstPanelToLoad <= panelCount) {
			$("#coda-nav-" + sliderCount + " a:eq(" + (settings.firstPanelToLoad - 1) + ")").addClass("current");
		// Otherwise we must be loading Panel 1, so make the first tab the current one.
		} else {
			$("#coda-nav-" + sliderCount + " a:eq(0)").addClass("current");
		};
		
		// Set the height of the first panel
		if (settings.autoHeight) {
			panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height();
			slider.css({ height: panelHeight });
		};
		
		// Trigger autoSlide
		if (settings.autoSlide) {
			slider.ready(function() {
				setTimeout(autoSlide,settings.autoSlideInterval);
			});
		};
		
		function alterPanelHeight(x) {
			if (settings.autoHeight) {
				panelHeight = $('.panel:eq(' + x + ')', slider).height()
				slider.animate({ height: panelHeight }, settings.autoHeightEaseDuration, settings.autoHeightEaseFunction);
			};
		};
		
		function autoSlide() {
			if (navClicks == 0 || !settings.autoSlideStopWhenClicked) {
				if (currentPanel == panelCount) {
					var offset = 0;
					currentPanel = 1;
				} else {
					var offset = - (panelWidth*currentPanel);
					currentPanel += 1;
				};
				alterPanelHeight(currentPanel - 1);
				// Switch the current tab:
				slider.siblings('.coda-nav').find('a').removeClass('current').parents('ul').find('li:eq(' + (currentPanel - 1) + ') a').addClass('current');
				// Slide:
				$('.panel-container', slider).animate({ marginLeft: offset }, settings.slideEaseDuration, settings.slideEaseFunction);
				setTimeout(autoSlide,settings.autoSlideInterval);
			};
		};
		
		// Kill the preloader
		$('.panel', slider).show().end().find("p.loading").remove();
		slider.removeClass("preload");
		
		sliderCount++;
		
	});
};
/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */

// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
(function($) {
	/**
	 * $ is an alias to jQuery object
	 *
	 */
	$.fn.lightBox = function(settings) {
		// Settings to configure the jQuery lightBox plugin how you like
		settings = jQuery.extend({
			// Configuration related to overlay
			overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
			overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
			// Configuration related to navigation
			fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
			// Configuration related to images
			imageLoading:			'http://dev.logicbydesign.com/quinn/dev/wp-content/themes/quinn/images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
			imageBtnPrev:			'http://dev.logicbydesign.com/quinn/dev/wp-content/themes/quinn/images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
			imageBtnNext:			'http://dev.logicbydesign.com/quinn/dev/wp-content/themes/quinn/images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
			imageBtnClose:			'http://dev.logicbydesign.com/quinn/dev/wp-content/themes/quinn/images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
			imageBlank:				'http://dev.logicbydesign.com/quinn/dev/wp-content/themes/quinn/images/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
			// Configuration related to container image box
			containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
			containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
			// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
			txtImage:				'Image',	// (string) Specify text "Image"
			txtOf:					'of',		// (string) Specify text "of"
			// Configuration related to keyboard navigation
			keyToClose:				'c',		// (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
			keyToPrev:				'p',		// (string) (p = previous) Letter to show the previous image
			keyToNext:				'n',		// (string) (n = next) Letter to show the next image.
			// Don´t alter these variables in any way
			imageArray:				[],
			activeImage:			0
		},settings);
		// Caching the jQuery object with all elements matched
		var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
		/**
		 * Initializing the plugin calling the start function
		 *
		 * @return boolean false
		 */
		function _initialize() {
			_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
			return false; // Avoid the browser following the link
		}
		/**
		 * Start the jQuery lightBox plugin
		 *
		 * @param object objClicked The object (link) whick the user have clicked
		 * @param object jQueryMatchedObj The jQuery object with all elements matched
		 */
		function _start(objClicked,jQueryMatchedObj) {
			// Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').css({ 'visibility' : 'hidden' });
			// Call the function to create the markup structure; style some elements; assign events in some elements.
			_set_interface();
			// Unset total images in imageArray
			settings.imageArray.length = 0;
			// Unset image active information
			settings.activeImage = 0;
			// We have an image set? Or just an image? Let´s see it.
			if ( jQueryMatchedObj.length == 1 ) {
				settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));
			} else {
				// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references		
				for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
					settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));
				}
			}
			while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) {
				settings.activeImage++;
			}
			// Call the function that prepares image exibition
			_set_image_to_view();
		}
		/**
		 * Create the jQuery lightBox plugin interface
		 *
		 * The HTML markup will be like that:
			<div id="jquery-overlay"></div>
			<div id="jquery-lightbox">
				<div id="lightbox-container-image-box">
					<div id="lightbox-container-image">
						<img src="../fotos/XX.jpg" id="lightbox-image">
						<div id="lightbox-nav">
							<a href="#" id="lightbox-nav-btnPrev"></a>
							<a href="#" id="lightbox-nav-btnNext"></a>
						</div>
						<div id="lightbox-loading">
							<a href="#" id="lightbox-loading-link">
								<img src="../images/lightbox-ico-loading.gif">
							</a>
						</div>
					</div>
				</div>
				<div id="lightbox-container-image-data-box">
					<div id="lightbox-container-image-data">
						<div id="lightbox-image-details">
							<span id="lightbox-image-details-caption"></span>
							<span id="lightbox-image-details-currentNumber"></span>
						</div>
						<div id="lightbox-secNav">
							<a href="#" id="lightbox-secNav-btnClose">
								<img src="../images/lightbox-btn-close.gif">
							</a>
						</div>
					</div>
				</div>
			</div>
		 *
		 */
		function _set_interface() {
			// Apply the HTML markup into body tag
			$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');	
			// Get page sizes
			var arrPageSizes = ___getPageSize();
			// Style overlay and show it
			$('#jquery-overlay').css({
				backgroundColor:	settings.overlayBgColor,
				opacity:			settings.overlayOpacity,
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
			// Get page scroll
			var arrPageScroll = ___getPageScroll();
			// Calculate top and left offset for the jquery-lightbox div object and show it
			$('#jquery-lightbox').css({
				top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
				left:	arrPageScroll[0]
			}).show();
			// Assigning click events in elements to close overlay
			$('#jquery-overlay,#jquery-lightbox').click(function() {
				_finish();									
			});
			// Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
			$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
				_finish();
				return false;
			});
			// If window was resized, calculate the new overlay dimensions
			$(window).resize(function() {
				// Get page sizes
				var arrPageSizes = ___getPageSize();
				// Style overlay and show it
				$('#jquery-overlay').css({
					width:		arrPageSizes[0],
					height:		arrPageSizes[1]
				});
				// Get page scroll
				var arrPageScroll = ___getPageScroll();
				// Calculate top and left offset for the jquery-lightbox div object and show it
				$('#jquery-lightbox').css({
					top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
					left:	arrPageScroll[0]
				});
			});
		}
		/**
		 * Prepares image exibition; doing a image´s preloader to calculate it´s size
		 *
		 */
		function _set_image_to_view() { // show the loading
			// Show the loading
			$('#lightbox-loading').show();
			if ( settings.fixedNavigation ) {
				$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
			} else {
				// Hide some elements
				$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
			}
			// Image preload process
			var objImagePreloader = new Image();
			objImagePreloader.onload = function() {
				$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
				// Perfomance an effect in the image container resizing it
				_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);
				//	clear onLoad, IE behaves irratically with animated gifs otherwise
				objImagePreloader.onload=function(){};
			};
			objImagePreloader.src = settings.imageArray[settings.activeImage][0];
		};
		/**
		 * Perfomance an effect in the image container resizing it
		 *
		 * @param integer intImageWidth The image´s width that will be showed
		 * @param integer intImageHeight The image´s height that will be showed
		 */
		function _resize_container_image_box(intImageWidth,intImageHeight) {
			// Get current width and height
			var intCurrentWidth = $('#lightbox-container-image-box').width();
			var intCurrentHeight = $('#lightbox-container-image-box').height();
			// Get the width and height of the selected image plus the padding
			var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the image´s width and the left and right padding value
			var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the image´s height and the left and right padding value
			// Diferences
			var intDiffW = intCurrentWidth - intWidth;
			var intDiffH = intCurrentHeight - intHeight;
			// Perfomance the effect
			$('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); });
			if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {
				if ( $.browser.msie ) {
					___pause(250);
				} else {
					___pause(100);	
				}
			} 
			$('#lightbox-container-image-data-box').css({ width: intImageWidth });
			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) });
		};
		/**
		 * Show the prepared image
		 *
		 */
		function _show_image() {
			$('#lightbox-loading').hide();
			$('#lightbox-image').fadeIn(function() {
				_show_image_data();
				_set_navigation();
			});
			_preload_neighbor_images();
		};
		/**
		 * Show the image information
		 *
		 */
		function _show_image_data() {
			$('#lightbox-container-image-data-box').slideDown('fast');
			$('#lightbox-image-details-caption').hide();
			if ( settings.imageArray[settings.activeImage][1] ) {
				$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
			}
			// If we have a image set, display 'Image X of X'
			if ( settings.imageArray.length > 1 ) {
				$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
			}		
		}
		/**
		 * Display the button navigations
		 *
		 */
		function _set_navigation() {
			$('#lightbox-nav').show();

			// Instead to define this configuration in CSS file, we define here. And it´s need to IE. Just.
			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
			
			// Show the prev button, if not the first image in set
			if ( settings.activeImage != 0 ) {
				if ( settings.fixedNavigation ) {
					$('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
						.unbind()
						.bind('click',function() {
							settings.activeImage = settings.activeImage - 1;
							_set_image_to_view();
							return false;
						});
				} else {
					// Show the images button for Next buttons
					$('#lightbox-nav-btnPrev').unbind().hover(function() {
						$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });
					},function() {
						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
					}).show().bind('click',function() {
						settings.activeImage = settings.activeImage - 1;
						_set_image_to_view();
						return false;
					});
				}
			}
			
			// Show the next button, if not the last image in set
			if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
				if ( settings.fixedNavigation ) {
					$('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
						.unbind()
						.bind('click',function() {
							settings.activeImage = settings.activeImage + 1;
							_set_image_to_view();
							return false;
						});
				} else {
					// Show the images button for Next buttons
					$('#lightbox-nav-btnNext').unbind().hover(function() {
						$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });
					},function() {
						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
					}).show().bind('click',function() {
						settings.activeImage = settings.activeImage + 1;
						_set_image_to_view();
						return false;
					});
				}
			}
			// Enable keyboard navigation
			_enable_keyboard_navigation();
		}
		/**
		 * Enable a support to keyboard navigation
		 *
		 */
		function _enable_keyboard_navigation() {
			$(document).keydown(function(objEvent) {
				_keyboard_action(objEvent);
			});
		}
		/**
		 * Disable the support to keyboard navigation
		 *
		 */
		function _disable_keyboard_navigation() {
			$(document).unbind();
		}
		/**
		 * Perform the keyboard actions
		 *
		 */
		function _keyboard_action(objEvent) {
			// To ie
			if ( objEvent == null ) {
				keycode = event.keyCode;
				escapeKey = 27;
			// To Mozilla
			} else {
				keycode = objEvent.keyCode;
				escapeKey = objEvent.DOM_VK_ESCAPE;
			}
			// Get the key in lower case form
			key = String.fromCharCode(keycode).toLowerCase();
			// Verify the keys to close the ligthBox
			if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) {
				_finish();
			}
			// Verify the key to show the previous image
			if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) {
				// If we´re not showing the first image, call the previous
				if ( settings.activeImage != 0 ) {
					settings.activeImage = settings.activeImage - 1;
					_set_image_to_view();
					_disable_keyboard_navigation();
				}
			}
			// Verify the key to show the next image
			if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) {
				// If we´re not showing the last image, call the next
				if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) {
					settings.activeImage = settings.activeImage + 1;
					_set_image_to_view();
					_disable_keyboard_navigation();
				}
			}
		}
		/**
		 * Preload prev and next images being showed
		 *
		 */
		function _preload_neighbor_images() {
			if ( (settings.imageArray.length -1) > settings.activeImage ) {
				objNext = new Image();
				objNext.src = settings.imageArray[settings.activeImage + 1][0];
			}
			if ( settings.activeImage > 0 ) {
				objPrev = new Image();
				objPrev.src = settings.imageArray[settings.activeImage -1][0];
			}
		}
		/**
		 * Remove jQuery lightBox plugin HTML markup
		 *
		 */
		function _finish() {
			$('#jquery-lightbox').remove();
			$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
			// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').css({ 'visibility' : 'visible' });
		}
		/**
		 / THIRD FUNCTION
		 * getPageSize() by quirksmode.com
		 *
		 * @return Array Return an array with page width, height and window width, height
		 */
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};
		/**
		 / THIRD FUNCTION
		 * getPageScroll() by quirksmode.com
		 *
		 * @return Array Return an array with x,y page scroll values.
		 */
		function ___getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
			}
			arrayPageScroll = new Array(xScroll,yScroll);
			return arrayPageScroll;
		};
		 /**
		  * Stop the code execution from a escified time in milisecond
		  *
		  */
		 function ___pause(ms) {
			var date = new Date(); 
			curDate = null;
			do { var curDate = new Date(); }
			while ( curDate - date < ms);
		 };
		// Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
		return this.unbind('click').click(_initialize);
	};
})(jQuery); // Call and execute the function immediately passing the jQuery object
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

jQuery.easing.jswing=jQuery.easing.swing; jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/ 2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e, a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return a==0?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c}, easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f))+c},easeOutElastic:function(e, a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin((a*d-e)*2*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d/2)==2)return c+b;f||(f=d*0.3*1.5);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a* d-e)*2*Math.PI/f)*0.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*a*a*(((f*=1.525)+1)*a-f)+c;return b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/= d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*0.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*0.5+b*0.5+c}});
/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
 /*!
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2009 M. Alsup
 * Version: 2.65 (07-APR-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(d){function h(){window.console&&window.console.log&&window.console.log("[cycle] "+Array.prototype.join.call(arguments," "))}function n(a,c,f){if(a.cycleStop==undefined)a.cycleStop=0;if(c===undefined||c===null)c={};if(c.constructor==String)switch(c){case "stop":a.cycleStop++;a.cycleTimeout&&clearTimeout(a.cycleTimeout);a.cycleTimeout=0;d(a).removeData("cycle.opts");return false;case "pause":a.cyclePause=1;return false;case "resume":a.cyclePause=0;if(f===true){c=d(a).data("cycle.opts");if(!c){h("options not found, can not resume"); return false}if(a.cycleTimeout){clearTimeout(a.cycleTimeout);a.cycleTimeout=0}q(c.elements,c,1,1)}return false;default:c={fx:c}}else if(c.constructor==Number){var k=c;c=d(a).data("cycle.opts");if(!c){h("options not found, can not advance slide");return false}if(k<0||k>=c.elements.length){h("invalid slide index: "+k);return false}c.nextSlide=k;if(a.cycleTimeout){clearTimeout(a.cycleTimeout);a.cycleTimeout=0}if(typeof f=="string")c.oneTimeFx=f;q(c.elements,c,1,k>=c.currSlide);return false}return c} function e(a,c){if(!d.support.opacity&&c.cleartype&&a.style.filter)try{a.style.removeAttribute("filter")}catch(f){}}function j(a,c,f,k,l){var b=d.extend({},d.fn.cycle.defaults,k||{},d.metadata?a.metadata():d.meta?a.data():{});if(b.autostop)b.countdown=b.autostopCount||f.length;var m=a[0];a.data("cycle.opts",b);b.$cont=a;b.stopCount=m.cycleStop;b.elements=f;b.before=b.before?[b.before]:[];b.after=b.after?[b.after]:[];b.after.unshift(function(){b.busy=0});!d.support.opacity&&b.cleartype&&b.after.push(function(){e(this, b)});b.continuous&&b.after.push(function(){q(f,b,0,!b.rev)});i(b);!d.support.opacity&&b.cleartype&&!b.cleartypeNoBg&&v(c);a.css("position")=="static"&&a.css("position","relative");b.width&&a.width(b.width);b.height&&b.height!="auto"&&a.height(b.height);if(b.startingSlide)b.startingSlide=parseInt(b.startingSlide);if(b.random){b.randomMap=[];for(m=0;m<f.length;m++)b.randomMap.push(m);b.randomMap.sort(function(){return Math.random()-0.5});b.randomIndex=0;b.startingSlide=b.randomMap[0]}else if(b.startingSlide>= f.length)b.startingSlide=0;b.currSlide=b.startingSlide=b.startingSlide||0;var o=b.startingSlide;c.css({position:"absolute",top:0,left:0}).hide().each(function(w){w=o?w>=o?f.length-(w-o):o-w:f.length-w;d(this).css("z-index",w)});d(f[o]).css("opacity",1).show();e(f[o],b);b.fit&&b.width&&c.width(b.width);b.fit&&b.height&&b.height!="auto"&&c.height(b.height);if(b.containerResize&&!a.innerHeight()){var t=0,x=0;for(m=0;m<f.length;m++){var z=d(f[m]),B=z[0],A=z.outerWidth();z=z.outerHeight();if(!A)A=B.offsetWidth; if(!z)z=B.offsetHeight;t=A>t?A:t;x=z>x?z:x}t>0&&x>0&&a.css({width:t+"px",height:x+"px"})}b.pause&&a.hover(function(){this.cyclePause++},function(){this.cyclePause--});if(g(b)===false)return false;if(!b.multiFx){m=d.fn.cycle.transitions[b.fx];if(d.isFunction(m))m(a,c,b);else if(b.fx!="custom"&&!b.multiFx){h("unknown transition: "+b.fx,"; slideshow terminating");return false}}var C=false;k.requeueAttempts=k.requeueAttempts||0;c.each(function(){var w=d(this);this.cycleH=b.fit&&b.height?b.height:w.height(); this.cycleW=b.fit&&b.width?b.width:w.width();if(w.is("img")){w=d.browser.opera&&this.cycleW==42&&this.cycleH==19&&!this.complete;var D=this.cycleH==0&&this.cycleW==0&&!this.complete;if(d.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete||w||D)if(l.s&&b.requeueOnImageNotLoaded&&++k.requeueAttempts<100){h(k.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){d(l.s,l.c).cycle(k)},b.requeueTimeout);C=true;return false}else h("could not determine size of image: "+ this.src,this.cycleW,this.cycleH)}return true});if(C)return false;b.cssBefore=b.cssBefore||{};b.animIn=b.animIn||{};b.animOut=b.animOut||{};c.not(":eq("+o+")").css(b.cssBefore);b.cssFirst&&d(c[o]).css(b.cssFirst);if(b.timeout){b.timeout=parseInt(b.timeout);if(b.speed.constructor==String)b.speed=d.fx.speeds[b.speed]||parseInt(b.speed);for(b.sync||(b.speed/=2);b.timeout-b.speed<250;)b.timeout+=b.speed}if(b.easing)b.easeIn=b.easeOut=b.easing;if(!b.speedIn)b.speedIn=b.speed;if(!b.speedOut)b.speedOut= b.speed;b.slideCount=f.length;b.currSlide=b.lastSlide=o;if(b.random){b.nextSlide=b.currSlide;if(++b.randomIndex==f.length)b.randomIndex=0;b.nextSlide=b.randomMap[b.randomIndex]}else b.nextSlide=b.startingSlide>=f.length-1?0:b.startingSlide+1;a=c[o];b.before.length&&b.before[0].apply(a,[a,a,b,true]);b.after.length>1&&b.after[1].apply(a,[a,a,b,true]);b.next&&d(b.next).click(function(){return y(b,b.rev?-1:1)});b.prev&&d(b.prev).click(function(){return y(b,b.rev?1:-1)});b.pager&&u(f,b);r(b,f);return b} function i(a){a.original={before:[],after:[]};a.original.cssBefore=d.extend({},a.cssBefore);a.original.cssAfter=d.extend({},a.cssAfter);a.original.animIn=d.extend({},a.animIn);a.original.animOut=d.extend({},a.animOut);d.each(a.before,function(){a.original.before.push(this)});d.each(a.after,function(){a.original.after.push(this)})}function g(a){var c=d.fn.cycle.transitions;if(a.fx.indexOf(",")>0){a.multiFx=true;a.fxs=a.fx.replace(/\s*/g,"").split(",");for(var f=0;f<a.fxs.length;f++){var k=a.fxs[f], l=c[k];if(!l||!c.hasOwnProperty(k)||!d.isFunction(l)){h("discarding unknown transition: ",k);a.fxs.splice(f,1);f--}}if(!a.fxs.length){h("No valid transitions named; slideshow terminating.");return false}}else if(a.fx=="all"){a.multiFx=true;a.fxs=[];for(p in c){l=c[p];c.hasOwnProperty(p)&&d.isFunction(l)&&a.fxs.push(p)}}if(a.multiFx&&a.randomizeEffects){c=Math.floor(Math.random()*20)+30;for(f=0;f<c;f++)a.fxs.push(a.fxs.splice(Math.floor(Math.random()*a.fxs.length),1)[0]);h("randomized fx sequence: ", a.fxs)}return true}function r(a,c){a.addSlide=function(f,k){var l=d(f),b=l[0];a.autostopCount||a.countdown++;c[k?"unshift":"push"](b);if(a.els)a.els[k?"unshift":"push"](b);a.slideCount=c.length;l.css("position","absolute");l[k?"prependTo":"appendTo"](a.$cont);if(k){a.currSlide++;a.nextSlide++}!d.support.opacity&&a.cleartype&&!a.cleartypeNoBg&&v(l);a.fit&&a.width&&l.width(a.width);a.fit&&a.height&&a.height!="auto"&&$slides.height(a.height);b.cycleH=a.fit&&a.height?a.height:l.height();b.cycleW=a.fit&& a.width?a.width:l.width();l.css(a.cssBefore);a.pager&&d.fn.cycle.createPagerAnchor(c.length-1,b,d(a.pager),c,a);d.isFunction(a.onAddSlide)?a.onAddSlide(l):l.hide()}}function q(a,c,f,k){if(f&&c.busy&&c.manualTrump){d(a).stop(true,true);c.busy=false}if(!c.busy){var l=c.$cont[0],b=a[c.currSlide],m=a[c.nextSlide];if(!(l.cycleStop!=c.stopCount||l.cycleTimeout===0&&!f))if(!f&&!l.cyclePause&&(c.autostop&&--c.countdown<=0||c.nowrap&&!c.random&&c.nextSlide<c.currSlide))c.end&&c.end(c);else{if(f||!l.cyclePause){var o= c.fx;b.cycleH=b.cycleH||d(b).height();b.cycleW=b.cycleW||d(b).width();m.cycleH=m.cycleH||d(m).height();m.cycleW=m.cycleW||d(m).width();if(c.multiFx){if(c.lastFx==undefined||++c.lastFx>=c.fxs.length)c.lastFx=0;o=c.fxs[c.lastFx];c.currFx=o}if(c.oneTimeFx){o=c.oneTimeFx;c.oneTimeFx=null}d.fn.cycle.resetState(c,o);c.before.length&&d.each(c.before,function(t,x){l.cycleStop==c.stopCount&&x.apply(m,[b,m,c,k])});o=function(){d.each(c.after,function(t,x){l.cycleStop==c.stopCount&&x.apply(m,[b,m,c,k])})};if(c.nextSlide!= c.currSlide){c.busy=1;if(c.fxFn)c.fxFn(b,m,c,o,k);else d.isFunction(d.fn.cycle[c.fx])?d.fn.cycle[c.fx](b,m,c,o):d.fn.cycle.custom(b,m,c,o,f&&c.fastOnEvent)}c.lastSlide=c.currSlide;if(c.random){c.currSlide=c.nextSlide;if(++c.randomIndex==a.length)c.randomIndex=0;c.nextSlide=c.randomMap[c.randomIndex]}else{f=c.nextSlide+1==a.length;c.nextSlide=f?0:c.nextSlide+1;c.currSlide=f?a.length-1:c.nextSlide-1}c.pager&&d.fn.cycle.updateActivePagerLink(c.pager,c.currSlide)}f=0;if(c.timeout&&!c.continuous)f=s(b, m,c,k);else if(c.continuous&&l.cyclePause)f=10;if(f>0)l.cycleTimeout=setTimeout(function(){q(a,c,0,!c.rev)},f)}}}function s(a,c,f,k){if(f.timeoutFn){a=f.timeoutFn(a,c,f,k);if(a!==false)return a}return f.timeout}function y(a,c){var f=a.elements,k=a.$cont[0],l=k.cycleTimeout;if(l){clearTimeout(l);k.cycleTimeout=0}if(a.random&&c<0){a.randomIndex--;if(--a.randomIndex==-2)a.randomIndex=f.length-2;else if(a.randomIndex==-1)a.randomIndex=f.length-1;a.nextSlide=a.randomMap[a.randomIndex]}else if(a.random){if(++a.randomIndex== f.length)a.randomIndex=0;a.nextSlide=a.randomMap[a.randomIndex]}else{a.nextSlide=a.currSlide+c;if(a.nextSlide<0){if(a.nowrap)return false;a.nextSlide=f.length-1}else if(a.nextSlide>=f.length){if(a.nowrap)return false;a.nextSlide=0}}d.isFunction(a.prevNextClick)&&a.prevNextClick(c>0,a.nextSlide,f[a.nextSlide]);q(f,a,1,c>=0);return false}function u(a,c){var f=d(c.pager);d.each(a,function(k,l){d.fn.cycle.createPagerAnchor(k,l,f,a,c)});d.fn.cycle.updateActivePagerLink(c.pager,c.startingSlide)}function v(a){function c(k){k= parseInt(k).toString(16);return k.length<2?"0"+k:k}function f(k){for(;k&&k.nodeName.toLowerCase()!="html";k=k.parentNode){var l=d.css(k,"background-color");if(l.indexOf("rgb")>=0){k=l.match(/\d+/g);return"#"+c(k[0])+c(k[1])+c(k[2])}if(l&&l!="transparent")return l}return"#ffffff"}a.each(function(){d(this).css("background-color",f(this))})}if(d.support==undefined)d.support={opacity:!d.browser.msie};d.fn.cycle=function(a,c){var f={s:this.selector,c:this.context};if(this.length==0&&a!="stop"){if(!d.isReady&& f.s){h("DOM not ready, queuing slideshow");d(function(){d(f.s,f.c).cycle(a,c)});return this}h("terminating; zero elements found by selector"+(d.isReady?"":" (DOM not ready)"));return this}return this.each(function(){a=n(this,a,c);if(a!==false){this.cycleTimeout&&clearTimeout(this.cycleTimeout);this.cycleTimeout=this.cyclePause=0;var k=d(this),l=a.slideExpr?d(a.slideExpr,this):k.children(),b=l.get();if(b.length<2)h("terminating; too few slides: "+b.length);else{var m=j(k,l,b,a,f);if(m!==false)if(m.timeout|| m.continuous)this.cycleTimeout=setTimeout(function(){q(b,m,0,!m.rev)},m.continuous?10:m.timeout+(m.delay||0))}}})};d.fn.cycle.resetState=function(a,c){c=c||a.fx;a.before=[];a.after=[];a.cssBefore=d.extend({},a.original.cssBefore);a.cssAfter=d.extend({},a.original.cssAfter);a.animIn=d.extend({},a.original.animIn);a.animOut=d.extend({},a.original.animOut);a.fxFn=null;d.each(a.original.before,function(){a.before.push(this)});d.each(a.original.after,function(){a.after.push(this)});var f=d.fn.cycle.transitions[c]; d.isFunction(f)&&f(a.$cont,d(a.elements),a)};d.fn.cycle.updateActivePagerLink=function(a,c){d(a).find("a").removeClass("activeSlide").filter("a:eq("+c+")").addClass("activeSlide")};d.fn.cycle.next=function(a){y(a,a.rev?-1:1)};d.fn.cycle.prev=function(a){y(a,a.rev?1:-1)};d.fn.cycle.createPagerAnchor=function(a,c,f,k,l){if(c=d.isFunction(l.pagerAnchorBuilder)?l.pagerAnchorBuilder(a,c):'<a href="#">'+(a+1)+"</a>"){var b=d(c);if(b.parents("body").length==0){var m=[];if(f.length>1){f.each(function(){var o= b.clone(true);d(this).append(o);m.push(o)});b=d(m)}else b.appendTo(f)}b.bind(l.pagerEvent,function(){l.nextSlide=a;var o=l.$cont[0],t=o.cycleTimeout;if(t){clearTimeout(t);o.cycleTimeout=0}d.isFunction(l.pagerClick)&&l.pagerClick(l.nextSlide,k[l.nextSlide]);q(k,l,1,l.currSlide<a);return false});l.pauseOnPagerHover&&b.hover(function(){l.$cont[0].cyclePause++},function(){l.$cont[0].cyclePause--})}};d.fn.cycle.hopsFromLast=function(a,c){var f=a.lastSlide,k=a.currSlide;return c?k>f?k-f:a.slideCount-f: k<f?f-k:f+a.slideCount-k};d.fn.cycle.commonReset=function(a,c,f,k,l,b){d(f.elements).not(a).hide();f.cssBefore.opacity=1;f.cssBefore.display="block";if(k!==false&&c.cycleW>0)f.cssBefore.width=c.cycleW;if(l!==false&&c.cycleH>0)f.cssBefore.height=c.cycleH;f.cssAfter=f.cssAfter||{};f.cssAfter.display="none";d(a).css("zIndex",f.slideCount+(b===true?1:0));d(c).css("zIndex",f.slideCount+(b===true?0:1))};d.fn.cycle.custom=function(a,c,f,k,l){var b=d(a),m=d(c),o=f.speedIn;a=f.speedOut;var t=f.easeIn;c=f.easeOut; m.css(f.cssBefore);if(l){o=typeof l=="number"?a=l:a=1;t=c=null}b.animate(f.animOut,a,c,function(){f.cssAfter&&b.css(f.cssAfter);f.sync||m.animate(f.animIn,o,t,k)});f.sync&&m.animate(f.animIn,o,t,k)};d.fn.cycle.transitions={fade:function(a,c,f){c.not(":eq("+f.currSlide+")").css("opacity",0);f.before.push(function(k,l,b){d.fn.cycle.commonReset(k,l,b);b.cssBefore.opacity=0});f.animIn={opacity:1};f.animOut={opacity:0};f.cssBefore={top:0,left:0}}};d.fn.cycle.ver=function(){return"2.65"};d.fn.cycle.defaults= {fx:"fade",timeout:4E3,timeoutFn:null,continuous:0,speed:1E3,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,pager:null,pagerClick:null,pagerEvent:"click",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!d.support.opacity, nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250}})(jQuery); (function(d){d.fn.cycle.transitions.scrollUp=function(h,n,e){h.css("overflow","hidden");e.before.push(d.fn.cycle.commonReset);h=h.height();e.cssBefore={top:h,left:0};e.cssFirst={top:0};e.animIn={top:0};e.animOut={top:-h}};d.fn.cycle.transitions.scrollDown=function(h,n,e){h.css("overflow","hidden");e.before.push(d.fn.cycle.commonReset);h=h.height();e.cssFirst={top:0};e.cssBefore={top:-h,left:0};e.animIn={top:0};e.animOut={top:h}};d.fn.cycle.transitions.scrollLeft=function(h,n,e){h.css("overflow","hidden"); e.before.push(d.fn.cycle.commonReset);h=h.width();e.cssFirst={left:0};e.cssBefore={left:h,top:0};e.animIn={left:0};e.animOut={left:0-h}};d.fn.cycle.transitions.scrollRight=function(h,n,e){h.css("overflow","hidden");e.before.push(d.fn.cycle.commonReset);h=h.width();e.cssFirst={left:0};e.cssBefore={left:-h,top:0};e.animIn={left:0};e.animOut={left:h}};d.fn.cycle.transitions.scrollHorz=function(h,n,e){h.css("overflow","hidden").width();e.before.push(function(j,i,g,r){d.fn.cycle.commonReset(j,i,g);g.cssBefore.left= r?i.cycleW-1:1-i.cycleW;g.animOut.left=r?-j.cycleW:j.cycleW});e.cssFirst={left:0};e.cssBefore={top:0};e.animIn={left:0};e.animOut={top:0}};d.fn.cycle.transitions.scrollVert=function(h,n,e){h.css("overflow","hidden");e.before.push(function(j,i,g,r){d.fn.cycle.commonReset(j,i,g);g.cssBefore.top=r?1-i.cycleH:i.cycleH-1;g.animOut.top=r?j.cycleH:-j.cycleH});e.cssFirst={top:0};e.cssBefore={left:0};e.animIn={top:0};e.animOut={left:0}};d.fn.cycle.transitions.slideX=function(h,n,e){e.before.push(function(j, i,g){d(g.elements).not(j).hide();d.fn.cycle.commonReset(j,i,g,false,true);g.animIn.width=i.cycleW});e.cssBefore={left:0,top:0,width:0};e.animIn={width:"show"};e.animOut={width:0}};d.fn.cycle.transitions.slideY=function(h,n,e){e.before.push(function(j,i,g){d(g.elements).not(j).hide();d.fn.cycle.commonReset(j,i,g,true,false);g.animIn.height=i.cycleH});e.cssBefore={left:0,top:0,height:0};e.animIn={height:"show"};e.animOut={height:0}};d.fn.cycle.transitions.shuffle=function(h,n,e){h=h.css("overflow", "visible").width();n.css({left:0,top:0});e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,true,true,true)});e.speed/=2;e.random=0;e.shuffle=e.shuffle||{left:-h,top:15};e.els=[];for(h=0;h<n.length;h++)e.els.push(n[h]);for(h=0;h<e.currSlide;h++)e.els.push(e.els.shift());e.fxFn=function(j,i,g,r,q){var s=q?d(j):d(i);d(i).css(g.cssBefore);var y=g.slideCount;s.animate(g.shuffle,g.speedIn,g.easeIn,function(){for(var u=d.fn.cycle.hopsFromLast(g,q),v=0;v<u;v++)q?g.els.push(g.els.shift()):g.els.unshift(g.els.pop()); if(q){u=0;for(v=g.els.length;u<v;u++)d(g.els[u]).css("z-index",v-u+y)}else{u=d(j).css("z-index");s.css("z-index",parseInt(u)+1+y)}s.animate({left:0,top:0},g.speedOut,g.easeOut,function(){d(q?this:j).hide();r&&r()})})};e.cssBefore={display:"block",opacity:1,top:0,left:0}};d.fn.cycle.transitions.turnUp=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,true,false);g.cssBefore.top=i.cycleH;g.animIn.height=i.cycleH});e.cssFirst={top:0};e.cssBefore={left:0,height:0};e.animIn={top:0}; e.animOut={height:0}};d.fn.cycle.transitions.turnDown=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,true,false);g.animIn.height=i.cycleH;g.animOut.top=j.cycleH});e.cssFirst={top:0};e.cssBefore={left:0,top:0,height:0};e.animOut={height:0}};d.fn.cycle.transitions.turnLeft=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,true);g.cssBefore.left=i.cycleW;g.animIn.width=i.cycleW});e.cssBefore={top:0,width:0};e.animIn={left:0};e.animOut={width:0}}; d.fn.cycle.transitions.turnRight=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,true);g.animIn.width=i.cycleW;g.animOut.left=j.cycleW});e.cssBefore={top:0,left:0,width:0};e.animIn={left:0};e.animOut={width:0}};d.fn.cycle.transitions.zoom=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,false,true);g.cssBefore.top=i.cycleH/2;g.cssBefore.left=i.cycleW/2;g.animIn={top:0,left:0,width:i.cycleW,height:i.cycleH};g.animOut={width:0,height:0, top:j.cycleH/2,left:j.cycleW/2}});e.cssFirst={top:0,left:0};e.cssBefore={width:0,height:0}};d.fn.cycle.transitions.fadeZoom=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,false);g.cssBefore.left=i.cycleW/2;g.cssBefore.top=i.cycleH/2;g.animIn={top:0,left:0,width:i.cycleW,height:i.cycleH}});e.cssBefore={width:0,height:0};e.animOut={opacity:0}};d.fn.cycle.transitions.blindX=function(h,n,e){h=h.css("overflow","hidden").width();e.before.push(function(j,i,g){d.fn.cycle.commonReset(j, i,g);g.animIn.width=i.cycleW;g.animOut.left=j.cycleW});e.cssBefore={left:h,top:0};e.animIn={left:0};e.animOut={left:h}};d.fn.cycle.transitions.blindY=function(h,n,e){h=h.css("overflow","hidden").height();e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g);g.animIn.height=i.cycleH;g.animOut.top=j.cycleH});e.cssBefore={top:h,left:0};e.animIn={top:0};e.animOut={top:h}};d.fn.cycle.transitions.blindZ=function(h,n,e){n=h.css("overflow","hidden").height();h=h.width();e.before.push(function(j,i,g){d.fn.cycle.commonReset(j, i,g);g.animIn.height=i.cycleH;g.animOut.top=j.cycleH});e.cssBefore={top:n,left:h};e.animIn={top:0,left:0};e.animOut={top:n,left:h}};d.fn.cycle.transitions.growX=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,true);g.cssBefore.left=this.cycleW/2;g.animIn={left:0,width:this.cycleW};g.animOut={left:0}});e.cssBefore={width:0,top:0}};d.fn.cycle.transitions.growY=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,true,false);g.cssBefore.top=this.cycleH/ 2;g.animIn={top:0,height:this.cycleH};g.animOut={top:0}});e.cssBefore={height:0,left:0}};d.fn.cycle.transitions.curtainX=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,false,true,true);g.cssBefore.left=i.cycleW/2;g.animIn={left:0,width:this.cycleW};g.animOut={left:j.cycleW/2,width:0}});e.cssBefore={top:0,width:0}};d.fn.cycle.transitions.curtainY=function(h,n,e){e.before.push(function(j,i,g){d.fn.cycle.commonReset(j,i,g,true,false,true);g.cssBefore.top=i.cycleH/2;g.animIn= {top:0,height:i.cycleH};g.animOut={top:j.cycleH/2,height:0}});e.cssBefore={left:0,height:0}};d.fn.cycle.transitions.cover=function(h,n,e){var j=e.direction||"left",i=h.css("overflow","hidden").width(),g=h.height();e.before.push(function(r,q,s){d.fn.cycle.commonReset(r,q,s);if(j=="right")s.cssBefore.left=-i;else if(j=="up")s.cssBefore.top=g;else if(j=="down")s.cssBefore.top=-g;else s.cssBefore.left=i});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};d.fn.cycle.transitions.uncover= function(h,n,e){var j=e.direction||"left",i=h.css("overflow","hidden").width(),g=h.height();e.before.push(function(r,q,s){d.fn.cycle.commonReset(r,q,s,true,true,true);if(j=="right")s.animOut.left=i;else if(j=="up")s.animOut.top=-g;else if(j=="down")s.animOut.top=g;else s.animOut.left=-i});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};d.fn.cycle.transitions.toss=function(h,n,e){var j=h.css("overflow","visible").width(),i=h.height();e.before.push(function(g,r,q){d.fn.cycle.commonReset(g, r,q,true,true,true);if(!q.animOut.left&&!q.animOut.top)q.animOut={left:j*2,top:-i/2,opacity:0};else q.animOut.opacity=0});e.cssBefore={left:0,top:0};e.animIn={left:0}};d.fn.cycle.transitions.wipe=function(h,n,e){var j=h.css("overflow","hidden").width(),i=h.height();e.cssBefore=e.cssBefore||{};var g;if(e.clip)if(/l2r/.test(e.clip))g="rect(0px 0px "+i+"px 0px)";else if(/r2l/.test(e.clip))g="rect(0px "+j+"px "+i+"px "+j+"px)";else if(/t2b/.test(e.clip))g="rect(0px "+j+"px 0px 0px)";else if(/b2t/.test(e.clip))g= "rect("+i+"px "+j+"px "+i+"px 0px)";else if(/zoom/.test(e.clip)){var r=parseInt(i/2),q=parseInt(j/2);g="rect("+r+"px "+q+"px "+r+"px "+q+"px)"}e.cssBefore.clip=e.cssBefore.clip||g||"rect(0px 0px 0px 0px)";h=e.cssBefore.clip.match(/(\d+)/g);r=parseInt(h[0]);var s=parseInt(h[1]),y=parseInt(h[2]);q=parseInt(h[3]);e.before.push(function(u,v,a){if(u!=v){var c=d(u),f=d(v);d.fn.cycle.commonReset(u,v,a,true,true,false);a.cssAfter.display="block";var k=1,l=parseInt(a.speedIn/13)-1;(function b(){var m=r?r- parseInt(k*(r/l)):0,o=q?q-parseInt(k*(q/l)):0,t=y<i?y+parseInt(k*((i-y)/l||1)):i,x=s<j?s+parseInt(k*((j-s)/l||1)):j;f.css({clip:"rect("+m+"px "+x+"px "+t+"px "+o+"px)"});k++<=l?setTimeout(b,13):c.css("display","none")})()}});e.cssBefore={display:"block",opacity:1,top:0,left:0};e.animIn={left:0};e.animOut={left:0}}})(jQuery);
