$(function(){
	$(".sliptab1").each(function(i,dom){
		$(".nav1 li:last").addClass("last");
		$(dom).nextAll("*").css("display","none")
		.eq(0).css("display","block");
		$(dom).children("*").click(function(){
		  var index = $(dom).children("*").index(this);
		  $(dom).children("*").removeClass("hover")
		  .eq(index).addClass("hover");
		  $(dom).nextAll("*").css("display","none")
		  .eq(index).css("display","block");
    });
  });
  //
	$(".sliptab2").each(function(i,dom){
		$(".nav1 li:last").addClass("last");
		$(dom).nextAll("*").css("display","none")
		.eq(0).css("display","block");
		$(dom).children("*").mouseover(function(){
		  var index = $(dom).children("*").index(this);
		  $(dom).children("*").removeClass("hover")
		  .eq(index).addClass("hover");
		  $(dom).nextAll("*").css("display","none")
		  .eq(index).css("display","block");
    });
  });
  //
})
//焦点图
$(function(){
	var index=0;
	var timer;
	var lis=$(".slider>li").length;
	$(".num li").mouseover(function(){
		index=$(".num li").index(this);
	  showImg(index);
		index+=1;
		if(index==lis){index=0;}
	}).eq(0).mouseover();
	 $('.focusimg').hover(function(){
			 clearInterval(timer);
		 },function(){
			 timer = setInterval(function(){
			  showImg(index)
				index++;
				if(index==lis){index=0;}
			  } , 3000);
	 }).trigger("mouseout");
	 function showImg(index){
		$(".slider li").hide().stop(true,true).eq(index).fadeIn();
		$(".num li").removeClass("focus")
		.eq(index).addClass("focus");
  }
})

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') {
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options);
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString();
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else {
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

$(function(){
var Folder = "/css/";
var defaultstyle = "";
if($.cookie('style') != null)
{
	defaultstyle=$.cookie('style');
}else
{
	var myDate = new Date();   
	var month = myDate.getMonth()+1;   
	if(month>=12 || month<=2){   
		defaultstyle = "winter.css";   
	}else if(month>=3&& month<=5){   
		defaultstyle = "spring.css";   
	}else if(month>=6&&month<=8){   
		defaultstyle = "summer.css";   
	}else if(month>=9&&month<=11){   
		defaultstyle = "autumn.css";
	}
	$.cookie('style', defaultstyle,{expires: 30,path: '/'});
}
self.pstyle.href=Folder+defaultstyle;

$('#ct').click(function(){
	  $.cookie('style', 'spring.css',{expires: 30,path: '/'});		
	  self.pstyle.href=Folder+'spring.css';
	});
$('#xt').click(function(){
	  $.cookie('style', 'summer.css',{expires: 30,path: '/'});	
	  self.pstyle.href=Folder+'summer.css';			  
	});
$('#qt').click(function(){
	  $.cookie('style', 'autumn.css',{expires: 30,path: '/'});		
	  self.pstyle.href=Folder+'autumn.css';			  
	});
$('#dt').click(function(){
	  $.cookie('style', 'winter.css',{expires: 30,path: '/'});	
	  self.pstyle.href=Folder+'winter.css';		  
	});
})
