$(function(){
	
	var $li = $("li[_label='nav']");
	var $a = $li.children('a');
	var $div = $a.next('div');

	var $li_all = $("div.u_1>ul>li");

	$(window).click(function(){
		$div.css('display','none');
	});
	

	$a.each(function(index){
		;(function($this,n){
			
			var $list = $div.eq(n);
			var data = list[n];
			var $ul = $li = $a = null;
			
			
			$this.click(function(){
				
				
				if(!list[n])return false;
				
				$li_all.removeClass("current");
				$li_all.eq(n + 1).addClass("current");

				if($ul){
					if($list.css('display') == 'block'){
						$list.css('display','none');
					}else{
						$div.css('display','none');
						$list.css('display','block');
					}
					return false;
				}
				
				$div.css('display','none');
				$list.css('display','block');
				$ul = $("<ul wxl='aaaaa' ></ul>");
			
				$domainUrl = 'http://www.lzlj.com.cn/';
				for(var i=0,len=data.length;i<len;i++){
					$li = $("<li>"+data[i].name+"</li>");
					if (data[i].name == "酒城览胜") {
						$a = $("<a href='"+'http://wap.lzlj.com.cn/jcls/'+"' target='_blank' >"+data[i].name+"</a>");
					}  else if (data[i].name == "饮酒养生") {
						$a = $("<a href='"+'http://ys.lzlj.com.cn'+"' target='_blank' >"+data[i].name+"</a>");
					}else {
						$a = $("<a href="+$domainUrl+data[i].href+">"+data[i].name+"</a>");
					}
					/*
					;(function($a){
						$a.click(function(){
							window.location.href = $(this).children('a').attr('href');
						//	return false;
						});


					})($li);
					*/
					$li.html($a);

					
					$ul.append($li);
				}
				
				$list.html($ul);

				var _w = 0;

				$ul.children('li').each(function(){
					_w+=$(this).width();
				});
				//设宽度
				$ul.css({
					'width' : _w
				})
				
				return false;
			});
			
		})($(this),index);
		
	});


	var $all_list = $("div.all_list:eq(0)");
	var $ul = $all_list.find("ul:eq(0)");
	var $pi_img = $all_list.find("div.pi_img:eq(0)>img");
		
		$ul.find('img').click(function(){
			$pi_img.attr('src',$(this).attr('src'));
			return false;
		});
	var $map_city = $("div.map_city:eq(0)");	
	var $map_info = $("div.map_info:eq(0)");
	
	var $city = $("[_lable='city']");
		$city.click(function(){
			var city = $(this).text();
			var tp = '';
			var areaname = '';
			
			for(var i=0,len=$location.length;i<len;i++){
				//alert($location[i]['subcom']+' - '+$location[i]['linkman']+' - '+$location[i]['areaname'])
				 if($location[i]['subcom'] == city){
				 	tp = $location[i]['telephone'];
					areaname = $location[i]['linkman'];
					address = $location[i]['areaname'];
				 }	
			}
			
			if(tp){
				$map_info.css({
					'display' : 'block'
				});
				
				$map_city.css({
					'display' : 'none'
				});
				
				var $p = $map_info.children('p');
					$p.eq(0).text('省份：'+city);
					$p.eq(1).text('地址：'+address);
					$p.eq(2).text('片区经理：：'+areaname);
					$p.eq(3).text('联系电话：'+tp);
					
			}
			//2011 11 13 sun
			$('a#back').click(function(){
				var map_city = $("div.map_city:eq(0)");	
				var map_info = $("div.map_info:eq(0)");
				map_city.css({display:'block'});
				map_info.css({display:'none'});
				return false;
			});
			
			return false;
		});
		
})

var list = [];
	list.push([
		{
			name : '国窖1573',href : 'index.php?m=content&c=index&a=show&catid=41&id=59'
		},{
			name: '泸州老窖',href : 'index.php?m=content&c=index&a=show&catid=39&id=76'
		},{
			name: '其它品牌',href : 'index.php?m=content&c=index&a=show&catid=40&id=38'
		}]);
		
	list.push([
		{
			name : '酒城览胜',href : 'index.php?m=content&c=index&a=lists&catid=101'
		},{
			name: '文化理念',href : 'index.php?m=content&c=index&a=lists&catid=45'
		},{
			name: '悠悠酒史',href : 'index.php?m=content&c=index&a=lists&catid=19'
		}]);
		
	
	
	list.push([
		{
			name : '销售网络',href : 'index.php?m=content&c=index&a=lists&catid=26'
		},{
			name: '专卖店网络',href : 'index.php?m=content&c=index&a=lists&catid=25'
		},{
			name: '投资者之窗',href : 'index.php?m=content&c=index&a=lists&catid=27'
		}
		/*,{
			name: '图',href : 'index.php?m=content&c=index&a=lists&catid=35'
		},{
			name: '文',href : 'index.php?m=content&c=index&a=lists&catid=70'
		},{
			name: '影',href : 'index.php?m=content&c=index&a=lists&catid=63'
		},{
			name: '音',href : 'index.php?m=content&c=index&a=lists&catid=38'
		}*/]);
		
	
	list.push([
		{
			name : '有机高粱',href : 'index.php?m=content&c=index&a=lists&catid=29'
		},{
			name: '品创公司',href : 'index.php?m=content&c=index&a=lists&catid=98'
		},{
			name: '饮酒养生',href : 'index.php?m=content&c=index&a=lists&catid=100'
		}]);
		
	
	list.push([
		{
			name : '访客留言',href : 'index.php?m=content&c=index&a=lists&catid=31'
		},{
			name: '博文酒道',href : 'index.php?m=content&c=index&a=lists&catid=71'
		},{
			name: '友情链接',href : 'index.php?m=content&c=index&a=lists&catid=99'
		}]);
		
	list.push([
		{
			name : '企业介绍',href : 'index.php?m=content&c=index&a=lists&catid=13'
		},{
			name: '核心团队',href : 'index.php?m=content&c=index&a=lists&catid=14'
		},{
			name: '企业荣誉',href : 'index.php?m=content&c=index&a=lists&catid=15'
		},{
			name: '联系我们',href : 'index.php?m=content&c=index&a=lists&catid=16'
		}]);







$(function(){
		var bigImg = $("[_label='bigimg']");
		var $img = $("[_label='img']");
		
		var $j_left = $(".j_left");
		var $j_right = $(".j_right");

		var ii = 0;
		
			$img.each(function(i){
				;(function($this,index){
						$this.click(function(){
							
							bigImg.attr('src','statics/pics/r_'+(++index)+'_big.jpg');
							ii = index;
							return false;
						});
				})($(this),i);
			});
	
		$j_left.click(function(){
			var i = --ii;
			if(i < 1){
				ii = i = $img.size();
			}
			bigImg.attr('src','statics/pics/r_'+(i)+'_big.jpg');
			return false;
		});

		$j_right.click(function(){
			var i = ++ii;
			if(i > $img.size()){
				ii = i = 1;
			}
			bigImg.attr('src','statics/pics/r_'+(i)+'_big.jpg');
			return false;
		});
		

});
