function getRequestBody(oForm){
var aParams=new Array();
for(var i=0;i<oForm.elements.length;i++){
//for(var i=1;i<oForm.elements.length-1;i++){
var sParam=encodeURIComponent(oForm.elements[i].name);
sParam+="=";
sParam+=encodeURIComponent(oForm.elements[i].value);
aParams.push(sParam);
}
return aParams.join("&");
}

function sendRequest(mb,hf,hf2){
var oForm=document.getElementById("form1");
var sBody=getRequestBody(oForm);

try{var oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){try{var oXmlHttp =new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){var oXmlHttp = new XMLHttpRequest();}}

oXmlHttp.open("post",mb);
oXmlHttp.setRequestHeader("REFERER", location.href);
oXmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

oXmlHttp.onreadystatechange=function(){
//alert(oXmlHttp.responseText);
if(oXmlHttp.readyState==4 && oXmlHttp.status == 200){
var stt=oXmlHttp.responseText;	
//alert(stt);
var a=stt.indexOf("<head><title>");
stt=stt.substring(0,a);

var all=stt;
var b=stt.indexOf("==");
stt=stt.substring(0,b);

var a1=all.split("==")[1];
//alert(a1);
var arr=a1.split("|");

var a2=all.split("==")[2];
//alert("a2="+a2);
if(stt.indexOf("成功")!=-1){

if(a2=="20"){for(var c=0;c<arr.length;c++){document.getElementById('p1'+arr[c]).src='img/reg1.gif';}}
if(a2=="21"){for(var c=0;c<arr.length;c++){document.getElementById('p1'+arr[c]).src='img/reg2.gif';}}
if(a2=="30"){for(var c=0;c<arr.length;c++){document.getElementById('p2'+arr[c]).src='img/reg1.gif';}}
if(a2=="31"){for(var c=0;c<arr.length;c++){document.getElementById('p2'+arr[c]).src='img/reg2.gif';}}
if(a2=="40"){for(var c=0;c<arr.length;c++){document.getElementById('p3'+arr[c]).src='img/reg1.gif';}}
if(a2=="41"){for(var c=0;c<arr.length;c++){document.getElementById('p3'+arr[c]).src='img/reg2.gif';}}
if(a2=="50"){for(var c=0;c<arr.length;c++){document.getElementById('p4'+arr[c]).src='img/reg1.gif';}}
if(a2=="51"){for(var c=0;c<arr.length;c++){document.getElementById('p4'+arr[c]).src='img/reg2.gif';}}
if(a2=="8"){for(var c=0;c<arr.length;c++){document.getElementById('sj'+arr[c]).innerHTML='<font color=green>上架</font>';}}
if(a2=="9"){for(var c=0;c<arr.length;c++){document.getElementById('sj'+arr[c]).innerHTML='<font color=red>暂不上架</font>';}}
if(a2=="82"){for(var c=0;c<arr.length;c++){document.getElementById('sh'+arr[c]).src='img/reg1.gif';}}
if(a2=="92"){for(var c=0;c<arr.length;c++){document.getElementById('sh'+arr[c]).src='img/reg2.gif';}}
if(a2=="1"||a2=="11"){for(var c=0;c<arr.length;c++){document.getElementById('div'+arr[c]).style.display='none';}}
if(a2=="2"){for(var c=0;c<arr.length;c++){document.getElementById('sh'+arr[c]).src='img/reg1.gif';}}
if(a2=="3"){for(var c=0;c<arr.length;c++){document.getElementById('sh'+arr[c]).src='img/reg2.gif';}}
if(a2=="6"){for(var c=0;c<arr.length;c++){document.getElementById('qx'+arr[c]).innerHTML='<font color=red>禁止登陆用户</font>';
document.getElementById('k1qx'+arr[c]).style.display='';document.getElementById('k2qx'+arr[c]).style.display='none';}}
if(a2=="7"){for(var c=0;c<arr.length-1;c++){document.getElementById('qx'+arr[c]).innerHTML='<font color=green>普通用户</font>';
document.getElementById('k1qx'+arr[c]).style.display='none';document.getElementById('k2qx'+arr[c]).style.display='';}}


alert(stt);
if(hf){location=hf;}
if(hf2){parent.document.list.location=hf2;}
}
else if(stt!=""){alert(stt);}
else{alert("操作失败，请重试");}
}

}
oXmlHttp.send(sBody);

}
