function ajaxCall(getObj) {
	return ajaxGetContent(getObj, '', 'text');
}

function ajaxGetContent(getObj, target, type) {
ajaxGetContent(getObj, target, type, null);
}
function ajaxGetContent(getObj, target, type, successfunc) {
	dojo.xhrGet( 
	{
        // The following URL must match that used to test the server.
        url: getObj, 
        handleAs: type,
        timeout: 5000, // Time in milliseconds
        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) {
        	if (target != null)
        		dojo.byId(target).innerHTML = response;
        	if (successfunc != null)
        		successfunc(response);
        	return response;
        },
        sync: true,
        
		// The ERROR function will be called in an error case.
		error: function(response, ioArgs) {
			alert(ioArgs.xhr.status);
			console.error("HTTP status code: ", ioArgs.xhr.status);
			return response; 
       	}
	});
}

function opengallery(galleryid, imageid) {
	document.getElementById("gallery").style.visibility = "visible";
	ajaxGetContent("/inc/viewgallery.php?galleryid=" + galleryid + "&id=" + imageid, "gallery", "text");
}
function nextimages(galleryid, lastid) {
	ajaxGetContent("/inc/viewgallery.php?galleryid=" + galleryid + "&id=" + lastid + "&thumbs=1", "gal_thumbimages", "text");
}

function closeGallery() {
	document.getElementById('gallery').style.visibility = 'hidden';
}			
