                         /* Phoenix Temple Article Edit Scripts */

var site_root="/site";
var list_root="/list";
var edit_message="You are about to edit an article.";
var save_message="Do you want to save your changes?";
var delete_message="Warning! You are about to delete an article.  This operation cannot be undone.  Are you sure?";
var editwin;

/*------------------------------ Edit Article ------------------------------*/

function edit_article(EDITFILE, ID) {

	// Edit the article with the passed ID number
	if (window.screen) {

		editwin = window.open('','editwin','width=825, height=560,left=' + 0 + ',top=' + 0 + ', scrollbars=none');
		editwin.location.href = site_root + "/php/editarticle.php?editfile=" + EDITFILE + "&id=" + ID ;
	}

	return true;
}

/*----------------------------- Insert Article -----------------------------*/

function insert_article(EDITFILE, ID) {

	// Edit the article with the passed ID number
	if (window.screen) {

		editwin = window.open('','editwin','width=825, height=560,left=' + 0 + ',top=' + 0 + ', scrollbars=none');
		editwin.location.href = site_root + "/php/insertarticle.php?editfile=" + EDITFILE + "&id=" + ID ;
	}

	return true;
}

/*------------------------------ Save Changes ------------------------------*/

function save_changes(EDITFILE, ID, MODE) {

	// Save changes made in the edit session
	// alert("Save changess made in the edit session");
	opener.location.href = site_root + "/php/saveindex.php?editfile=" + EDITFILE + "&id=" + ID + "&mode=" + MODE;

	return true;
}

/*------------------------------ Restore Item ------------------------------*/

function restore_item(EDITFILE, FILE) {

	// Restore a file
	ret = confirm("Restore file " + FILE + "?", "OK", "Cancel");

	if (ret == true) {

		location.href = site_root + "/php/restorebackup.php?editfile=" + EDITFILE + "&option=" + FILE;
	}

	return ret;
}

/*----------------------------- Delete Article -----------------------------*/

function delete_article(EDITFILE, ID) {

	// Delete the article with the passed ID number
	ret = confirm(delete_message, "OK", "Cancel");

	if (ret == true) {

		location.href = site_root + "/php/deletearticle.php?editfile=" + EDITFILE + "&id=" + ID;
	}

	return ret;
}

/*----------------------------- Togggle Article -----------------------------*/

function toggle_article(szImgID, szDivID)
{
	if(document.layers) {	   //NN4+

		if (document.layers[szDivID].visibility == "hide")
			document.layers[szDivID].visibility = "show";
		else
			document.layers[szDivID].visibility = "hide";
	}
	else if(document.getElementById) {	  //gecko(NN6) + IE 5+

		var obj = document.getElementById(szDivID);
		var img = document.getElementById(szImgID);

		if (obj.style.display == "none") {

			obj.style.display = "";
			img.src="/site/images/collapse.gif";
			img.alt="collapse ID=" + szDivID;
		}
		else {

			obj.style.display = "none";
			img.src="/site/images/expand.gif";
			img.alt="expand ID=" + szDivID;
		}
	}
	else if(document.all) {	// IE 4

		if (document.all[szDivID].style.visibility == "hidden")
			document.all[szDivID].style.visibility == "visible";
		else
			document.all[szDivID].style.visibility == "hidden";
	}
}

/*-------------------------- Drag and Drop Article --------------------------*/

function cancelEvent() {
	window.event.returnValue = false;
}

function drop() {
	alert("Dropped!");
}

/*----------------------- View Mailing List Log Files ----------------------*/

function view_item(FILE) {

	// View a file
	if (window.screen) {

		var w = 700;
		var h = 300;
		writew=w-238;
		writeh=h-50;

		var chasm = screen.availWidth;
		var mount = screen.availHeight;

		popup = window.open('','popup','width=' + (chasm - 60) + ',height=' + (mount - 60) + ',left=' + 30 + ',top=' + 0 + ', scrollbars=yes');
	}

	popup.location.href = list_root + "/admin/viewmailinglistlogfiles.php?option=" + FILE;

	return true;
}


/*--------------------- View Phoenix Temple Image Files --------------------*/

function view_image(FILE) {

	// View a file
	if (window.screen) {

		var w = 700;
		var h = 300;
		writew=w-238;
		writeh=h-50;

		var chasm = screen.availWidth;
		var mount = screen.availHeight;

		popup = window.open('','popup','width=' + (chasm - 60) + ',height=' + (mount - 60) + ',left=' + 30 + ',top=' + 0 + ', scrollbars=yes');
	}

	popup.location.href = site_root + "/php/viewimagefiles.php?option=" + FILE;

	return true;
}

/*--------------------- View Phoenix Temple Developer Files --------------------*/

function view_developerfile(FILE) {

	// View a file
	if (window.screen) {

		var w = 700;
		var h = 300;
		writew=w-238;
		writeh=h-50;

		var chasm = screen.availWidth;
		var mount = screen.availHeight;

		popup = window.open('','popup','width=' + (chasm - 60) + ',height=' + (mount - 60) + ',left=' + 30 + ',top=' + 0 + ', scrollbars=yes');
	}

	popup.location.href = "/web/admin/viewdeveloperfiles.php?option=" + FILE;

	return true;
}

