/**
* jQuery.fn.dualSlider - Dual sliders, why not?
* Date: June 2010
*
* @author Rob Phillips (Front End Developer - Hugo & Cat - http://www.hugoandcat.com)
* @version 0.3
* @web http://www.hugoandcat.com/DualSlider/index.html
*
* Requirements:
* jquery.1.3.2.js - http://jquery.com/
* jquery.easing.1.3.js - http://gsgd.co.uk/sandbox/jquery/easing/
* jquery.timers-1.2.js - http://plugins.jquery.com/project/timers
*
* 0.2 - Tested and fixed for IE6+, auto loops, manual pause/play controls
*	  - Disabled buttons until animation finishes - Thanks for the bug John.
* 0.3 - Now with a seamless loop, instead of that nasty rewind...was 'too much' apparently
*
* WITH MODIFICATIONS by favila 2011-06-13:
* works with jquery 1.2.6
* no easing or timer plugin dependencies
* "background" area narrower than full carousel width
* background and details move at same time
**/

(function(a){a.fn.dualSlider=function(b){var c={auto:true,autoDelay:1e4,duration:1e3};var b=a.extend(c,b);this.each(function(){function t(){if(!m){m=setInterval(function(){r(f+1,true);n()},b.autoDelay)}}function s(){if(m){clearInterval(m);m=null}}function r(d,e){if(l!=true){f=parseFloat(d);if(e==false)s();var g=d*j-j;var h=d*k-k;if(g!=0){g=g*-1;h=h*-1}a(".details",c).animate({marginLeft:h},{duration:b.duration,queue:false});a(".backgrounds",c).animate({marginLeft:g},{duration:b.duration,complete:function(){q();p();o()}})}}function q(){if(f<1){a(".backgrounds",c).css("margin-left",-1*(e-1)*j);a(".details",c).css("margin-left",-1*(e-1)*k);f=e}if(f>e){a(".backgrounds",c).css("margin-left",0);a(".details",c).css("margin-left",0);f=1}}function p(){a(".numbers a",c).removeClass("selected");a(".numbers .link"+f,c).addClass("selected");if(b.auto==false){f==e?a(".next",c).hide():a(".next",c).show();f<2?a(".previous",c).hide():a(".previous",c).show()}}function o(){l=false}function n(){l=true}var c=a(this);var d;var e=a(".backgrounds",c).children().length;var f=1;var g=1;var h="";var j=a(".backgrounds",c).children().width();var k=a(".panel .details_wrapper",c).width();var l=false;var m;if(b.auto==true){a(".backgrounds",c).prepend(a(".backgrounds .item:last-child",c).clone().css("margin-left","-"+j+"px"));a(".backgrounds",c).append(a(".backgrounds .item:nth-child(2)",c).clone());a(".details",c).prepend(a(".details .detail:last-child",c).clone().css("margin-left","-"+k+"px"));a(".details",c).append(a(".details .detail:nth-child(2)",c).clone())}a(".backgrounds",c).css("width",(e+1)*j+100+"px");a(".details_wrapper .details",c).css("width",k*j+"px");for(i=1;i<=e;i++){i==1?h+='<a rel="'+g+'" title="Go to page '+g+' " class="link'+g+' selected" href="javascript:void(0)">'+g+"</a>":h+='<a rel="'+g+'"\ttitle="Go to page '+g+' " class="link'+g+'" href="javascript:void(0)" >'+g+"</a>";g++}a(".numbers",c).html(h);a(".next",c).click(function(a){a.preventDefault();r(parseInt(f+1),false);n()});a(".previous",c).click(function(a){a.preventDefault();r(parseInt(f-1),false);n()});a(".numbers a",c).click(function(b){b.preventDefault();r(a(this).attr("rel"),false);n()});if(b.auto==true){setTimeout(t,b.autoDelay)}})}})(jQuery)
