var isMSIE=/*@cc_on!@*/false; // http://dean.edwards.name/weblog/2007/03/sniff/
var homeSlideShow={
  interval: 3000,
  imgs:[
    'assets/images/home/pic2.jpg',
    'assets/images/home/pic3.jpg',
    'assets/images/home/pic4.jpg'
  ],
  init:function(){
    window.IEpre7=(isMSIE&&(typeof document.body.style.maxHeight=='undefined'));
    var par=$('.slideShow ul'),imgs=homeSlideShow.imgs;
    if(IEpre7) {
      $('.slideShow').wrapInner('<div class="ie6fix"></div>')
        .find('.ie6fix').css({overflow:'hidden',position:'relative',
          height:$('.slideShow').height()});
    }
    var zIdx=500;
    par.find('li').css('zIndex',zIdx+10); 
    for(var i=0,k=imgs.length;i<k;i++){
      par.append('<li><img src="'+imgs[i]+'" alt="" /></li>')
        .find('li:last').css('zIndex',zIdx-((i+1)*10));
    }
    homeSlideShow.timer=setInterval(homeSlideShow.next,homeSlideShow.interval);
    $('.slideShow ul').click(homeSlideShow.pause);
    if(IEpre7) {
      $('.slideShow img').load(function(){
        var one=$(this),par=$('.slideShow .ie6fix');
        $('.slideShow .ie6fix')
          .css({width:Math.min(one.width(),par.width()),
            height:Math.min(one.height(),par.height())});        
      });
    }
  },
  next:function(){
    $('.slideShow li:first').fadeOut(function(){
      $('.slideShow li:first').appendTo('.slideShow ul');
      $('.slideShow li').each(function(i){
        $(this).css('zIndex',500-((i+1)*10)).show();
      });
    });
  },
  pause:function(){
    if(homeSlideShow.timer!=null){
      clearInterval(homeSlideShow.timer);
      homeSlideShow.timer=null;
    } else {
      homeSlideShow.timer=setInterval(homeSlideShow.next,
        homeSlideShow.interval);
    }
    return false;
  }
};
$(document).ready(homeSlideShow.init);

