// ===================================================================
// Author: Arthur Yarnell
// WWW: http://www.arthursweb.co.uk
//

function printpage() 
{ 
window.print();  
} 

//reloads the window if Nav4 resized
function MM_reloadPage(init) 
{  
  if (init==true) with (navigator) 
  {
  	if ((appName=="Netscape")&&(parseInt(appVersion)==4)) 
  	{
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; 
	}
  }
  	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function window_open()
{
	var newWindow;
	var urlstring = '100_pop_up_calendar.htm';
	newWindow = window.open(urlstring,'Calendar','height=200,width=280,toolbar=no,minimize=no,status=no,memubar=no,location=no,scrollbars=no,top=100,left=100');
}

function validEmail(emailAddress)
{
	//no space / : etc allowed
	//( ) < > @ , ; : \ " . [ ]
	invalidChars = " /:,;()><\[]"
	//check for no wmail address
	if (emailAddress == "")
		{
		alert("You must enter a valid email address so that we can reply to you.")
		return false
		}	
	//Check to see if there is an invalid character in the email
	//for (initialization; condition; increment) 
	for (i=0; i<invalidChars.length; i++)
		{
		badChar=invalidChars.charAt(i)
		if (emailAddress.indexOf(badChar,0) > -1) 
			{
			alert("You have invlaid characters in your email address")
			return false
			}
		}
	//must have an @ ie find position if not found  pos = -1
	atPos = emailAddress.indexOf("@",1)
	if (atPos == -1 )
		{
		alert("An Email address must contain an @ symbol")
		return false
		}
	//must be at least 1 dot after the @
	periodPos = emailAddress.indexOf(".",atPos)
	if (periodPos == -1 )
		{
		alert("There must be a full stop after the @ symbol for a valid email address")
		return false
		}
	//must be at least 2 chrs after the . ie search for the dot after the @ symbol
	if (periodPos + 3 > emailAddress.length)
		{
		alert("Must have at least 2 characters after the full stop after the @ symbol")
		return false
		}
	//if reached this point it must be OK
	return true	
}
