function valid_password()
{
function validEmail(email)
{
var email = document.password.email.value

invalidChars = " /:,;"

  if(email == "")
  {
    return false
  }
  for(i=0; i<invalidChars.length; i++)
  {
    badChar = invalidChars.charAt(i)
    if(email.indexOf(badChar,0) > -1)
   {
      return false
    }
  }

  atPos = email.indexOf("@",1)
  if(atPos == -1)
  {
    return false
  }

  if(email.indexOf("@",atPos+1) > -1)
  {
    return false
  }

  periodPos = email.indexOf(".",atPos)
  if(periodPos == -1)
  {
    return false
  }

  if(periodPos+3 > email.length)
  {
    return false
  }
  return true;
  }


 if(!validEmail(document.password.email.value))
{
    alert("Invalid email address")
    document.password.email.focus()
    document.password.email.select()
    return false
}
}

	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*548*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		var ck = name+"="+value+expires+"; path=/";
		if (days != -1) 
		document.cookie = ck;
	}
	
	function readCookie(name)
	{
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i<ca.length;i++)
		{
	var c = ca[i];
	while (c.charAt(0)==' ') c = c.substring(1,c.length);
	if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	}
	
	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}
	
	
	/* Some extra functions. They're only here to allow me to add some
		alerts to the example */
	
	function saveIt(name)
	{
		var x = document.login.username.value;
		if (!x){
			document.login.username.focus();
		}
		else
		createCookie(name,x,7);
	}
	
	function readIt(name)
	{
		alert('The value of the cookie is ' + readCookie(name));
		}
	
		function eraseIt(name)
		{
			eraseCookie(name);
			alert('Cookie erased');
		}
		
		function init()
		{
		for (var i=1;i<3;i++)
		{
			var x = readCookie('username' + i);

			//if (x) alert('Cookie username' + i + '\nthat you set on a previous visit, is still active.\nIts value is ' + x);
			if (x) document.login.username.value=x;
			if (document.login.username.value !="")
			{document.login.password.focus();}{
			/*document.login.username.focus();*/
			}
			
		}
	}
