// JavaScript Document

$(document).ready(function(){
	var times = null;
	$(".Navigation li.show").mouseenter(function(){
		var $self = $(this);
		times = setTimeout(function(){
//			$self.children(0).animate({backgroundPosition:'0 20px'},1).animate({top:'-25'}).end().siblings().children(0).show().animate({top:'35'});
			$self.children(0).animate({backgroundPosition:'0 0px'},50,"linear").animate({top:'-4px'},100,"linear").end().parent().children(".show .slideup").show().animate({top:'35'});
		},100);
	}).mouseleave(function(){
		if(times){
			clearTimeout(times);
			$(this).children(0).animate({top:'35'},50,"linear").animate({backgroundPosition:'0 100px'},100,"linear");
		}
	});

	//for harvest_home_POPUP
	$.facebox.settings.opacity = 0.7;  
	$('a[rel*=facebox]').facebox()

	//how it works
//how it works
	var currno=0;
	$(document).ready(function(){
		autoSlide();
		$(".thumbimg li").each(function(i){
			$(this).click(function(){
				$(document).stopTime();
				$(".thumbimg li").css({backgroundColor:"#333333"});
				$(this).css({backgroundColor:"#d47728",opacity:".8"});
				slideto(i);
				setTimeout(autoSlide,1000);
			});
		});
	});
	function autoSlide(){
		$(document).everyTime(8000, function() {
			slideto(currno+1);
		})
	}
	
	function slideto(num){
		if(num>=5){num=0;$(document).stopTime()};
		hilightbtn(num);
		var str="-"+900*num+"px"
		$("#pics").animate({marginLeft:str},"slow");	
		currno=num;
	}
	
	function hilightbtn(num){
		var $thumbimgLi=$(".thumbimg li");
		$thumbimgLi.css({backgroundColor:"#333333"});
		$thumbimgLi.eq(num).css({backgroundColor:"#d47728",opacity:".8"});	
	}


});
	
function getmaxcntheight(){
	var h=0;
	$(".latestNews_1").each(function(){
		h+=$(this).height();
	});	
	return h;
}

