var vDetail = true;
var vFont = 2;
var bMV = false;

try
{
	var imgX = new Image;
	imgX.src = "/new/images/lin_BG_top.png";
	var imgX = new Image;
	imgX.src = "/new/images/lin_BG_btm.png";
	var imgX = new Image;
	imgX.src = "/new/images/top_toolbar_background.gif";
	var imgX = new Image;
	imgX.src = "/new/images/new_web_header_background1.gif";
	var imgX = new Image;
	imgX.src = "/new/images/lin_FeatArea_BG_3panel.png";
	var imgX = new Image;
	imgX.src = "/new/images/lin_BG_btm_.jpg";
	var gImages = document.images;
}
catch (e)
{
	var foo = "";
}

function showHiddenAd(oAd,oAdDesc)
{
	try
	{
		switch(window.event.type)
		{
			case "mouseover":
				oAdDesc.style.left = window.event.x + "px";
				oAdDesc.style.top = window.event.y + "px";
				oAdDesc.style.display = "";
				break;
			case "mouseout":
				oAdDesc.style.display = "none";
				break;
		}
	}
	catch(e)
	{
		var eMessage = e.description;
	}
}

function loadLibrary(inPath,inTitle)
{
alert(inPath);
alert(inTitle);
	//photoLink.href = "/linimages.aspx?album=" + inPath + "&album_name=" + inTitle;
	//photoLink.click();
}


function updFlyer()
{
		upRow.style.display = '';
		//open('/Events/uploadflyer.asp',null,'top=200,left=200,height=50,width=60,directories=no,location=no,menubar=no,resizeable=yes,scrollbars=auto,status=yes,toolbar=no');
}

function fPassword()
{
	vElements = frmLogin.elements;
	if (!validateFormField(vElements["email"],"User Name (email)","txtBox",100,1)) return;
	if (!validateEmail(vElements["email"].value)) return;
	open("forgot.asp?user=" + vElements["email"].value);
}

function updateCart(vElements,vP,vQ)
{
	vElements["productid"].value = vP;
	vElements["quantity"].value = vQ;
	frmUpdateCart.submit();
}

function validateOnlyNumField(vField,vFldName)
{
	var valid = "0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<vField.value.length; i++)
	{
		temp = "" + vField.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("LibertyTemple.org\n\nInvalid entry!\n\nOnly numbers are accepted\nfor the \"" +vFldName + "\" field!\n\nPlease enter a valid value\n\nThank You!");
		vField.focus();
		vField.select();
		return false;
	}
	return true;
}

function validateNumField(vField,vFldName)
{
	var valid = "0123456789,.";
	var ok = "yes";
	var temp;
	for (var i=0; i<vField.value.length; i++)
	{
		temp = "" + vField.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no")
	{
		alert("LibertyTemple.org\n\nInvalid entry!\n\nOnly numbers, commas and a period are accepted\nfor the \"" +vFldName + "\" field!\n\nPlease enter a valid value\n\nThank You!");
		vField.focus();
		vField.select();
		return false;
	}
	return true;
}

function validateFormField(vFld,vFldName,vFldType,vMaxL,vMinL)
{
	var fType = vFld.type;
	var vMsg1 = "LibertyTemple.org\n\n";
	var vMsg2 = " is a required field!\nPlease enter a valid value\n\nThank You!";
	var vMsg3 = " has a maximum\ncharacter length of "
	var vMsg4 = " characters!\n\nPlease enter a valid value\n\nThank You!";
	switch(vFldType)
	{
		case "txtBox":
			if (vMinL != null)
			{
				if (vFld.value.length < vMinL)
				{
					alert(vMsg1 + "\"" + vFldName + "\"" + vMsg2);
					if (fType != "hidden")
					{
						vFld.focus();
						vFld.select();
					}
					return false;
				}
			}
			return true;
		case "txtArea":
			if (vMinL != null)
			{
				if (vFld.value.length < vMinL)
				{
					alert(vMsg1 + "\"" + vFldName + "\"" + vMsg2);
					vFld.focus();
					vFld.select();
					return false;
				}
			}
			if (vMaxL != null)
			{
				if (vFld.value.length > vMaxL)
				{
					alert(vMsg1 + "\"" + vFldName + "\"" + vMsg3 + vMaxL + vMsg4);
					vFld.focus();
					vFld.select();
					return false;
				}
			}
			return true;
		case "listBox":
			if (vMinL != null)
			{
				if (vFld.options[vFld.selectedIndex].value.length < vMinL)
				{
					alert(vMsg1 + "\"" + vFldName + "\"" + vMsg2);
					vFld.focus();
					return false;
				}
			}
			return true;
	}
}

function validateFutureDate(vField,vFldName)
{
	var vMsg1 = "LibertyTemple.org\n\n";
	var vMsg2 = " must\nbe greater than today's date.\nPlease enter a valid value\n\nThank You!";
	var rDate = new Date(vField.value);
	var vToday = new Date();
	if ((vField.value != "") && (rDate >= vToday))
	{
		return true;
	}
	else
	{
		alert(vMsg1 + "\"" + vFldName + "\"" + vMsg2);
		vField.focus();
		vField.select();
		return false;
	}
}

function validFileName(vField)
{
	var valid = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_ (){}%$~@^&+.";
	var txtValid = "0123456789\"\n\"abcdefghijklmnopqrstuvwxyz\"\n\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n\"-_<Blank Space>(){}%$~@'^&+.";
	var ok = "yes";
	var temp;
	for (var i=0; i<vField.length; i++)
	{
		temp = "" + vField.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
		if (temp == "#") ok = "no";
	}
	if (ok == "no")
	{
		alert("Invalid File Name!\n\nThe following characters cannot be used as a part of the file name\n\n\\\/\:\?\*\<\>\'\|\#\;\,\!\n\n\"ONLY\" the following characters constitute a valid file name.\n\n\"" + txtValid + "\"\n\nPlease rename the file before uploading.\n\nThank You!");
		return false;
	}
	return true;
}

function validateEmail(emailStr)
{
	var msg = "LibertyTemple.org - Webmasters\n\n\""+ emailStr + "\" is an invalid email address.\nPlease enter a valid value.\n\nThank You!"
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null)
	{
		alert(msg);
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++)
	{
		if (user.charCodeAt(i)>127)
		{
			alert(msg);
			return false;
		}
	}

	for (i=0; i<domain.length; i++)
	{
		if (domain.charCodeAt(i)>127)
		{
			alert(msg);
			return false;
		}
	}

	if (user.match(userPat)==null)
	{
		alert(msg);
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null)
	{
		for (var i=1;i<=4;i++)
		{
			if (IPArray[i]>255)
			{
				alert(msg);
				return false;
			}
		}
		return true;
	}
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++)
	{
		if (domArr[i].search(atomPat)==-1)
		{
			alert(msg);
			return false;
		}
	}

	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
	{
		alert(msg);
		return false;
	}

	if (len<2)
	{
		alert(msg);
		return false;
	}
	return true;
}

	function fnDate()
	{
		var d, nDay, nMonth, sDate, sDay, sMonth;
		d = new Date();
		nDay = d.getDay();
		sDate = "";
		nMonth = d.getMonth();
		var sDay = new Array("Sunday", "Monday", "Tuesday");
		var sDay = sDay.concat("Wednesday","Thursday", "Friday");
		var sDay = sDay.concat("Saturday");

		var sMonth = new Array("January", "Feburary", "March");
		var sMonth = sMonth.concat("April","May", "June");
		var sMonth = sMonth.concat("July","August", "September");
		var sMonth = sMonth.concat("October","November", "December");
		sDate += sDay[nDay];
		sDate += " ";
		sDate += sMonth[nMonth];
		sDate += " ";
		sDate += (d.getDate());
		sDate += ", ";
		sDate += d.getYear();
		return(sDate);
	}

function Refresh()
// Refresh the recordset by submitting the form.
{
	try{
	document.frmReport.lstPages.value = document.frmReport1.lstPages[document.frmReport1.lstPages.selectedIndex].value;
	}
	catch (e)
	{}
	if (fromSA == "no")
		document.frmReport.hdnPageSize.value = document.frmReport1.hdnPageSize.value;
	document.frmReport.submit();
}

function MoveToPage(PageNumber)
{
// Select the page number to go to, then submit the page.
	if (PageNumber != -1)
	{
		document.frmReport1.lstPages[PageNumber].selected = true;
		document.frmReport.lstPages.value = document.frmReport1.lstPages[PageNumber].value;
		document.frmReport.hdnPageSize.value = document.frmReport1.hdnPageSize.value;
	}
	else
	{
		document.frmReport1.lstPages[0].selected = true;
		document.frmReport.lstPages.value = document.frmReport1.lstPages[0].value;
		document.frmReport.hdnPageSize.value = document.frmReport1.hdnPageSize.value;
	}
	Refresh();
}

	function doExecCmd(vCommand,vDir)
	{
		switch (vCommand)
		{
			case "CreateLink" || "Copy" || "Cut":
				if (document.selection.createRange().text.length > 0)
				{
					document.execCommand(vCommand);
					foo.focus();
				}
				else
				{
					alert("Rhema Rich Text Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "FontSize":
				if (document.selection.createRange().text.length > 0)
				{
					if (vDir != null)
					{
						if (vDir == "inc")
						{
							if (vFont <= 6)
							{
								document.execCommand(vCommand,false,vFont+1);
								vFont = vFont + 1;
							}
						}
						else
						{
							if (vFont >= 2)
							{
								document.execCommand(vCommand,false,vFont-1);
								vFont = vFont - 1;
							}
						}
						foo.focus();
					}
				}
				else
				{
					alert("Rich Text HTML Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "InsertImage":
				if (document.selection.createRange().text.length > 0)
				{
					document.execCommand(vCommand,true);
					foo.focus();
				}
				else
				{
					alert("Rich Text HTML Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "Copy":
				if (document.selection.createRange().text.length > 0)
				{
					document.execCommand(vCommand);
					foo.focus();
				}
				else
				{
					alert("Rich Text HTML Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "Cut":
				if (document.selection.createRange().text.length > 0)
				{
					document.execCommand(vCommand);
					foo.focus();
				}
				else
				{
					alert("Rich Text HTML Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "ForeColor":
				if (document.selection.createRange().text.length > 0)
				{
					newColor = prompt("Enter the HEX value or word for the new color!","");
					if (newColor != null)
					{		
						if (newColor.length > 0)
						{
							document.execCommand(vCommand,false,newColor.toString());
							foo.focus();
						}
						else
						{
							alert("The Fonts color will not be changed!");
						}
					}
				}
				else
				{
					alert("Rich Text HTML Editor\n\nThis operation requires that you\nselect some text to apply this\naction to!\n\nPlease select some text or an object\n\nThank You!");
				}
				break;
			case "Paste":
				document.execCommand(vCommand);
				break;
			default:
				document.execCommand(vCommand);
				break;
		}
	}

function frmValidateRegisterForm(vElements)
{
	if (!validateFormField(vElements["fname"],"First Name","txtBox",25,1)) return false;
	if (!validateFormField(vElements["lname"],"Last Name","txtBox",25,1)) return false;
	if (!validateFormField(vElements["email"],"Email","txtBox",100,1)) return false;
	if (!validateEmail(vElements["email"].value)) return false;
	if (!validateFormField(vElements["password1"],"Password","txtBox",20,6)) return false;
	if (!validateFormField(vElements["password2"],"Verify Password","txtBox",20,6)) return false;
	if (vElements["password1"].value != vElements["password2"].value)
	{
		alert('LibertyTemple.org - Webmasters\n\nPlease confirm that both\npasswords are exactly the same.\n\nThanks You!');
		vElements["password"].focus();
		vElements["password"].select();
		return false;
	}
	if (!validateFormField(vElements["phone1"],"Phone Number Area Code","txtBox",3,3)) return false;
	if (!validateOnlyNumField(vElements["phone1"],"Phone Number Area Code")) return false;
	if (!validateFormField(vElements["phone2"],"Phone Number Prefix","txtBox",3,3)) return false;
	if (!validateOnlyNumField(vElements["phone2"],"Phone Number Prefix")) return false;
	if (!validateFormField(vElements["phone3"],"Phone Number Suffix","txtBox",4,4)) return false;
	if (!validateOnlyNumField(vElements["phone3"],"Phone Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["phone4"],"Phone Extension")) return false;
	if (!validateOnlyNumField(vElements["fax1"],"Fax Number Area Code")) return false;
	if (!validateOnlyNumField(vElements["fax2"],"Fax Number Prefix")) return false;
	if (!validateOnlyNumField(vElements["fax3"],"Fax Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["mob1"],"Mobile Number Area Code")) return false;
	if (!validateOnlyNumField(vElements["mob2"],"MObile Number Prefix")) return false;
	if (!validateOnlyNumField(vElements["mob3"],"Mobile Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["zip1"],"Mobile Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["zip2"],"Mobile Number Suffix")) return false;
	return true;
}

function frmValidateUpdateForm(vElements)
{
	if (!validateFormField(vElements["fname"],"First Name","txtBox",25,1)) return false;
	if (!validateFormField(vElements["lname"],"Last Name","txtBox",25,1)) return false;
	if (vElements["password1"].value != vElements["password2"].value)
	{
		alert('LibertyTemple.org - Webmasters\n\nPlease confirm that both\npasswords are exactly the same.\n\nThanks You!');
		vElements["password"].focus();
		vElements["password"].select();
		return false;
	}
	if (!validateFormField(vElements["phone1"],"Phone Number Area Code","txtBox",3,3)) return false;
	if (!validateOnlyNumField(vElements["phone1"],"Phone Number Area Code")) return false;
	if (!validateFormField(vElements["phone2"],"Phone Number Prefix","txtBox",3,3)) return false;
	if (!validateOnlyNumField(vElements["phone2"],"Phone Number Prefix")) return false;
	if (!validateFormField(vElements["phone3"],"Phone Number Suffix","txtBox",4,4)) return false;
	if (!validateOnlyNumField(vElements["phone3"],"Phone Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["phone4"],"Phone Extension")) return false;
	if (!validateOnlyNumField(vElements["fax1"],"Fax Number Area Code")) return false;
	if (!validateOnlyNumField(vElements["fax2"],"Fax Number Prefix")) return false;
	if (!validateOnlyNumField(vElements["fax3"],"Fax Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["mob1"],"Mobile Number Area Code")) return false;
	if (!validateOnlyNumField(vElements["mob2"],"Mobile Number Prefix")) return false;
	if (!validateOnlyNumField(vElements["mob3"],"Mobile Number Suffix")) return false;
	if (!validateOnlyNumField(vElements["zip1"],"Zip Code")) return false;
	if (!validateOnlyNumField(vElements["zip2"],"Zip Code +4")) return false;
	return true;
}

function frmValidateLoginForm(vElements)
{
	//if (!validateFormField(vElements["email"],"User Name (email)","txtBox",100,1)) return false;
	//if (!validateEmail(vElements["email"].value)) return false;
	//if (!validateFormField(vElements["password"],"Password","txtBox",20,1)) return false;
	return true;
}
