function toggleLayer(whichLayer)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(whichLayer).style;
style2.display = style2.display? "":"block";
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[whichLayer].style;
style2.display = style2.display? "":"block";
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[whichLayer].style;
style2.display = style2.display? "":"block";
}
}

function openWin(url) {
  popUpWin = window.open(url,
                         'HelpWin',
                         'titlebar=0,toolbar=0,location=no,top=30,left=340,directories=0,status=0,'+
                         'menubar=no,scrollbars=0,resizable=no,'+
                         'Height=450,Width=420');
}

function BuildMailTo() {
	sFullPath = location.href;
	return "<A href='#' onClick=javascript:openWin('/tell-a-friend.asp?page="+sFullPath+"')>";
}

function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function check(form) {
	if (form.name.value == "") 
	{
		alert("Please enter your name.")
		form.name.focus();
		return;
	}
	
	if (form.name.value == "") 
	{
		alert("Please enter your name.")
		form.name.focus();
		return;
	}
	
	if (!IsNumeric(form.telephone.value)) {
		alert("Please enter a valid telephone number.")
		form.telephone.focus();
		return;
	}
	if (!IsNumeric(form.fax.value)) {
		alert("Please enter a valid fax number.")
		form.fax.focus();
		return;
	}		

	if (form.email.value == "") 
	{
		alert("Please enter your email address.")
		form.email.focus();
		return;
	}
		

	var stremail=form.email.value
	var emailchar=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (!emailchar.test(stremail)) {

	alert("Please enter a valid email address.");
	form.email.focus();
	return
	}

	if (form.comments.value == "") 
	{
		alert("Please type a comment or question.")
		form.comments.focus();
		return;
	}
	else
	{
		form.submit();
	}
}
