function swapImg(sImgName,sImgSrc)
{
  document.images[sImgName].src = sImgSrc;
}


function popupWin(url, name, height, width, top, left) 
{
  PopWin=window.open(url, name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left);
  return PopWin;
}


function deadlink() 
{
  alert("This link is not implemented in the prototype");
}


function STGpopupWin(url, name, height, width, top, left) 
{
  PopWin=window.open(url, name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left);
  PopWin.focus();
  return PopWin;
}


function STGLaunchPopup(url)
{
  STGpopupWin(url, "Popup", 350,500,150,200)
}


function STGLaunchGlossary(url, height, width)
{
  STGpopupWin(url, "glossary", height, width, (600 - height)/2, (800 - width)/2);
}


function STGInsertBackToTop()
{
  document.write("<img src='images/dblArrowUp.gif' align='absmiddle' border='0'>");
}


function STGDoURL(sURL)
{
  if (window.opener != null)
  {
    window.opener.location = sURL;
    window.close();
  }
  else
  {
    window.location = sURL;
  }
}


function CheckCodes (e,theform)
{
  var code;
  var nav4 = window.Event ? true : false;
  
  if (nav4)
    code = e.which
  else
    code = e.keyCode;
    
  if (code == 13)
  {
    SubmitForm(theform);
    return false;
  }
  else
  {
    return true;
  }
}


function SubmitForm (obj)
{
  obj.submit();
}


function SubmitQuickForm (obj)
{
  obj.submit();
}


function validateEmailForm()
{
	var msg;
	var msgflag;
	msgflag = "false";
	msg="The following fields require values:\n";

	if (document.forms[0].Name.value=="")
	{
		msg = msg + "Name\n";
		msgflag = "true";
	}
	if (document.forms[0].Email.value=="")
	{
		msg = msg + "Email Address\n";
		msgflag = "true";
	}
  if(document.forms[0].UserNeed)
  {
    // this is the imlost.jsp page so make UserNeed mandatory
    if (document.forms[0].UserNeed.value=="")
    {
      msg = msg + "What were you trying to find?\n";
      msgflag = "true";
    }
    else
    // this is the feedback.jsp page so make userscomment mandatory
      if (document.forms[0].UsersComment.value=="")
      {
        msg = msg + "Comments\n";
        msgflag = "true";
      }
  }
	
	
	if(document.forms[0].Email.value  != ""){
     	var estr = new String(document.forms[0].Email.value);
    		var atindex = estr.indexOf("@");
     	if(atindex ==-1)
		{
			alert("You must enter a valid Electronic Mail Address")
			document.forms[0].Email.focus();
			document.forms[0].Email.select();
			return false;
         }
	}
	
	
	if (msgflag=="false")
		return true;
	else
	{
		alert(msg);
		return false;
	}
}