var frameset0 = 0;
var frameset2 = 0;
var frameset3 = 0;
var frameset4 = 0;
function init() {
	if (document.getElementById) {
		flashMovie0 = document.getElementById("infinity");
		flashMovie1 = document.getElementById("questions");
		flashMovie2 = document.getElementById("screen");
		flashMovie3 = document.getElementById("timeline");
	}
}
function animate1() {
	if (flashMovie1) {
		flashMovie1.startAnimation();
	}
}
function animate2() {
	if (flashMovie2) {
		flashMovie2.startAnimation();
	}
}
function animate3() {
	if (flashMovie3) {
		flashMovie3.startAnimation();
	}
}
function animate4() {
	if (flashMovie4) {
		flashMovie4.startAnimation();
	}
}

function infinity(j) {
	//alert(j);
	frameset0 = j;
	$("#slide0 .slideContent").children(".frameset").children("li").fadeTo(200,0).css("display","none");
	$("#slide0 .slideContent").children(".frameset").children("li:eq("+(j)+")").css("display","block").fadeTo(200,1);
	$("#slide0 .slideContent").children(".prev, .next").fadeIn(10);
	if (j == 0) {
		$("#slide0 .slideContent").children(".prev").fadeOut(10);
	}
	if (j == 4) {
		$("#slide0 .slideContent").children(".next").fadeOut(10);
	}
}


function flashscreen(k) {
	frameset2 = k;
	$("#slide2 .slideContent").children(".frameset").children("li").fadeTo(200,0).css("display","none");
	$("#slide2 .slideContent").children(".frameset").children("li:eq("+(k)+")").css("display","block").fadeTo(200,1);
	$("#slide2 .slideContent").children(".prev, .next").fadeIn(10);
	if (k == 0) {
		$("#slide2 .slideContent").children(".prev").fadeOut(10);
	}
	if (k == 2) {
		$("#slide2 .slideContent").children(".next").fadeOut(10);	
	}	
}
function casestudies(l) {
	//alert(l);
	frameset3 = l;
	$("#slide3 .slideContent").children(".frameset").children("li").fadeTo(200,0).css("display","none");
	$("#slide3 .slideContent").children(".frameset").children("li:eq("+(l)+")").css("display","block").fadeTo(200,1);
	$("#slide3 .slideContent").children(".prev, .next").fadeIn(10);
	if (l == 0){
		$("#slide3 .slideContent").children(".prev").fadeOut(10);
	}
	if (l == 9){
		$("#slide3 .slideContent").children(".next").fadeOut(10);	
	}
	$("#pre2008, #post2008").removeClass("active");
	if(l < 5){
		$("#post2008").addClass("active");
	} else {
		$("#pre2008").addClass("active");
	}
}
function aboutus(m){
	frameset4 = m;
	$("#slide4 .slideContent").children(".frameset").children("li").fadeTo(200,0).css("display","none");
	$("#slide4 .slideContent").children(".frameset").children("li:eq("+(m)+")").css("display","block").fadeTo(200,1);
	$("#slide4 .slideContent").children(".prev, .next").fadeIn(10);
	if (m == 0){
		$("#slide4 .slideContent").children(".prev").fadeOut(10);
	}
	if (m == 2){
		$("#slide4 .slideContent").children(".next").fadeOut(10);	
	}
}

$(document).ready(function() {
	window.onload = function() {
		if(window.location.hash){
			initialiseStateFromURL();
		}
		init();
	}
	var recentHash = "";
	function initialiseStateFromURL() {
		var initialTab = Number(window.location.hash.substr(1));
		$("#backgroundImage").width($("#content").width()+4000);
		$("#contact").animate({
			top:"-240px"
		},1000,"easeInOutBack");
		
		$("#content").animate({
			left:-(initialTab*100)+"%"
		},1500,"easeInOutBack",function(){
			if(initialTab == 1){
				animate1();
			}else if(initialTab == 2){
				animate2();
			}else if(initialTab == 3){
				animate3();
			}else if(initialTab == 4){
				animate4();
			}
		});
		
		$("#slider").animate({
			left:((initialTab*100)/5)+"%"
		},1500,"easeInOutBack");
		
		return false;
	}
	jQuery.easing.def = 'easeInOutQuad';
	if($("body").width()<1000){
		newWidth=1000;
	}else{
		newWidth=$("body").width();
	}
	$("#menu a.logo img[rel='alt']").fadeOut(10);
	$("#menu a.logo").hover(
		function(){
			$(this).children("img[rel='main']").fadeOut(200);
			$(this).children("img[rel='alt']").fadeIn(200);
		}
		,
		function(){
			$(this).children("img[rel='alt']").fadeOut(200);
			$(this).children("img[rel='main']").fadeIn(200);
		}
	);
	$("#menu a.logo img").css("left",($("#menu a.logo").width()-200)/2);
	$(".slide").width(newWidth);
	$("#content").width($(".slide").width()*5);
	$("#backgroundImage").width($("#content").width()+4000);
	$("#menu ul li a").click(function(){
		//alert($(this).eq());
		var index = $("#menu ul li a").index(this);	
		$("#contact").animate({
			top:"-240px"
		},1000,"easeInOutBack");
		$("#contactBackground").fadeOut(1000);
		
		$("#content").animate({
			left:-(index*100)+"%"
		},1500,"easeInOutBack",function(){
			if(index == 1){
				animate1();
			}else if(index == 2){
				animate2();
			}else if(index == 3){
				animate3();
			}else if(index == 4){
				animate4();
			}
		});
		
		$("#slider").animate({
			left:((index*100)/5)+"%"
		},1500,"easeInOutBack");
		
		window.location.hash=index;
		return false;
	});
	$("#menu ul li:last-child a").css({
		"border-right":"none"
	});
	$(window).resize(function(){
		if($("body").width()<1000){
			newWidth=1000;
		}else{
			newWidth=$("body").width();
		}
		$("#menu ul").width(newWidth);
		$("#menu ul li").width(newWidth/5);
		$(".slide").width(newWidth);
		$("#content").width($(".slide").width()*5);
		$("#backgroundImage").width($("#content").width()+4000);
		$("#slider, #slider img").css({
			width: $("#menu ul li").width()-1
		});
		$("#menu a.logo img").css("left",($("#menu a.logo").width()-200)/2);
	});
	$("#menu ul").width(newWidth);
	$("#menu ul li").width(newWidth/5);
	$("#menu").prepend('<div id="slider"><img src="/images/background_menu_highlight.gif" alt="" /></div>');
	$("#content").prepend('<div id="backgroundImage" style="display:none;">&nbsp;</div>');
	$("#slide3 .slideContent").prepend('<a id="pre2008" href="#">Pre 2008</a><a id="post2008" href="#" class="active">Post 2008</a>');
	$("#pre2008").click(function(){
		casestudies(0);
		flashMovie3.selectedGo('pre1Bn');
		return false;
	});
	$("#post2008").click(function(){
		casestudies(5);
		flashMovie3.selectedGo('post1Bn');
		return false;
	});
	
	$("#slider, #slider img").css({
		position: "absolute",
		left: "0px",
		top: "0px",
		"z-index": "3",
		height: $("#menu ul li").height(),
		width: $("#menu ul li").width()-1
	});
	
	$(".print").attr("target","_blank	");
	
	$("#footer .contact, #contact .contactinfo, #contact .contactcards").click(function(){
		//alert($("#contact").position().top);
		if($("#contact").position().top<-1){
			$("#contact").animate({
				top:"0px"
			},1000,"easeInOutBack");
			$("#contactBackground").fadeIn(1000);
		}else{
			$("#contact").animate({
				top:"-240px"
			},1000,"easeInOutBack");
			$("#contactBackground").fadeOut(1000);
		}
		return false;
	});
	
	$("#contactBackground").fadeOut(10);
	
	$(".frameset").children("li").fadeTo(10,.0).css("display","none");
	
	$(".frameset").each(function(){
		$(this).children("li:eq(0)").css("display","block").fadeTo(200,1);
		$(this).parent().children(".prev").fadeOut(10);
	});
	
	$(".pages").children(".page").fadeTo(10,.0).css("display","none");
	$(".pages").each(function(){
		$(this).children(".page:eq(0)").css("display","block").fadeTo(200,1);
		$(this).children(".page").each(function(i){
			 $(this).attr("offset", i);							
		})
	});

	$("#slide0 .next").click(function(){
		frameset0++;
		if(frameset0 == 0){
			flashMovie0.comprehensive();
		} else if(frameset0 == 1){
			flashMovie0.progressive();
		} else if(frameset0 == 2){
			flashMovie0.innovative();
		} else if(frameset0 == 3){
			flashMovie0.integrative();
		} else if(frameset0 == 4){
			flashMovie0.supportive();
		}
		infinity(frameset0);
		return false;
	});
	$("#slide0 .prev").click(function(){
		//alert(frameset1);
		frameset0--;
		if(frameset0 == 0){
			flashMovie0.comprehensive();
		} else if(frameset0 == 1){
			flashMovie0.progressive();
		} else if(frameset0 == 2){
			flashMovie0.innovative();
		} else if(frameset0 == 3){
			flashMovie0.integrative();
		} else if(frameset0 == 4){
			flashMovie0.supportive();
		}		
		infinity(frameset0);
		return false;
	});
	$("#slide2 .next").click(function(){
		frameset2++;
		if(frameset2 == 0){
			flashMovie2.overallGoals();
		} else if(frameset2 == 1){
			flashMovie2.forSuccess();
		} else if(frameset2 == 2){
			flashMovie2.bigPicture();
		}
		flashscreen(frameset2);
		return false;
	});
	$("#slide2 .prev").click(function(){
		frameset2--;
		if(frameset2 == 0){
			flashMovie2.overallGoals();
		} else if(frameset2 == 1){
			flashMovie2.forSuccess();
		} else if(frameset2 == 2){
			flashMovie2.bigPicture();
		}		
		flashscreen(frameset2);
		return false;
	});
	$("#slide3 .next").click(function(){
		frameset3++;
		if(frameset3 == 0){
			flashMovie3.selectedGo('pre1Bn');
		}else if(frameset3 == 1){
			flashMovie3.selectedGo('pre2Bn');
		}else if(frameset3 == 2){
			flashMovie3.selectedGo('pre3Bn');
		}else if(frameset3 == 3){
			flashMovie3.selectedGo('pre4Bn');
		}else if(frameset3 == 4){
			flashMovie3.selectedGo('pre5Bn');
		}else if(frameset3 == 5){
			flashMovie3.selectedGo('post1Bn');
		}else if(frameset3 == 6){
			flashMovie3.selectedGo('post2Bn');
		}else if(frameset3 == 7){
			flashMovie3.selectedGo('post3Bn');
		}else if(frameset3 == 8){
			flashMovie3.selectedGo('post4Bn');
		}else if(frameset3 == 9){
			flashMovie3.selectedGo('post5Bn');
		}
		casestudies(frameset3);
		return false;
	});
	$("#slide3 .prev").click(function(){
		frameset3--;
		if(frameset3 == 0){
			flashMovie3.selectedGo('pre1Bn');
		}else if(frameset3 == 1){
			flashMovie3.selectedGo('pre2Bn');
		}else if(frameset3 == 2){
			flashMovie3.selectedGo('pre3Bn');
		}else if(frameset3 == 3){
			flashMovie3.selectedGo('pre4Bn');
		}else if(frameset3 == 4){
			flashMovie3.selectedGo('pre5Bn');
		}else if(frameset3 == 5){
			flashMovie3.selectedGo('post1Bn');
		}else if(frameset3 == 6){
			flashMovie3.selectedGo('post2Bn');
		}else if(frameset3 == 7){
			flashMovie3.selectedGo('post3Bn');
		}else if(frameset3 == 8){
			flashMovie3.selectedGo('post4Bn');
		}else if(frameset3 == 9){
			flashMovie3.selectedGo('post5Bn');
		}
		casestudies(frameset3);
		return false;
	});
	$("#slide4 .next").click(function(){
		frameset4++;
		flashMovie4.moveButton(frameset4);
		aboutus(frameset4);
		return false;
	});
	$("#slide4 .prev").click(function(){
		frameset4--;		
		flashMovie4.moveButton(frameset4);
		aboutus(frameset4);
		return false;
	});
	
	$(".nextpage").click(function(){
	    var $pages = $('.pages', $(this).parent()).children('.page');
	    var totalPages = $pages.length;
        var currentOffest = 0;
		
		$pages.each(function(i){
			if ($(this).css("display") == "block") {
                currentOffset = i;
            }
		});

		nextOffset = currentOffset + 1;
		
        if (nextOffset == totalPages-1) {
			$(this).fadeTo(200,.0).css("display","none");
			$(this).siblings(".prevpage").css("display","block").fadeTo(200,1);
        } else { 
			$(this).siblings(".prevpage").css("display","block").fadeTo(200,1);
        }

        $($pages[currentOffset]).fadeTo(200,0).css("display","none");
        $($pages[nextOffset]).css("display","block").fadeTo(200,1);
		
		return false;
	});
	$(".prevpage").click(function(){
	    var $pages = $('.pages', $(this).parent()).children('.page');
	    var totalPages = $pages.length;
        var currentOffest = 0;
		
		$pages.each(function(i){
			if ($(this).css("display") == "block") {
                currentOffset = i;
            }
		});
		
		prevOffset = currentOffset - 1;
		
        if (prevOffset == 0) {
			$(this).fadeTo(200,.0).css("display","none");
			$(this).siblings(".nextpage").css("display","block").fadeTo(200,1);
        } else {
			$(this).siblings(".nextpage").css("display","block").fadeTo(200,1);
        }

        $($pages[currentOffset]).fadeTo(200,0).css("display","none");
        $($pages[prevOffset]).css("display","block").fadeTo(200,1);
		
		return false;
	});
	$(".prevpage").fadeTo(10,.0).css("display","none");
	
	$("h2[title], h3[title]").each(function(){
		altAtr = $(this).html();
		$(this).wrapInner("<span></span>")
		$(this).css({
			"background":"url(/images/heading_"+$(this).attr('title').toLowerCase()+".gif) no-repeat"
		})
		$(this).append('<img src="/images/heading_'+$(this).attr('title').toLowerCase()+'.gif" alt="'+altAtr+'" />');
		$(this).children("span").css({
			"display":"none"
		});
	});
	
	
	
	
	$("div.col:last-child").css({
		'margin-right':'0px'
	});
});
/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4259 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */

(function($){
	
$.dimensions = {
	version: '1.2'
};

// Create innerHeight, innerWidth, outerHeight and outerWidth methods
$.each( [ 'Height', 'Width' ], function(i, name){
	
	// innerHeight and innerWidth
	$.fn[ 'inner' + name ] = function() {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
	};
	
	// outerHeight and outerWidth
	$.fn[ 'outer' + name ] = function(options) {
		if (!this[0]) return;
		
		var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
		
		options = $.extend({ margin: false }, options || {});
		
		var val = this.is(':visible') ? 
				this[0]['offset' + name] : 
				num( this, name.toLowerCase() )
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
		
		return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
	};
});

// Create scrollLeft and scrollTop methods
$.each( ['Left', 'Top'], function(i, name) {
	$.fn[ 'scroll' + name ] = function(val) {
		if (!this[0]) return;
		
		return val != undefined ?
		
			// Set the scroll offset
			this.each(function() {
				this == window || this == document ?
					window.scrollTo( 
						name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
						name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
					) :
					this[ 'scroll' + name ] = val;
			}) :
			
			// Return the scroll offset
			this[0] == window || this[0] == document ?
				self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
					$.boxModel && document.documentElement[ 'scroll' + name ] ||
					document.body[ 'scroll' + name ] :
				this[0][ 'scroll' + name ];
	};
});

$.fn.extend({
	position: function() {
		var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
		
		if (elem) {
			// Get *real* offsetParent
			offsetParent = this.offsetParent();
			
			// Get correct offsets
			offset       = this.offset();
			parentOffset = offsetParent.offset();
			
			// Subtract element margins
			offset.top  -= num(elem, 'marginTop');
			offset.left -= num(elem, 'marginLeft');
			
			// Add offsetParent borders
			parentOffset.top  += num(offsetParent, 'borderTopWidth');
			parentOffset.left += num(offsetParent, 'borderLeftWidth');
			
			// Subtract the two offsets
			results = {
				top:  offset.top  - parentOffset.top,
				left: offset.left - parentOffset.left
			};
		}
		
		return results;
	},
	
	offsetParent: function() {
		var offsetParent = this[0].offsetParent;
		while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
			offsetParent = offsetParent.offsetParent;
		return $(offsetParent);
	}
});

function num(el, prop) {
	return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
};

})(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 © 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 © 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. 
 *
 */