function changeImages(num) {
	renderContent(num);
}
// Render content
function renderContent(num) {
	if (!IsReadyToSend()) return;
	
	sendData = "actionNumber=" + num;
	
	document.getElementById("content_text").innerHTML = "<p class='textRegular'>Loading..</p>";
	sendRequest(getScriptUrl(), sendData, "he_content");
}

var xmlHttp;

function getScriptUrl()
{
	var url = "action.php";
	url = url + "?sid=" + Math.random();
	return url;
}

function getGalleryUrl()
{
	var url = "gallery.php";
	url = url + "?sid=" + Math.random();
	return url;
}

function sendGetRequest(url, sendData, layer)
{
	xmlHttp.open("GET", url, false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp.setRequestHeader("Content-length", sendData.length);
	xmlHttp.send(sendData);	
	if (xmlHttp.readyState == 4)
	{
		document.getElementById(layer).innerHTML = xmlHttp.responseText;
	}
}
function sendRequest(url, sendData, layer)
{
	xmlHttp.open("POST", url, false);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp.setRequestHeader("Content-length", sendData.length);
	xmlHttp.send(sendData);	
	if (xmlHttp.readyState == 4)
	{
		document.getElementById(layer).innerHTML = xmlHttp.responseText;
	}
}
function IsReadyToSend()
{
	var bRet = true;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("showHint: Your browser does not support AJAX!");
		bRet = false;
	}
	return bRet;
}
function GetXmlHttpObject()
{
	var xmlHttp = null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}	
	return xmlHttp;
}
