function UpdateCat(divID, line, id) {
	if (XMLHttpRequestObject) {
		var obj = document.getElementById(divID);
		// var id = document.getElementById("subuser").value;
		var name = document.getElementById("name" + line).value;
		var description = document.getElementById("description" + line).value;
		var graphic_ad = document.getElementById("graphic_ad" + line).value;
		var url = document.getElementById("url" + line).value;

		// var withimages = document.getElementById("withimages").value;
		// alert(withimages); return false;
		if (name == '' || id == '') {
			alert ("You must have a title and ID present. If the title is present, then the id is missing. This is bad and should not have happened.");
			return false;
		} else {		
			obj.innerHTML = "Updating category.<br/><img src=\"/images/animation/loading.gif\"><br/>Please Wait";

			// Must tell it that we are opening it in POST format
			XMLHttpRequestObject.open("POST", "/admin.php?do=category&run=update", true);
			// Also tell if which content-type
			XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			
			// Create a null function
			XMLHttpRequestObject.onreadystatechange = function() {
				// Check to make sure download is 100% ready
				// 200 to make sure download is ready
				if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
					// Respond with error code / response in divid
					var response = XMLHttpRequestObject.responseText;
					var details = new Array();
					
					details = response.split('|');
					

					obj.innerHTML = details[0];	
				}	
			}
			
			XMLHttpRequestObject.send("name=" + encodeURI(name) + "&id=" + encodeURI(id) + "&description=" + encodeURI(description) + "&graphic_ad=" + encodeURI(graphic_ad) + "&url=" + encodeURI(url));
		}
	}
}

function UpdateNotes(divID) {
	if (XMLHttpRequestObject) {
		var obj = document.getElementById(divID);
		// var id = document.getElementById("subuser").value;
		var notes = document.getElementById("notes").value;

		
		obj.innerHTML = "Updating Notes.<br/><img src=\"/images/animation/loading.gif\"><br/>Please Wait";

		// Must tell it that we are opening it in POST format
		XMLHttpRequestObject.open("POST", "/admin.php?do=stats&run=updatenotes", true);
		// Also tell if which content-type
		XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		
		// Create a null function
		XMLHttpRequestObject.onreadystatechange = function() {
			// Check to make sure download is 100% ready
			// 200 to make sure download is ready
			if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
				// Respond with error code / response in divid
				var response = XMLHttpRequestObject.responseText;
				var details = new Array();
				
				details = response.split('|');
				

				obj.innerHTML = details[0];	
			}	
		}
		
		XMLHttpRequestObject.send("notes=" + encodeURI(notes));

	}
}

function AddGallery() {
	var gtitle = document.getElementById("gtitle").value;
	var image = document.getElementById("image").value;
	
	if (gtitle == '' || image == '') {
		alert("Please enter both a title and description");
		return false;
	} else {
		return true;
	}
}

function AddImage() {
	var image = document.getElementById("image").value;
	
	if (image == '') {
		alert("Please enter an image");
		return false;
	} else {
		return true;
	}
}

function AddVIPPornstar() {
	if (IsEmpty("name") || IsEmpty("image")) {
		alert("Please enter all required fields.");
		return false;
	} else {
		return true;
	}
}