﻿(function () {
		
//easing Stuff
$.easing.elasout = 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;
};

$.easing.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;
};

$.easing.easeOutCubic = function (x, t, b, c, d) {
	return c*((t=t/d-1)*t*t + 1) + b;
};

$.easing.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;
};

$.easing.easeInOutSine = function (x, t, b, c, d) {
	return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
};


$.easing.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;
};

$.easing.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;
};

$.easing.easeOutCubic = function (x, t, b, c, d) {
	return c*((t=t/d-1)*t*t + 1) + b;
};
//Navigation Animation

$("#mainNavL1").css("border-bottom", "solid #919191 1px");
$("#mainNavL2").css("border-bottom", "solid #ffffff 2px");

if ($('.mainNavL1 > li span').is('.active')) {
	$("#mainNavL1").css("border-bottom", "solid #ffffff 2px");
} else {
	$("#mainNavL1").css("border-bottom", "solid #919191 1px");
}

if ($('.mainNavL2 > li span').is('.active')) {
	$("#mainNavL1").css("border-bottom", "solid #919191 1px");
	$("#mainNavL2").css("border-bottom", "solid #ffffff 2px");
} else {
	$("#mainNavL2").css("border-bottom", "solid #919191 1px");
}

if ($('.mainNavL3 > li span').is('.active')) {
	$("#mainNavL1").css("border-bottom", "solid #919191 1px");
	$("#mainNavL2").css("border-bottom", "solid #919191 1px");
	$("#mainNavL3").css("border-bottom", "solid #ffffff 2px");
	
} else {
	$("#mainNavL3").css("border-bottom", "solid #606162 1px");
}
		
$(".mainNavL1 > li a").hover(	
	function () {
		$("#mainNavL1").stop().animate({borderBottomColor: '#ea8b2b'}, 400);
	},
	function () {
		if ($('.mainNavL1 > li span').is('.active')) {
			if ($('.mainNavL2 > li span').is('.active')) { 
				$("#mainNavL1").stop().animate({borderBottomColor: '#919191'}, 400);
			} else {
				$("#mainNavL1").stop().animate({borderBottomColor: '#ffffff'}, 400);
			}
		} else {
			$("#mainNavL1").stop().animate({borderBottomColor: '#919191'}, 400);
		}
	});

$(".mainNavL2 > li a").hover(
	function () {
		$("#mainNavL2").stop().animate({borderBottomColor: '#ea8b2b'}, 400);
	},
	function () {
		if ($('.mainNavL2 > li span').is('.active')) {
			
			if ($('.mainNavL3 > li span').is('.active')) { 
				$("#mainNavL2").stop().animate({borderBottomColor: '#919191'}, 400);
			} else {
				$("#mainNavL2").stop().animate({borderBottomColor: '#ffffff'}, 400);
			}
		} else {
			$("#mainNavL2").stop().animate({borderBottomColor: '#919191'}, 400);
		}
	});

	
$(".mainNavL3 > li a").hover(
	function () {
		$("#mainNavL3").stop().animate({borderBottomColor: '#ea8b2b'}, 400);
	},
	function () {
		if ($('.mainNavL3 > li span').is('.active')) {
			$("#mainNavL3").stop().animate({borderBottomColor: '#ffffff'}, 400);
		} else {
			$("#mainNavL3").stop().animate({borderBottomColor: '#919191'}, 400);
		}
	});
	


})(jQuery)

function HoverImgOf(filename)
{
   var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1_hover.$2");
}
function NormalImgOf(filename)
{
   var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1.$2");
}
