$(document).ready(function(){
	resizeWidth();
	$(window).resize(function(){
		resizeWidth();
	});
	//解决小屏幕看不全问题
	$('.menu > li,.btn,.title').hover(
		function(){$(this).animate({'margin-left':'10px'},500)},
		function(){$(this).animate({'margin-left':'0px'},500)});
	//菜单动画效果
	$(".back_to_top").hide();
	$(window).scroll(function(){
		if ($(window).scrollTop()>300){
			$(".back_to_top").fadeIn(1500);
		}
		else{
		$(".back_to_top").fadeOut(1500);
		}
	});
	$(".back_to_top").click(function(){
		$('body,html').animate({'scrollTop':'0'},1000,'easeInOutCubic');
		return false;
	});
	//回到顶部动画效果
	$.waypoints.settings.scrollThrottle = 10;
	$("#sidebar ul li:last-child").waypoint(function(event,direction){
		if(direction === "down"){
			$(this).parent().parent().parent().addClass('sticky').find('#mainmenu').hide().fadeIn(1000);
		}	else
		{
			$(this).parent().parent().parent().removeClass('sticky').find('#mainmenu').fadeOut(1000).fadeIn(1000).show();
		}
	},{
		offset:100
	});
	//菜单sticky效果
	$('h2.title a').click(function(){
		$(this).text("请稍候，正在努力为你加载页面。。。").hide().fadeIn(1000);
		setTimeout(function(){
			window.location = $(this).attr('href');
		},1000)
	})
	//跳转提示
});
function resizeWidth(){
	var height = $(window).height();
		width = $(window).width();
		if(width<=1024){
			$("#main").css({"width":"650px"});
			$("#container").css({"margin-left":"20px","background-position-x":"-7px"});
		}else{
			$("#main").css({"width":"800px"});
			$("#container").css({"margin-left":"60px","background-position-x":"33px"});
		}
}
