simute = {
  tSelectMenu: function()
  {
    var tobj = $('#topMenu');
    var tLocation = location.href;
    var tLocationString = tLocation.substring(0, tLocation.lastIndexOf('/'));
    tLocationString = tLocationString.substr(tLocationString.indexOf('//') + 2);
    if (tLocationString.indexOf('/') == -1) tobj.find('li:first').find('a').addClass('selected');
    else
    {
      tLocationString = tLocationString.substr(tLocationString.indexOf('/') + 1);
      tobj.find('li').find('[href*=\'' + tLocationString + '\']').addClass('selected');
    };
  }
};

simute.home = {
  tPara: [],
  tInitLeft1: function()
  {
    var tobj = $('.homeLeft1');
    tobj.find('.tit').click(function(){
      if ($(this).attr('current') != 'true')
      {
        tobj.find('li').removeAttr('current');
        tobj.find('li').removeClass('tit-selected');
        tobj.find('.intro').slideUp('fast');
        $(this).addClass('tit-selected');
        $(this).next().slideDown('fast');
        $(this).attr('current', 'true');
      };
    });
    tobj.find('.tit:first').click();
  },
  tInitLeft2: function(_pageitem, _boxheight)
  {
    var tthis = this;
    var tpageitem = _pageitem;
    var tboxheight = _boxheight;
    var tobj = $('.homeLeft2');
    var titemobj = $('.homeLeft2').find('.itemBoxContent').find('.item');
    var titemlength = titemobj.length;
    var tpagenum = Math.ceil(titemlength / tpageitem);
    if (tpagenum > 1)
    {
      tthis.tPara['init-left2-current-page'] = 0;
      tthis.tPara['init-left2-pagenum'] = tpagenum;
      tthis.tPara['init-left2-boxheight'] = tboxheight;
      tobj.find('.itemPage').find('ul').append('<li class="left"></li>');
      for (var ti = 0; ti < tpagenum; ti ++)
      {
        if (ti != 0) tobj.find('.itemPage').find('ul').append('<li i="' + ti + '" class="item"></li>');
        else tobj.find('.itemPage').find('ul').append('<li i="' + ti + '" class="item selected"></li>');
      };
      tobj.find('.itemPage').find('ul').append('<li class="right"></li>');
      tobj.find('.itemPage').find('ul').find('.item').click(function(){
        var tli = $(this);
        tthis.tInitLeft2SelectPage(tli.attr('i'));
      });
      tobj.find('.itemPage').find('ul').find('.left').click(function(){
        var tCurrentPage = tthis.tPara['init-left2-current-page'];
        tCurrentPage = tCurrentPage - 1;
        if (tCurrentPage < 0) tCurrentPage = tthis.tPara['init-left2-pagenum'] - 1;
        tthis.tInitLeft2SelectPage(tCurrentPage);
      });
      tobj.find('.itemPage').find('ul').find('.right').click(function(){
        var tCurrentPage = tthis.tPara['init-left2-current-page'];
        tCurrentPage = tCurrentPage + 1;
        if (tCurrentPage >= tthis.tPara['init-left2-pagenum']) tCurrentPage = 0;
        tthis.tInitLeft2SelectPage(tCurrentPage);
      });
    };
  },
  tInitLeft2SelectPage: function(_i)
  {
    var ti = _i;
    var tthis = this;
    var tobj = $('.homeLeft2');
    var tpagenum = tthis.tPara['init-left2-pagenum'];
    var tboxheight = tthis.tPara['init-left2-boxheight'];
    tobj.find('.itemBoxContent').animate({'top': (0 - tboxheight * ti)}, 'normal');
    tobj.find('.itemPage').find('li').removeClass('selected');
    tobj.find('.itemPage').find('[i=\'' + ti + '\']').addClass('selected');
    tthis.tPara['init-left2-current-page'] = ti;
  }
};

simute.banner = {
  tLoadBannerI: 0,
  tLoadBannerLength: 0,
  tLoadBannerAutoTimeout: null,
  tLoadBannerInit: function()
  {
    var tthis = this;
    var tObj1 = $('#bannerContentBox');
    var tBgData = tObj1.attr('bgdata');
    if (tBgData)
    {
      var tBgDataArray = tBgData.split('$|||$');
      var tBgDataArrayLength = tBgDataArray.length;
      tthis.tLoadBannerLength = tBgDataArrayLength;
      for (var ti = 0; ti < tBgDataArrayLength; ti ++)
      {
        var tBgDataString = tBgDataArray[ti];
        var tBgDataStringArray = tBgDataString.split('$$$');
        if (tBgDataStringArray.length == 4)
        {
          var tImageURL = tBgDataStringArray[1];
          var tLinkURL = tBgDataStringArray[2];
          var tTarGet = tBgDataStringArray[3];
          if (ti == 0)
          {
            $('#bannerB2').css({'background-image': 'url(' + tImageURL + ')'});
            if (tLinkURL && tTarGet) $('#bannerB2').html('<a href="' + cls.thtmlEncode(tLinkURL) + '" target="' + cls.thtmlEncode(tTarGet) + '">&nbsp;</a>');
            $('#bannerSelect').append($('<span i="' + ti + '" id="banner-select-' + ti + '" class="selected" rsurl="' + tBgDataString + '"></span>').click(function(){ tthis.tLoadBannerSelect($(this).attr('i')); }));
          }
          else $('#bannerSelect').append($('<span i="' + ti + '" id="banner-select-' + ti + '" rsurl="' + tBgDataString + '"></span>').click(function(){ tthis.tLoadBannerSelect($(this).attr('i')); }));
        };
      };
      if (tBgDataArrayLength <= 1) $('#bannerSelect').hide();
    };
    tthis.tLoadBannerSelectAuto();
  },
  tLoadBannerSelect: function(_ti)
  {
    var tthis = this;
    var ti = _ti;
    tthis.tLoadBannerI = ti;
    tthis.tLoadBannerSelectAuto();
    var tObj1 = $('#banner-select-' + ti);
    var tBgDataString = tObj1.attr('rsurl');
    var tBgDataStringArray = tBgDataString.split('$$$');
    if (tBgDataStringArray.length == 4)
    {
      var tImageURL = tBgDataStringArray[1];
      var tLinkURL = tBgDataStringArray[2];
      var tTarGet = tBgDataStringArray[3];
      tObj1.parent().find('span').removeClass('selected');
      tObj1.addClass('selected');
      $('#bannerB1').css({'opacity': '0', 'background-image': 'url(' + tImageURL + ')'});
      $('#bannerB1').animate({'opacity': '1'}, 'slow');
      $('#bannerB2').animate({'opacity': '0'}, 'slow', function(){
        $('#bannerB2').html('');
        $('#bannerB2').css({'background-image': 'url(' + tImageURL + ')', 'opacity': '1'});
        if (tLinkURL && tTarGet) $('#bannerB2').html('<a href="' + cls.thtmlEncode(tLinkURL) + '" target="' + cls.thtmlEncode(tTarGet) + '">&nbsp;</a>');
      });
    };
  },
  tLoadBannerSelectAuto: function()
  {
    var tthis = this;
    clearTimeout(tthis.tLoadBannerAutoTimeout);
    tthis.tLoadBannerAutoTimeout = setTimeout(function(){ tthis.tLoadBannerSelectAutos(); }, 10000);
  },
  tLoadBannerSelectAutos: function()
  {
    var tthis = this;
    var tBannerI = tthis.tLoadBannerI;
    var tBannerLength = tthis.tLoadBannerLength;
    tBannerI = tBannerI + 1;
    if (tBannerI >= tBannerLength) tBannerI = 0;
    if (tthis.tLoadBannerLength >=2) tthis.tLoadBannerSelect(tBannerI);
  }
};