// JavaScript Document
function getid(id) {return document.getElementById(id);}
var http_request=false;
function send_request(url,who){//初始化，指定处理函数，发送请求的函数
  http_request=false;
 //开始初始化XMLHttpRequest对象
 if(window.XMLHttpRequest){//Mozilla浏览器
   http_request=new XMLHttpRequest();
     if(http_request.overrideMimeType){//设置MIME类别
       http_request.overrideMimeType("text/xml");
      }
  }else if(window.ActiveXObject){//IE浏览器
    try{   
      http_request=new ActiveXObject("Msxml2.XMLHTTP");   
    }catch(e){
      try{
        http_request=new ActiveXObject("Microsoft.XMLHttp");
      }catch(e){}
    }
}
if(!http_request){//异常，创建对象实例失败
  window.alert("创建XMLHttp对象失败！");
  return false;
 }
  http_request.onreadystatechange=who;
 //确定发送请求方式，URL，及是否同步执行下段代码
  http_request.open("GET",url,true);
  http_request.send(null);
 }
function chackres(){
	if(http_request.readyState==4){//判断对象状态
		 if(http_request.status==200){//信息已成功返回，开始处理信息
		  var qian=http_request.responseText;
		  document.getElementById('theprice').innerHTML=qian;
		  if(!document.all){
		  document.getElementById('theprice').style.marginLeft="-7px";
		  }
		}
	}
}

function chprice(tid,yj){
	//alert(yj);
	var prps=document.getElementsByName("props[]");
	//if(prps){
	if(prps.length==1){
		pvalue=prps[0].value;
	}else if(prps.length==2){
		pvalue=prps[0].value+','+prps[1].value;
	}else if(prps.length==3){
		pvalue=prps[0].value+','+prps[1].value+','+prps[2].value;	
	}
	//alert(pvalue);
	//}
	//for(i=0;i<prps.length;i++){
		//pvalue+=prps[i].value+',';
	//pvalue=prps[0].value+','+prps[1].value+','+prps[2].value;
	//}
	//alert(pvalue);
		var strlen=yj.length;
		var jg=yj.substr(0,strlen-2);
		//alert(jg)
		document.getElementById(tid).style.border='solid 1px #ccc';
		send_request('changeprice.php?prp='+pvalue+'&yj='+jg,chackres);
}

//会员退出
function logstat(){
	if(http_request.readyState==4){//判断对象状态
		 if(http_request.status==200){//信息已成功返回，开始处理信息
		  var res=http_request.responseText;
		  if(res=='1'){
			  location.reload();
			  }
		 }
	}
	}
function loginout(){
	 send_request('logout.php',logstat);
	}

