// common.js

function logIn() 
{ 
  document.location = 'login.html';   	
}  

/** is widget in a valid state */
function isValid(widgit)
{
  var valid = false;
  if(widgit.type == "text" && widgit.isValid() || 
     widgit.type == "password" && widgit.isValid() || 
     widgit.type == "checkbox" && widgit.checked) 
  {
    valid = true;
  }
  return valid;
}

/** highlight label if field still required */ 
function isStillRequired(widgit) 
{  
  var className = "";
  if(!isValid(widgit)) 
     className = "required"; 

  dojo.byId(widgit.name+"Row").className = className;
}

/* Create a tooltip next to the field
 * that has validation errors */
function createErrorToolTip(fieldName, message)
{  
  /* destroy the ttoltip if it already exists then create a new one */
  var toolTipId = fieldName + "Tip";
  var oldTip = dijit.byId(toolTipId);
  if(oldTip != null)
  {
    oldTip.destroy();
  }
  var tip = new dijit.Tooltip({ id:toolTipId, label:message, connectId:[fieldName] });
  var div = dojo.byId(fieldName);
  div.style.display = "";
}

