function getXmlHttpReq()
{
	var xmlHttpReq = null;
	if (window.XMLHttpRequest) {
		xmlHttpReq = new XMLHttpRequest(); // Mozilla, Opera, Safari
	} else if (window.ActiveXObject) {
		xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); // IE 5.5+
	}

	return xmlHttpReq;
}
function getContent(dbTable, dbField, dbWhere, htmlBox)
{		
	var xmlHttpReq = getXmlHttpReq();
	
	xmlHttpReq.onreadystatechange = function()
	{
		if (xmlHttpReq.readyState == 4) {
			div 		   = document.getElementById(htmlBox);
			paragraphs     = div.getElementsByTagName('p');
			paragraphs[0].innerHTML = xmlHttpReq.responseText;
		}
	}
	xmlHttpReq.open("GET", "getContent.php?dbTable=" + dbTable + "&dbField=" + dbField + "&dbWhere=" + dbWhere + "&htmlBox=" + htmlBox, true);
	xmlHttpReq.send(null); // nu merge fara null

	return false;
}
function setMainImage(image, prodId)
{
	var xmlHttpReq = getXmlHttpReq();
	
	xmlHttpReq.onreadystatechange = function()
	{
		if (xmlHttpReq.readyState == 4) {
			images = document.getElementsByName('prodImage');
			for (i = 0; i < images.length; i++) images[i].className = '';
			image.className = 'main';			
		}
	}
	xmlHttpReq.open("GET", "setMainImage.php?imageSrc=" + image.src + "&prodId=" + prodId, true);
	xmlHttpReq.send(null); // nu merge fara null

	return false;
}
