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 xmlHttp1 = false;
try {
  xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp1 = false;
  }
}
if (!xmlHttp1 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp1 = new XMLHttpRequest();
}



function ajaxSub(t,url) 
{
	if (url.indexOf("?")==-1)
		url = url + '?t000='+Math.random()
	else
		url = url + '&t000='+Math.random()

	xmlHttp.open("GET", url, true);
	switch (t) {
		case 0 :
			xmlHttp.onreadystatechange = getDeliverArea2
			break;
		case 1 :
			xmlHttp.onreadystatechange = getDeliverList;
			break;
//		case 2 :
//			xmlHttp.onreadystatechange = setarea2;
//			break;
		default :
			break;
	} 
	xmlHttp.send(null);  
}
/*******************/

			function getDeliverArea2() {
			  if (xmlHttp.readyState < 4) {
				document.getElementById('deliver_area_2').innerHTML="loading...";
			  }
			  if (xmlHttp.readyState == 4) {
				var response = xmlHttp.responseText;
				document.getElementById('deliver_area_2').innerHTML=response;
			  }
			}


			function ajaxSub1(t,url)
			{
				xmlHttp1.open("GET", url+'&t000='+Math.random(), true);
				xmlHttp1.onreadystatechange = getDeliverList;
				xmlHttp1.send(null);
			}
			function getDeliverList() {
			 if (xmlHttp1.readyState < 4) {
				document.getElementById('div_deliver_show').innerHTML="<span>loading...</span>";
			  }
			  if (xmlHttp1.readyState == 4) {
				var response = xmlHttp1.responseText;
				if (response == "")
				{
					//var pweight = document.getElementsByName('p_weight')[0].value/1000;
					document.getElementById('div_deliver_show').innerHTML="未选择";
					document.getElementsByName('sendtype')[0].value = '-';
					document.getElementsByName('deliver_price')[0].value = 0;
				}else
				{
					document.getElementById('div_deliver_show').innerHTML= response;
				
					
				}
			  }
			}

		function getDeliverPrice(i)
			{
			
				
				//var d_name = document.getElementsByName('deliver_name')[i].value;
				//var s_type = document.getElementsByName('s_type').value;
				//var d_name = document.getElementsByName('deliver_name')[i].value;
				var d_name = document.getElementsByName('deliver_name')[i].value;
				//var s_type = document.getElementsByName('s_type').value;
			document.getElementsByName('sendtype')[0].value = d_name;
				//document.getElementsByName('deliver_price')[0].value = deliverPrice;
			}
	function simOptionClick4IE(){ 
var evt=window.event ; 
var selectObj=evt?evt.srcElement:null; 
// IE Only 
if (evt && selectObj && evt.offsetY && evt.button!=2 
&& (evt.offsetY > selectObj.offsetHeight || evt.offsetY<0 ) ) { 

// 记录原先的选中项 
var oldIdx = selectObj.selectedIndex; 

setTimeout(function(){ 
var option=selectObj.options[selectObj.selectedIndex]; 
// 此时可以通过判断 oldIdx 是否等于 selectObj.selectedIndex 
// 来判断用户是不是点击了同一个选项,进而做不同的处理. 
showOptionValue(option) 

}, 60); 
} 
} 
function showOptionValue(opt,msg){ 
//alert('aa'); 
var now=new Date(); 
var dt= (1900+now.getYear())+'-'+(now.getMonth()+1)+'-'+now.getDate()+ 
' '+now.getHours()+':'+now.getHours()+':'+now.getSeconds()+'.'+now.getMilliseconds(); 
var resultZone=document.getElementById('reslut'); 
resultZone.style.margin="10px"; 
document.getElementsByName('sendtype')[0].value = opt.value;
document.getElementsByName('stype')[0].value = opt.text;
//resultZone.innerHTML=dt +" 时,点击了: " + (opt.text + ' = '+opt.value); 
} 
function Check_user_id() {
  var user_id = document.getElementById("com_username").value;
  if ((user_id == null) || (user_id == "")) return;
  var url = "Swant_Ajax.asp?action=user_name&user_id=" + escape(user_id);
//  location.href= url;
//  return false;
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_user_id_page;
  xmlHttp.send(null);  
}

function Check_user_id_page() {
  if (xmlHttp.readyState < 4) {
	C_Username.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_Username.innerHTML=response;
  }
}

function Check_user_ps1() {
  var ps1 = document.getElementById("ps1").value;
  if ((ps1 == null) || (ps1 == "")) return;
  var url = "Ajax_reg.asp?do=ps1&ps1=" + escape(ps1);
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_user_ps1_page;
  xmlHttp.send(null);  
}

function Check_user_ps1_page() {
  if (xmlHttp.readyState < 4) {
	C_user_ps1.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_user_ps1.innerHTML=response;
  }
}

function Check_user_pass() {
  var ps1 = document.getElementById("ps1").value;
  var ps2 = document.getElementById("ps2").value;
  if ((ps2 == null) || (ps2 == "")) return;
  var url = "Ajax_reg.asp?do=pass&ps1=" + escape(ps1) +"&ps2=" + escape(ps2);
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_user_pass_page;
  xmlHttp.send(null);  
}

function Check_user_pass_page() {
  if (xmlHttp.readyState < 4) {
	C_Username.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_Username.innerHTML=response;
  }
}



function Check_com_user_name() {
  var user_name = document.getElementById("com_name").value;
  if ((user_name == null) || (user_name == "")) return;
  var url = "Swant_Ajax.asp?action=comname&user_id=" + escape(user_name);
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_user_name_page;
  xmlHttp.send(null);  
}

function Check_user_name_page() {
  if (xmlHttp.readyState < 4) {
	C_user_id.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_user_id.innerHTML=response;
  }
}



function Check_user_tel() {
  var user_tel = document.getElementById("user_tel").value;
  if ((user_tel == null) || (user_tel == "")) return;
  var url = "Ajax_reg.asp?do=user_tel&user_tel=" + escape(user_tel);
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_user_tel_page;
  xmlHttp.send(null);  
}

function Check_user_tel_page() {
  if (xmlHttp.readyState < 4) {
	C_user_tel.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_user_tel.innerHTML=response;
  }
}



function Check_verifycode() {
  var verifycode = document.getElementById("verifycode").value;
  if ((verifycode == null) || (verifycode == "")) return;
  var url = "Ajax_reg.asp?do=ck_verifycode&ck_verifycode=" + escape(verifycode);
  xmlHttp.open("GET", url+"&t="+Math.random(), true);
  xmlHttp.onreadystatechange = Check_verifycode_page;
  xmlHttp.send(null);  
}

function Check_verifycode_page() {
  if (xmlHttp.readyState < 4) {
	C_user_vcode.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	C_user_vcode.innerHTML=response;
  }
}