// JavaScript Document

var xmlhttp;
function changeinputbox(box){
 	tit=document.getElementById(box); 
	tit.innerHTML="<input type='text' id='definesubject' name='definesubject' value=''><input type='button' name='save' value='保存' onclick='defines()'>";
 }
function ajaxcreate(){
     if (window.ActiveXObject) {
        xmlhttpg = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
}
function defines(){
	subject=document.getElementById("definesubject").value;
	subject=decodeURI(subject);
	chat=document.getElementById("chatid").value;
	ajaxcreate();
	url="definesubject.aspx?chat="+chat+"&subject="+subject+"&rnd="+Math.random();
	//alert(url);
	xmlhttp.onreadystatechange=ondefinesubject;
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null); 
}	
function onstateofclass(){
	if(xmlhttp.readyState==4){
   		if(xmlhttp.status==200){
			if(xmlhttp.responseText!="error"){
				window.location.reload();
				}	
		}
	}
}
function ondefinesubject(){
	if(xmlhttp.readyState==4 && xmlhttp.status==200){
		window.location.reload();
	}
}