//================================================
// Display the main page header
//================================================
function PageHeader()
{
	document.write('	<div id="PageHeader" style="position:absolute; left:0px; top:0px; height:56px; width:100%; background-image:url(\'images/bg-hdr.gif\'); background-repeat:repeat-x;">');
	document.write('		&nbsp;');
	document.write('	</div>');
}

//================================================
// Display the main page footer
//================================================
function PageFooter()
{
	document.write('		<td width=10>&nbsp\;</td>');
	document.write('			<td width=730>');
	document.write('				<table width=730 border=0 cellspacing=0 cellpadding=3>');
	document.write('					<tr>');
	document.write('						<td width=230 align="left" valign="middle" class="footer">');
	document.write('						<a href="site-map.html"><span class="footer">Site Map</span></a>&nbsp\;&nbsp\;&nbsp\;&nbsp\;&nbsp\;');
	document.write('						<a href="privacy.html"><span class="footer">Privacy Statement</span></a>');
	document.write('						</td>');
	document.write('						<td width=500 align="right" valign="middle" class="footer">');
	document.write('							&copy;2010 APLM Distributing - All rights reserved.');
	document.write('						</td>');
	document.write('					</tr>');
	document.write('				</table>');
	document.write('			</td>');
	document.write('			<td width=10>&nbsp\;</td>');
}

//================================================
// Display the suplimental menu
//================================================
function PageMenu()
{
	document.write('	<a href="contact.html">Contact Us</a>&nbsp\;&nbsp\;|&nbsp\;&nbsp\;<a href="help.html">Help</a>&nbsp\;&nbsp\;|&nbsp\;&nbsp\;<a href="index.html">Home</a>');
}

//================================================
// Validate Order Form
//================================================
function Validate(theForm)
{
	var emlPattern = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;  // for validating email addresses
	
	// Validate User Name
	//------------------------------------------------
	if(theForm.txtName.value.length == 0)
	{
		alert("Please provide us with your name.");
		theForm.txtName.value = "";
		theForm.txtName.focus();
		return false;
	}
	
	// Validate Email Address
	//------------------------------------------------
	if((theForm.txtEmail.value.length != 0) && (!emlPattern.test(theForm.txtEmail.value)))
	{
		alert("Please provide a valid email address.");
		theForm.txtEmail.value = "";
		theForm.txtEmail.focus();
		return false;
	}
	
	if(theForm.txtEmail.value.length == 0)
	{
		alert("Please provide a valid email address.");
		theForm.txtEmail.value = "";
		theForm.txtEmail.focus();
		return false;
	}
	
	// Validate Phone Number
	//------------------------------------------------
	if(theForm.txtPhone.value.length == 0)
	{
		alert("Please provide a phone number in the following format: xxx-xxx-xxxx.");
		theForm.txtPhone.value = "";
		theForm.txtPhone.focus();
		return false;
	}
}

//================================================
// Validate Contact Form
//================================================
function contactValidate(theForm)
{
	var emlPattern = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;  // for validating email addresses
	
	// Validate User Name
	//------------------------------------------------
	if(theForm.txtName.value.length == 0)
	{
		alert("Please provide us with your name.");
		theForm.txtName.value = "";
		theForm.txtName.focus();
		return false;
	}
	
	// Validate Email Address
	//------------------------------------------------
	if((theForm.txtEmail.value.length != 0) && (!emlPattern.test(theForm.txtEmail.value)))
	{
		alert("Please provide a valid email address.");
		theForm.txtEmail.value = "";
		theForm.txtEmail.focus();
		return false;
	}
	
	if(theForm.txtEmail.value.length == 0)
	{
		alert("Please provide a valid email address.");
		theForm.txtEmail.value = "";
		theForm.txtEmail.focus();
		return false;
	}
}