/*
 * interface FX - http://www.eyecon.ro/interface/
 *
 * Copyright (c) 2006 Stefan Petre
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

jQuery.fn.fxReset = function ()
{
	return this.each(function(){
		new jQuery.fx.fxReset(this);
	});
};
jQuery.fx.fxReset = function(e)
{
	if (/tr|td|tbody|caption|thead|tfoot|col|colgroup|th|body|header|script|frame|frameset|meta/i.test(e.nodeName) )
		return false;
	var par = e.parentNode;
	if (jQuery.hasWord(par, 'fxWrapper')) {
		var p = jQuery(par);
		e.opd = p.css('display');
		par.style.display = e.od;
		if(e.od == 'none') {
			par.style.display = 'block';
		}
		var t = jQuery.getPos(e);
		e.op.h = t.h;
		e.op.w = t.w;
		if (jQuery.browser == "msie") {
			e.style.filter = "alpha(opacity=" + 0.999*100 + ")";
		}
		e.style.top = '0px';
		e.style.left = '0px';
		e.style.width = e.op.w + 'px';
		e.style.height = e.op.h + 'px';
		e.style.opacity = 0.999;
		par.style.overflow = 'hidden';
		par.style.width = e.op.wb + 'px';
		par.style.height = e.op.hb + 'px';
	} else {
		var t = jQuery(e);
		e.opz = t.css('position');
		e.od = t.css('display');
		e.opd = e.od;
		if(e.od == 'none') {
			e.style.display = 'block';
		}
		e.op = jQuery.getPos(e);
		e.om = jQuery.getMargins(e);
		var es = e.style;
		var wid = 'w_' + parseInt(Math.random() * 10000);
		var wr = document.createElement(/img|br|input|select|textarea|object|iframe|button|form|table/i.test(e.nodeName) ? 'div' : e.nodeName);
		jQuery(wr).set('id', wid ).addClass('fxWrapper');
		var wrs = wr.style;
		var top = 0;
		var left = 0;
		if (e.opz == 'relative' || e.opz == 'absolute'){
			top = t.css('top');
			left = t.css('left');
		}
		wrs.top = top + 'px';
		wrs.left = left + 'px';
		wrs.position = e.opz != 'relative' && e.opz != 'absolute' ? 'relative' : e.opz;
		wrs.height = e.op.hb + 'px';
		wrs.width = e.op.wb + 'px';
		wrs.marginTop = e.om.t + 'px';
		wrs.marginRight = e.om.r == 0 ?  'auto' : (e.om.r + 'px');
		wrs.marginBottom = e.om.b + 'px';
		wrs.marginLeft = e.om.l == 0 ?  'auto' : (e.om.l + 'px');
		wrs.display = e.od;
		wrs.overflow = 'hidden';
		if (jQuery.browser == "msie") {
			es.filter = "alpha(opacity=" + 0.999*100 + ")";
		}
		es.opacity = 0.999;
		t.wrap(wr);
		es.marginTop = '0px';
		es.marginRight = '0px';
		es.marginBottom = '0px';
		es.marginLeft = '0px';
		es.position = 'absolute';
		es.listStyle = 'none';
		es.top = '0px';
		es.left = '0px';
	}
	return true;
};
jQuery.fn.Pulsate = function(s, t, o) {
	/*return this.each(function(){
		new jQuery.fx.Pulsate(this, s, t, o);
	});*/
	return this.each(function(){
		new jQuery.fx.Pulsate(this, s, t, o);
	});
};

jQuery.fx.Pulsate = function (a,b,t,o)
{	
	var z = this;
	jQuery.fx.fxReset(a);
	z.a = a;
	z.b = b;
	t = parseInt(t);
	if (t) {
		z.times = t;
		z.cnt = 1;
	} else {
			z.times = 3;
			z.cnt = 1;
	}
	if ( o && o.constructor == Function ) {
		z.o = o;
	}
	z.doPulsate = function ()
	{
		if (z.cnt <= z.times) {
			jQuery(z.a).animate(
				{opacity: 'hide'},
				z.b,
				function()
				{
					jQuery(z.a).animate( 
						{opacity: 'show'},
						z.b,
						function()
						{
							z.cnt ++;
							z.doPulsate();
						}
					);
				}
			);
		} else if (z.o && z.o.constructor == Function) {
			z.o(z.a);
		}
	};
	z.doPulsate();
};

jQuery.fn.ScrollTo = function(s) {
	o = jQuery.speed(s);
	return this.each(function(){
		new jQuery.fx.ScrollTo(this, o);
	});
};

jQuery.fx.ScrollTo = function (e, o)
{
	var z = this;
	z.o = o;
	z.e = e;
	z.p = jQuery.getPos(e);
	z.s = jQuery.getScroll();
	z.clear = function(){clearInterval(z.timer);z.timer=null};
	z.t=(new Date).getTime();
	z.step = function(){
		var t = (new Date).getTime();
		var p = (t - z.t) / z.o.duration;
		if (t >= z.o.duration+z.t) {
			z.clear();
			setTimeout(function(){z.scroll(z.p.y, z.p.x)},13);
		} else {
			st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t;
			sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l;
			z.scroll(st, sl);
		}
	};
	z.scroll = function (t, l){window.scrollTo(l, t)};
	z.timer=setInterval(function(){z.step();},13);
};

jQuery.fn.SlideInUp = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'up', 'in');
	});
};
jQuery.fn.SlideOutUp = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'up', 'out');
	});
};
jQuery.fn.SlideToggleUp = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'up', 'toggle');
	});
};
jQuery.fn.SlideInDown = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'down', 'in');
	});
};
jQuery.fn.SlideOutDown = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'down', 'out');
	});
};
jQuery.fn.SlideToggleDown = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'down', 'toggle');
	});
};
jQuery.fn.SlideInLeft = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'left', 'in');
	});
};
jQuery.fn.SlideOutLeft = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'left', 'out');
	});
};
jQuery.fn.SlideToggleLeft = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'left', 'toggle');
	});
};

jQuery.fn.SlideInRight = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'right', 'in');
	});
};
jQuery.fn.SlideOutRight = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'right', 'out');
	});
};
jQuery.fn.SlideToggleRight = function (s,o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'right', 'toggle');
	});
};
jQuery.fx.slide = function(e, o, d, t)
{
	var z = this;
	z.e = jQuery(e);
	e.sldd = t;
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	if (t == 'toggle') {
		e.sldd = e.opd == 'none' || z.w.css('height') == 0 || z.w.css('width') == 0 ? 'in' : 'out';
	}
	if (e.opd == 'none')
		z.w.show();
	if (o.complete && o.complete.constructor == Function) {
		e.oComp = o.complete;
	}
	o.complete = function(){
		if(this.sldd != 'in') {
			this.parentNode.style.display = 'none';
		}
		if (this.oComp && this.oComp.constructor == Function) {
			this.oComp();
		}
	};
	switch (d) {
		case 'up':
			z.e.css('left', '0px');
			fxi = new jQuery.fx(e, o, 'top');
			fxh = new jQuery.fx(e.parentNode,o.duration, 'height');
			if (e.sldd == 'in') {
				fxi.custom (-e.op.hb, 0);
				fxh.show();
			} else {
				fxi.custom (0, -e.op.hb);
				fxh.hide();
			}
		break;
		case 'down':
			z.e.css('left', '0px');
			fxi = new jQuery.fx(e, o, 'top');
			if (e.sldd == 'in') {
				fxi.custom (e.op.hb, 0);
			} else {
				fxi.custom (0, e.op.hb);
			}
		break;
		case 'left':
			z.e.css('top', '0px');
			fxi = new jQuery.fx(e, o, 'left');
			fxh = new jQuery.fx(e.parentNode,o.duration, 'width');
			if (e.sldd == 'in') {
				fxi.custom (-e.op.wb, 0);
				fxh.show();
			} else {
				fxi.custom (0, -e.op.wb);
				fxh.hide();
			}
		break;
		case 'right':
			z.e.css('top', '0px');
			fxi = new jQuery.fx(e, o, 'left');
			if (e.sldd == 'in') {
				fxi.custom (e.op.wb, 0);
			} else {
				fxi.custom (0, e.op.wb);
			}
		break;
	}
};

//stays in for backward compatibility
jQuery.fn.SlideUp = function (s, o)
{
	//o = jQuery.speed(s, o);
	/*return this.each(function(){
		new jQuery.fx.SlideDirection(this, o, 'up');
	});*/
	
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'up', 'out');
	});
};
jQuery.fn.SlideDown = function (s, o)
{
	/*o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.SlideDirection(this, o, 'down');
	});*/
	
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'up', 'in');
	});
};
jQuery.fn.SlideLeft = function (s, o)
{
	//o = jQuery.speed(s, o);
	/*return this.each(function(){
		new jQuery.fx.SlideDirection(this, o, 'left');
	});*/
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'left', 'out');
	});
};
jQuery.fn.SlideRight = function (s, o)
{
	//o = jQuery.speed(s, o);
	/*return this.each(function(){
		new jQuery.fx.SlideDirection(this, o, 'right');
	});*/
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.slide(this, o, 'left', 'in');
	});
};

jQuery.fn.Shake = function (t, o) {
	return this.each(function(){
		new jQuery.fx.Shake(this, t, o);
	});
};
jQuery.fx.Shake = function (e, t, o)
{
	var z = this;
	z.e = jQuery(e);
	if (o && o.constructor == Function) {
		z.o = o;
	}
	if (t) {
		z.times = t;
		z.cnt = 1;
	} else {
			z.times = 2;
			z.cnt = 1;
	}
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	z.e.css(
		{
			position: 'absolute',
			top: '0px',
			left: '0px'
		}
	);
	z.w.css(
		{
			overflow: 'visible'
		}
	);
	z.doShake = function ()
	{
		if (z.cnt <= z.times) {
			
			fxi = new jQuery.fx(e, 
						 {
							 duration: 60,
							 complete : function ()
							 {
								fx2 = new jQuery.fx(e, 
											 {
												 duration: 60,
												 complete : function ()
												 {
													fx3 = new jQuery.fx(e,{duration: 60, complete: function(){z.cnt ++;z.doShake();}}, 'left');
													fx3.custom (-20, 0);
												 }
											}, 'left');
								fx2.custom (20, -20);
							 }
						}, 'left');
			fxi.custom (0, 20);
		} else if (z.o && z.o.constructor == Function) {
			z.o(z.e.cur[o]);
		}
	};
	z.doShake();
		
};

jQuery.fn.BlindUp = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.BlindDirection(this, o, 'up');
	});
};
jQuery.fn.BlindDown = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.BlindDirection(this, o, 'down');
	});
};
jQuery.fn.BlindToggleVerticaly = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.BlindDirection(this, o, jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px') ? 'down' : 'up');
		new jQuery.fx.BlindDirection(this, o, 'togglever');
	});
};
jQuery.fn.BlindLeft = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.BlindDirection(this, o, 'left');
	});
};
jQuery.fn.BlindRight = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.BlindDirection(this, o, 'right');
	});
};
jQuery.fn.BlindToggleHorizontaly = function (s, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.BlindDirection(this, o, jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px') ? 'right' : 'left');
		new jQuery.fx.BlindDirection(this, o, 'togglehor');
	});
};

jQuery.fx.BlindDirection = function (e, o, d)
{
	var z = this;
	z.e = jQuery(e);
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	s = {duration : o.duration};
	if (o.complete) {
		e.parentNode.complete = o.complete;
		s.complete = function(){this.complete(this.firstChild)};
	}
	if ( d == 'togglever') {
		d = e.opd == 'none' || z.w.css('height') == 0 || z.w.css('width') == 0? 'down' : 'up';
	} else if (d == 'togglehor') {
		d = e.opd == 'none' || z.w.css('height') == 0 || z.w.css('width') == 0? 'right' : 'left';
	}
	if (e.opd == 'none')
		z.w.show();
	switch (d) {
		case 'up':
			fxh = new jQuery.fx(z.w.cur[0],s, 'height');
			fxh.custom(e.op.hb, 0);
		break;
		case 'down':
			fxh = new jQuery.fx(z.w.cur[0],s, 'height');
			fxh.custom(0, e.op.hb);
		break;
		case 'left':
			fxh = new jQuery.fx(z.w.cur[0],s, 'width');
			fxh.custom(e.op.wb, 0);
		break;
		case 'right':
			fxh = new jQuery.fx(z.w.cur[0],s, 'width');
			fxh.custom(0, e.op.wb);
		break;
	}
};

jQuery.fn.Fold = function (s, h, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.DoFold(this, o, h, 'fold');
	});
};
jQuery.fn.UnFold = function (s, h, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		new jQuery.fx.DoFold(this, o, h, 'unfold');
	});
};
jQuery.fn.FoldToggle = function (s, h, o)
{
	o = jQuery.speed(s, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.DoFold(this, o, h, (jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px')) ? 'unfold' : 'fold');
		new jQuery.fx.DoFold(this, o, h, 'toggle');
	});
};

jQuery.fx.DoFold = function (e, o, h, t)
{
	var z = this;
	z.e = jQuery(e);
	z.o = o;
	z.h = h && h.constructor == Number ? h : 20;
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	if ( t == 'toggle') {
		t = e.opd == 'none' || z.w.css('height') == 0 || z.w.css('width') == 0? 'unfold' : 'fold';
	}
	if (e.opd == 'none' ) {
		z.w.show();
	}
	if ( t == 'unfold') {
		z.w.css('height', z.h + 'px');
		fxh = new jQuery.fx(z.w.cur[0],
				{
					duration : o.duration,
					complete : function()
					{
						fxi = new jQuery.fx(z.w.cur[0],z.o, 'height');
						fxi.custom(z.h, e.op.hb);
					}
				}, 'width');
		fxh.custom(0, e.op.wb);
	} else {
		fxh = new jQuery.fx(z.w.cur[0],
				{
					duration : o.duration,
					complete : function()
					{
						fxi = new jQuery.fx(z.w.cur[0],z.o, 'width');
						fxi.custom(e.op.wb, 0);
					}
				}, 'height');
		fxh.custom(e.op.hb, z.h);
	}
};

jQuery.fn.DropOutDown = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'down', 'out');
	});
};
jQuery.fn.DropInDown = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'down', 'in');
	});
};
jQuery.fn.DropToggleDown = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.DropOutDirectiont(this, o, 'down', (jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px')) ? 'in' : 'out');
		new jQuery.fx.DropOutDirectiont(this, o, 'down', 'toggle');
	});
};
jQuery.fn.DropOutUp = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'up', 'out');
	});
};
jQuery.fn.DropInUp = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'up', 'in');
	});
};
jQuery.fn.DropToggleUp = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.DropOutDirectiont(this, o, 'up', (jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px')) ? 'in' : 'out');
		new jQuery.fx.DropOutDirectiont(this, o, 'up', 'toggle');
	});
};
jQuery.fn.DropOutLeft = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'left', 'out');
	});
};
jQuery.fn.DropInLeft = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'left', 'in');
	});
};
jQuery.fn.DropToggleLeft = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.DropOutDirectiont(this, o, 'left', (jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px')) ? 'in' : 'out');
		new jQuery.fx.DropOutDirectiont(this, o, 'left', 'toggle');
	});
};
jQuery.fn.DropOutRight = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'right', 'out');
	});
};
jQuery.fn.DropInRight = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.DropOutDirectiont(this, o, 'right', 'in');
	});
};
jQuery.fn.DropToggleRight = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		//p = this.parentNode;
		//new jQuery.fx.DropOutDirectiont(this, o, 'right', (jQuery.hasWord(p, 'fxWrapper') && (p.style.display == 'none' || p.style.height == '0px' || p.style.width == '0px')) ? 'in' : 'out');
		new jQuery.fx.DropOutDirectiont(this, o, 'right', 'toggle');
	});
};
jQuery.fx.DropOutDirectiont = function (e, o, d, t)
{
	var z = this;
	z.e = jQuery(e);
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	z.w.css(
		{
			overflow: 'visible'
		}
	);
	if ( t == 'toggle') {
		t = e.opd == 'none' || z.w.css('height') == 0 || z.w.css('width') == 0? 'in' : 'out';
	}
	if (e.opd == 'none' ) {
		z.w.show();
	}
	if ( t == 'out') {
		no = {duration:o.duration,complete:function(){jQuery(this.parentNode).hide()}};
	} else {
		no = o.duration;
	}
	di = 1;
	switch (d){
		case 'up':
			fxi = new jQuery.fx(e, no, 'top');
			di = -1;
		break;
		case 'down':
			fxi = new jQuery.fx(e, no, 'top');
		break;
		case 'right':
			fxi = new jQuery.fx(e, no, 'left');
		break;
		case 'left':
			fxi = new jQuery.fx(e, no, 'left');
			di = -1;
		break;
	}
	fxo = new jQuery.fx(e,o, 'opacity');
	if (t == 'in') {
		fxi.custom(100*di, 0);
		fxo.show();
	} else {
		fxi.custom(0, 100*di);
		fxo.hide();
	}
};

jQuery.fn.CloseVerticaly = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.CloseDirection(this, o, 'verticaly');
	});
};
jQuery.fn.CloseHorizontaly = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.CloseDirection(this, o, 'horizontaly');
	});
};
jQuery.fn.SwitchHorizontaly = function (t,o) 
{
	o = jQuery.speed(t, o);
	return this.each( function(){
		e = jQuery(this);
		jQuery.fx.fxReset(this);
		w = jQuery(this.parentNode);
		if (this.opd == 'none' || w.css('height') == 0 || w.css('width') == 0) {
			w.show();
			new jQuery.fx.OpenDirection(this, o, 'horizontaly');
		} else {
			new jQuery.fx.CloseDirection(this, o, 'horizontaly');
		}
	});
};
jQuery.fn.SwitchVerticaly = function (t,o) 
{
	o = jQuery.speed(t, o);
	return this.each( function(){
		e = jQuery(this);
		jQuery.fx.fxReset(this);
		w = jQuery(this.parentNode);
		if (this.opd == 'none' || w.css('height') == 0 || w.css('width') == 0) {
			w.show();
			new jQuery.fx.OpenDirection(this, o, 'verticaly');
		} else {
			new jQuery.fx.CloseDirection(this, o, 'verticaly');
		}
	});
};
jQuery.fn.OpenVerticaly = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.OpenDirection(this, o, 'verticaly');
	});
};
jQuery.fn.OpenHorizontaly = function (t, o) {
	o = jQuery.speed(t, o);
	return this.each(function(){
		new jQuery.fx.OpenDirection(this, o, 'horizontaly');
	});
};
jQuery.fx.CloseDirection = function (e, o, d)
{
	var z = this;
	z.e = jQuery(e);
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	s = {duration : o.duration/2};
	if (o.complete) {
		e.fxComplete = o.complete;
		s.complete = function(){
			jQuery(this.parentNode).hide();
			jQuery(this).css('width', this.op.w + 'px').css('height', this.op.h + 'px').css('display', this.od);
			this.fxComplete(this)
		};
	}
	switch (d) {
		case 'verticaly':
			fxh = new jQuery.fx(e, s, 'height');
			fxt = new jQuery.fx(e,o.duration , 'top');
			fxh.custom(e.op.h,0);
			fxt.custom(0, e.op.h/2 + (e.op.h - e.op.hb)/2);
		break;
		case 'horizontaly':
			fxw = new jQuery.fx(e, s, 'width');
			fxl = new jQuery.fx(e,o.duration, 'left');
			fxw.custom(e.op.w,0);
			fxl.custom(0, e.op.w/2 + (e.op.w - e.op.wb)/2);
		break;
	}
};
jQuery.fx.OpenDirection = function (e, o, d)
{
	var z = this;
	z.e = jQuery(e);
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	s = {duration : o.duration/2};
	if (o.complete) {
		e.fxComplete = o.complete;
		s.complete = function(){
			this.fxComplete(this)
		};
	}
	switch (d) {
		case 'verticaly':
			var fxh = new jQuery.fx(e, s, 'height');
			var fxt = new jQuery.fx(e,o.duration , 'top');
			fxh.custom(0, e.op.h);
			fxt.custom(e.op.h/2 + (e.op.h - e.op.hb)/2, 0);
		break;
		case 'horizontaly':
			var fxw = new jQuery.fx(e, s, 'width');
			var fxl = new jQuery.fx(e,o.duration, 'left');
			fxw.custom(0, e.op.w);
			fxl.custom(e.op.w/2 + (e.op.w - e.op.wb)/2, 0);
		break;
	}
};

jQuery.fn.Bounce = function (h, o) {
	return this.each(function(){
		new jQuery.fx.iBounce(this, h, o);
	});
};
jQuery.fx.iBounce = function (e, h, o)
{
	var z = this;
	z.e = jQuery(e);
	if (o && o.constructor == Function) {
		z.o = o;
	}
	z.times = 5;
	if (h) {
		z.bhight = h;
		z.cnt = 1;
	} else {
		z.bhight = 40;
		z.cnt = 1;
	}
	jQuery.fx.fxReset(e);
	z.w = jQuery(e.parentNode);
	z.e.css(
		{
			position: 'absolute',
			top: '0px',
			left: '0px'
		}
	);
	z.w.css(
		{
			overflow: 'visible'
		}
	);
	z.doBounce = function ()
	{
		if (z.cnt <= z.times) {
			
			fxi = new jQuery.fx(e, 
						 {
							 duration: 120,
							 complete : function ()
							 {
								fx2 = new jQuery.fx(e, 
											 {
												 duration: 80,
												 complete : function ()
												 {
													z.cnt ++;
													z.bhight = parseInt(z.bhight/2);
													z.doBounce();
												 }
											}, 'top');
								fx2.custom (-z.bhight, 0);
							 }
						}, 'top');
			fxi.custom (0, -z.bhight);
		} else if (z.o && z.o.constructor == Function) {
			z.o(z.e.cur[o]);
		}
	};
	z.doBounce();
		
};