// Get Base URL
DocumentURL = document.location.href;
EndChar = DocumentURL.lastIndexOf("/") + 1;
var BaseURL = DocumentURL.substring(0, EndChar);

var ajaxError = false;

function ajaxPOST (DocumentURL) {
	// Does URL begin with http?
	if (DocumentURL.substring(0, 4) != "http") {
		DocumentURL = BaseURL + DocumentURL;
	}

	// Create new JS element
	var DocumentElement = document.createElement("SCRIPT");
	DocumentElement.type = "text/javascript";
	DocumentElement.src = DocumentURL;

	// Append JS element (therefore executing the AJAX call)
	document.body.appendChild (DocumentElement);

	return true;
}

function ajaxGET (PostURL, Result, Status) {
	// Has element been passed as object or id-string?
	if (typeof(Result) == "string") {
		Result = document.getElementById(Result);
	}

	// Valid el?
	if (Result == null) {
		return false;
	}

	// Does URL begin with http?
	if (PostURL.substring(0, 4) != "http") {
		PostURL = BaseURL + PostURL;
	}

	// Create getfile URL
	getFileURL = BaseURL + "assets/ajax_get_file.php?PostURL=" + escape(PostURL) + "&Result=" + escape(Result.id);
	// alert(getFileURL);

	// Do Ajax
	ajaxPOST (getFileURL);

	return true;
}

function ajaxHIDE (divName) {
	setTimeout("hideDIV(" + divName + ")", 5000);
}

function showDIV(divName) {
	divName = document.getElementById(divName);
	divName.style.display = "";
}

function hideDIV(divName) {
	divName.style.display = "none";
}