/**
 *
 * 首页JS操作文件
 *
 * @FileName: index.js
 * @Auther: Pandao
 * @QQ: 272383090
 * @CreateTime: 2011-10-27 09:38:58
 * @UpdateTime: 2011-11-30 17:39:56
 * Copyright 2011 泉州市科伟信息咨询有限公司版权所有，禁止非法用于商业用途，否则后果自负!
 */

 var bannerIndex = -1;
 var bannerTimer;
 var speedTime = 5000;  //间隔时间5秒，1秒等于1000毫秒
 var bannerTotal;
 var clearAutoTimer;

 function showBanner() {
     //var titleText = $('#index_banner_left ul a').eq(bannerIndex).attr('title');
     //$('#banner_title').html(titleText);

     $('#index_banner_list li').hide().eq(bannerIndex).fadeIn(1000);
     $('#index_banner_btns a').removeClass('this').eq(bannerIndex).addClass('this');
 }

 function autoShowBanner() {
     bannerIndex += 1;
     if (bannerIndex == bannerTotal) bannerIndex = 0;
     bannerTimer = setTimeout(autoShowBanner, speedTime);

     showBanner();
     if (clearAutoTimer) {
         //alert('dsafds');
         clearTimeout(clearAutoTimer);
         clearAutoTimer = false;
         //if (clearAutoTimer == false) $('#debuger').html('141114');
     }
 }

 $(function() {
     bannerTotal = $('#index_banner_list li').length;
     autoShowBanner();

     $('#index_banner').hover(function() {
         clearTimeout(bannerTimer);
     }, function() {
         clearAutoTimer = setTimeout(autoShowBanner, speedTime);
     });

     $('#index_banner_btns a').click(function() {
         bannerIndex = parseInt($(this).html()) - 1;
         //alert(bannerIndex);
         $(this).addClass('this').siblings().removeClass('this');
         showBanner();
     });
 });
