/**
 * $LastChangedDate$
 * $Rev$
 * $Author$
 * $HeadURL$
 */


function submit_on_enter(form, e) {
    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
         form.submit();
         return false;
    }
 }

function plainTextProcess(el, state, default_val) {
    //setup the default value for this input
    if (!default_val) {
        default_val = el.defaultValue;
    }
    if (state=="focus") {
        if (el.value==default_val)  {
              el.value = '';
                el.select();
          }
    } else if (state=="blur") {
        if (el.value =='')  {
              el.value = default_val;
          }
    }
}

function focusPassword() {
   var newObject = document.createElement('input');
    var el = document.getElementById('auth_user_password');
    var blurFunction = blurPassword();
    if (el.value==el.defaultValue)  {
          if(el.name) newObject.name = el.name;
          if(el.id) newObject.id = el.id;
          if(el.className) newObject.className = el.className;
          newObject.onblur = blurPassword;
          newObject.type = 'password';
          newObject.value = '';
          el.parentNode.replaceChild(newObject,el);
          newObject.select();
          newObject.focus();
    }

}

function blurPassword() {
   var newObject = document.createElement('input');
    var el = document.getElementById('auth_user_password');
    if (el.value =='')  {
        if(el.name) newObject.name = el.name;
        if(el.id) newObject.id = el.id;
        if(el.className) newObject.className = el.className;
        newObject.onfocus = focusPassword;
        newObject.onblur = blurPassword;
        newObject.type = 'text';
        newObject.defaultValue = 'Password';
        newObject.value = 'Password';
        el.parentNode.replaceChild(newObject,el);
    }

}
