var xmlHttp;
var thisSn;
var thisObj;
var kdHold;
function chPart(sn,obj,kd){
  //alert(obj[obj.selectedIndex].value);
  id=obj[obj.selectedIndex].value;
  if(!kd){
    kd=0;
  }
  if(!id){
    return;
  }
  if(!newXml()){
		return;
	}
  xmlHttp.open("GET","/bin/game/partChAj.php?pt="+id+"&sn="+sn+"&kd="+kd,true);
  xmlHttp.onreadystatechange=showDone;
  thisSn=sn;
  kdHold=kd;
	xmlHttp.send(null);
	return;
}


function showDone(){
  //alert(thisSn);
  if(xmlHttp.readyState!=4)
    return;
  if(kdHold){
    objStr="pa";
  }else{
    objStr="par";
  }
  try{
    document.getElementById(objStr+thisSn).innerHTML=xmlHttp.responseText;
  }catch(e){
  }
}
function addAjax(act,oid){

  if(!act||!oid){
    return;
  }
  if(!newXml()){
		return;
	}
  xmlHttp.open("GET",act,true);
  xmlHttp.onreadystatechange=echoAjax;
  thisObj=oid;
	xmlHttp.send(null);
	return;
}
function echoAjax(){
  if(xmlHttp.readyState!=4)
    return;
  try{
    document.getElementById(thisObj).innerHTML=xmlHttp.responseText;
  }catch(e){
  } 
}
function newXml(){
  try{
    xmlHttp=new XMLHttpRequest();
  }catch(e){
    try{
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(ee){
      try{
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(eee){
        xmlHttp=null;
				alert("SCRIPT ERROR");
				return false;
      }
    }
  }
	return true;

}
