jQuery(function($){
  /* ---------------
   * install the code to allow the login field labels to float over their
   * respective fields (to act as placeholders)
   * 
   */
  function toggleLabel( id, visible ) {
    $("label.overlabel-apply[for='" + id + "']").toggleClass("hidden", !visible);
  }
  
  $("label.overlabel[for]").each(function(){
    var id = $(this).attr("for");
    var fld = $("#" + id);
    
    // if the label's for doesn't point to a real field, skip
    if( !id || fld.length === 0 ) return;
    
    // activate the label
    $(this).addClass("overlabel-apply").removeClass("overlabel");
    
    // hide the label if the field isn't empty
    if( fld.val() ) toggleLabel(id, false);
    
    // install the necessary event handlers
    $(this).click(function(){ fld.focus(); });
    fld.focus(function(){ toggleLabel(this.id, false); });
    fld.blur(function(){ if( !$(this).val() ) toggleLabel(this.id, true); });
  });
});  

$(document).ready(function() {
	$('#loginbox-pw').focus();
	$('#header-login-un').focus();
	setTimeout(function() {
		$('[name=btnLogin]').focus();
		$('[name=btnLogin]').blur();
		$('#loginbox-pw').blur();
		$('#header-login-un').blur();
	}, 100);
});
