// JavaScript Document
function ButText (elem,linktext){
elem.value=linktext;
}
function eventWindow(url) {
	event_popupWin = window.open(url, 'event', 'resizable=yes,scrollbars=yes,toolbar=no, width=850, height=650');
	event_popupWin.opener = self;
}
function ret_to_menu(){
	window.location = "userlogin.php"
}
function recalc_dates(form){
	var mval=form.month.options[form.month.options.selectedIndex].value; 
	var yval=form.year.options[form.year.options.selectedIndex].value;
	self.location='addevent.php?month=' + mval + '&year=' + yval;
}
function recalc_dates_up(form, ev_id){
	var mval=form.month.options[form.month.options.selectedIndex].value; 
	var yval=form.year.options[form.year.options.selectedIndex].value;
	self.location='updateevent.php?month=' + mval + '&year=' + yval + '&ev_id=' + ev_id;
}
function recalc_dates_ni(form){
	var mval=form.month.options[form.month.options.selectedIndex].value; 
	var yval=form.year.options[form.year.options.selectedIndex].value; 
	self.location='addnews.php?month=' + mval + '&year=' + yval;
}
function emailValidator(){
	var elem = document.getElementById('email');
	var elemname = document.getElementById('name');
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if (elemname.value.length == 0){
		alert("Please enter your name.");
		elemname.focus();
		return false;
	}else{
		if(elem.value.match(emailExp)){
			return true;
		}else{
			alert("Please enter a valid Email address.");
			elem.focus();
			return false;
		}
	}
}
function del_ev_confirm(ev_id) {
	var answer = confirm("Are you sure you want to delete this event?");
	if (answer){
		window.location = "delete.php?ev_id="+ev_id;
	}
}
function del_pr_confirm(news_id) {
	var answer = confirm("Are you sure you want to delete this Media/PR item?");
	if (answer){
		window.location = "deletepr.php?news_id="+news_id;
	}
}
function del_gb_confirm(post_id) {
	var answer = confirm("Are you sure you want to delete this Guestbook post?");
	if (answer){
		window.location = "deletegb.php?post_id="+post_id;
	}
}
function app_gb_confirm(post_id) {
	var answer = confirm("Are you sure you want to approve this Guestbook post for public display?");
	if (answer){
		window.location = "approvegb.php?post_id="+post_id;
	}
}
function gbpost_confirm(gbform,ip) {
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	var now = month + "/" + day + "/" + year;
	var pname = document.getElementById('postname').value;
	var plocn = document.getElementById('postlocn').value;
	var pcomment = document.getElementById('comment').value;
	var msg =  pname + ", thanks for contributing to our website.  Your message is: \n\n" + pcomment + "\n\nClick OK if you wish to go ahead and submit this post.  It should appear within 24 hours.";
	var answer = confirm(msg);
	if (answer){
		return true;
	} else {
		return false;
	}
}
function updateevent(ev_id) {
	window.location = "updateevent.php?ev_id="+ev_id;
}
