
function changeBG(hexBG)
{
	document.getElementById("bgVal").value = hexBG;
	document.bgColor = "#"+hexBG;
	myUrl = "http://www.joemccarthy.net/JoesWeb/PHP/ChangeBGColor.php?bgColor=" + hexBG;
	doAction(myUrl);
}

function changeBGb()
{
	bgVal = document.bgValForm.bgVal.value;
	document.bgColor = "#"+bgVal;
	myUrl = "http://www.joemccarthy.net/JoesWeb/PHP/ChangeBGColor.php?bgColor=" + bgVal;
	doAction(myUrl);
	return false;
}

function doAction(hexBG) 
{
    try {
	    if(window.XMLHttpRequest) {
	        // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera, Internet Explorer 7
		    xmlhttp = new XMLHttpRequest(); 
	    } else if(window.ActiveXObject) {  
	        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 4,5,5.5,6
	    } 
    } catch(e) {
        return false;
    }	
	// Open a connection. Replace GET with HEAD in order to do a HEAD request.
	xmlhttp.open("GET", myUrl, true); 

	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState == 4) { // Wait until everything is fetched!
		    // Prints all the response headers to the screen to see if it was successful
			//alert(xmlhttp.getAllResponseHeaders()); 
			// xmlhttp.responseText contains the contents of the response.
			//alert(xmlhttp.responseText); 
		}
	}
	xmlhttp.send(null); // send() is used to initiate the transfer. No actual data have to be sent in this case.
}


