function replacePhoto(photoID, fileName) {
	document.photoForm.action="photo_replace.php";
	document.photoForm.photo_id.value = photoID;
	document.photoForm.photo_file_name.value = fileName;
	document.photoForm.photo_action.value = "update";
	document.photoForm.submit();
}

function confirmDelete(photoID, fileName) {
	if (confirm("Are you sure you want to delete " + fileName)) {
		document.photoForm.action="photo_delete.php";
		document.photoForm.photo_id.value = photoID;
		document.photoForm.photo_file_name.value = fileName;
		document.photoForm.submit();
		return true;
	} else {
		return false;
	}
}

function searchPhotoAdmin() {
	document.photoForm.action="index.php";
	document.photoForm.start_row.value="0";
	document.photoForm.submit();
}

function showAll() {
	document.photoForm.quick_search.value="";
	searchPhotoAdmin();
}

function cancelUpload() {
	var start_row = document.uploadForm.start_row.value;
	var max_rows = document.uploadForm.max_rows.value;
	document.location.href="/admin/index.php?start_row=" + start_row + "&max_rows=" + max_rows;
}

function goNextPrev(start_row) {
	document.photoForm.action = "index.php";
	document.photoForm.start_row.value = start_row;
	document.photoForm.submit();
}

function setMaxRows() {
	document.photoForm.action = "index.php";
	document.photoForm.start_row.value = "0";
	document.photoForm.submit();
}

function gotoAnchor(anchor) {
	document.location.href="#" + anchor;
}

function submitsearch(E){
	var keycode;

	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13) {
		searchPhotoAdmin();
		return false;
	} else
		return true;
}
