/*@cc_on
eval((function(props) {
	var code = [];
	for (var i = 0, l = props.length; i < l; i++) {
		var prop = props[i];
		window['_'+prop]=window[prop];
		code.push(prop+'=_'+prop)
	}
	return 'var '+code.join(',');
})('document self top parent alert setInterval clearInterval setTimeout clearTimeout'.split(' ')));
@*/

//initialize
var minWidth = 900;
var minHeight = 600;

var DefaultFontSize = 10;
var DefaultLineHeight = 13;

var GlobalScale = 1;

var underIE8 = ($.browser.msie && $.browser.version < 9);
var isSafari = ($.browser.safari);

var mouseCurImg		= '../cms/web-contents/images/pointer.'+(underIE8?'gif':'png');

var wrapper;
var wrapperPos;

//Core
jQuery(document).ready(function($){
	wrapper = $("#wrapper");
	wrapperPos = wrapper.offset();

//TEMP
$('.selfbox p a').each(function(){
	var url = $(this).attr('href');
	$(this).parent().parent().parent().click(function(){
		location.href = url;
	});
});
	
	//MouseCursor
	$('head').append('<style><!--a,#wrapper{cursor:url(/cms/web-contents/images/blank.cur),none}--></style>');
	var mouseCursor = $('<div id="mouseCur"><img src="'+mouseCurImg+'" alt="" /></div>');
	var mouseCursorObj = mouseCursor.children('img');
	wrapper.append(mouseCursor)
		.parent().mousemove(function(e){
			mouseCursor.css({"top":e.pageY-wrapperPos.top,"left":e.pageX-wrapperPos.left});
		});
	//MouseCursor - CUR:Pointer
	$('a,#contents .nav-global .ext img,#contents .nav-global ul li a span img')
	.hover(function(){mouseCursorObj.css('left','-100%')},function(){mouseCursorObj.css('left','0')});
	
	//MouseCursor - CUR:hidden
	$('input, textarea')
	.hover(function(){mouseCursorObj.fadeToExt(100,0)},function(){mouseCursorObj.fadeToExt(100,1)});
	
	
	//IE Fix
	if(underIE8) {
		$("img[src$=png]").each(
			function(){
				$(this).attr('src',$(this).attr('src').replace(/\.png$/, ".gif"));
			});
		window.onload=function(){
			a=document.getElementsByTagName("a");
			for(i=0;i<a.length;i++){
				a[i].onfocus=function(){this.blur();}
			}
			area=document.getElementsByTagName("area");
			for(i=0;i<area.length;i++){
				area[i].onfocus=function(){this.blur();}
			}
		}
	}
	
	//DesignInitialize
	$('#contents .page .main.enBG').children('.pagearea:not(.disBG)').prepend(createBgObj('pagearea'));
	function createBgObj(bgfile) {
		return	$('<img/>')
			.attr('src','../cms/web-contents/images/bg_box/'+bgfile+'.'+(underIE8?'gif':'png'))
			.css({
				'width'		: '100%',
				'height'	: '100%',
				'position'	: 'absolute',
				'top'		: '0',
				'left'		: '0'
			});
	}
	
	$('#header .nav-assist ul li a').hover(function(){
		$(this).siblings('img.bg').show();
	},function(){
		$(this).siblings('img.bg').hide();
	});
	
	//Effect:TopPage BearHover
	/*
	$('.index .nav-global .ext').hover(function(){
		$(this).stop().animate({'bottom':'-10%'},100);
	},function(){
		$(this).stop().animate({'bottom':'-25%'},100);
	});
	*/
	
	//Effect:Header sub-links
	$("#header .nav-sublink a").hover(function(){
		$(this).children('img').attr('src',$(this).children('img').attr('src').replace('.gif','_h.gif'));
	},function(){
		$(this).children('img').attr('src',$(this).children('img').attr('src').replace('_h.gif','.gif'));
	});
	
	//FIX::GlobalNavigation
	$("#wrapper #contents .nav-global > ul > li > div.sub:not(.comming)").each(function(i){
		var i = i+1;
		if(!underIE8) $(this).css({
				"background": "url(/cms/web-contents/images/bg_box/nav_sub_00"+i+".png) no-repeat",
				"-webkit-background-size": "100% 100%",
				"-moz-background-size": "100% 100%",
				"-o-background-size": "100% 100%",
				"background-size": "100% 100%"
			});
		else $(this).append($('<div />').css({'position':'absolute','width':'100%','height':'100%','top':'0','left':'0',"filter": "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/cms/web-contents/images/bg_box/nav_sub_00"+i+".gif', sizingMethod='scale')"}));
	});
	$("#wrapper #contents .nav-global > ul > li > div.sub.comming").each(function(){
		if(underIE8) $(this).find('img').css({'width':'80%'});
	});
	
	//Effect:GlobalNavigation
	$("#wrapper #contents .nav-global > ul").mousemove(function(e){
		$("#wrapper #contents .nav-global > ul > li").each(function(){
			var offset = $(this).offset();
			var posx = offset.left + $(this).width() / 2 - e.pageX;
			var posy = offset.top + $(this).height() / 2 - e.pageY - 40;
			var distance = Math.sqrt(posx * posx + posy * posy * 3);
			distance -= $(this).width() / 2;
			distance = distance < 0 ? 0 : distance / 1.2;
			distance = distance > 100 ? 100 : distance;
			var scale = (10 - distance / 10) * 5 + 100;
			$(this).find('span > img').css('width', scale + '%').css('margin-left', -scale / 2 + '%');
		});
	});
	$("#wrapper #contents .nav-global > ul > li > a").click(function(){
		$(this).parents('ul').find(".selected").hide();
		$(this).parent().find(".sub").show().addClass("selected");
		return false;
	}).parent().hover(function(){},function(){
		/*$(this).find(".sub").hide("fast").removeClass("selected");*/
	});
	
	$('#wrapper').live('click',function(){
		$("#wrapper #contents .nav-global > ul > li > .sub.selected").hide().removeClass("selected");
	});
	
	//
	var poor_def_set = $('body').hasClass('index') ? 25 : 50;
	var poor_timer = setInterval(function(){
		var moveObj = $('#wrapper #contents .nav-global .ext');
		moveObj.animate({'bottom':'-'+(poor_def_set-10)+'%'},200,'easeInOutBack',function(){
				moveObj.animate({'bottom':'-'+poor_def_set+'%'},600,'easeOutBounce');
		});
	},5000);
	
	/*
	var poor_timer = setInterval(function(){
		var moveObj = $('#wrapper #contents .nav-global .ext');
		moveObj.animate({'left':'2%'},300,function(){
			moveObj.animate({'left':'-2%'},400,function(){
				moveObj.animate({'left':'0%'},300);
			});
		});
	},5000);
	*/
	
	//Effect:GlobalNavigation(Pages)
	var mv_timer;
	if(underIE8) $("body.page #wrapper #contents .nav-global").css("z-index","-1");
	$("body.page #wrapper #contents .nav-global").append('<div class="bgbar"></div>');
	$("body.page #wrapper #contents .nav-global .ext img").click(
		function(){
			if(underIE8) $("body.page #wrapper #contents .nav-global").css("z-index","30");
			clearInterval(mv_timer);
			$("#wrapper #contents .nav-global > ul").stop().animate({"bottom":"10%"},200);
			//$("#wrapper #contents .nav-global .ext").stop().animate({"bottom":"-35%"},200,function(){
				if($("#wrapper #contents .nav-global .ext").children('.infobord').html() != null){
					$("#wrapper #contents .nav-global .ext").children('img').hide();
					$("#wrapper #contents .nav-global .ext").children('.infobord').show();
				}
			//});
			$("body.page #wrapper #contents .nav-global .bgbar").stop().animate({"height":"350%"},200);
		});
	$("body.page #wrapper #contents .nav-global > ul").hover(
		function(){clearInterval(mv_timer);},
		function(){
		/*
			clearInterval(mv_timer);
			mv_timer = setInterval(function(){
				$("#wrapper #contents .nav-global > ul > li > .sub.selected").hide().removeClass("selected");
				$("#wrapper #contents .nav-global > ul").stop().animate({"bottom":"-100%"},200);
				if($("#wrapper #contents .nav-global .ext .infobord").html() != null){
					$("#wrapper #contents .nav-global .ext .infobord").hide().siblings('img').show().parent().stop().animate({"bottom":"-50%"},200);
				}else{
					$("#wrapper #contents .nav-global .ext").stop().animate({"bottom":"-50%"},200);
				}
				$("body.page #wrapper #contents .nav-global .bgbar").stop().animate({"height":"0"},200);
				if(underIE8) $("body.page #wrapper #contents .nav-global").css("z-index","-1");
			},500);
		*/
		});
	
	$("body.page #wrapper #contents .nav-global .bgbar").click(function(){
		$("#wrapper #contents .nav-global > ul > li > .sub.selected").hide().removeClass("selected");
		$("#wrapper #contents .nav-global > ul").stop().animate({"bottom":"-100%"},200);
		if($("#wrapper #contents .nav-global .ext .infobord").html() != null){
			$("#wrapper #contents .nav-global .ext .infobord").hide().siblings('img').show().parent().stop().animate({"bottom":"-50%"},200);
		}else{
			$("#wrapper #contents .nav-global .ext").stop().animate({"bottom":"-50%"},200);
		}
		$("body.page #wrapper #contents .nav-global .bgbar").stop().animate({"height":"0"},200);
		if(underIE8) $("body.page #wrapper #contents .nav-global").css("z-index","-1");
	});
	
	//Effect:GlobalLocalNavigation
	$("#wrapper #contents .nav-global > ul > li > .sub > ul > li > a").hover(function(){
		$(this).css({'font-size':'110%','font-weight':'bold'}).append('<span class="hovericon">★</span>');
	},function(){
		$(this).css({'font-size':'100%','font-weight':'normal'}).children('span.hovericon').remove();
	});
	
	//Effect:LocalNavigation
	changeLocalNav(-1);
	$("body.page .nav-local ul li").hover(
			function(){changeLocalNav($(this).parent().find("li").index(this))},
			function(){changeLocalNav(-1)}
		);
	
	//PageLocalNavigation
	$(".nav-page-loc.enPage a").click(function(){
		var navigation = $("body.page .nav-local ul");
		var currentPage = navigation.find("li.current");
		var listID = navigation.find("li").index(currentPage);
		
		var gotoLink = 0;
		var s = "";
		if($(this).hasClass("next")){
			gotoLink = listID == navigation.find("li").size() - 1 ? 0 : listID + 1;
			if(typeof navigation.find("li:eq("+gotoLink+") a").attr('href') == 'undefined') gotoLink = gotoLink + 1;
		}else{
			gotoLink = listID == 0 ? navigation.find("li").size() - 1 : listID - 1;
			if(typeof navigation.find("li:eq("+gotoLink+") a").attr('href') == 'undefined') gotoLink = gotoLink - 1;
			s = "-";
		}
		var target = $("body.page #contents .main .pagearea");
		if(!underIE8)	target.hide('drop',{'direction':(s == "-" ? "left" : "right")},400);
		else		target.animate({"left":s+"150%"},400);
		
		mv_timer = setInterval(function(){
			location.href = navigation.find("li:eq("+gotoLink+") a").attr("href") + "#!" + s;
		},400);
		return false;
	});
	
	//PageLocalNavigation:inline
	if($(".nav-page-loc").hasClass('enLoc')){
		
		var curPage = 0;
		var pageNum = 0;
		$('.pagearea').each(function(){
			$(this).css({
				'position':'absolute',
				'top':'0',
				'left':(150*pageNum)+'%'
			});
			pageNum++;
		});
		
		$(".nav-page-loc.enLoc a").click(function(){
			var pageMax = $('.pagearea').size();
			var pageNum = 0;
			if(!$(this).hasClass("next")) curPage = curPage == pageMax-1 ? 0 : curPage+1;
			else curPage = curPage == 0 ? pageMax-1 : curPage-1;
			$('.pagearea').each(function(){
				$(this).animate({'left':((150*pageNum)-(150*curPage))+'%'},250);
				pageNum++;
			});
			return false;
		});
	}
	
	//ImageSlider
	var imgSlider_timer;
	var imgSlider_selected = new Array();
	var imgSlider_obj = $("ul.slideImg");
	
	//imgSlider_obj.parent().parent().parent().css('margin-top','-30%');
	//if(underIE8 || $.browser.mozilla) imgSlider_obj.parent().parent().parent().css('margin-top','-20%');
	imgSlider_obj.each(function(n){
		imgSlider_selected[n] = 0;
		$(this).find('li img').each(function(i){
			if(i>0) $(this).hide();
		});
	});
	imgSlider_timer = setInterval(function(){
		imgSlider_obj.each(function(n){
			var prev_select = imgSlider_selected[n];
			imgSlider_selected[n] = imgSlider_selected[n] == imgSlider_obj.eq(n).find('li img').size()-1 ? 0 : imgSlider_selected[n]+1;
			imgSlider_obj.eq(n).find('li img').eq(prev_select).fadeOut(500,function(){
				imgSlider_obj.eq(n).find('li img').eq(imgSlider_selected[n]).fadeIn(500);
			});
		});
	},3000);
	
	//ScrollBar
	var scrollPartsParents = $('.pagearea.scroller');
	scrollPartsParents.each(function(){
		var scrollPartsParent = $(this);
		var scrollSlider = scrollPartsParent.find('.parts-scrollbar .slider');
		var scrollAreaParent = scrollPartsParent.find('.page-scroller-gb');
		var scrollAreaChild = scrollAreaParent.find('.page-scroller');
		
		scrollPartsParent.find('.parts-scrollbar').children('.nav-down, .nav-up').click(function(){
			var delta = $(this).hasClass('nav-up') ? 1 : -1;
			mousescroll(delta);
			return false;
		});
		scrollPartsParent.mousewheel(function(event, delta){
			mousescroll(delta);
			return false;
		});
		scrollSlider.parent().bind("mousedown", function(event){
			$(document).bind("mousemove", dragmove);
			return false;
		});
		$(document).bind("mouseup", function(){
			$(document).unbind("mousemove", dragmove);
		});
		function mousescroll(delta){
			if(scrollAreaChild.height() <= scrollAreaParent.height()) return false;
			var scrollAreaParentPerPx = (scrollAreaChild.height() - scrollAreaParent.height()) / 100;
			var scrollAreaParentPer = scrollAreaParentPerPx / scrollAreaParent.height() * 100;
			var scrollAreaParentPer2 = scrollAreaParentPerPx / scrollSlider.parent().height() * 100;
			
			var nowPos = (scrollSlider.offset().top - scrollSlider.parent().offset().top) / scrollSlider.parent().height() * 100;
			var curPos = (nowPos - delta / scrollAreaParentPer2 * 30);
			curPos = curPos < 0 ? 0 : ( curPos > 100 ? 100 : curPos );
			var curPosPer = curPos * -scrollAreaParentPer;
			scrollSlider.stop().animate({"top": curPos + "%"},100);
			scrollAreaChild.stop().animate({"top": curPosPer + "%"},100);
		}
		function dragmove(event){
			if(scrollAreaChild.height() <= scrollAreaParent.height()) return false;
			var scrollAreaParentPerPx = (scrollAreaChild.height() - scrollAreaParent.height()) / 100;
			var scrollAreaParentPer = scrollAreaParentPerPx / scrollAreaParent.height() * 100;
			var scrollAreaParentPer2 = scrollAreaParentPerPx / scrollSlider.parent().height() * 100;
			
			var mousedownY = event.pageY - scrollSlider.parent().offset().top;
			mousedownY = mousedownY < 0 ? 0 : (mousedownY > scrollSlider.parent().height() ? scrollSlider.parent().height() : mousedownY);
			var mouseYPer = mousedownY / scrollSlider.parent().height() * 100;
			scrollSlider.css({"top": mouseYPer + "%"});
			var scrollPer = mousedownY / (scrollSlider.parent().height()) * 100;
			var curPosPer = scrollPer * -scrollAreaParentPer;
			scrollAreaChild.css({"top": curPosPer + "%"});
			return false;
		}
	});
});

//PageLocalNavigationSelectorTransform
function changeLocalNav(indexID){
	if($("body.page").size() == 0) return;
	
	var LocalNavCursor = $(".nav-local .cursor img");
	var LocalNav = $(".nav-local ul");
	
	var WidthScale = GlobalScale;
	var HeightScale = GlobalScale;
	
	LocalNavCurrent = indexID > -1 ? LocalNav.find('li:eq('+indexID+') a') : LocalNav.find('li.current a');
	LNCHIEFIX = (LocalNavCurrent.height() * HeightScale / 5.3) + 2.5;
	LNCHIEFIX = underIE8 ? Math.round(LNCHIEFIX) : LNCHIEFIX;
	LocalNavCursor.stop().animate({'width':LocalNavCurrent.width() * WidthScale + 28,'height':LNCHIEFIX + '%','top':LocalNavCurrent.position().top+GlobalScale*4},100);
}

//ResizeWindow
var FLAG_resized = false;
jQuery.event.add(window, "load", resizeFrame);
jQuery.event.add(window, "resize", resizeFrame);
function resizeFrame(){
	var w = $(window).width() - 150;
	var h = $(window).height() - 150;
	var scale = 1;
	if(h > minHeight && w > minWidth) scale = (w - minWidth) < (h - minHeight) ? w / minWidth : h / minHeight;
	
	wrapper
	.css('width', minWidth * scale)
	.css('height', minHeight * scale)
	.css('margin-left', -minWidth * scale / 2)
	.css('margin-top', -minHeight * scale / 2)
	.css('font-size', DefaultFontSize * scale);
	//.css('line-height', DefaultLineHeight * scale + 'px');
	
	if(isSafari) $("#wrapper").css('font-size', DefaultFontSize * scale / 1.05);
	
	changeLocalNav(-1);
	
	if(FLAG_resized != true){
		
		$("#wrapper").css("visibility","visible");
		if(!underIE8) $("#wrapper").hide().fadeIn(300);
		
		FLAG_resized = true;
	}
	wrapperPos = wrapper.offset();
}

//VerticalAlignFix
$(window).bind('load',function(){
	var imgObj = $('img');
	var s = 0;
	var m = imgObj.size();
	imgObj.each(function(){
		var a = $('<img/>');
		a[0].src = $(this).attr('src');
		/*
		a.load(function(){
			s++;
			$('#loadingBar').stop().animate({'width':(s/m*100)+'%'},100);
			if(s >= m) initialize();
		});
		*/
	});
	
	$(".valignM").each(function(i){
		valignMiddler($(this),true)
	});
	if(getUrlVars().charAt(0)=="!"){
		var target = $("body.page #contents .main-box > img.background, body.page #contents .main-box > .page-loc");
		if(!underIE8)	target.show('drop',{'direction':(getUrlVars().charAt(1) == "-" ? "right" : "left")},400);
		else		target.css('left',(getUrlVars().charAt(1) == "-" ? "" : "-")+'150%').animate({"left":"0"},400);
	}
});

function valignMiddler(obj,func){
	function core(){
		var parH = obj.parent().height();
		//var parW = obj.parent().width();
		var objH = obj.height();
		//var objW = obj.width();
		var perPos = (100 - (objH / parH * 100)) / 2;
		//console.log(parH+':'+objH+':'+perPos);
		if(perPos >= 50) return false;
		if(func) obj.css({'position':'absolute','top':perPos +'%'});
		else return perPos;
	}
	if(obj.get(0).tagName.match(/img/i)) { obj.load(core()); }
	else { core(); }
}

//GetInnerUrlVars
function getUrlVars()
{
	var param = window.location.href.split('#')[1];
	return param == undefined ?
		"" : param;
}


jQuery.fn.extend({
	fadeToExt: function(speed,opacity,callback){
		if(underIE8) {
			opacity == 1 ? this.show() : this.hide();
			return $(callback);
		}else	return this.fadeTo(speed,opacity,callback);
	}
});


//REL-CLASS

(function ($) {
	$.fn.vAlign = function(){
		return this.each(function(i){
			$(this).children().wrapAll('<div class="nitinh-vAlign" style="position:relative;"></div>');
			var div = $(this).children('div.nitinh-vAlign');
			var ph = $(this).innerHeight();
			var dh = div.height();
			var mh = (ph - dh) / 2;
			div.css('top', mh);
		});
	};
})(jQuery);

/*
 * 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.
 * 
 * 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. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + 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;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	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;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright c 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. 
 *
 */
