var $ = jQuery.noConflict();
$(function() {
	$('#activator').click(function(){
		jQuery('html, body').animate({scrollTop:0},500);
		$('#box').animate({'top':'65px'},500);
	});
	$('#boxclose').click(function(){
		$('#box').animate({'top':'-400px'},500);
	});
	$('#activator_share').click(function(){
		jQuery('html, body').animate({scrollTop:0},500);
		$('#box_share').animate({'top':'65px'},500);
	});
	$('#boxclose_share').click(function(){
		$('#box_share').animate({'top':'-400px'},500);
	});

	$(".toggle_container").hide(); 
	$(".trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false;
	});
	
	$(".Sort > li > a").click(function(){
		if($(this).parent("li").attr("class")=="sort1")
		{
			$(this).next(".subsort").slideDown(500)
			$(this).parent("li").removeClass("sort1").addClass("sort2")
		}
		else
		{
			$(this).next(".subsort").slideUp(500)
			$(this).parent("li").removeClass("sort2").addClass("sort1")
		}
	})
	//处理文章里面图片的宽度
	$(".Info_Cont img").removeAttr("height").css("display","block").css("width","100%")
});
window.addEventListener("load",function() {
	setTimeout(function(){window.scrollTo(0, 1);}, 0);
});


$(document).ready(function(){
	mainMenuStatus = 'closed';
	mainMenuAnimation = 'complete';
	
	$('.nav_hand').click(function(){
		mainMenuHeight =  $('.nav').outerHeight();
		if(mainMenuStatus == 'closed' && mainMenuAnimation == 'complete'){
			mainMenuAnimation = 'incomplete';
			$('.nav').css({'margin-top': -mainMenuHeight, 'display':'block'});
			$('.nav').stop(true, true).animate({"margin-top": 0}, 600, function(){
				mainMenuStatus = 'open';
				mainMenuAnimation = 'complete';
			});
		}else if(mainMenuStatus == 'open' && mainMenuAnimation == 'complete'){
			mainMenuAnimation = 'incomplete';
			$('.nav').stop(true, true).animate({"margin-top": -mainMenuHeight}, 600, function(){
				mainMenuStatus = 'closed';
				mainMenuAnimation = 'complete';
				$('body, html').stop(true, true).animate({scrollTop:0}, 1000,'easeOutCubic');
			});
		};
		return false;
	});	
});

function s1click(obj){
	if($(obj).next().children("li").length > 0) 
	{
		return false
	}
	else
	{
		return true
	}
}
