function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}
var searchReq = getXmlHttpRequestObject();
function getPictures() {
	if (searchReq.readyState == 4 || searchReq.readyState == 0) { 
		image_id = '';
		if (document.getElementById('image')) image_id = document.getElementById('image').value;
		if (image_id) {
			searchReq.open("GET", 'AjaxActions.php?view=images&image_id='+ image_id +'&rnd=' + Math.round(99999999*Math.random()), true);
			searchReq.onreadystatechange = handleGetPictures; 
			searchReq.send(null);
		}
	}		
}

//Called when the AJAX response is returned.
function handleGetPictures() { 
	if (searchReq.readyState == 4) {
		eval(searchReq.responseText);
	}
}

///*******************
function getFolderPictures() {
	if (searchReq.readyState == 4 || searchReq.readyState == 0) { 
		image_id = '';
		if (document.getElementById('image')) image_id = document.getElementById('image').value;
		if (image_id) {
			searchReq.open("GET", 'AjaxActions.php?view=folderimages&image_id='+ image_id +'&rnd=' + Math.round(99999999*Math.random()), true);
			searchReq.onreadystatechange = handleGetFolderPictures; 
			searchReq.send(null);
		}
	}		
}

//Called when the AJAX response is returned.
function handleGetFolderPictures() { 
	if (searchReq.readyState == 4) {
		eval(searchReq.responseText);
	}
}
///****************