function usertest ()
{   em_val = /^\w+@\w+(\.\w+?)/
	if ( (form1.userlog.value == "")||(form1.passlog.value == "") ) 
	{ alert("Please enter username and password")
		return false;
	} else 
 	 if (em_val.test(document.form1.userlog.value)==false) 
	 {
 		alert("invalid email address")
		form1.userlog.focus();
		return (false); 
	 } else
	 form1.submit();
}


function email_validateu(email){
    em_val = /^\w+@\w+(\.\w+?)/
    if(em_val.test(email)) { document.form1.submit();
    } else { alert(email+" is an invalid email address") }
}

function formvalidator(theForm)
{

  if (theForm.firstname.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.firstname.focus();
    return (false);
  }
  
  if (theForm.lastname.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    theForm.lastname.focus();
    return (false);
  }

 

  

  if (theForm.password.value == "")
  {
    alert("Please enter a value for the \"password\" field.");
    theForm.password.focus();
    return (false);
  }

  if (theForm.password.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"password\" field.");
    theForm.password.focus();
    return (false);
  }

  
  if (theForm.password2.value == "")
  {
    alert("Please enter a value for the \"Confirm password\" field.");
    theForm.password2.focus();
    return (false);
  }

  if (theForm.password2.value.length < 3)
  {
    alert("Please enter at least 3 characters in the \"Confirm password\" field.");
    theForm.password2.focus();
    return (false);
  }

  if (theForm.password2.value != theForm.password.value)
  {
    alert("Please enter  \"Confirm password\" as \"password\".");
    theForm.password2.focus();
    return (false);
  }   
  
 if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"email\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length < 7)
  {
    alert("Please enter at least 7 characters in the \"email\" field.");
    theForm.email.focus();
    return (false);
  }
 

document.myform.action="updateuser.php"
document.myform.submit()
}




function Validate () 
{
	em_val = /^\w+@\w+(\.\w+?)/
	if ( (myform.firstname.value == "")||(myform.lastname.value == "")||(myform.email.value == "")||(myform.password.value == "")||(myform.password2.value == "") )
		 {
				alert ('Please fill in the boxes with the sign *');
				return false;
		}
		else
		 if (em_val.test(document.myform.email.value)==false) {
 			alert("invalid email address")
			myform.email.focus();
			return (false); 
			}
		else
	  	if (myform.password2.value != myform.password.value)
  		{
   		 alert("Please enter  \"Confirm password\" as \"password\".");
   		 myform.password2.focus();
   		 return (false);
  		}   
	else 	return true;
}	
	
function gosubmit() {
if (Validate()==true)
{
document.myform.submit();
}
}

function emailval() {
em_val = /^\w+@\w+(\.\w+?)/
if (document.psend.email.value == "" )
{ alert("Please enter an e-mail in the box");
	psend.email.focus();
	return (false);
}
	else
if (em_val.test(document.psend.email.value)==false) 
	{
	 		alert("invalid email address")
			psend.email.focus();
			return (false); 
	} else {
 	document.psend.submit();
}
}

//pop up image
function showPicture(pictureToShow, windowTitle)
{
	 PicWin=window.open("","PictureViewer",'status=0,scrollbars=no,resizable=yes,width=100,height=100,screenX=20,screenY=20,top=20,left=20');
	 PicWin.document.open();
	 PicWin.document.writeln('<html><head><title>' + windowTitle + '</title></head>');
	 PicWin.document.writeln('<body topmargin="0" onload="this.focus()" bgcolor="white" leftmargin="0" link="#808080" vlink="#808080">');
	 PicWin.document.writeln('<table border="0" width="100%" height="100%"><tr><td align="center" valign="middle">');
	 PicWin.document.writeln('<img onLoad="window.opener.resizeWindow(50,70,100);" border="1" src="'+ pictureToShow +'">');
	 PicWin.document.writeln('<br><a style="font-size:11px;font-family:verdana;" href="javascript:this.close()">Close</a></body></html>');
	 PicWin.document.close();
}
function resizeWindow(Hborder, Vborder, millisecs)
{     
	 setTimeout("PicWin.resizeTo(PicWin.document.images[0].width + " + Hborder + ", PicWin.document.images[0].height + " + Vborder + ");", millisecs);
}
//end

//pop up
function crownpop(mypage){
	var h = 450;
	var w = 500;
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars=no,';
	settings +='resizable=no ,';
	settings +='status=yes ,';
	win=window.open(mypage,"popup",settings);
	if(parseInt(navigator.appVersion) >= 4)
		{win.window.focus();}
}

