ItImgMgr={cur_index:0,interval:7000,timer:null,goToNext:function(new_index){if(new_index==null)
ItImgMgr.cur_index++;else
ItImgMgr.cur_index=new_index;if(ItImgMgr.cur_index>=jq("#imgmover_items li").size()){ItImgMgr.cur_index=0;}else if(ItImgMgr.cur_index<0){ItImgMgr.cur_index=jq("#imgmover_items li").size()-1;}
jq('#imgmover_paging li').removeClass('this_page');jq('#PAGE_'+(parseInt(ItImgMgr.cur_index)+1)).addClass('this_page');ItImgMgr.setPaging();cur_item=jq('#imgmover_items li.active');cur_item.fadeOut("normal",function(){cur_item.removeClass('active');jq('#I_'+ItImgMgr.cur_index).addClass('active').fadeIn();ItImgMgr.startTimer();});},startTimer:function(){if(ItImgMgr.timer)
ItImgMgr.stopTimer();ItImgMgr.timer=setTimeout("ItImgMgr.goToNext()",ItImgMgr.interval);safelog(ItImgMgr.timer,"info","ItImgMgr.startTimer");},stopTimer:function(){clearTimeout(ItImgMgr.timer);safelog("stopTimeout","info","ItImgMgr.stopTimer");},trigger:function(e){if(e)preventDefault(e);if(!jq(this).parent().is(".persistent")){var index=jq(this).attr('id').split("_");ItImgMgr.goToNext(index[1]);}else{if(jq(this).parent().is(".prev"))
ItImgMgr.goToNext(parseInt(ItImgMgr.cur_index)-1);else
ItImgMgr.goToNext();}},setPaging:function(){var furthest_page=jq("#imgmover_paging li").not('.persistent').size();var this_item=jq('#imgmover_paging .this_page');var index=this_item.attr('id').split("_");if(furthest_page<=5){start_page=1;end_page=furthest_page+1;}else{var start_page=Math.max(1,parseInt(index[1])-2);start_page=Math.min(start_page,(furthest_page-5)+1);end_page=start_page+4;}
jq("#imgmover_paging li").not('.persistent').hide();for(i=start_page;i<=end_page;i++){jq('#PAGE_'+i).show();}},addTriggers:function(){jq("#imgmover").hover(function(){ItImgMgr.stopTimer();},function(){ItImgMgr.startTimer();});jq("#imgmover_paging a").click(ItImgMgr.trigger);ItImgMgr.startTimer();ItImgMgr.setPaging();}}
pageLoadFuncs.push(function(){ItImgMgr.addTriggers();});
