/**
 * Sets up a password placeholder from to input fields.
 * e.g
 * <input id="password-clear" type="text" value="Password" class="login-field" size=40/>
   <input id="password-password" type="password" name="password" class="login-field" size=40 value=""/>
 *
 * By calling initPasswordPlaceholder('password-clear','password-password') the password-clear input field 
 * will be displayed and when clicked on the other input field "password-password" will be displayed and
 * focused on and the initial field will lose focus and will be hidden. 
 *  
 * @param viewableId the id of the input text field that has a readable value
 * @param passwordId the id of the input password field
 * @author adrian.oros@iquestint.com 
 */
function initPasswordPlaceholder(viewableId, passwordId) {
  $('#' + viewableId).show();
  $('#' + passwordId).hide();
  
  $('#' + viewableId).focus(function() {
    $('#' + viewableId).hide();
    $('#' + passwordId).show();
    $('#' + passwordId).focus();
  });
  $('#' + passwordId).blur(function() {
    if ($('#' + passwordId).val() == '') {
      $('#' + viewableId).show();
      $('#' + passwordId).hide();
    }
  });
}

function validateEmail(email) {
 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
 return correct = reg.test(email); 
}
