// Create image objects and preload all active and inactive images

if (document.images) {
	// image objects for the active images
	var newsevents_on = new Image();
	newsevents_on.src = "images/nav_newsevents_on.gif";
	
	var seminars_on = new Image();
	seminars_on.src = "images/nav_seminars_on.gif";
	
	var bandmentoring_on = new Image();
	bandmentoring_on.src = "images/nav_bandmentoring_on.gif";

	var nadinesez_on = new Image();
	nadinesez_on.src = "images/nav_nadinesez_on.gif";

	var wildweekend_on = new Image();
	wildweekend_on.src = "images/nav_wildweekend_on.gif";

	var pressquotes_on = new Image();
	pressquotes_on.src = "images/nav_pressquotes_on.gif";

	var speakingreligion_on = new Image();
	speakingreligion_on.src = "images/nav_speakingreligion_on.gif";
	
	var hospice_on = new Image();
	hospice_on.src = "images/nav_hospice_on.gif";
	
	var biography_on = new Image();
	biography_on.src = "images/nav_biography_on.gif";

	
	// image objects for the inactive images
	var newsevents_off = new Image();
	newsevents_off.src = "images/nav_newsevents_off.gif";
	
	var seminars_off = new Image();
	seminars_off.src = "images/nav_seminars_off.gif";
	
	var bandmentoring_off = new Image();
	bandmentoring_off.src = "images/nav_bandmentoring_off.gif";

	var nadinesez_off = new Image();
	nadinesez_off.src = "images/nav_nadinesez_off.gif";

	var wildweekend_off = new Image();
	wildweekend_off.src = "images/nav_wildweekend_off.gif";
		
	var pressquotes_off = new Image();
	pressquotes_off.src = "images/nav_pressquotes_off.gif";

	var speakingreligion_off = new Image();
	speakingreligion_off.src = "images/nav_speakingreligion_off.gif";
	
	var hospice_off = new Image();
	hospice_off.src = "images/nav_hospice_off.gif";
	
	var biography_off = new Image();
	biography_off.src = "images/nav_biography_off.gif";

	
	// image objects for the down images

}

// Function to activate an image
function imgOn(imgName) {
	if (document.images) {
		document.images[imgName].src = eval(imgName + "_on.src");
	}
}

//Function to deactivate an image
function imgOff(imgName) {
	if (document.images) {
		document.images[imgName].src = eval(imgName + "_off.src");
	}
}

//Function to show down state of an image
function imgDn(imgName) {
	if (document.images) {
		document.images[imgName].src = eval(imgName + "_dn.src");
	}
}


function loginfocus(){
document.loginform.Admin_ID.focus();
}

function VerifyDataEvents() {
	if (document.adminform.Title.value == "") {
		alert("You must enter an Event Title.");
		return false;
	} else if ((document.adminform.Date_Month.value == "Blank") ||
				(document.adminform.Date_Day.value == "Blank") ||
				(document.adminform.Date_Year.value == "Blank") ||
				(document.adminform.Time_Hour.value == "Blank") ||
				(document.adminform.Time_Minute.value == "Blank") ||
				(document.adminform.Time_AMPM.value == "Blank")) {
		alert("You must complete the Date and Time fields.");
		return false;
	} else if (document.adminform.Description.value == "") {
		alert("You must enter a Description.");
		return false;
	} else if (document.adminform.Location.value == "") {
		alert("You must select a Location.");
		return false;
	} else
		return true;
}

/*iCal*/

function addToOutlook(eventId){
		location.href=("ics/" + eventId + ".ics");
}

function VerifyDataSeminars() {
	if (document.adminform.Title.value == "") {
		alert("You must enter an Seminar Title.");
		return false;
	} else if ((document.adminform.Date_Month.value == "Blank") ||
				(document.adminform.Date_Day.value == "Blank") ||
				(document.adminform.Date_Year.value == "Blank") ||
				(document.adminform.Time_Hour.value == "Blank") ||
				(document.adminform.Time_Minute.value == "Blank") ||
				(document.adminform.Time_AMPM.value == "Blank")) {
		alert("You must complete the Date and Time fields.");
		return false;
	} else if (document.adminform.Description.value == "") {
		alert("You must enter a Description.");
		return false;
	} else if (document.adminform.Price.value == "") {
		alert("You must enter a Price.");
		return false;
	} else if (document.adminform.Location.value == "") {
		alert("You must select a Location.");
		return false;
	} else
		return true;
}


function VerifyDataSettings() {
	if (document.frmUser.Admin_Pass.value != document.frmUser.Admin_Pass2.value) {
		alert("Passwords do not Match.");
		return false;
	} else if (document.frmUser.Admin_ID.value == "") {
		alert("You must enter an Admin ID.");
		return false;
	} else if (document.frmUser.Admin_Email.value == "") {
		alert("You must enter an Admin Email.");
		return false;
	} else if (document.frmUser.Admin_Pass.value == "") {
		alert("You must enter an Admin Password.");
		return false;
	} else if (confirm("Are you sure you want to update your settings?")) {
		return true;
	}
		return false;
}

function VerifyDataSignup() {

	var form = document.subscribersform
	
	/* check if the email address field is empty */		
	var CheckEmptyEmail = form.Email.value
		
	if (CheckEmptyEmail == null || CheckEmptyEmail == "")
		{
		alert("Please enter your Email Address");
		form.Email.focus();
		return false
		}
		
/* The validation process determines if the email 
is less than 9 characters. If so, then it sets 
the return variable to true indicating a failed 
validation. It also adds the appropriate message 
to the existing message string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		if (CheckEmptyEmail.length < 9)  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}
		
/* Next, we check for the existence of the @ character */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
 	    var charA = CheckEmptyEmail.indexOf("@");
		if (charA == -1)  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}
	
/* Once it has been determined that there is an 
@ character, the validation process checks to see if 
it is it more than two characters in from the left 
side of the string. */	
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
 	    var charA = CheckEmptyEmail.indexOf("@");		
			if (charA < 2 )  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}

		
/* The check continues to determine if a . (period) 
exists. It begins the search from the right side of 
the string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");
		if (charP == -1)  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}

/* Now that we have a . (period), is it at
the proper place at the end of the string. */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");
		if (charP != CheckEmptyEmail.length - 3 && charP != CheckEmptyEmail.length - 4)  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}

/* Okay, now that we have both the @ and . (period)
characters, are they separated by at least two characters? */
	if (CheckEmptyEmail != null || CheckEmptyEmail != "")
		{
		var charP = CheckEmptyEmail.lastIndexOf(".");
			if (charP < charA + 3)  {
			alert("Please enter a valid Email Address");
			form.Email.focus();
			return false
			}
		}
	form.submit();
	return true
}


function VerifyDataUpdate() {
	if (document.subscribersform.EmailNew.value == "") {
		alert("You must enter an Email Address.");
		return false;
	} else
		document.subscribersform.submit()
}

function VerifyDataQuotes() {
	if (document.adminform.Quote.value == "") {
		alert("You must enter a Quote.");
		return false;
	} else if (document.adminform.Author.value == "") {
		alert("You must enter an Author.");
		return false;
	} else if (document.adminform.Category.value == "") {
		alert("You must enter a Category.");
		return false;
	} else if (document.adminform.Rank.value == "") {
		alert("You must enter a Rank.");
		return false;
	} else
		return true;
}

function VerifyDataQuit()
{
var ConfirmStatus = confirm("Are you sure you want to unsubscribe?")
if (ConfirmStatus == true) {
	document.adminform.submit()
	}
	else {
	return false
	}
}


function mOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
function mOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
} 
function mClk(src){ 
	if(event.srcElement.tagName=='TD')
		src.children.tags('A')[0].click();
}
function dispMsg(message){
	window.status = message
}

function archive_view_open(ID) {
	window.open('archive_view_html.asp?ID='+ID, 'archive_view_html_window', 'scrollbars=yes,status=no,menubar=no, resizable=yes,width=600,height=600,screenX=50,screenY=50,top=50,left=50')
}


function sendform() {
	var Subject = document.sendmailform.Subject.value;
	var Body = document.sendmailform.Body.value;
	document.sendmailform.target = "_top";
	
	if (Subject == "") {
		alert("You must enter a Subject.");
		document.sendmailform.Subject.focus();
		return false;
	} else if (Body == "") {
		alert("You must enter a Body.");
		document.sendmailform.Body.focus();
		return false;
	} else 	

if (document.sendmailform.test.checked != true) {
			var ConfirmStatus = confirm("Send to All Subscribers?")
			if (ConfirmStatus == true) {
				document.sendmailform.action = "sendmail_send.asp";
				}
				else {
				return false;
				}
	} else {
			var ConfirmStatus = confirm("Send a Test?")
			if (ConfirmStatus == true) {
				document.sendmailform.action = "sendmail_test.asp";
				}
				else {
				return false;
				}
 			}
		}
		
function sendmail_view_open(action) {
	var Subject = document.sendmailform.Subject.value;
	var Body = document.sendmailform.Body.value;

	if (Subject == "") {
		alert("You must enter a Subject.");
		document.sendmailform.Subject.focus();
		return false;
	} else if (Body == "") {
		alert("You must enter a Body.");
		document.sendmailform.Body.focus();
		return false;
	} else 		

	document.sendmailform.action = action;
	document.sendmailform.target = "newwindow";
	newWindow = window.open(action,'newwindow','scrollbars=yes,status=no,menubar=no, resizable=no,width=810,height=560,screenX=10,screenY=10,top=10,left=10');
	newWindow.focus();
}

