﻿//杩欎釜鏄璐墿杞﹁繘琛屾搷浣滅殑鍦板潃
var HishopShoppingCartAjaxUrlBase="";
//杩欎釜鏄敤浜庤幏鍙栬喘鐗╄溅鐩稿叧淇℃伅鐨?
var HishopShoppingCartAjaxUrlBase2="";

//璐墿杞﹂儴鍒嗗拰璧犲搧閮ㄥ垎鐨凞IV鏍囩鐨勶缉锛?
var HishopShoppingCartGiftSelectDivId="ShoppingCartGiftSelectDiv";
//鏈?涓樉绀鸿禒鍝佺殑閮ㄥ垎锛屼竴涓槸璐墿杞︽樉绀猴紝涓€涓槸鍦ㄦ坊鍔?淇敼绛夎繑鍥炰俊鎭儴鍒嗘樉绀?
//濡傛灉鏈変竴椤靛悓鏃舵湁姝?涓儴鍒嗭紝灏变粎鍦?HishopShoppingCartGiftSelectDivId 閮ㄥ垎鏄剧ず
var HishopShoppingCartGiftSelectDivId2="ShoppingCartReturnGiftSelectDiv";
var HishopShoppingCartDivId="ShoppingCartItemListDiv";


//鎵€鏈夌殑瑕佹洿鏂扮殑鏁伴噺鐨勬爣绛剧殑闆嗗悎
var HishopShoppingCartAllNumList;
//鍒涘缓涓幏鍙栧晢鍝佹暟閲忕殑鏂规硶
function ShoppingCartCountNumCreate(_controlId,_shoppingCartItem, _showAll)
{
	this.ControlId=_controlId;
	this.ShoppingCartItem=_shoppingCartItem;
	this.ShowAll=_showAll;
	this.GetCountNum=function()
	{
		var _con=document.getElementById(this.ControlId);
		if (_con != null)
		{
			var theUrl = HishopShoppingCartAjaxUrlBase2 + "?Type=CountNum&ShoppingCartItem=" + this.ShoppingCartItem + "&ShowAll=" + this.ShowAll;
			GetValue2(theUrl, this.CounNumBack,_con);
		}
	}
	this.CounNumBack=function(_backText,_con)
	{
		if (_con.nodeName=="INPUT")
			_con.value=_backText;
		else
			_con.innerHTML=_backText;
	}
}
//娣诲姞鏁伴噺鏍囩鍒伴泦鍚堜腑
function HishopShoppingCartAllNumAdd(_numElement)
{
	if (HishopShoppingCartAllNumList ==null)
		HishopShoppingCartAllNumList=new Array();
		
		//鐪嬫湁娌℃湁閲嶅鐨?
	//妫€娴嬫湁娌℃湁閲嶅鐨勩€傘€傛牴鎹瓹ontrolId鍒ゆ柇
    var n=-1;
    for(var i=0;i<HishopShoppingCartAllNumList.length;i++)
    {        
    	if (HishopShoppingCartAllNumList[i].ControlId==_numElement.ControlId)
        {
        	n=i;
            break;
		}        
   	}
    if (n!=-1)
    {
        //鏈夐噸澶嶇殑灏卞垹闄?    
        HishopShoppingCartAllNumList[n]=null;
        HishopShoppingCartAllNumList.splice(n,1);
    }
	
	HishopShoppingCartAllNumList.push(_numElement);
	
}
//鏇存柊闆嗗悎涓殑鎵€鏈夋暟閲?
function HishopShoppingCartAllNumGet(){
	if (HishopShoppingCartAllNumList!=null) {
	
		for (var i = 0; i < HishopShoppingCartAllNumList.length; i++) {
			HishopShoppingCartAllNumList[i].GetCountNum();
		}
	}
}


//鎵€鏈夎鏇存柊鐨勪环鏍肩殑闆嗗悎
var HishopShoppingCartAllCountMoneyList;
//娣诲姞鑾峰彇閲戦绫诲埌闆嗗悎涓?
function HishopShoppingCartAllCountMoneyAdd(_countMoneyElement)
{
	if (HishopShoppingCartAllCountMoneyList ==null)
		HishopShoppingCartAllCountMoneyList=new Array();
	
	//鐪嬫湁娌℃湁閲嶅鐨?
	//妫€娴嬫湁娌℃湁閲嶅鐨勩€傘€傛牴鎹瓹ontrolId鍒ゆ柇
    var n=-1;
    for(var i=0;i<HishopShoppingCartAllCountMoneyList.length;i++)
    {        
    	if (HishopShoppingCartAllCountMoneyList[i].ControlId==_countMoneyElement.ControlId)
        {
        	n=i;
            break;
        }        
   	}
    if (n!=-1)
    {
        //鏈夐噸澶嶇殑灏卞垹闄?    
        HishopShoppingCartAllCountMoneyList[n]=null;
        HishopShoppingCartAllCountMoneyList.splice(n,1);
    }
	HishopShoppingCartAllCountMoneyList.push(_countMoneyElement);
	
	
}
//鍒涘缓鑾峰彇閲戦鐨勭被
function ShoppingCartCountMoneyCreate(_controlId,_shoppingCartItem, _showAll)
{
	this.ControlId=_controlId;
	this.ShoppingCartItem=_shoppingCartItem;
	this.ShowAll=_showAll;
	this.GetCountMoney=function()
	{
		var _con=document.getElementById(this.ControlId);
		if (_con != null)
		{
			var theUrl = HishopShoppingCartAjaxUrlBase2 + "?Type=CountMoney&ShoppingCartItem=" + this.ShoppingCartItem + "&ShowAll=" + this.ShowAll;
			GetValue2(theUrl, this.TextBack, _con);
		}		
	}
	this.TextBack=function(_text,_control)
	{
		_control.innerHTML=_text;		
	}
}
//鏇存柊闆嗗悎涓殑鎵€鏈夐噾棰?
function HishopShoppingCartAllCountMoneyGet()
{	
	if (HishopShoppingCartAllCountMoneyList != null) {
		for (var i = 0; i < HishopShoppingCartAllCountMoneyList.length; i++) {
			HishopShoppingCartAllCountMoneyList[i].GetCountMoney();
		}
	}
}


//鎵€鏈夎鏇存柊鐨勬秷鑰楃Н鍒嗙殑闆嗗悎
var HishopShoppingCartAllCountPointList;
//娣诲姞鑾峰彇娑堣€楃Н鍒嗙殑瀵硅薄鍒伴泦鍚堜腑
function HishopShoppingCartAllCountPointAdd(_countPointElement)
{
	if (!HishopShoppingCartAllCountPointList)
		HishopShoppingCartAllCountPointList=new Array();
	
	//鐪嬫湁娌℃湁閲嶅鐨?
	//妫€娴嬫湁娌℃湁閲嶅鐨勩€傘€傛牴鎹瓹ontrolId鍒ゆ柇
    var n=-1;
    for(var i=0;i<HishopShoppingCartAllCountPointList.length;i++)
    {        
    	if (HishopShoppingCartAllCountPointList[i].ControlId==_countPointElement.ControlId)
        {
        	n=i;
            break;
        }        
   	}
    if (n!=-1)
    {
        //鏈夐噸澶嶇殑灏卞垹闄?    
        HishopShoppingCartAllCountPointList[n]=null;
        HishopShoppingCartAllCountPointList.splice(n,1);
    }
	HishopShoppingCartAllCountPointList.push(_countPointElement);
	
	
}
//鍒涘缓鑾峰彇娑堣€楃Н鍒嗙殑瀵硅薄
function ShoppingCartCountPointCreate(_controlId,_shoppingCartItem, _showAll)
{
	this.ControlId=_controlId;
	this.ShoppingCartItem=_shoppingCartItem;
	this.ShowAll=_showAll;
	this.GetCountPoint=function()
	{
		var _con=document.getElementById(this.ControlId);
		if (_con != null)
		{
			var theUrl = HishopShoppingCartAjaxUrlBase2 + "?Type=CountPoint&ShoppingCartItem=" + this.ShoppingCartItem + "&ShowAll=" + this.ShowAll;
			GetValue2(theUrl, this.TextBack, _con);
		}		
	}
	this.TextBack=function(_text,_control)
	{
		_control.innerHTML=_text;		
	}
}
//鏇存柊闆嗗悎涓殑鎵€鏈夋秷鑰楃Н鍒?
function HishopShoppingCartAllCountPointGet()
{
	if (HishopShoppingCartAllCountPointList != null) {
		for (var i = 0; i < HishopShoppingCartAllCountPointList.length; i++) {
			HishopShoppingCartAllCountPointList[i].GetCountPoint();
		}
	}
}


var HishopShoppingCartAllCountCcbPointList;
//娣诲姞鑾峰彇娑堣€楃Н鍒嗙殑瀵硅薄鍒伴泦鍚堜腑
function HishopShoppingCartAllCountCcbPointAdd(_countCcbPointElement) {
    if (!HishopShoppingCartAllCountCcbPointList)
        HishopShoppingCartAllCountCcbPointList = new Array();

    //鐪嬫湁娌℃湁閲嶅鐨?
    //妫€娴嬫湁娌℃湁閲嶅鐨勩€傘€傛牴鎹瓹ontrolId鍒ゆ柇
    var n = -1;
    for (var i = 0; i < HishopShoppingCartAllCountCcbPointList.length; i++) {
        if (HishopShoppingCartAllCountCcbPointList[i].ControlId == _countCcbPointElement.ControlId) {
            n = i;
            break;
        }
    }
    if (n != -1) {
        //鏈夐噸澶嶇殑灏卞垹闄?
        HishopShoppingCartAllCountCcbPointList[n] = null;
        HishopShoppingCartAllCountCcbPointList.splice(n, 1);
    }
    HishopShoppingCartAllCountCcbPointList.push(_countCcbPointElement);


}
//鍒涘缓鑾峰彇娑堣€楃Н鍒嗙殑瀵硅薄
function ShoppingCartCountCcbPointCreate(_controlId, _shoppingCartItem, _showAll) {
    this.ControlId = _controlId;
    this.ShoppingCartItem = _shoppingCartItem;
    this.ShowAll = _showAll;
    this.GetCountCcbPoint = function() {
        var _con = document.getElementById(this.ControlId);
        if (_con != null) {
            var theUrl = HishopShoppingCartAjaxUrlBase2 + "?Type=CountCcbPoint&ShoppingCartItem=" + this.ShoppingCartItem + "&ShowAll=" + this.ShowAll;
            GetValue2(theUrl, this.TextBack, _con);
        }
    }
    this.TextBack = function(_text, _control) {
        _control.innerHTML = _text;
    }
}
//鏇存柊闆嗗悎涓殑鎵€鏈夋秷鑰楃Н鍒?
function HishopShoppingCartAllCountCcbPointGet() {
    if (HishopShoppingCartAllCountCcbPointList != null) {
        for (var i = 0; i < HishopShoppingCartAllCountCcbPointList.length; i++) {
            HishopShoppingCartAllCountCcbPointList[i].GetCountCcbPoint();
        }
    }
}


//_goodsId 瑕佹坊鍔犵殑鍟嗗搧锛╋激
//閫夋嫨鐨勮嚜閫夋嫨鎵╁睍灞炴€у瓧绗︿覆
//_parentId 鍙互涓虹┖
function ShoppingCartAdd(_goodsId,_num,_numControlId,_userSelectExtAttributeQueryString,_parentId)
{
	//if (_hishopMousePos!=null)
		//alert(_hishopMousePos.x+"|"+_hishopMousePos.y);

	 //鍒ゆ柇num鏄笉鏄釜鏁板瓧锛屽鏋滀笉鏄氨鎻愮ず
	var reg=/^\d*(\.?\d+)$/;
	if (!reg.test(_num)) {
		
		alert("璇疯緭鍏ユ纭殑鏁伴噺")
		var _numControl= document.getElementById(_numControlId);
		_numControl.focus();
		_numControl.select();
		return;
	}

	var theUrl=HishopShoppingCartAjaxUrlBase+"?Type=Add&Num="+_num+"&GoodsId="+_goodsId;
	if (_userSelectExtAttributeQueryString !=null && _userSelectExtAttributeQueryString != undefined && _userSelectExtAttributeQueryString!='' )
		theUrl+= "&"+_userSelectExtAttributeQueryString;	
	
	//濡傛灉娌℃湁瑕佹樉绀烘洿鏂拌繃鐨勮喘鐗╄溅鍐呭鐨勶缉锛わ紝閭ｄ箞灏卞姞涓夾ddSuccecdNotBack鍙傛暟锛岄€氱煡鍚庡彴绋嬪簭鍦ㄦ坊鍔犳垚鍔熷悗涓嶇敤杩斿洖鏇存柊杩囩殑璐墿杞﹀唴瀹?
	if (_parentId==null || _parentId==undefined || _parentId=='' )
		theUrl+="&SuccecdNotBack=1";
		
	
	//鍜屾洿鏂颁娇鐢ㄥ悓涓€涓繑鍥炴柟娉曞鐞?
    GetValue2(theUrl,ShoppingCartUpdateShow,_parentId);
}


//鏇存柊璐墿杞︼紝
//_shoppingCartItemId銆€璐墿杞︼缉锛?
//_num 鏁伴噺鎺т欢鐨処D
//_userSelectExtAttributeQueryString 閫夋嫨鐨勮嚜閫夋嫨鎵╁睍灞炴€у瓧绗︿覆
//_parentId 鍖呭惈璐墿杞︾殑span 锛╋激
function ShoppingCartUpdate(_shoppingCartItemId,_numControlId,_userSelectExtAttributeQueryString,_parentId)
{

	var _num=0;
	var _numControl=document.getElementById(_numControlId);
	var _isUpNum=true;
	if (_numControl)
		_num=_numControl.value;
	else
		_isUpNum=false;
	
		//鍒ゆ柇num鏄笉鏄釜鏁板瓧锛屽鏋滀笉鏄氨鎻愮ず
		//var reg = /^\d{1,}$/;
		var reg=/^\d*(\.?\d+)$/;
		if (!reg.test(_num)) {
		
			alert("璇疯緭鍏ユ纭殑鏁伴噺");			
			_numControl.focus();
			_numControl.select();
			return;
		}
	
	
	var theUrl;
	if (_isUpNum)
		theUrl=HishopShoppingCartAjaxUrlBase+"?Type=Update&Num="+_num+"&ShoppingCartItemId="+_shoppingCartItemId;
	else
		theUrl=HishopShoppingCartAjaxUrlBase+"?Type=Update&ShoppingCartItemId="+_shoppingCartItemId;
	
	if (_userSelectExtAttributeQueryString!="")
	    theUrl+="&"+_userSelectExtAttributeQueryString;
	    
		//document.write(theUrl);
    GetValue2(theUrl,ShoppingCartUpdateShow,_parentId,_shoppingCartItemId);
}
//杩斿洖缁撴灉
//_shoppingCartItemId 杩欎釜鍙傛暟鍙湪璐墿杞︽洿鏂扮殑鏃跺€欒繑鍥?
function ShoppingCartUpdateShow(_backText, _parentId,_shoppingCartItemId)
{
	//鏇存柊鏁伴噺锛屼环鏍煎拰绉垎绛変俊鎭?
	HishopShoppingCartAllNumGet();
	HishopShoppingCartAllCountMoneyGet();
	HishopShoppingCartAllCountPointGet();
	HishopShoppingCartAllCountCcbPointGet();
	
	
	//濡傛灉褰撳墠椤甸潰鏈夎禒鍝侀儴鍒嗗氨鏇存柊璧犲搧淇℃伅锛屽湪姝ゆ柟娉曚腑宸茬粡妫€娴嬪鍣ㄦ槸鍚﹀瓨鍦?
	ShoppingCartYouhuiReLoad();
	
	if (_backText == "True" || _backText.substr(0,6) =="ERROR:" || _backText.substr(0,8)=="SUCCEED:" ) 
	{	
		var _message;
		if (_backText.length>6 && _backText.substr(0,6) =="ERROR:"){
			_message=_backText.replace("ERROR:", "");
			//alert(_backText.replace("ERROR:", ""));
			//濡傛灉鏇存柊鐨勬椂鍊欏彂鐢熶簡閿欒锛岄偅涔堝氨鏇存柊涓嬫璁㈠崟椤圭殑鑷€夋嫨鎵╁睍灞炴€ч儴鍒?
			if (_shoppingCartItemId)
			{
				var theUrl=HishopAjaxDirUrl+"/HishopShoppingCartUserSelects.aspx?ShoppingCartItemId="+_shoppingCartItemId+"&ShoppingCartId="+_parentId;
				//document.write(theUrl);
				GetValue2(theUrl,ShoppingCartUserSelectShow,_shoppingCartItemId);
			
			}
		}
		else if (_backText.length>8 && _backText.substr(0,8) =="SUCCEED:"){
			_message=_backText.replace("SUCCEED:", "");
		}
		
		ShowReturnDiv(_message);
	}
	else if (_backText.indexOf("RELOADSHOPPINGCARTITEM") >-1 ||
	 _backText.indexOf("RELOADSHOPPINGCARTYOUHUI") >-1)
	{
		
		if (document.getElementById(HishopShoppingCartDivId) &&_backText.indexOf("RELOADSHOPPINGCARTITEM") >-1)
			//閲嶆柊璇诲叆璐墿杞?
			ShoppingCartItemListReLoad();
			
		if (document.getElementById(HishopShoppingCartGiftSelectDivId) && _backText.indexOf("RELOADSHOPPINGCARTYOUHUI") >-1)
			ShoppingCartYouhuiReLoad();
	}
	else
	{	
		if (_parentId) {
			var el = document.getElementById(_parentId);
			if (el != null) {
				setInnerHTML(el, _backText);
			}
		}
	}
}

function ShoppingCartItemListReLoad()
{
		var theUrl=HishopAjaxDirUrl+"/HishopShoppingCartItemList.aspx";
		GetValue2(theUrl,ShoppingCartItemListShow);
}
//鏇存柊璐墿杞?
function ShoppingCartItemListShow(_backText)
{
	var el = document.getElementById(HishopShoppingCartDivId );
	if (el!=null) 
	{	
		setInnerHTML(el, _backText);
	}	
}

//鏄剧ず鑷€夋嫨鎵╁睍灞炴€ч儴鍒?
function ShoppingCartUserSelectShow(_backText,_shoppingCartItemId)
{
	var el = document.getElementById("UserSelect_"+ _shoppingCartItemId);
		if (el) 
		{
			setInnerHTML(el, _backText);
		}
}

//鍒犻櫎
function ShoppingCartDelete(_shoppingCartItemId,_parentId)
{
	var theUrl=HishopShoppingCartAjaxUrlBase+"?Type=Delete&ShoppingCartItemId="+_shoppingCartItemId;
	//document.write(theUrl);
	//鍜屾洿鏂颁娇鐢ㄥ悓涓€涓繑鍥炴柟娉曞鐞?
   	GetValue2(theUrl,ShoppingCartUpdateShow,_parentId);
}
//鍒犻櫎鎵€鏈?
function ShoppingCartDeleteAll(_parentId)
{
	var theUrl=HishopShoppingCartAjaxUrlBase+"?Type=DeleteAll";
	//鍜屾洿鏂颁娇鐢ㄥ悓涓€涓繑鍥炴柟娉曞鐞?
    GetValue2(theUrl,ShoppingCartUpdateShow,_parentId);		
}

//鏍规嵁绱㈠紩鍙樻崲鍒楄〃椤逛娇鐢ㄧ殑鏍峰紡
function CheckShoppingCartItemClass(_id,_index)
{
    var _item=document.getElementById(_id);
    if (_item!=null)
    {
        if (_index % 2 == 0)
            _item.className="ShoppingAlternatingItem";
        else
            _item.className="ShoppingItem";
    }
}
function CheckShoppingCart2ItemClass(_id,_index)
{
    var _item=document.getElementById(_id);
    if (_item!=null)
    {
        if (_index % 2 == 0)
            _item.className="Shopping2AlternatingItem";
        else
            _item.className="Shopping2Item";
    }
}

var ShoppingCartReturnTimeOut;
var ShoppingCartReturnIntervalTimeOut;
var ShoppingCartReturnCloseTimes=3000;
var ShoppingCartReturnIntervalStartTime=3;
//鍦ㄦ坊鍔狅紝淇敼锛屽垹闄ゆ搷浣滃悗鏄剧ず杩斿洖鐨勪俊鎭?
function ShowReturnDiv(_message)
{

	//鎶婃坊鍔犲晢鍝佸埌璐墿杞︾殑div鍏抽棴
	CloseAddDiv();
	var _returnDiv = document.getElementById("ShoppingCartReturnDiv");
	var _returnMessage = document.getElementById("ShoppingCartReturnMessage");
	if (_returnDiv != null) {
		_returnDiv.style.display = "block";
		if (_hishopMousePos.y != null) 
			_returnDiv.style.top = _hishopMousePos.y + "px";
		
		if (_hishopMousePos.x != null) 
			_returnDiv.style.left = (_hishopMousePos.x + 15) + "px";
	}
	
	
	if (_returnMessage && _message) {
			_returnMessage.innerHTML = _message;
	}
	

	//鏄剧ず浼樻儬閮ㄥ垎锛屽湪姝ゆ柟娉曚腑宸茬粡妫€娴嬪鍣ㄦ槸鍚﹀瓨鍦?
	ShoppingCartYouhuiReLoad();
	
	if (ShoppingCartReturnTimeOut != null)//濡傛灉鐐瑰嚮澶氭锛屽氨鍙栨秷涓婃鐨凜loseReturnDiv鎵ц锛岃繖鏍峰彲浠ヤ竴鐩翠繚鎸侊紨绉掓樉绀?
	{
		window.clearTimeout(ShoppingCartReturnTimeOut);	
	}
	if (ShoppingCartReturnIntervalTimeOut!=null)
		window.clearInterval(ShoppingCartReturnIntervalTimeOut);
	
	
	ShoppingCartReturnIntervalStartTime=3;
	var _shoppingCartReturnTime=document.getElementById("ShoppingCartReturnTime");
	if (_shoppingCartReturnTime)
		_shoppingCartReturnTime.innerHTML=ShoppingCartReturnIntervalStartTime;
		
	ShoppingCartReturnIntervalTimeOut= window.setInterval(function()
	{
		ShoppingCartReturnIntervalStartTime--;
		document.getElementById("ShoppingCartReturnTime").innerHTML = ShoppingCartReturnIntervalStartTime;
	},950 )
	//3绉掑悗鑷姩鍏抽棴
	//涓嶈兘鐩存帴璋冪敤window.setTimeout("CloseReturnDiv('"+_m+"')"銆€杩欑鏂规硶銆?
	//杩欐牱浼氬鑷村湪ff绛夋祻瑙堝櫒涓嬪彧鑳芥墽琛屼竴娆＄殑鎯呭喌
	//window.setTimeout("CloseReturnDiv('"+_m+"')",4000 );
	ShoppingCartReturnTimeOut=window.setTimeout(function(){CloseReturnDiv()},ShoppingCartReturnCloseTimes);
	
}
function CloseReturnDiv(_parentControl)
{
	//鍙栨秷鍊掕鏃?
	if (ShoppingCartReturnIntervalTimeOut!=null)
		window.clearInterval(ShoppingCartReturnIntervalTimeOut);
		
	var _returnDiv=document.getElementById("ShoppingCartReturnDiv");

	if (_returnDiv != null) {
		_returnDiv.style.display="none";
	}
	
	/*
	//鍏抽棴鐨勬椂鍊欐妸鎸夐挳璁剧疆涓哄仠姝?
	if (_parentControl)
	{

		_parentControl.style.display="none";
		_parentControl.src=HishopAjaxDirUrl+"/Images/Stop.gif";
		_parentControl.onclick=function(){StopCloseReturnDiv(_parentControl);}
		_parentControl.alt="鍋滄";
		
	}
	*/
}
//鍋滄鍏抽棴杩斿洖淇℃伅绐楀彛鐨勫€掕鏃跺姩浣?
function StopCloseReturnDiv(_parentControl)
{
	//鍙栨秷鍊掕鏃?
	if (ShoppingCartReturnIntervalTimeOut!=null)
		window.clearInterval(ShoppingCartReturnIntervalTimeOut);
		
	if (ShoppingCartReturnTimeOut != null)//濡傛灉鐐瑰嚮澶氭锛屽氨鍙栨秷涓婃鐨凜loseReturnDiv鎵ц锛岃繖鏍峰彲浠ヤ竴鐩翠繚鎸侊紨绉掓樉绀?
		window.clearTimeout(ShoppingCartReturnTimeOut);	
	
	/*
	_parentControl.style.display="none";
	_parentControl.src= HishopAjaxDirUrl+"/Images/Close.gif";
	_parentControl.alt="鍏抽棴";
	_parentControl.onclick=function(){CloseReturnDiv(_parentControl);}
	*/

}

//鏄剧ず娣诲姞璇︾粏鍐呭
function ShowAddDiv(_goodsId)
{
	//鎶婂彲鑳芥湁鐨勮繑鍥炴秷鎭鍏抽棴銆?
	CloseReturnDiv();
	var theUrl=HishopAjaxDirUrl+"/HishopShoppingCartAdd.aspx?GoodsId="+_goodsId;
	
    GetValue2(theUrl,ShoppingCartAddDivShow);
}

function ShoppingCartAddDivShow(_text)
{
	var _addDiv=document.getElementById("ShoppingCartAddDiv");
	if (_addDiv != null) {
		_addDiv.style.display="block";
		
		if (_hishopMousePos.y != null) 
			_addDiv.style.top = _hishopMousePos.y -30 + "px";		
		if (_hishopMousePos.x != null) 
			_addDiv.style.left = (_hishopMousePos.x - 130) + "px";
			
		setInnerHTML(_addDiv,_text);
	}
	
}

function CloseAddDiv()
{
	var _addDiv=document.getElementById("ShoppingCartAddDiv");
	if (_addDiv != null) {
		_addDiv.style.display="none";
	}	
}

//娣诲姞璧犲搧鍒拌喘鐗╄溅
//_shoppingCartYouhuiItemId 璐墿杞︿紭鎯犻」ID
//_giftSelectQueryString 閫夋嫨鐨勮禒鍝?
function ShoppingCartGiftSelectAdd(_shoppingCartYouhuiItemId,_giftSelectQueryString)
{
	var theUrl=HishopAjaxDirUrl+"/HishopShoppingCartGift.aspx?Type=Add&"+ _giftSelectQueryString;
	//document.write(theUrl);
	GetValue2(theUrl,ShoppingCartUpdateShow,null,null);
}

//閲嶆柊鑾峰彇璧犲搧閮ㄥ垎锛岀幇鍦ㄨ喘鐗╄溅鐨勬墍鏈夋洿鏂伴兘瀵艰嚧璧犲搧閮ㄥ垎鐨勯噸鏂拌幏鍙?
function ShoppingCartYouhuiReLoad()
{	

	var el = document.getElementById(HishopShoppingCartGiftSelectDivId);
	if(!el)
		el=document.getElementById(HishopShoppingCartGiftSelectDivId2);
	
	if (el) {
		var theUrl = HishopAjaxDirUrl + "/HishopShoppingCartGiftSelect.aspx";
		GetValue2(theUrl, ShoppingCartYouhuiShow, el);
	}
}
//鏇存柊璧犲搧閮ㄥ垎
function ShoppingCartYouhuiShow(_backText,el)
{
	if (el)
		setInnerHTML(el, _backText);

}
