﻿var eventShow = null;
var eventHide = null;
var eventHideAll = null;
var visibles = null;

var ie6 = false, ie = false;
if (window.navigator != null && window.navigator.appVersion != null) {
	ie = window.navigator.appVersion.indexOf("MSIE ") >= 0;
	if (ie)
		ie6 = window.navigator.appVersion.indexOf("MSIE 6.0") >= 0;
}

function appenParam(url, name, val) {
	if (url.indexOf("?") < 0)
		url += "?";
	else if (url.charAt[url.length - 1] != '&')
		url += "&";
	url += name + "=" + val;
	return url;
}

function registerClick(ev) {
	ev = ev || window.event;
	var item = ev.target || ev.srcElement;
	var anchor = item;
	if (anchor.tagName == "IMG")
		anchor = anchor.parentNode;
	if (anchor.tagName != "A")
		anchor = anchor.firstChild;
	else
		item = item.parentNode;
	if (anchor.tagName != "A")
		return;
	Cpo.StopPropagation(ev);
	var url = anchor.getAttribute("href");
	if (!url)
		return;

	if (url && url.length > 0) {
		var target = anchor.getAttribute("target");
		if (target && target.length > 0) {
			window.open(url, target);
			//Cpo.StopPropagation(ev);
		} else if (ev.shiftKey) {
			window.open(url);
			//Cpo.StopPropagation(ev);
		}
	}
}

function findParentAttrib(obj, name, value, stack) {
	var c = 0;
	while (obj != null && obj.getAttribute != null && obj.getAttribute(name) != value && c++ < stack)
		obj = obj.parentNode;
	if (obj != null && obj.getAttribute != null && obj.getAttribute(name) == value)
		return obj;
	return null;
}

function registerOver(ev, item, subMenuId, menuStyle, mouseOverClass, imageId, imageHoverId) {
	if (eventHideAll != null) {
		window.clearTimeout(eventHideAll.thread);
		eventHideAll = null;
	}

	if (!item.initialized) {
		item.mouseOverClass = mouseOverClass;
		item.popDown = item.getAttribute("popdir") == "down";
		item.parentSubMenu = findParentAttrib(item.parentNode, "menutype", "submenu", 1);
		if (item.parentSubMenu != null)
			item.parentRootMenu = item.parentSubMenu.parentRootMenu;
		if (item.parentRootMenu == null)
			item.parentRootMenu = findParentAttrib(item.parentNode, "menutype", "menu", 50);
		if (item.parentSubMenu != null)
			item.parentMenu = item.parentSubMenu;
		else
			item.parentMenu = item.parentRootMenu;
		item.panel = findParentAttrib(item.parentMenu, "menutype", "panel", 1);
		if (item.panel == null)
			item.panel = item.parentMenu;
		item.parentMenu.panel = item.panel;
		item.parentItem = item.parentMenu.parentNode;

		//item.subMenu = document.getElementById(item.getAttribute("submenuid"));
		item.subMenu = document.getElementById(subMenuId);
		//item.menuStyle = item.getAttribute("menustyle");
		item.menuStyle = menuStyle;
		item.imageId = imageId;
		item.imageHoverId = imageHoverId;
		item.image = document.getElementById(item.id + "img");

		if (item.subMenu != null) {
			item.subPanel = findParentAttrib(item.subMenu, "menutype", "panel", 1);
			if (item.subPanel == null)
				item.subPanel = item.subMenu;
			item.subMenuNoHide = item.subPanel.getAttribute("nohide") == "1";
			item.subMenu.panel = item.subPanel;
			item.subMenu.parentSubMenu = item.parentSubMenu;
			item.subMenu.parentMenu = item.parentMenu;
			item.subMenu.parentRootMenu = item.parentRootMenu;
		} else
			item.subPanel = item.subMenu;

		if (item.subMenu != null)
			item.subMenu.firstItem = item.subMenu.getElementsByTagName("li")[0];
		if (item.parentSubMenu == null && item.parentMenu.firstItem == null)
			item.parentMenu.firstItem = item.parentMenu.getElementsByTagName("li")[0];
		item.initialized = true;

		if (ie6 && item.menuStyle == "pop")
			item.style.width = item.offsetWidth + "px";

		var rootMenu = item.parentRootMenu;
		rootMenu.expandAnimation = rootMenu.getAttribute("expandAnimation");
		rootMenu.expandTime = rootMenu.getAttribute("expandTime");
		rootMenu.collapseAnimation = rootMenu.getAttribute("collapseAnimation");
		rootMenu.collapseTime = rootMenu.getAttribute("collapseTime");
		rootMenu.fps = rootMenu.getAttribute("fps");
	}


	if (item.mouseOverClass != null) {
		if (item.orgClass == undefined)
			item.orgClass = item.className;
		item.className = item.mouseOverClass;
	}

	if (item.image && item.imageHoverId)
		item.image.src = "/file.cpo?id=" + item.imageHoverId;

	if (item.subVisible || item.subMenuNoHide)
		return;

	Cpo.StopPropagation(ev);

	clearShowEvent();
	if (item.subMenu != null)
		eventShow = new eventClass(item, item.subMenu, window.setTimeout(doShowSub, 300));
	else
		eventHide = new eventClass(item, null, window.setTimeout(doHideSub, 300));
}

function registerOut(item) {
	if (item.orgClass != undefined)
		item.className = item.orgClass;
	//if (item.subVisible)
	//	item.className += " miExpanded";

	if (item.image && item.imageId)
		item.image.src = "/file.cpo?id=" + item.imageId;

	if (eventHideAll == null)
		eventHideAll = new eventClass(item, null, window.setTimeout(doHideAll, 500));
}

function clearHideEvent() {
	if (eventHide != null) {
		window.clearTimeout(eventHide.thread);
		eventHide = null;
	}
}

function clearShowEvent() {
	if (eventShow != null) {
		window.clearTimeout(eventShow.thread);
		eventShow = null;
	}
}

function eventClass(iitem, isub, ithread) {
	this.item = iitem;
	this.sub = isub;
	this.thread = ithread;
}

function doHideAll() {
	while (visibles != null && visibles.length > 0)
		hideSub(visibles.pop().subVisible);
}

function getPosition(element) {
	var result = new Object();
	result.x = 0;
	result.y = 0;
	result.w = element.offsetWidth;
	result.h = element.offsetHeight;
	while (element.offsetParent != null && element.offsetParent.style.position != "absolute" && element.offsetParent.style.position != "relative") {
		result.x += element.offsetLeft;
		result.y += element.offsetTop;
		element = element.offsetParent;
	}
	return result;
}

function doShowSub() {
	var ievent = eventShow;
	clearShowEvent();
	if (ievent == null)
		return;

	var item = ievent.item;
	var sub = ievent.sub;
	item.subVisible = sub;
	sub.parentItem = item;
	hideSubs(item);
	if (visibles == null)
		visibles = new Array();
	visibles.push(item);
	//item.className += " miExpanded";
	if (item.menuStyle == "nest") {
		if (item.parentRootMenu.expandAnimation) {
			var root = item.parentRootMenu;
			sub.style.visibility = "hidden";
			sub.style.display = "";
			if (!sub.animHeight)
				sub.animHeight = sub.clientHeight;
			sub.style.display = "none";
			new CpoAnimate(sub, root.expandTime, root.fps, 0, sub.animHeight, "height", CpoAnimate.Effects[root.expandAnimation],
				function () { this.style.visibility = ""; this.style.display = ""; },
				function () { this.style.height = "auto"; });
		}
		else
			sub.style.display = "block";
		return;
	}

	sub.panel.style.position = "absolute";
	sub.panel.style.display = "block";
	sub.panel.style.visibility = "hidden";

	var pos = getPosition(item);
	var xbord = 0, ybord = 0;

	if (item.parentSubMenu == null) {
		var pos = getPosition(item);

		if (item.popDown) {
			var parPos = getPosition(item.parentMenu);
			pos.y = parPos.y + item.parentMenu.offsetHeight;
		} else {
			var parPos = getPosition(item.parentMenu);
			pos.x = parPos.x + item.parentMenu.offsetWidth;
			if (ie)
				pos.y -= ((sub.firstItem.parentNode.offsetHeight - sub.firstItem.parentNode.clientHeight) / 2.0);
			else
				pos.y -= (sub.firstItem.parentNode.offsetHeight - sub.firstItem.parentNode.clientHeight);
		}
		pos.x += document.body.offsetLeft;
		pos.y += document.body.offsetTop;
	}
	else {
		var pos = getPosition(item);
		pos.x += item.parentMenu.clientWidth - item.offsetLeft;
		pos.y += item.offsetTop - (sub.firstItem.parentNode.offsetHeight - sub.firstItem.parentNode.clientHeight);
	}

	var offset = parseInt(item.parentMenu.getAttribute("popoffsetx"));
	if (offset != 0 && !isNaN(offset))
		pos.x += offset;

	offset = parseInt(item.parentMenu.getAttribute("popoffsety"));
	if (offset != 0 && !isNaN(offset))
		pos.y += offset;

	sub.panel.style.left = (pos.x) + "px";
	sub.panel.style.top = (pos.y) + "px";

	if (item.parentRootMenu.expandAnimation) {
		var root = item.parentRootMenu;
		if (!sub.panel.animHeight)
			sub.panel.animHeight = sub.panel.clientHeight;
		sub.panel.style.height = "0px";
		sub.panel.style.visibility = "";
		new CpoAnimate(sub.panel, root.expandTime, root.fps, 0, sub.panel.animHeight, "height", CpoAnimate.Effects[root.expandAnimation],
			function () { this.style.visibility = ""; },
			function () { this.style.height = "auto"; });
	}
	else
		sub.panel.style.visibility = "";
}

function hideSub(sub) {
	if (sub.parentItem.parentRootMenu.collapseAnimation) {
		var root = sub.parentItem.parentRootMenu;
		if (!sub.panel.animHeight)
			sub.panel.animHeight = sub.panel.clientHeight;
		sub.panel.owner = sub;
		new CpoAnimate(sub.panel, root.collapseTime, root.fps, sub.panel.animHeight, 0, "height", CpoAnimate.Effects[root.collapseAnimation],
			function () { this.style.visibility = ""; },
			function () {
				this.style.display = "none";
				this.style.height = "auto";
				this.owner.parentItem.subVisible = null;
				//this.owner.parentItem.className.replace(" miExpanded", "");
			});
	}
	else {
		sub.panel.style.display = "none";
		sub.parentItem.subVisible = null;
		//sub.parentItem.className.replace(" miExpanded", "");
	}
}

function hideSubs(item) {
	if (visibles == null || visibles.length == 0)
		return;
	if (item.subVisible == visibles[visibles.length - 1])
		return;
	while (visibles.length > 0 && item.parentSubMenu != visibles[visibles.length - 1].subVisible) {
		hideSub(visibles.pop().subVisible);
	}
}

function doHideSub() {
	var ievent = eventHide;
	clearHideEvent();
	if (ievent == null)
		return;
	hideSubs(ievent.item);
}

function CpoAnimate(element, duration, fps, fromValue, endValue, propName, animFunc, onStartFunc, onEndFunc) {
	if (element.cpoAnimate)
		element.cpoAnimate.stop();

	this.element = element;
	element.cpoAnimate = this;

	this.fromValue = fromValue;
	this.endValue = endValue;
	this.propName = propName;

	if (!duration)
		this.duration = 200;
	else
		this.duration = duration;

	if (!fps)
		this.fps = 60;
	else
		this.fps = fps;

	this.interval = 1000.0 / this.fps;
	this.totalFrames = this.duration / this.interval;
	this.startTime = new Date().getTime();

	if (!animFunc)
		this.animFunc = CpoAnimate.Effects["InQuad"];
	else
		this.animFunc = animFunc;

	this.onStartFunc = onStartFunc;
	this.onEndFunc = onEndFunc;

	element.style.overflow = "hidden";
	element.style[this.propName] = this.fromValue + "px";

	this.timer = window.setInterval(CpoCreateDelegate(this, this.animator), this.interval);
};

function CpoCreateDelegate(instance, method) {
	return function () {
		return method.apply(instance, arguments);
	}
};

CpoAnimate.prototype = {

	stop: function () {
		this.duration = -1000;
	},

	reset: function () {
		clearInterval(this.timer);
		this.element.cpoAnimate = null;
		this.element.style[this.propName] = this.endValue + "px";
		this.element.style.overflow = "";
		if (this.onEndFunc)
			this.onEndFunc.call(this.element);
		this.element = null;
	},

	animator: function () {
		var time = new Date().getTime();

		var ellapsedTime = time - this.startTime;
		if (ellapsedTime >= this.duration) {
			this.reset();
			return;
		}

		var frame = (time - this.startTime) / this.interval;
		var value = Math.abs(this.endValue - this.fromValue) / this.totalFrames * frame;

		value = this.animFunc(ellapsedTime, 0, value, this.duration);

		if (this.endValue < this.fromValue)
			value = this.fromValue - value;
		/*
		if (this.endValue > this.fromValue)
		value = Math.min(value, this.endValue);
		else
		value = Math.max(value, this.endValue);
		*/
		try {
			this.element.style[this.propName] = Math.ceil(value) + "px";
		} catch (ex) {
		}

		if (!this.didAnimate) {
			this.didAnimate = true;
			if (this.onStartFunc)
				this.onStartFunc.call(this.element);
		}
	}
}

CpoAnimate.Effects = [];

/*
Easing Equations v1.5
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.
*/

// simple linear tweening - no easing
// t: current time, b: beginning value, c: change in value, d: duration
CpoAnimate.Effects["Linear"] = function (t, b, c, d) {
	return c * t / d + b;
};


///////////// QUADRATIC EASING: t^2 ///////////////////

// quadratic easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in value, d: duration
// t and d can be in frames or seconds/milliseconds
CpoAnimate.Effects["InQuad"] = function (t, b, c, d) {
	return c * (t /= d) * t + b;
};

// quadratic easing out - decelerating to zero velocity
CpoAnimate.Effects["OutQuad"] = function (t, b, c, d) {
	return -c * (t /= d) * (t - 2) + b;
};

// quadratic easing in/out - acceleration until halfway, then deceleration
CpoAnimate.Effects["InOutQuad"] = function (t, b, c, d) {
	if ((t /= d / 2) < 1) return c / 2 * t * t + b;
	return -c / 2 * ((--t) * (t - 2) - 1) + b;
};


///////////// CUBIC EASING: t^3 ///////////////////////

// cubic easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in value, d: duration
// t and d can be frames or seconds/milliseconds
CpoAnimate.Effects["InCubic"] = function (t, b, c, d) {
	return c * (t /= d) * t * t + b;
};

// cubic easing out - decelerating to zero velocity
CpoAnimate.Effects["OutCubic"] = function (t, b, c, d) {
	return c * ((t = t / d - 1) * t * t + 1) + b;
};

// cubic easing in/out - acceleration until halfway, then deceleration
CpoAnimate.Effects["InOutCubic"] = function (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;
};


///////////// QUARTIC EASING: t^4 /////////////////////

// quartic easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in value, d: duration
// t and d can be frames or seconds/milliseconds
CpoAnimate.Effects["InQuart"] = function (t, b, c, d) {
	return c * (t /= d) * t * t * t + b;
};

// quartic easing out - decelerating to zero velocity
CpoAnimate.Effects["OutQuart"] = function (t, b, c, d) {
	return -c * ((t = t / d - 1) * t * t * t - 1) + b;
};

// quartic easing in/out - acceleration until halfway, then deceleration
CpoAnimate.Effects["InOutQuart"] = function (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;
};


///////////// QUINTIC EASING: t^5  ////////////////////

// quintic easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in value, d: duration
// t and d can be frames or seconds/milliseconds
CpoAnimate.Effects["InQuint"] = function (t, b, c, d) {
	return c * (t /= d) * t * t * t * t + b;
};

// quintic easing out - decelerating to zero velocity
CpoAnimate.Effects["OutQuint"] = function (t, b, c, d) {
	return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
};

// quintic easing in/out - acceleration until halfway, then deceleration
CpoAnimate.Effects["InOutQuint"] = function (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;
};



///////////// SINUSOIDAL EASING: sin(t) ///////////////

// sinusoidal easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in position, d: duration
CpoAnimate.Effects["InSine"] = function (t, b, c, d) {
	return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
};

// sinusoidal easing out - decelerating to zero velocity
CpoAnimate.Effects["OutSine"] = function (t, b, c, d) {
	return c * Math.sin(t / d * (Math.PI / 2)) + b;
};

// sinusoidal easing in/out - accelerating until halfway, then decelerating
CpoAnimate.Effects["InOutSine"] = function (t, b, c, d) {
	return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
};


///////////// EXPONENTIAL EASING: 2^t /////////////////

// exponential easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in position, d: duration
CpoAnimate.Effects["InExpo"] = function (t, b, c, d) {
	return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
};

// exponential easing out - decelerating to zero velocity
CpoAnimate.Effects["OutExpo"] = function (t, b, c, d) {
	return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
};

// exponential easing in/out - accelerating until halfway, then decelerating
CpoAnimate.Effects["InOutExpo"] = function (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;
};


/////////// CIRCULAR EASING: sqrt(1-t^2) //////////////

// circular easing in - accelerating from zero velocity
// t: current time, b: beginning value, c: change in position, d: duration
CpoAnimate.Effects["InCirc"] = function (t, b, c, d) {
	return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
};

// circular easing out - decelerating to zero velocity
CpoAnimate.Effects["OutCirc"] = function (t, b, c, d) {
	return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
};

// circular easing in/out - acceleration until halfway, then deceleration
CpoAnimate.Effects["InOutCirc"] = function (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;
};


/////////// ELASTIC EASING: exponentially decaying sine wave  //////////////

// t: current time, b: beginning value, c: change in value, d: duration, a: amplitude (optional), p: period (optional)
// t and d can be in frames or seconds/milliseconds

CpoAnimate.Effects["InElastic"] = function (t, b, c, d, a, p) {
	if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
	if ((!a) || 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;
};

CpoAnimate.Effects["OutElastic"] = function (t, b, c, d, a, p) {
	if (t == 0) return b; if ((t /= d) == 1) return b + c; if (!p) p = d * .3;
	if ((!a) || 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;
};

CpoAnimate.Effects["InOutElastic"] = function (t, b, c, d, a, p) {
	if (t == 0) return b; if ((t /= d / 2) == 2) return b + c; if (!p) p = d * (.3 * 1.5);
	if ((!a) || 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;
};


/////////// BACK EASING: overshooting cubic easing: (s+1)*t^3 - s*t^2  //////////////

// back easing in - backtracking slightly, then reversing direction and moving to target
// t: current time, b: beginning value, c: change in value, d: duration, s: overshoot amount (optional)
// t and d can be in frames or seconds/milliseconds
// s controls the amount of overshoot: higher s means greater overshoot
// s has a default value of 1.70158, which produces an overshoot of 10 percent
// s==0 produces cubic easing with no overshoot
CpoAnimate.Effects["InBack"] = function (t, b, c, d, s) {
	if (s == undefined) s = 1.70158;
	return c * (t /= d) * t * ((s + 1) * t - s) + b;
};

// back easing out - moving towards target, overshooting it slightly, then reversing and coming back to target
CpoAnimate.Effects["OutBack"] = function (t, b, c, d, s) {
	if (s == undefined) s = 1.70158;
	return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
};

// back easing in/out - backtracking slightly, then reversing direction and moving to target,
// then overshooting target, reversing, and finally coming back to target
CpoAnimate.Effects["InOutBack"] = function (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;
};


/////////// BOUNCE EASING: exponentially decaying parabolic bounce  //////////////

// bounce easing out
CpoAnimate.Effects["OutBounce"] = function (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;
	}
};

// bounce easing in
// t: current time, b: beginning value, c: change in position, d: duration
CpoAnimate.Effects["InBounce"] = function (t, b, c, d) {
	return c - CpoAnimate.Effects["OutBounce"](d - t, 0, c, d) + b;
};



// bounce easing in/out
CpoAnimate.Effects["InOutBounce"] = function (t, b, c, d) {
	if (t < d / 2) return CpoAnimate.Effects["InBounce"](t * 2, 0, c, d) * .5 + b;
	return CpoAnimate.Effects["OutBounce"](t * 2 - d, 0, c, d) * .5 + c * .5 + b;
};


