
window.onerror=function(){return true;}

function AddToShoppingCart(productID)
{
	var url = null;
	var pid = null;
	if(productID==null || productID<1) {
		url = "http://pay.iciba.com";
	} else {
		url = "http://pay.iciba.com/?pid="+productID+"&referenceUrl="+escape(window.location.href);
		/*
		//设置cookie
		pid = getCookie('pids');
		if(pid == false) {
			setCookie('pids', productID);
		} else {
			setCookie('pids', pid + '#' + productID);
		}
		//隐藏span,最好无需要
		*/
	}
	var popup = window.open(url, "shoppingCart");
	popup.focus()
}


function setCookie(name, value)
{
	var Days = 1;
	var exp = new Date();
	exp.setTime(exp.getTime() + Days*24*60*60*1000);//Days*24*60*60*1000;
	document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}

function getCookie(name)
{
	var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	if(arr != null)  {
		return unescape(arr[2]);
	} else {
		return false;
	}
}
