/*
Script Name: 	FX (http://jastegg.it/eggs/fx ) 
version: 		2.0 beta
version date:	2008-06-21
Plugin for:		JAST ( http://jastegg.it )
--------------------------------
*/
FX_RESIZE_ORIGINAL='original';FX_SCROLL_TOP='top';FX_SCROLL_LEFT='left';JASTEggIt.extend('fx',{info:{title:'FX 2.0 - Special Effects',version:'2.0',eggUrl:'http://jastegg.it/eggs/fx2',author:'Diego La Monica',url:'http://diegolamonica.info'},effects:[],queues:[],queue:function(effects){var q=new Object();q.effects=effects;q.paused=false;q.done=false;q.current=0;var queueIndex=JASTEggIt.fx.queues.length;JASTEggIt.fx.queues[queueIndex]=q;JASTEggIt.fx.runQueue(queueIndex);return queueIndex;},appendToQueue:function(index,effect){if(JASTEggIt.fx.queues[index]==null){return JASTEggIt.fx.queue([effect]);}else{var q=JASTEggIt.fx.queues[index];var e=q.effects;e[e.length]=effect;if(q.done){q.done=false;JASTEggIt.fx.runQueue(index);}}},runQueue:function(index){var q=JASTEggIt.fx.queues[index];var c=q.current;var f=q.effects[c];if(q.paused){if(q.interval==null)q.interval=setInterval('JASTEggIt.fx.runQueue('+index+')',100);return false;}if(q.interval!=null){clearInterval(q.interval);q.interval=null;}f.fn(f.id,index);},queueCommandDone:function(index){var q=JASTEggIt.fx.queues[index];var c=q.current;if(c==q.effects.length-1){q.done=true;}else{q.current+=1;JASTEggIt.fx.runQueue(index);}},commandDone:function(o){o.done=true;clearInterval(o.intvl);if(o.queueIndex!=null)JASTEggIt.fx.queueCommandDone(o.queueIndex);},setEffect:function(id,effect,options,speed){options.done=false;options.paused=false;if(JASTEggIt.fx.effects[id]==null)JASTEggIt.fx.effects[id]=new Object();var o=JASTEggIt.fx.getEffect(id,effect);if(o!=null)clearInterval(o.intvl);options.intvl=setInterval('JASTEggIt.fx._'+effect+'("'+id+'");',speed);JASTEggIt.fx.effects[id][effect]=options;},getEffect:function(id,effect){if(JASTEggIt.fx.effects[id]==null)return null;return JASTEggIt.fx.effects[id][effect];},effectExists:function(id,effect){if(JASTEggIt.fx.effects[id]==null)return false;return(JASTEggIt.fx.effects[id][effect]!=null);},_fade:function(id){var f=JASTEggIt.fx.effects[id];if(f==null)return false;var o=f['fade'];if(o==null)return false;if(o.paused)return false;if((o.opacity>o.limit&&o.step>0)||(o.opacity<o.limit&&o.step<0)){JASTEggIt.fx.commandDone(o);}else{if(o.opacity==null&&o.step>0)o.opacity=0;if(o.opacity==null&&o.step<0)o.opacity=100;var el=JASTEggIt._id(id);if(JASTEggIt.Browser.ie){if(el.style.height==null||el.style.height==''){var sz=JASTEggIt.DOM.realSize(el);el.style.height=sz.height;o.forced=true;};if((o.opacity==100||o.opacity==0)&&o.forced){el.style.height='';};el.style.filter='alpha(opacity='+o.opacity+')';}else{el.style.opacity=o.opacity/100;el.style.MozOpacity=o.opacity/100;el.style.KhtmlOpacity=o.opacity/100;};o.opacity+=o.step;}},fade:function(id,speed,limit,step,q){var options=new Object();options.limit=limit;options.step=step;options.queueIndex=q;var f=JASTEggIt.fx.getEffect(id,'fade');if(f!=null)options.opacity=f.opacity;JASTEggIt.fx.setEffect(id,'fade',options,speed);},fadeIn:function(id,speed,limit,step,q){if(step<0)step=step*-1;JASTEggIt.fx.fade(id,speed,limit,step,q);},fadeOut:function(id,speed,limit,step,q){if(step>0)step=step*-1;JASTEggIt.fx.fade(id,speed,limit,step,q);},_resize:function(id){var f=JASTEggIt.fx.effects[id];if(f==null)return false;var o=f['resize'];if(o==null)return false;if(o.paused)return false;var c=o.current;var oldW=c.width;var oldH=c.height;if(c.width<o.to.width&&o.stepW>0||c.width>o.to.width&&o.stepW<0)c.width+=o.stepW;if(c.height<o.to.height&&o.stepH>0||c.height>o.to.height&&o.stepH<0)c.height+=o.stepH;c.overflow='hidden';JASTEggIt.DOM.setStyle(id,{width:c.width+'px',height:c.height+'px',overflow:'hidden'});if(oldW==c.width&&oldH==c.height)JASTEggIt.fx.commandDone(o);},resize:function(id,from,to,speed,steps,q){var options=new Object();options.to=((to==FX_RESIZE_ORIGINAL)?JASTEggIt.DOM.realSize(id):to);var r=JASTEggIt.fx.getEffect(id,'resize');if(r!=null)options.from=r.current;else options.from=((from==FX_RESIZE_ORIGINAL)?JASTEggIt.DOM.realSize(id):from);options.stepW=(options.to.width-options.from.width)/steps;options.stepH=(options.to.height-options.from.height)/steps;options.current=options.from;options.queueIndex=q;JASTEggIt.fx.setEffect(id,'resize',options,speed);},_scroll:function(id){var f=JASTEggIt.fx.effects[id];if(f==null)return false;var o=f['scroll'];if(o==null)return false;if(o.paused)return false;o.increments+=o.step;var s=JASTEggIt._id(id).style;if(s.position==''||s.position==null)s.position='relative';s[o.direction]=(o.startFrom+o.increments)+'px';if(((o.increments>=-o.limit)&&o.step>0)||((o.increments<=-o.limit)&&o.step<0)){JASTEggIt.fx.commandDone(o);}},scroll:function(id,speed,step,limit,queueIndex,direction){var o=new Object();var l=JASTEggIt.DOM.style(id,direction);l=parseInt(l[direction]);if(isNaN(l))l=0;o.startFrom=l;o.limit=limit;o.step=step;o.direction=direction;o.queueIndex=queueIndex;o.increments=0;JASTEggIt.fx.setEffect(id,'scroll',o,speed);},hscroll:function(id,speed,step,limit,queueIndex){JASTEggIt.fx.scroll(id,speed,step,limit,queueIndex,FX_SCROLL_TOP);},hscroll:function(id,speed,step,limit,queueIndex){JASTEggIt.fx.scroll(id,speed,step,limit,queueIndex,FX_SCROLL_LEFT);}});
