//初始化
$(document).ready(function(){
	//播放速度
	var speed = 3000;
	//控制范围，符合jQuery路径即可
	var block = '#flower_list li';
	//需要显示的内容条目数
	var eq = 5;
	if($(block).length > eq){//如果内容数目大于需要滚动的数目，开始滚动！
		//隐藏除了第一个的其它所有节点
		//$(block).gt(eq-1).css('display','none');
		$(block).slice(eq-1).css('display','none');
		//播放开始
		setInterval('scrollContent("'+block+'",'+eq+',3)',speed);
	}
	
	
	//菜单控制
	//允许最大宽度
	max_width = 500;
	//获取控制菜单
	obj = $('#nav ul li');
	//菜单总长度
	len = obj.parent().parent().width();
	li_num = obj.length;
	//alert('len:'+len+';li number:'+li_num);
	var tmp_width = 0;
	obj.each(function(i){
		li_width = $(this).width();
		tmp_width = tmp_width + li_width;
		if(tmp_width > max_width){
			$('#nav span.right').html('<span id="moreMenu">>></span>');
			$('#nav').parent().append('<div id="moreMenuContent"><span id="menuClose"></span><ul></ul></div>');
			$('#moreMenuContent').css({display:'none'});
			$('#moreMenuContent ul').html(obj.gt(i-1));
			return false;
		}
	})
	$('#moreMenu').bind('mouseover',function(){
		MenuOver();
		$(this).attr('class','moreMenu_hover');
	})
	$('#menuClose').bind('click',function(){
		MenuOut();
		$('#moreMenu').removeAttr('class').unbind('mouseover').animate({opacity:'show'},500,
			function(){
				$(this).bind('mouseover',function(){
					MenuOver();
					$(this).attr('class','moreMenu_hover');
				})
		});
	})
})
function MenuOut(){
	$('#moreMenuContent').animate({height:'hide',opacity:'hide'},500);
}
function MenuOver(){
	if($('#moreMenuContent').css('display') == 'none'){
		tmp_top = $('#moreMenu').offset().top + $('#moreMenu').height()+3;
		tmp_left = $('#moreMenu').offset().left - 75;
		$('#moreMenuContent').css({top:tmp_top,left:tmp_left}).animate({height:'show'},500);
	}

}
//初始化结束
