function eventTitleShow() {
	formValue = document.recur.product.value;
	if (formValue == "OTHER") {
		myElem = document.getElementById("event_other_div");
		myElem.style.height = "37px";
		myElem.style.visibility = "visible";
	}else{
		myElem = document.getElementById("event_other_div");
		myElem.style.height = "0px";
		myElem.style.visibility = "hidden";
	}
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays)
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
} 

function getCookie(c_name) {
	if (document.cookie.length>0) {
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1) { 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return ""
}
function nav1_on(me) {
	me.className = "buttonL1_on";
}
function nav1_off(me) {
	me.className = "buttonL1";
}
function nav2_on(me) {
	me.className = "buttonL2_on";
}
function nav2_off(me) {
	me.className = "buttonL2";
}
function setSearch() {
	me = document.getElementById("Search");
	me.className = "search";
	document.form1["Search"].value = "Search Associates";
}
function searchFocus(me,myForm) {
	me.className = "searchFocus";
	myName = me.name;
	myValue = document[myForm][myName].value;
	if (myValue == "Search Associates" || myValue == "Search Associates") {
		document[myForm][myName].value = "";
	}
}
function searchUnfocus(me,myForm) {
	myName = me.name;
	myValue = document[myForm][myName].value;
	if (myValue == "" || myValue == "Search Associates" || myValue == "Search Associates") {
		me.className = "search";
		if (myForm == "associateViews") {
			document[myForm][myName].value = "Search Associates";
		}else{
			document[myForm][myName].value = "Search Associates";
		}
	}
}
function searchCheck(myForm) {
	me = document.getElementById("Search");
	myName = me.name;
	myValue = document[myForm][myName].value;
	if (myValue == "" || myValue == "Search Associates") {
		alert('Please enter a search phrase.');
		return false;
	}
}
function menu(myID) {
	loadPage(myID);
}
function searchBlock_on(me) {
	me.className = "associateViewText_on";
}
function searchBlock_off(me) {
	me.className = "associateViewText";
}
function go(URL) {
	window.location.href = URL;
}
function searchAll() {
	document.SearchForm.Name.value = "";
	document.SearchForm.All.value = '1';
	document.SearchForm.submit();
}
function inputFocus(me) {
	me.className = "inputFocus";
}
function inputBlur(me) {
	me.className = "inputBlur";
}
function validateForm(myForm) {
	var X;
	var Empty = false;
	var VEmail = true;
	var wrongDateTime = false;
	var wrongPrivate = false;
	var wrongCapacity = false;
	var wrongPrice = false;
	var wrongRecur = false;
	var wrongImage = false;
	for (X in Required) {
		if ($type(document[myForm][Required[X]]) == 'element') {
			if (Required[X] == "VERIFY_TIME") {
				myStartHour = parseInt(document[myForm]["startHour"].value);
				myEndHour = parseInt(document[myForm]["endHour"].value);
				myStartMinute = document[myForm]["startMinute"].value;
				myEndMinute = document[myForm]["endMinute"].value;
				myStartAMPM = document[myForm]["startAMPM"].value;
				if (myStartAMPM == "PM") {
					myStartHour += 12;
				}
				if (myStartHour < 10) {
					myStartHour = "0" + myStartHour;
				}
				myEndAMPM = document[myForm]["endAMPM"].value;
				if (myEndAMPM == "PM") {
					myEndHour += 12;
				}
				if (myEndHour < 10) {
					myEndHour = "0" + myEndHour;
				}
				myStartTime = myStartHour + ":" + myStartMinute;
				myEndTime = myEndHour + ":" + myEndMinute;
				if (myStartTime > myEndTime) {
					document.getElementById("startHour").className = "Required";
					document.getElementById("startMinute").className = "Required";
					wrongDateTime = true;
				}else{
					document.getElementById("startHour").className = "";
					document.getElementById("startMinute").className = "";
				}
			}else if (Required[X] == "VERIFY_DATE") {		
				myStartDate = document[myForm]["startDate"].value;
				startMonth = myStartDate.substring(0,2);
				startDay = myStartDate.substring(3,5);
				startYear = myStartDate.substring(6,10);
				myEndDate = document[myForm]["endDate"].value;
				endMonth = myEndDate.substring(0,2);
				endDay = myEndDate.substring(3,5);
				endYear = myEndDate.substring(6,10);
				if (myStartDate.length < 10 || isNaN(startMonth) || isNaN(startDay) || isNaN(startYear) || myStartDate > myEndDate) {
					document.getElementById("startDate").className = "Required";
					wrongDateTime = true;
				}else{
					document.getElementById("startDate").className = "";
				}
				if (myEndDate.length < 10 || isNaN(endMonth) || isNaN(endDay) || isNaN(endYear)) {
					document.getElementById("endDate").className = "Required";
					wrongDateTime = true;
				}else{
					document.getElementById("endDate").className = "";
				}
			}else if (Required[X] == "VERIFY_STARTDATE") {		
				myStartDate = document[myForm]["startDate"].value;
				startMonth = myStartDate.substring(0,2);
				startDay = myStartDate.substring(3,5);
				startYear = myStartDate.substring(6,10);
				if (myStartDate.length < 10 || isNaN(startMonth) || isNaN(startDay) || isNaN(startYear)) {
					document.getElementById("startDate").className = "Required";
					wrongDateTime = true;
				}else{
					document.getElementById("startDate").className = "";
				}
			}else if (Required[X] == "VERIFY_RECURRENCE") {
				if (document.recur.type.value == "daily") {//Daily
					if (isNaN(document.recur.daily_days.value)) {
						document.getElementById("daily_days").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("daily_days").className = "";
					}
				}else if (document.recur.type.value == "weekly") {//weekly
					if (isNaN(document.recur.weekly_days.value)) {
						document.getElementById("weekly_days").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("weekly_days").className = "";
					}
				}else if (document.recur.type.value == "monthly") {//Monthly
					//monthly_daynum
					if (isNaN(document.recur.monthly_daynum.value) || document.recur.monthly_daynum.value > 31) {
						document.getElementById("monthly_daynum").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("monthly_daynum").className = "";
					}
					//monthly_monthnum
					if (isNaN(document.recur.monthly_monthnum.value)) {
						document.getElementById("monthly_monthnum").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("monthly_monthnum").className = "";
					}
					//monthly_monthnum2
					if (isNaN(document.recur.monthly_monthnum2.value)) {
						document.getElementById("monthly_monthnum2").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("monthly_monthnum2").className = "";
					}
				}else if (document.recur.type.value == "yearly") {//Yearly
					//yearly_day
					if (isNaN(document.recur.yearly_day.value) || document.recur.monthly_daynum.value > 31) {
						document.getElementById("yearly_day").className = "Required";
						wrongRecur = true;
					}else{
						document.getElementById("yearly_day").className = "";
					}
				}
			}else if (Required[X] == "VERIFY_IMAGE") {
				myImage = document[myForm]["file"].value;
				lastIndex = myImage.lastIndexOf(".");
				myExt = myImage.substring(lastIndex);
				if (myExt != ".jpg" && myExt != ".jpeg" && myExt != ".gif" && myExt != ".png" && lastIndex != -1) {
					wrongImage = true;
				}
			}else if (Required[X] == "VERIFY_PRICE") {
				if (document.recur.privateCheckBox.checked == false) {
					myPriceValue = document[myForm]["price"].value;
					if (isNaN(myPriceValue)) {
						document.getElementById("price").className = "Required";
						wrongPrice = true;
					}else{
						document.getElementById("price").className = "";
					}
				}
			}else if (Required[X] == "VERIFY_CAPACITY") {
				if (document.recur.privateCheckBox.checked == false) {
					myCapacity = document[myForm]["capacity"].value;
					if (isNaN(myCapacity)) {
						document.getElementById("capacity").className = "Required";
						wrongCapacity = true;
					}else{
						document.getElementById("capacity").className = "";
					}
				}
			}else if (Required[X] == "VERIFY_PRIVATE") {
				myPrivateValue = document[myForm]["private"].value;
				if (myPrivateValue === 0 && (document[myForm]["capacity"].value == "" || document[myForm]["price"].value == "")) {
					wrongPrivate = true;
				}
			}else{
				if (document[myForm][Required[X]].value == "") {
					document.getElementById(Required[X]).className = "Required";
					Empty = true;
				}else{
					document.getElementById(Required[X]).className = "";
				}
				if (Empty != true && (Required[X] == "Email" || Required[X] == "email" || Required[X] == "reg_email")) {
					VEmail = validateEmail(myForm,Required[X]);
				}
			}
		}
	}
	if (Empty == true) {
		alert("Please fill out required fields.");
		return false;
	}else if (wrongRecur == true) {
		alert("Please enter a correct recurrence value.");
		return false;
	}else if (wrongDateTime == true) {
		alert("Dates and times must be valid.");
		return false;
	}else if (wrongCapacity == true) {
		alert("Capacity must be a valid number.");
		return false;
	}else if (wrongImage == true) {
		alert("Image must be a jpg, gif, or png.");
		return false;
	}else if (wrongPrice == true) {
		alert("Price must be a valid number.");
		return false;
	}else if (wrongPrivate == true) {
		alert("Please fill out a capacity and price.");
		return false;
	}else if (VEmail == false) {
		document.getElementById(Required[X]).className = "Required";
		alert("Please Enter A Valid Email.");
		return false;
	}else{
		//formLoading();
		//return true;
	}
}
function validateEmail(myForm,myName) {
	ME = document[myForm][myName].value;
	Length = ME.length;
	AtPOS = ME.indexOf("@");
	DotPOS = ME.lastIndexOf(".");
	DotPOSP = DotPOS + 1; 
	CHARAD = Length - DotPOSP;
	if (CHARAD == 2 || CHARAD == 3) {
		CHARAD_TF = true;
	}else{
		CHARAD_TF = false;
	}
	//alert(Length + " " + DotPOS + " " + AtPOS + " " + CHARAD_TF);
	if (AtPOS == -1 || DotPOS == -1 || CHARAD_TF == false) {
		//alert("Please Enter A Valid Email.");
		return false;
	}
}
function formLoading() {
	document.getElementById('Processing').innerHTML = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"130\" height=\"20\" id=\"formprocessing\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"img/formprocessing.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#FFFFFF\" /><embed src=\"img/formprocessing.swf\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#FFFFFF\" width=\"130\" height=\"20\" name=\"formprocessing\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
}
function formFinished(pageName,pageString) {
	var pageString = (pageString == null)?false:pageString;
	url = pageName;
	if (pageString != false) url += pageString; 
	new Ajax(url, {
			method: 'get',
			onComplete: function(){
				loadElements_response(this.response,navAnchor);
			}
		}).request();
}
function keynote1On(myValue) {
	myKeynote = document.getElementById("keynoteTemplate1");
	myKeynote.style.cursor = "pointer";
	myKeynote.style.borderColor = "#445169";
	myKeynote.style.borderWidth = "2px";
}
function keynote1Off(myValue) {
	myKeynote = document.getElementById("keynoteTemplate1");
	myKeynote.style.cursor = "pointer";
	myKeynote.style.borderColor = "#faf7e8";
	myKeynote.style.borderWidth = "2px";
}
function keynote2On(myValue) {
	myKeynote = document.getElementById("keynoteTemplate2");
	myKeynote.style.cursor = "pointer";
	myKeynote.style.borderColor = "#445169";
	myKeynote.style.borderWidth = "2px";
}
function keynote2Off(myValue) {
	myKeynote = document.getElementById("keynoteTemplate2");
	myKeynote.style.cursor = "pointer";
	myKeynote.style.borderColor = "#faf7e8";
	myKeynote.style.borderWidth = "2px";
}
function confirmPassword(myForm) {
	password1 = document[myForm].Password.value;
	password2 = document[myForm].Password2.value;
	if (password1 != password2) {
		alert('Passwords do not match.');
		return false;
	}
}
function recurrenceTab(myName) {
	var tabs = new Array();
	tabs[0] = "daily";
	tabs[1] = "weekly";
	tabs[2] = "monthly";
	tabs[3] = "yearly";
	tabs[4] = "none";
	for(i=0;i<5;i++) {
		myTab = tabs[i] + "Base";
		myButton = tabs[i] + "Button";
		if (tabs[i] == myName) {
			document.recur.type.value = tabs[i];
			document.getElementById(myButton).className = "recurrenceTabOn";
			myBase = document.getElementById(myTab);
			myBase.style.height = "120px";
			myBase.style.width = "100%";
			myBase.style.display = "block";
		}else{
			document.getElementById(myButton).className = "recurrenceTabOff";
			myBase = document.getElementById(myTab);
			myBase.style.width = "100%";
			myBase.style.display = "none";
		}
	}
}
function privateCheck() {
	myVal = document.recur.privateCheckBox.checked;
	if (myVal == true) {
		document.recur.capacity.disabled = "disabled";
		document.recur.price.disabled = "disabled";
	}else{
		document.recur.capacity.disabled = "";
		document.recur.price.disabled = "";
	}
}
function submitStoreSearch() {
	document.form1.action = "../index.php?ID=23&Name=" + document.form1.Search.value;
	document.form1.submit();
}
function addLoginSubmitEvent() {
	$('login').addEvent('submit', function(e) {
		new Event(e).stop();
		this.send({
			onRequest: function() {
				loginLoading();
			},
			
			onComplete: function() {
				loadElements_response(this.response);
			}
		});	
	});
}