﻿function createAjax() {			//该函数将返回XMLHTTP对象实例
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	//IE的创建方式
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();	//FF等浏览器的创建方式
		}
		catch (e) {
			_xmlhttp=false;		//如果创建失败，将返回false
		}
	}
	return _xmlhttp;	//返回xmlhttp对象实例
}
//--------------------------------------------------------------------
function collect(C_GoodId,C_GoodName,C_GoodPhoto,issuit){

    var xmlhttp=createAjax();
	if (xmlhttp){
	    xmlhttp.open('get','/ajaxHtml/getSession.asp?n='+Math.random(),true);
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
						str=unescape(xmlhttp.responseText);

						getUid(str,C_GoodId,C_GoodName,C_GoodPhoto,issuit);
			}else {
			            //alert(xmlhttp.status)
			}
		}
	    xmlhttp.send(null);

	}
	

}
//--------------------------------------------------------------------
function getUid(Userid,C_GoodId,C_GoodName,C_GoodPhoto,issuit){
  if(Userid!=""&&Userid!=null){
    var xmlhttp=createAjax();
	if (xmlhttp){
		xmlhttp.onreadystatechange=function() {		
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
						alert(unescape(xmlhttp.responseText));
			}
			else {
				//alert(xmlhttp.status)
			}
		}
	xmlhttp.open("post", "/ajaxHtml/collect.asp", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send("Userid="+Userid+"&C_GoodId="+C_GoodId+"&C_GoodName="+C_GoodName+"&C_GoodPhoto="+C_GoodPhoto+"&issuit="+issuit);
	//alert("Userid="+Userid+"&C_GoodId="+C_GoodId+"&C_GoodName="+C_GoodName+"&C_GoodPhoto="+C_GoodPhoto+"&issuit="+issuit);
	}
  }else{
	  alert("请先登录")
  }

}
//----------------邮件发送确认------------------------------------------------------------------------------------------   
function postmail(Userid){
  re=/#/g
  url=location.href
  url=url.replace(re,"@@@")
  url=url+".asp"
  window.open("/ajaxHtml/mail.asp?userid="+Userid+"&url="+url,"","height=400,width=550,top=135,left=495,titlebar=no ");

}