var xmlHttp;
var cmsPath = 'http://cms.gideon.hr/';
var sta;
var showPhotogalleryDetails;

function showContent2(query, action, to_div)
{ 
	
	xmlHttp=GetXmlHttpObject();
	
	sta = to_div;
	
	if (xmlHttp==null)
	{
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	
	var url    = 'ajax_post.php?';	

	switch(action) {
	
		case "1":
			var query2 = unescape("%26id=")+query+unescape("%26action=")+action;
			xmlHttp.onreadystatechange = handlePhoto;
		break;
		case "2":
			var query2 = unescape("%26id=")+query+unescape("%26action=")+action;
			xmlHttp.onreadystatechange = handlePhoto2;
			break;
	}

	xmlHttp.open("POST", url, true);
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", query2.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(query2);
	
}

function handlePhoto() 
{ 
	if (xmlHttp.readyState==1)
	{ 
		document.getElementById('pop').style.display = "block";
		document.getElementById('pop').style.left = (screen.width/2) - 463 + "px";
		document.getElementById('pop').style.top =  (screen.height/2) - 230 + "px";
		document.getElementById(sta).innerHTML = "Wait...";
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		var response = xmlHttp.responseText;
		document.getElementById(sta).innerHTML = response;
	}
}
function handlePhoto2() 
{ 
	if (xmlHttp.readyState==1)
	{ 
		document.getElementById('pop2').style.display = "block";
		document.getElementById('pop2').style.left = (screen.width/2) - 463 + "px";
		document.getElementById('pop2').style.top =  (screen.height/2) - 230 + "px";
		document.getElementById(sta).innerHTML = "Wait...";
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		var response = xmlHttp.responseText;
		document.getElementById(sta).innerHTML = response;
	}
}

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;
}