$(function(){
	function menuBarScroll(){
		var sH=$(document).scrollTop(),
		_bar=$(".menuBar");
		if(sH>42){
			_bar.addClass("scrollBar");
			//IE6下的定位
			if (!window.XMLHttpRequest) {
				_bar.css("top", sH-42);
			}
		}else{
			_bar.removeClass("scrollBar");
			_bar.css("top", -5);
		}
	}
	$(window).bind("scroll", menuBarScroll);
});

/*图片轮播*/
(function($){
	$.fn.Xslider = function(options){var settings ={
			speed: 1200, //动画速度
			space: 3000, //时间间隔
			auto: true, //自动滚动
			trigger: 'mouseover', //触发事件 注意用mouseover代替hover
			conbox: '.conbox', //内容容器id或class
			ctag: 'a', //内容标签 默认为<a>
			switcher: '.switcher', //切换触发器id或class
			stag: 'a', //切换器标签 默认为a
			current:'cur' //当前切换器样式名称
		};
		settings = $.extend({}, settings, options);
		var index = 1;
		var last_index = 0;
		var $conbox = $(this).find(settings.conbox),$contents = $conbox.find(settings.ctag);
		var $switcher = $(this).find(settings.switcher),$stag = $switcher.find(settings.stag);
		$.each($contents,function(k, v){
			(k === 0) ? $(this).css({'position':'absolute','z-index':9}):$(this).css({'position':'absolute','z-index':1,'opacity':0});
		});
		function slide(){
			if (index >= $contents.length){index = 0;}
			$stag.removeClass(settings.current).eq(index).addClass(settings.current);
			$contents.eq(last_index).stop().animate({'opacity': 0}, settings.speed/2).css('z-index',1)
				.end().eq(index).css('z-index',9).stop().animate({'opacity': 1}, settings.speed/2);
			last_index = index;
			index++;
		};
		if(settings.auto) var Timer = setInterval(slide, settings.space);
		$stag.bind(settings.trigger,function(){
			_pause();
			index = $(this).index();
			slide();
		});
		$conbox.hover(_pause,_continue);
		function _pause(){
			clearInterval(Timer);
		}
		function _continue(){
			if(settings.auto)Timer = setInterval(slide, settings.space);
		}	
	}
})(jQuery);

$(document).ready(function(){
	$("#bannerslider").Xslider({ctag: 'div',stag:'li'});
	$(".main_list ul li").hover(function(){
		$(this).addClass("proCurr");
	},function(){
		$(this).removeClass("proCurr");
	});
});