function isEmailAddr(email)
				{
				  var result = false
				  var theStr = new String(email)
				  var index = theStr.indexOf("@");
				  if (index > 0)
				  {
				  	var pindex = theStr.indexOf(".", index);
				  	if (pindex > 0) {
						result = true;
					}
				  }
				  return result;
				}
				
function validate(theForm)
		{	
		// validates logon form
                  if (theForm.Email.value == "")
                  {
                    alert("Please enter a value for the \"email\" field.");
                    theForm.Email.focus();
                    return (false);
                  }

                  //if (!isEmailAddr(theForm.Email.value))
                  //{
                  //  alert("Please enter a complete email address in the form: yourname@yourdomain.com");
                  //  theForm.Email.focus();
                  //  return (false);
                  //}

                  if (theForm.Email.value.length < 1)
                  {
                    alert("Please enter at least 1 characters in the \"email\" field.");
                    theForm.Email.focus();
                    return (false);
                  }
                //if (theForm.PWD.value == "")
                //{
                //alert("Please enter a value for the \"Password\" field.");
                //theForm.PWD.focus();
                //return (false);
                //}
			
		return true;
		theForm.submit();
	}
	
	
	function validate1(theForm1)
	{
		// validates registration form
                  if (theForm1.FName.value == "")
                  {
                    alert("Please enter a value for the \"First Name\" field.");
                    theForm1.FName.focus();
                    return (false);
                  }
                  if (theForm1.LName.value == "")
                  {
                    alert("Please enter a value for the \"Last Name\" field.");
                    theForm1.LName.focus();
                    return (false);
                  }
                  if (theForm1.Job_Role.value == "")
                  {
                    alert("Please select a value for the \"Job Role\" field.");
                    theForm1.Job_Role.focus();
                    return (false);
                  }
                  if (theForm1.Location.value == "")
                  {
                    alert("Please select a value for the \"Location\" field.");
                    theForm1.Location.focus();
                    return (false);
                  }
                  if (theForm1.Department.value == "")
                  {
                    alert("Please select a value for the \"Department\" field.");
                    theForm1.Department.focus();
                    return (false);
                  }
             /*     if (theForm1.FullName.value == "")
                  {
                    alert("Please enter a value for the \"Full Name\" field.");
                    theForm1.FullName.focus();
                    return (false);
                  }
                  if (theForm1.Org.value == "")
                  {
                    alert("Please enter a value for the \"Organization\" field.");
                    theForm1.Org.focus();
                    return (false);
                  } */
                  if (theForm1.Email.value == "")
                  {
                    alert("Please enter a value for the \"email\" field.");
                    theForm1.Email.focus();
                    return (false);
                  }
                  //if (!isEmailAddr(theForm1.Email.value))
                  //{
                  //  alert("Please enter a complete email address in the form: yourname@yourdomain.com");
                  //  theForm1.Email.focus();
                  //  return (false);
                  //}

                  if (theForm1.Email.value.length < 1)
                  {
                    alert("Please enter at least 1 characters in the \"email\" field.");
                    theForm1.Email.focus();
                    return (false);
                  }
                  if (theForm1.Email2.value == "")
                  {
                    alert("Please enter a value for the \"re-type email\" field.");
                    theForm1.Email2.focus();
                    return (false);
                  }

                  //if (!isEmailAddr(theForm1.Email2.value))
                  //{
                  //  alert("Please enter a complete email address in the form: yourname@yourdomain.com");
                  //  theForm1.Email2.focus();
                  //  return (false);
                  //}

                  if (theForm1.Email2.value.length < 1)
                  {
                    alert("Please enter at least 1 characters in the \"re-type email\" field.");
                    theForm1.Email2.focus();
                    return (false);
                  }
                  if (theForm1.Email.value != theForm1.Email2.value)
                  {
                    alert("Email addresses do not match.");
                    theForm1.reset();
                    theForm1.Email.focus();
                    return (false);
                  }
		// validate new password if in edit mode
		if (theForm1.LoginType.value == "edit") {
			if (theForm1.pwd.value.length < 1) {
				alert("Please enter at least 1 characters in the \"password\" field.");
				theForm1.pwd.focus();
				return (false);
			}
			if (theForm1.pwd.value != theForm1.pwd2.value) {
				alert("Passwords do not match.");
				theForm1.reset();
				theForm1.Email.focus();
				return (false);
			}
		}
		theForm1.submit();
	}
				
function toggleLayer( whichLayer )
{  
var elem, vis;  
if( document.getElementById ) 
// this is the way the standards work    
	elem = document.getElementById( whichLayer );  
else if( document.all ) 
// this is the way old msie versions work      
	elem = document.all[whichLayer];  
else if( document.layers ) 
// this is the way nn4 works    
	elem = document.layers[whichLayer];  
	vis = elem.style;  
// if the style.display value is blank we try to figure it out here  
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)    
	vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';  
	vis.display = (vis.display==''||vis.display=='block')?'none':'block';
	
}

function HandleReportPrint() {
				window.focus();
				window.print();
			}
