// JavaScript Document
var xmlHttp = false; 
try { 
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); 
} catch (e) { 
try { 
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
} catch (e2) { 
xmlHttp = false; 
} 
} 
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { 
xmlHttp = new XMLHttpRequest(); 
} 
var sp_id,user_id;
function callserver() { 
sp_id = document.getElementById("sp_id").value;
user_id = document.getElementById("user_id").value;
if (sp_id == null || sp_id == "") return;
if (user_id == null || user_id == ""){
	alert("此功能只对会员开放");
	return;
}
var url = "collection.php?sp_id=" + escape(sp_id) + "&user_id=" + escape(user_id) ;
xmlHttp.open("GET", url, true); 
xmlHttp.onreadystatechange = updatePage; 
xmlHttp.send(null); 
} 
function updatePage() {  
if (xmlHttp.readyState == 4) {
var response=xmlHttp.responseText;
   if (response=="1"){
  alert("商品已成功加入您的收藏夹");
   return false;
  }else{
  alert("加入收藏失败");
   return false;
  }
}
}