/**
 * @requires jQuery 1.6.2+
 *
 */
jQuery.noConflict();
jQuery(function($) {

	/**
	 * lightbox
	 *
	 */
	if( typeof $.fn.lightBox == 'function' ) {
		$('a[href$=jpeg], a[href$=jpg], a[href$=png], a[href$=gif]').each(function(){
			$(this).lightBox({
				imageLoading:	'/wp/wp-content/themes/wp-leding/resource/common/js/lightbox/images/loading.gif',	// (string) Path and the name of the loading icon
				imageBtnPrev:	'/wp/wp-content/themes/wp-leding/resource/common/js/lightbox/images/prevlabel.gif',	// (string) Path and the name of the prev button image
				imageBtnNext:	'/wp/wp-content/themes/wp-leding/resource/common/js/lightbox/images/nextlabel.gif',	// (string) Path and the name of the next button image
				imageBtnClose:	'/wp/wp-content/themes/wp-leding/resource/common/js/lightbox/images/closelabel.gif',	// (string) Path and the name of the close btn
				imageBlank:	'/wp/wp-content/themes/wp-leding/resource/common/js/lightbox/images/lightbox-blank.gif'	// (string) Path and the name of a blank image (one pixel)
			});
		});
	}

	/**
	 * .hover-hl (highlight)
	 *
	 */
	$('.hover-hl').each(function(){
		$(this).hover(
			function(){
				$(this).animate({opacity: 0.85}, 100);
			},
			function(){
				$(this).animate({opacity: 1}, 100);
			}
		);
	});

	/**
	 * .hover-ro (rollover)
	 *
	 */
	$('.hover-ro img, img.hover-ro, input[type=image].hover-ro').each(function(){
		var thisSrc = this.src;
		var overSrc = this.src.replace(/\.(gif|png|bmp|jpe?g)$/, '_on.$1');
		var overObj = new Image();
		overObj.src = overSrc;
		$(this).hover(
			function(){ this.src = overSrc; },
			function(){ this.src = thisSrc; }
		);
	});

	/**
	 * .pagetop
	 *
	 */
	 $('#pagetop a, .pagetop a').each(function(){
		 $(this).click(function(){
			$('html, body').animate({ scrollTop: 0 }, '3000', 'easeOutExpo');
			return false;
		 });
	 });

	/**
	 * .faq-list
	 *
	 */
	 $('.list-faq').each(function(){
		 $('dt', this).each(function(){
			var $a = $(this).next('dd');
			$a.hide();

			$('a', this).click(function(){
				$a.slideToggle(250, 'swing');
				return false;
			});
		 });
	 });

	/**
	 * .tabArea
	 *
	 */
	 $('.tabArea').each(function(i){
		var $tabLinks = $('.tabs a', this);
		var $contents = $('.tab_content', this);

		function initArea() {
			$tabLinks.stop(true, true).removeClass('current');
			$contents.stop(true, true).hide();
		};

		// show first
		initArea();
		$contents.eq(0).show();
		$tabLinks.eq(0).addClass('current');

		$tabLinks.each(function(i){
			var $tabLink = $(this);
			var targetID = $(this).attr('href');
			$(this).click(function(){
				initArea();
				$(targetID).fadeIn(800);
				$tabLink.addClass('current');
				return false;
			});
		});
	 });

});

/**
 * 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 c 2008 George McGinley Smith
 * All rights reserved.
 *
 */
jQuery.extend(jQuery.easing, {
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	}
});


