$(document).ready(function(){
    $('#sidebar').click(function(event){
		$(this).find('.i-list').show();
		$(this).find('h3').addClass('hover');
		event.stopPropagation();
	});
	$(document).click(function(){
		$(".i-list").each(function(){
				$(this)	.hide();		   
		});
		//$(this).find('.i-list').hide();
		$(this).find('h3').removeClass('hover');
	});
	
	 $('#sidebar').click(function(event){
	$(this).find('.i-list2').show();
	$(this).find('h3').addClass('hover');
	event.stopPropagation();
	});
	 
	 
	$(document).click(function(){
	$(this).find('.i-list2').hide();
	$(this).find('h3').removeClass('hover');
	});
	
});

function head_brand(info)
{
	$("#pinyin").html('<img src="images/ajax/loading.gif"/>正在搜索中，请等待...');
	var str = '';
	str = "<ul>";
	$.ajax
	(
		{
			url: '/?ctl=index&act=ajax&go=headbrand&' + Math.random(),
			type:'post',
			dataType: 'json',
			complete :function(){},
			data: {info:info},
			error: function(bency) { alert('服务器没有返回数据，可能服务器忙，请重试！');},
			success: function(response)
			{
				if(response == 0)
				{
					alert('服务器没有返回数据，可能服务器忙，请重试！');
				}
				else
				{
					var num = $(response).length;
					for(i = 0; i < num; i++)
					{
						str += '<li><a href="/magazine/show/uid/'+response[i]['uid']+'/jid/'+response[i]['jourid']+'" target="_blank">'+response[i]['title']+'</a></li>';
					}
				};
				str += '</ul>';
				$('div#pinyin').html(str);
			}
		}
	);
}
