/*-----------------------------------------------------------------
 Change Curreng Image 
-----------------------------------------------------------------*/
function doNewGalleryImage(imgID) 
{  // This function does the AJAX request
	http.open("GET", "http://" + location.hostname + "/climatechange/wp-content/themes/climateChange/ajax/newGallery.php?id="+ imgID, true);
	http.onreadystatechange = getGalleryImage;
	http.send(null);
}

function getGalleryImage() 
{
	if (http.readyState < 4 ) 
	{
		document.getElementById("POTWDisplay").innerHTML = doLoading;
	}
	if (http.readyState == 4) 
	{ 
		res = http.responseText;  // These following lines get the response and update the page
		document.getElementById("POTWDisplay").innerHTML = res;
	}
}
/*-----------------------------------------------------------------
 SETUP AJAX/JS
-----------------------------------------------------------------*/
function getXHTTP() 
{
	var xhttp;
	try 
	{   // The following "try" blocks get the XMLHTTP object for various browsers...
		xhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			xhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e2) 
		{
		// This block handles Mozilla/Firefox browsers...
			try 
			{
			xhttp = new XMLHttpRequest();
			} 
			catch (e3) 
			{
				xhttp = false;
			}
		}
	}
	return xhttp; // Return the XMLHTTP object
}
var http = getXHTTP(); // This executes when the page first loads.
var doLoading = '<img src="images/ajax-loader.gif" alt="Loading..." class="loadingImg"/>';