/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * jFlow
 * Version: 1.2 (July 7, 2008)
 * Requires: jQuery 1.2+
 */
(function(a){a.fn.jFlow=function(m){var b=a.extend({},a.fn.jFlow.defaults,m),e=b.controller,f=b.slideWrapper,g=b.selectedWrapper,c=0,i,j=a(e).length,k=function(d,n){a(b.slides).children().css({overflow:"hidden"});a(b.slides+" iframe").hide().addClass("temp_hide");a(b.slides).animate({marginLeft:"-"+(n*a(b.slides).find(":first-child").width()+"px")},b.duration*d,b.easing,function(){a(b.slides).children().css({overflow:"hidden"});a(".temp_hide").show()})};a(this).find(e).each(function(d){a(this).click(function(){h();
if(a(b.slides).is(":not(:animated)")){a(e).removeClass(g);a(this).addClass(g);k(Math.abs(c-d),d);c=d}})});a(b.slides).before('<div id="'+f.substring(1,f.length)+'"></div>').appendTo(f);a(b.slides).find("div").each(function(){a(this).before('<div class="jFlowSlideContainer"></div>').appendTo(a(this).prev())});a(e).eq(c).addClass(g);var l=function(){a(f).css({position:"relative",width:b.width,height:b.height,overflow:"hidden"});a(b.slides).css({position:"relative",width:a(f).width()*a(e).length+"px",
height:a(f).height()+"px",overflow:"hidden"});a(b.slides).children().css({position:"relative",width:a(f).width()+"px",height:a(f).height()+"px","float":"left",overflow:"hidden"});a(b.slides).css({marginLeft:"-"+(c*a(b.slides).find(":eq(0)").width()+"px")})};l();a(window).resize(function(){l()});a(b.prev).click(function(){h();if(a(b.slides).is(":not(:animated)")){var d=1;if(c>0)c--;else d=c=j-1;a(e).removeClass(g);k(d,c);a(e).eq(c).addClass(g)}});a(b.next).click(function(){h();if(a(b.slides).is(":not(:animated)")){var d=
1;if(c<j-1)c++;else{c=0;d=j-1}a(e).removeClass(g);k(d,c);a(e).eq(c).addClass(g)}});var h=function(){if(b.auto==true){i!=null&&clearInterval(i);i=setInterval(function(){a(b.next).click()},3E3)}};h()};a.fn.jFlow.defaults={controller:".jFlowControl",slideWrapper:"#jFlowSlide",selectedWrapper:"jFlowSelected radius",auto:false,easing:"swing",duration:500,width:"100%",prev:".jFlowPrev",next:".jFlowNext"}})(jQuery);
