/* -------------------------- */
/* GLOBAL VAR				  */
/* -------------------------- */
var nocache = 0;
var pageGlobal='none';
var idTask_global;
var idUser_global;

/* ---------------------------- */
/* XMLHTTPRequest Enable		*/
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}else{
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

function bulbReset() {
	nocache = Math.random();

	/* Post */
	var url = "/listBox.ajax.php";
	var params = "step=1&nocache = "+nocache;
	http.open("POST", url, true);
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = bulbsChange;
	http.send(params);
}
function bulbReset2() {
	nocache = Math.random();
	/* Post */
	var url = "/listBox.ajax.php";
	var params = "step=1&nocache = "+nocache;
	http.open("POST", url, true);
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = bulbsChange2;
	http.send(params);
}
function bulbsChange() {
	if(http.readyState == 4){
		var response = http.responseText;
		document.getElementById('make_container').innerHTML = response;
	}
}
function bulbsChange2() {
	if(http.readyState == 4){
		var response = http.responseText;
		document.getElementById('make_container').innerHTML = response;
		tractorReset();
	}
}

function makeChange() {
	descTask1=document.getElementById('make_ajax').value;
	nocache = Math.random();
	/*http.open('get', '/listBox.ajax.php?step=2&make='+descTask1+'&nocache = '+nocache);
	http.onreadystatechange = makeHTML;
	http.send(null);*/

	/* Post */
	var url = "/listBox.ajax.php";
	var params = 'step=2&make='+descTask1+'&nocache = '+nocache;
	http.open("POST", url, true);
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = makeHTML;
	http.send(params);
}
function makeHTML() {
	if(http.readyState == 4){
		var response = http.responseText;
		document.getElementById('type_container').innerHTML = response;
	}
}

function tractorReset() {
	nocache = Math.random();
	/*http.open('get', '/listBox2.ajax.php?step=1&nocache = '+nocache);
	http.onreadystatechange = tractorHTML;
	http.send(null);*/

	var url = "/listBox2.ajax.php";
	var params = 'step=1&nocache = '+nocache;
	http.open("POST", url, true);
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = tractorHTML;
	http.send(params);
}
function tractorHTML() {
	if(http.readyState == 4){
		var response = http.responseText;
		document.getElementById('make_container2').innerHTML = response;
	}
}
function makeChange2() {
	descTask1=document.getElementById('make_ajax2').value;
	nocache = Math.random();
	/*http.open('get', '/listBox2.ajax.php?step=2&make='+descTask1+'&nocache = '+nocache);
	http.onreadystatechange = makeHTML2;
	http.send(null);*/

	var url = "/listBox2.ajax.php";
	var params = 'step=2&make='+descTask1+'&nocache = '+nocache;
	http.open("POST", url, true);
	
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = makeHTML2;
	http.send(params);
}
function makeHTML2() {
	if(http.readyState == 4){
		var response = http.responseText;
		document.getElementById('type_container2').innerHTML = response;
	}
}
