
function CheckEmail(EmailIn)
	{
		//First check to see that all the email is in the correct format
			
		str = new String(EmailIn); // email string
		if (str.length > 0) 
			{
				var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
				var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
				if (!reg1.test(str) && reg2.test(str)==false) 
				{
					return false;
				}
			}
		return true;
	}

function CheckPhone(PhoneIn)
	{
		str = new String(PhoneIn); // phone string
		if (str.length > 0) 
			{
				var reg1 = /((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}/;
							
				if (reg1.test(str)==false) 
						{
							return false;
						}
			}
			return true;
	}

function CheckZip(ZipIn)
	{
		//First check to see that all the email is in the correct format
			
		str = new String(ZipIn); // email string
		if (str.length > 0) 
			{
				var reg1 = /\d{5}(-\d{4})?/; // not valid
				if (reg1.test(str)==false) 
				{
					return false;
				}
			}
		return true;
	}

function CheckWebURL(URLIn)
	{
		str = new String(URLIn); // website string
		if (str.length > 0) 
			{
				reg1 = new RegExp("^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)?((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)?(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&%\$#\=~_\-@]*)*$");
				if (reg1.test(str)==false) 
					{
						return false;
					}
			}
		return true;
	}


function SetListItem(ListIn, LookItem)
	{
		var listlen = ListIn.length;
		for (var loop=0; loop < listlen-1; loop++)
			{
				var listval=ListIn.options[loop].value;
				if (listval==LookItem)
					{
					//example of how you would use the loop value once it's set.
			//			window.document.ContribForm.lstMethod.options[loop].selected=true;
						return loop;
					}
			}
	}

function GetListValue(ListIn)
{
    var the_index = ListIn.selectedIndex; 
    return ListIn.options[the_index].value;
}

//These two functions are used to "hide"  and "show" the text box controls within a form

function hidetextbox(textboxin)
{
//	textboxin.style.color="#F9F2B9";
//	textboxin.style.backgroundColor="#F9F2B9";
	textboxin.style.borderColor="#ffffff";
	textboxin.style.borderRight="#ffffff 1px solid";
	textboxin.style.borderLeft="#ffffff 1px solid";
	textboxin.style.borderTop="#ffffff 1px solid";
	textboxin.style.borderBottom="#ffffff 1px solid";
	textboxin.style.border="none";
}
function showtextbox(textboxin)
{
	textboxin.style.backgroundColor="white";
	textboxin.style.borderColor="#7F9DB9";
	textboxin.style.borderRight="#7F9DB9 1px solid";
	textboxin.style.borderLeft="#7F9DB9 1px solid";
	textboxin.style.borderTop="#7F9DB9 1px solid";
	textboxin.style.borderBottom="#7F9DB9 1px solid";
	textboxin.style.height="16px";
}	

function MailSomeone (Who, What)
{
 parent.location.href='mailto:'+Who+'?subject='+What+'';
}