function addToCart(_sPrdCode)
{
	var _obj = $N(_sPrdCode);
	var quantity = null;
	var mu = 0;
	var i = 0;
	if ( _obj.length > 0 )
	{
		while(_obj[i])
		{
			if ( _obj[i].checked )
			{
				_obj = $(_obj[i]);
				quantity = $('quantity_'+_sPrdCode+i);
				mu = $('multi_code_'+_sPrdCode+i);
				break;
			}
			i = -(~i);
		}
	}
	if ( mu && mu.value && mu.value.length > 0 ) mu = mu.value; else 
	{
		mu = 0;
		_obj = $(_sPrdCode+'0');
		quantity = $('quantity_'+_sPrdCode+'0');
	}
	if ( !quantity ) quantity  = $('quantity_'+_sPrdCode);
	if ( !quantity ) quantity = 1;else quantity = parseInt(quantity.value);
	quantity = isNaN(quantity) ? 1 : quantity;
	if ( _obj.elementExists() )
	{
		_obj = _obj.value.split("|");

		addActCode($N('act_code_'+mu));
		addActCode($N('act_code_0'));
		Load.show();
		Req.addPostParas('prd_code',_sPrdCode);
		Req.addPostParas('multi_code',mu);
		Req.addPostParas('capability',_obj[0]);
		Req.addPostParas('unit',_obj[1]);
		Req.addPostParas('amount',quantity);
		Req.makeRequest(Url.order('addPrdToCart'),function(_ajax)
		{
			Load.hide();
			var _data = null;
			try
			{
				eval('_data = '+_ajax.responseText);
				succSubmit(_data,_sPrdCode,mu);
			}
			catch (e){$msg('',_ajax.responseText);}
		});
	}
}
function addToFavorite(_sPrdCode)
{
	Load.show();
	Req.addPostParas('prd_code',_sPrdCode);
	Req.makeRequest(Url.order('addPrdToCollection'),function(_ajax)
	{
		Load.hide();
		switch(_ajax.responseText)
		{
			case 'unlogin':
				Url.set(Url.head+'member/collection/?addprd='+_sPrdCode);
				break;
			case '1':
				$prompt('成功添加到收藏夾中',null,function()
				{
					Url.set(Url.head+'member/collection/');
				});
				break;
			default:
				$msg('有問題',_ajax.responseText);
		}
	});
}
function succSubmit(_data,_sPrdCode,mu,noCS)
{
	$prompt(_data[2],null,function()
	{
		Sys.delayExecute(function()
		{
			EF.bulk('showcolor_'+_sPrdCode,floatCartEffect,function()
			{
				$('skep').set(_data[1]);
				$('sprice').set(_data[0]);
				if ( !noCS ) cartShade(_sPrdCode,mu);
			},2,50,true);
		},240);
	});
}
function cartShade(_sPrdCode,_sMultiCode,_clear)
{
	var _obj = null;
	_sMultiCode = _sMultiCode || '' ;
	_sMultiCode = _sMultiCode == '0' ? '' : _sMultiCode;
	_obj = $('showcolor_'+_sPrdCode);
	if ( _obj.elementExists() )
	{
		var mCtl = _obj.getAttribute('setMultiColorCtl') || '';
		mCtl = mCtl.split("|");
		if ( _clear )
		{
			if ( _sMultiCode.length )
			{
				mCtl = mCtl.without(_sMultiCode);
			}
			else mCtl.clear();
		}
		else
		{
			if ( _sMultiCode.length && !mCtl.exists(_sMultiCode) )
			{
				if ( !mCtl[0].length ) mCtl.clear();
				mCtl.push(_sMultiCode);
			}
		}
		with(_obj.style)
		{
			border = mCtl.length ? '1px solid #FF7D7D' : '0px';
			backgroundColor = mCtl.length ? '#FFECEC' : '#FFFFFF';
		}
		_obj.setAttribute('setMultiColorCtl',mCtl.join("|"));
		mCtl = null;
	}
	_obj = $('showtext_'+_sPrdCode+'_'+_sMultiCode)
	if ( _obj.elementExists() )
	{
		if ( _clear ) _obj.hide();
		else
		{
			_obj.innerHTML = '<font color="#FF0000">'+$('quantity_'+_sPrdCode).get()+'件該商品放入購物車</font>「<a href="javascript:;" onclick="delPrd(\''+_sPrdCode+'\',\''+_sMultiCode+'\');">刪除</a>」';
			_obj.disp();
		}
	}
	_obj = null;
}
function addActCode(act)
{
	if ( act && act.length > 0 )
	{
		var i = 0;
		var j = 0;
		while(act[i])
		{
			if ( act[i].checked )
			{
				if ( !j ) Req.addPostParas('is_act','1');
				Req.addPostParas('act_code['+j+']',act[i].value);
				j = -(~j);
			}
			i = -(~i);
		}
		i = null;j = null;
	}
}
function addNotify(code)
{
	Panel.prompt(Url.order('addNotify')+'&code='+code,$empty,'貨到通知',1);
}
function addToCartByAct(code)
{
	var _form = $('my_post_'+code);
	Req.addPostParas('prd_code',code);
	Req.addPostParas('multi_code',_form.multi_code.value);
	Req.addPostParas('capability',_form.capability.value);
	Req.addPostParas('unit',_form.unit.value);
	Req.addPostParas('amount',_form.amount.value);
	Req.addPostParas('is_act',_form.is_act.value);
	var ac = _form.elements['act_code[]'];
	var j = i = 0;
	if ( ac && ac.length )
	{
		while(i<ac.length)
		{
			if ( ac[i].checked )
			{
				Req.addPostParas('act_code['+j+']',ac[i].value);
				j = -(~j);
			}
			i = -(~i);
		}
	}
	else if ( ac && ac.checked )
	{
		Req.addPostParas('act_code[0]',ac.value);
	}
	Req.makeRequest(Url.order('addPrdToCart'),function(_ajax)
	{
		Load.hide();
		var _data = null;
		try
		{
			eval('_data = '+_ajax.responseText);
			succSubmit(_data,code,_form.multi_code.value,true);
		}
		catch (e){alert(_ajax.responseText);}
	});
}