var global_cid = -1;
function getShop(cid)
{
	var strChk = '';
	if (typeof(cid) == 'number') {
		global_cid = cid;
	} else if (typeof(cid) == 'object') {
		obj = cid;
		cid = global_cid;
		var li_id = '#search_click_'+$(obj).val();
		if (obj.checked) {
			$(obj).attr('chkd','chkd');
			$(li_id).addClass('searchR_click');
		} else {
			$(obj).removeAttr('chkd');
			$(li_id).removeClass('searchR_click');
		}
	}
	if (typeof(cid) == 'number' && cid != 11) {
		$($("input[chkd='chkd']")).each(
				function() {
					strChk += this.value + ',';
				});
	}
	var url = 'index.php?r=navi_shops/getshop';
	Request = GetRequest();
	unid = Request['unid'];
    if (unid != undefined) {
		url += '&unid=' + unid;
    }
	$.get(url,
		{
			cid:cid,
			pro:strChk
		},
		function(data){
			$('#data').html(data);
		} 
	)
}

function getFavShop()
{
	setTimeout(function(){$('#data').html('<table width="100%"><tr><td class="data" align="center" valign="middle"><img alt="" src="/themes/general/images/load.gif" /></td></tr></table>');},1);
	var url = 'index.php?r=navi_shops/getfavshop';
	$.get(url,
		{
			
		},
		function(data){
			$('#data').html(data);
		} 
	)
}

/**
* 获取当前url中的参数值，类似php中的$_GET函数
* @return 
*/
function GetRequest() 
{
  var url = location.search; //获取url中"?"符后的字串
  var theRequest = new Object();
  if (url.indexOf("?") != -1) {
     var str = url.substr(1);
     strs = str.split("&");
     for(var i = 0; i < strs.length; i ++) {
        theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
     }
  }
  return theRequest;
}

function changeSearch(starget)
{
	$('#starget').val(starget);
	if (starget == 'taobao') {
		$('#shop_logo').attr('src','/themes/general/images/shop_logo/xitao_t_.gif');
	} else if (starget == 'dangdang') {
		$('#shop_logo').attr('src','/themes/general/images/shop_logo/xitao_d_.gif');
	} else if (starget == 'jingdong') {
		$('#shop_logo').attr('src','/themes/general/images/shop_logo/xitao_j_.gif');
	} else if (starget == 'zhuoyue') {
		$('#shop_logo').attr('src','/themes/general/images/shop_logo/xitao_z_.gif');
	}
}

function goSearch()
{
	$('form').submit();
	//$.post('index.php?r=navi_shops/search');
}

