/**
 * showbox
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * Required Version:
 * 	PHP5 or higher
 * 	WordPress 3.0 or higher
 *
 * If you find my work useful and you want to encourage the development of more free resources,
 * you can do it by donating...
 * 	paypal: yofox2008@163.com
 * 	alipay: yofox2008@163.com
 *
 * @author wpbus team <wpbus2010@163.com>
 * @link http://www.wpbus.com/
 * @copyright Copyright (C) 2010 wpbus.com All rights reserved.
 * @License: GNU General Public License v2.0
 * @License URI:http://www.gnu.org/licenses/gpl-2.0.html
 */

 /* It would be great if you’d leave the link back to my site in the footer */
$(function(){var $cur=1;var $i=1;var $len=$('.showbox>ul>li').length;var $pages=Math.ceil($len/$i);var $w=$('.ibox').width();var $showbox=$('.showbox');var $num=$('span.num li');var $pre=$('span.pre');var $next=$('span.next');var $autoFun;autoSlide();$pre.click(function(){if(!$showbox.is(':animated')){if($cur==1){$showbox.animate({left:'-='+$w*($pages-1)},500);$cur=$pages}else{$showbox.animate({left:'+='+$w},500);$cur--}$num.eq($cur-1).addClass('numcur').siblings().removeClass('numcur')}});$next.click(function(){if(!$showbox.is(':animated')){if($cur==$pages){$showbox.animate({left:0},500);$cur=1}else{$showbox.animate({left:'-='+$w},500);$cur++}$num.eq($cur-1).addClass('numcur').siblings().removeClass('numcur')}});$num.click(function(){if(!$showbox.is(':animated')){var $index=$num.index(this);$showbox.animate({left:'-'+($w*$index)},500);$cur=$index+1;$(this).addClass('numcur').siblings().removeClass('numcur')}});clearFun($showbox);clearFun($pre);clearFun($next);clearFun($num);function clearFun(elem){elem.hover(function(){clearAuto()},function(){autoSlide()})}function autoSlide(){$next.trigger('click');$autoFun=setTimeout(autoSlide,3000)}function clearAuto(){clearTimeout($autoFun)}});