/**************
<COMMENT id="PUR" date="2003.09.08 13:52" reason="Check Password" author="pur">
  -- Created 

</COMMENT>  *********/ 
function CheckPsswd() {
  /* Warning when password = userID
    Used in OptimalView\application\hts\x_login_psd.hts
  *********/
    var userID = document.forms[0].elements["PORTALID.USERPSD.PSD"].value;
    userID = userID.toUpperCase();
    var myPsswd  = document.forms[0].elements["PORTALPASS.USERPSD.PSD"].value;
    myPsswd = myPsswd.toUpperCase();
    if(userID == myPsswd)
       alert("WARNING: "
         + "\nYour password matches to your user ID. "
         + "\nAfter login change your password using [Profile] link and [Change Password] screen."
         );

  return true;
}	


function CheckNewPsswd() {
  /* Checks Entering New Password in OptimalView\application\hts\x_cpass_psd.hts
     Be aware of changes in the x_cpass_psd.hts: 
     <FORM onSubmit=>, added idWarning, idUID, and the USER_ID.USERPSD.PSD field
  ************/
  var myWarning = "";
  
    if (document.forms[0].elements["PORTALPASS.USERPSD.PSD"].value.toUpperCase() 
        == idUID.innerHTML.toUpperCase())
      myWarning += "Your new password matches to your user ID. ";

    if (document.forms[0].elements["PORTALPASS.USERPSD.PSD"].value.length < 6)
      myWarning += "Your new password is too short. ";

    if (document.forms[0].elements["PORTALPASS.USERPSD.PSD"].value 
        != document.forms[0].elements["PORTALPASS_AGAIN.USERPSD.PSD"].value )
      myWarning += "You did not type in your new password correctly. ";

    if (document.forms[0].elements["PORTALPASS.USERPSD.PSD"].value 
        == document.forms[0].elements["PORTALPASS_OLD.USERPSD.PSD"].value )
      myWarning += "You have to change your new password. ";


    if (myWarning != "") {
      myWarning += "Please try again. <br>";
      idWarning.innerHTML = myWarning;
    }
    // alert(myWarning);
    return (myWarning=="" ? true : false );
}	

