//SET GLOBALS //try to keep out ANY globals except the xml/HTTP ones here, put rest into functions //these are for the http XML section var xmlHttp var xmlDocument var next_function //var overrideResponse = 'F'; function http_process(url) { xmlHttp = GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return } xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) //sends data to the PHP page (url) using GET method xmlHttp.send(null) } /* STATES 0 Uninitialized - open() has not been called yet. 1 Loading - send() has not been called yet. 2 Loaded - send() has been called, headers and status are available. 3 Interactive - Downloading, responseText holds the partial data. 4 Completed - Finished with all operations. */ function stateChanged() { //i had override response logic, but it doesn't work the way I tried to just return if resp=2 and override=T if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete") { // do all magic in here.... //in php file, if there's an error, I can set a text msg of MYERROR to shut it down if (xmlHttp.responseText.indexOf('MYERROR') != -1) { alert ('HTTP failure. Please hit refresh to try again.'); //alert(xmlHttp.responseText); //TURN on for debugging return } else { //alert('XML: ' + xmlHttp.responseText); //KEY FOR DEBUGGING xmlDocument = xmlHttp.responseXML; //use if requested XML eval(next_function +'()'); //execute the next function } } } function GetXmlHttpObject() { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } function set_inner_html(id,value) { if(document.getElementById(id)) { document.getElementById(id).innerHTML = value; } } function set_border_color(id,color) { // this REQUIRES that the ID element has a VALID class in the CSS, otherwise it does NOT work. // does it also need to have a border of 1+ ??? if so, set color:white. document.getElementById(id).style.borderColor = color; } function set_bg_color(id,color) { // this REQUIRES that the ID element has a VALID class in the CSS, otherwise it does NOT work. // IT also must have a border of 1+, so initially set border=1, color:white. document.getElementById(id).style.backgroundColor = color; } function fade_color(id,type) { var letter = "F"; var color = ""; var time = 0; //this gets added by every factor in between color shifts var factor = 65; //delay between color shifts. Appx 1 second fade (65ms*15colors = appx 1000ms = 1sec) if(type == "") { type = "bg";} if (type == "bg") { origRowColor = document.getElementById(id).style.backgroundColor; } var i=1; while(i <= 9) { color = "#" + i + i + "FF" + i + i; time = time + factor; if(type == "border") { setTimeout("set_border_color('"+id+"','"+color+"')",time); //white } else { setTimeout("set_bg_color('"+id+"','"+color+"')",time); //white } i+=1; } i=1; while(i<=6) { if(i == 1) {letter = "A";} if(i == 2) {letter = "B";} if(i == 3) {letter = "C";} if(i == 4) {letter = "D";} if(i == 5) {letter = "E";} if(i == 6) {letter = "F";} color = "#" + letter + letter + "FF" + letter + letter; time = time + factor; if(type == "border") { setTimeout("set_border_color('"+id+"','"+color+"')",time); //white } else { setTimeout("set_bg_color('"+id+"','"+color+"')",time); //white } i+=1; } //return row color to ORIG color if(type=="bg") { //return to the original color, if possible if(origRowColor != "") { //have to set this AHEAD of the time factor else it gets overwritten setTimeout("set_bg_color('"+id+"','"+origRowColor+"')",(time+25)); } } }