function sendToAFriendSubmit()
{
	var staf = document.getElementById('staf');
	var name = document.getElementById('staf-name').value.replace(/^\s+|\s+$/g, '');
	var email = document.getElementById('staf-email').value.replace(/^\s+|\s+$/g, '');
	var friend = document.getElementById('staf-friend').value.replace(/^\s+|\s+$/g, '');
	if (document.getElementById('staf-friend-name') != null)
	{
		var friendName = document.getElementById('staf-friend-name').value.replace(/^\s+|\s+$/g, '');
	}
	else
	{
		var friendName = "";
	}
	
	var message = document.getElementById('staf-message').value.replace(/^\s+|\s+$/g, '');
	if (document.getElementById('staf-friend-name') != null)
	{
		var splash = document.getElementById('staf-splash').value.replace(/^\s+|\s+$/g, '');
	}
	else
	{
		var splash = "";
	}
	
	if (name == "")
	{
		alert('Your Name is a required field.')
	}
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) == false)
	{
		alert('Your Email field is invalid.');
	}
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(friend) == false)
	{
		alert('Friend\'s Email field is invalid.');
	}
	else
	{
		try { var xhr = new XMLHttpRequest(); }                 
		catch(e) { var xhr = new ActiveXObject("Microsoft.XMLHTTP"); } 
		xhr.onreadystatechange  = function()
		{ 
			if(xhr.readyState == 4)
			{
				if (xhr.status == 200){}
				else{}
			}
		}; 
		xhr.open("POST", "SendToAFriendLocal.aspx",  true); 
		xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
		var postData = "YourName=" + escape(name) + "&YourEmail=" + escape(email) + "&FriendsName=" + escape(friendName) + "&FriendsEmail=" + escape(friend) + "&Message=" + escape(message) + "&Splash=" + escape(splash);
		xhr.send(postData); 
		if (staf!= null) staf.style.display = 'none'
		setTimeout(function(){
			alert('Sent');
			if (splash == "1")
			{
				document.location = 'default.asp';
			}
		}, 250);
	}
}

function printPage()
{
	window.print();
}

function sendToAFriend()
{
	var staf = document.getElementById('staf');
	if (staf.style.display == 'none')
	{
		staf.style.display = '';
		document.getElementById('staf-name').focus();
	}
	else
	{
		staf.style.display = 'none';
	}
}