var currentStory=null;

function markThisPage(id, parent, onlytoplevel) {
	var level;
	var currentStory = 0;
	var editstory = false;
	var pageid = "n" + id;
	if (parent == null) {
		parent = 0;
	}
	if (parent == 0) {	// if no parent must be level 1 nav link
		level = 1;
	}
	else {
		level = 2;
	}
	if (onlytoplevel == null) {
		onlytoplevel = true;
	}
	if (onlytoplevel && parent > 0) {	// sublevel nav links not to be marked
		return;
	}
	if (document.getElementById(pageid) != null) {
			var oNavlink = document.getElementById(pageid);
			oNavlink.className = "navbarcurrent";
	}
}

function emailThis() {

	var url = "/easyweb/index.php?fuseaction=main.emailthis";
	var s = "";
	var r = "";
	var email = "";
	var note = "";
	
	while (s == "") {
	      s = prompt("Please enter your Name", "");
	}
	while (r == "") {
	      r = prompt("Please enter Recipients Name", "");
	}
	
	while (email == "") {
	      email = prompt("Please enter the email address you wish to sent this page to", "");
	}
	note = prompt("Please enter any annotation/note to be sent to accompany email", "I thought you might be interested in this . . ");
	
	// opens a separate dialog window
	
	if (email != null) {
		url += "&s=" + escape(s) + "&r=" + escape(r) + "&email=" + escape(email) + "&note=" + escape(note);
		window.open(url, "popup","top=200,left=200,height=250,width=250,scrollbars=no");
		return;
	}
}

function showImage(image,desc) {

	var url = "/easyweb/index.php?fuseaction=main.showimage";
	
	url += "&image=" + escape(image) + "&desc=" + escape(desc);
	window.open(url, "showimage","scrollbars=yes,resizable=yes,top=200,left=200,height=400,width=400");
	return;
}

function isValidEmail(email) {
	if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) {
		return true;
	} else {
		alert ('This does not appear to be a valid e-mail address.  Please enter your e-mail address in the form: you@you.com');
		return false;
	}
}
