(function(e){var d=[];var c=0;var b="";var a=0;jQuery.fn.divroller=function(q){settings=jQuery.extend({visible:3,pause:3000,click_item_class:".item-thumbnail-image",click_item_parent_class:".news-item",rotator_container:".rotator-container"},q);b=this.attr("id");for(var o=0;o<this.children().length;o++){e(this.children()[o]).data("rotateID",o);}e("#"+b+" "+settings.click_item_class).live("click",function(){f();switch(settings.rotateType){case"swapOnly":var u=e(settings.focusContainer).children();var i=u[0];var v=e(this).parents(settings.click_item_parent_class);h(e(settings.rotator_container),v);t(i,v);break;case"rotateOnly":var v=e(this).parents(settings.click_item_parent_class);h(e(settings.rotator_container),v);j(v);break;}m(e(settings.rotator_container));s(settings,e(settings.rotator_container));});l(settings,this);function l(i,u){c=0;p(u);s(i,u);}function s(i,u){switch(i.rotateType){case"swapOnly":a=setInterval(function(){r(i,u);},i.pause);break;case"roll":a=setInterval(function(){g(i,u);},i.pause);break;case"rotateOnly":a=setInterval(function(){k(i,u);},i.pause);break;default:a=setInterval(function(){g(i,u);},i.pause);}}function p(u){var i=u.children();j(i[0]);}function n(u){var i=u.children();var v=e(i[i.length-1]).remove();d.push(v);j(v);}function f(){clearInterval(a);}function r(i,y){var w=y.children();var u=e(i.focusContainer).children();var v=u[0];var x=w[c];t(v,x);m(y);}function m(i){c++;if(c>=i.children().length){c=0;}}function g(v,w){var x=d.pop();w.prepend(x);var u=w.children();var i=(e(u[u.length-1]).remove());j(i);d.push(i);e(w.children()[0]).hide();e(w.children()[0]).slideDown("slow");}function k(i,u){var v=u.children();var w=v[c];j(w);m(u);}function j(i){e(settings.focusContainer).children().remove();e(i).clone().appendTo(settings.focusContainer);}function h(v,x){var w=v.children();for(var u=0;u<w.length;u++){if(e(x).data("rotateID")==e(w[u]).data("rotateID")){c=u;break;}}}function t(u,i){var w=(e(u).children().remove());var v=(e(i).children().remove());e(u).prepend(v);e(i).prepend(w);}};}(jQuery));
