var catews;
var catenu;
var catewtf;
var xmlhttp;

function cate(id,box) {
	catews = document.getElementById('ws_' + id);
	catenu = document.getElementById('nu_' + id);
	catewtf = document.getElementById('wtf_' + id);
	loadXMLDocCate('/cate.php?id='+id+'&box='+box);
}

function loadXMLDocCate(url) {
	xmlhttp=null;
	// code for Mozilla, etc.
	if (window.XMLHttpRequest) {
		xmlhttp=new XMLHttpRequest();
	}
	// code for IE
	else if (window.ActiveXObject) {
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp!=null) {
		xmlhttp.onreadystatechange=state_ChangeCate;
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}
	else {
		alert("Your browser does not support XMLHTTP.");
	}
}

function state_ChangeCate() {
	// if xmlhttp shows "loaded"
	if (xmlhttp.readyState==4) {
		// if "OK"
		if (xmlhttp.status==200) {
			catews.style.backgroundColor = '';
			catenu.style.backgroundColor = '';
			catewtf.style.backgroundColor = '';
			if(xmlhttp.responseText == '1') catews.style.backgroundColor = '#009900';
			if(xmlhttp.responseText == '2') catenu.style.backgroundColor = '#009900';
			if(xmlhttp.responseText == '3') catewtf.style.backgroundColor = '#009900';
			catews = '';
			catenu = '';
			catewtf = '';
		}
		else {
			alert("Problem retrieving data:" + xmlhttp.statusText);
		}
	}
}
