// create custom animation algorithm for jQuery called "bouncy"
	$.easing.bouncy = function (x, t, b, c, d) {
		var 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;
	}
	
	// create custom tooltip effect for jQuery Tooltip
	$.tools.tooltip.addEffect("bouncy",
	
		// opening animation
		function(done) {
			this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show();
		},
	
		// closing animation
		function(done) {
			this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  {
				$(this).hide();
				done.call();
			});
		}
	);
	//code for dynamic tooltips
	$(document).ready(	
		function() {
		// initialize tooltip
		$("#dyna img[title]").tooltip({
		
			// use single tooltip element for all tips
			tip: '#dynatip', 
			
			// tweak the position
			offset: [-10, 5],
			
			// use "slide" effect
			effect: 'bouncy'
			
		// add dynamic plugin 
		}).dynamic( {
		
			// customized configuration on bottom edge
			bottom: {
				direction: 'down', 
				bounce: true
			}
		});
	
	});
	// vertical tab slide plugin 
	$(function() {	
		$("#vertaccordion").tabs("#vertaccordion div.vpane", {tabs: 'h3', effect: 'slide'});
		$("div.tabs").tabs(".images > div", {		
			effect: 'fade',
			fadeOutSpeed: 900,
			rotate: true
		}).slideshow();
		$("div.tabs").tabs().play();
		
	});
	$(function() {
		$("#accordion").tabs("#accordion div", {
			tabs: 'img', 
			effect: 'horizontal',
			event: 'mouseover' 
		});
	});
	//code to open overlays
	$(function() {	
		$("a[rel]").overlay({
	
			expose: 'darkred',
			effect: 'apple',
	
			onBeforeLoad: function() {
	
				// grab wrapper element inside content
				var wrap = this.getContent().find("div.wrap");
	
				// load only for the first time it is opened
				if (wrap.is(":empty")) {
					wrap.load(this.getTrigger().attr("href"));
				}
			}
	
		});
	});
