/*
 * 
 * WhatInOut
 * Nice fadeInOut effect with jQuery!!!!
 * jQuery 1.4 or higher, jQuery.easing required
 * 
 * Licensed under the MIT 
 * Copyright (c) 2010 nori (norimania@gmail.com)
 * 5509 - http://5509.me/
 * 
 * $Update: 2010-05-01 21:41
 * $Date: 2010-04-28 21:14
 * 
 */

(function(c){var a=c.easing.easeOutCirc?"easeOutCirc":"swing",b=function(e){return{marginTop:parseInt(e.css("marginTop")),marginLeft:parseInt(e.css("marginLeft")),width:e.attr("offsetWidth"),height:e.attr("offsetHeight"),opacity:e.css("opacity")};},d=function(e,f){if(c.data(document,e)==null){c.data(document,e,f);}};returnID=function(f){if(f.attr("id")){return f.attr("id");}else{var e="what_"+Math.floor(Math.random()*Math.random()*1000);f.attr("id",e);return e;}};c.fn.whatSlideIn=function(f){c(this).show();var i=c.extend({easing:a,duration:400,posIn:20,callback:function(){}},f),g=c(this),e=returnID(g),h=c.data(document,e)!=null?c.data(document,e):b(g);d(e,h);g.css({marginTop:h.marginTop+parseInt(i.posIn),opacity:0}).stop(true,false).animate(c.data(document,e),{duration:i.duration,easing:i.easing,complete:function(){i.callback();g.css(c.data(document,e));}});};c.fn.whatSlideOut=function(f){c(this).show();var i=c.extend({easing:a,duration:400,posOut:"-20",callback:function(){}},f),g=c(this),e=returnID(g),h=c.data(document,e)!=null?c.data(document,e):b(g);d(e,h);g.css(c.data(document,e)).stop(true,false).animate({marginTop:h.marginTop+parseInt(i.posOut),opacity:0},{duration:i.duration,easing:i.easing,complete:function(){i.callback();g.hide().css(c.data(document,e));}});};c.fn.whatIn=function(g){c(this).show();var l=c.extend({easing:a,duration:400,sizeFrom:80,callback:function(){}},g),i=c(this),f=returnID(i),e=l.sizeFrom/100,j=c.data(document,f)!=null?c.data(document,f):b(i),k={width:j.width*e,height:j.height*e},h={marginTop:j.marginLeft+(j.height-k.height)/2,marginLeft:j.marginLeft+(j.width-k.width)/2};d(f,j);i.hide().css({width:k.width,height:k.height,opacity:0,marginTop:h.marginTop,marginLeft:h.marginLeft}).stop(true,false).animate(c.data(document,f),{duration:l.duration,easing:l.easing,complete:function(){i.css(c.data(document,f));l.callback();}});};c.fn.whatOut=function(h){c(this).show();var l=c.extend({easing:a,duration:400,sizeTo:80,callback:function(){}},h),i=c(this),g=returnID(i),f=l.sizeTo/100,j=c.data(document,g)!=null?c.data(document,g):b(i),e={width:j.width*f,height:j.height*f},k={marginTop:j.marginLeft+(j.height-e.height)/2,marginLeft:j.marginLeft+(j.width-e.width)/2};d(g,j);i.hide().css(c.data(document,g)).stop(true,false).animate({marginTop:k.marginTop,marginLeft:k.marginLeft,width:e.width,height:e.height,opacity:0},{duration:l.duration,easing:l.easing,complete:function(){i.hide().css(c.data(document,g));l.callback();}});};})(jQuery);
