$(document).ready(function(){

/* DISTRIBUTOR LOGIN */
      /* http://www.developertutorials.com/tutorials/ajax/getting-started-with-ajax-in-jquery-8-05-11/page3.html */
      jQuery.ajaxSettings.traditional = true;
      $('#tryagain').hide();
      $("#login_form").submit(function() {
            var unameval = $("#username").val();
            var pwordval = $("#password").val();
            $.post("/services/logemin_a.php", { user: unameval, pass: pwordval },
            function(data) {
                 if (data.indexOf("<!-- GOOD -->")!=-1) {
                        $('#login_form input').hide();
                        $('#login_form button').hide();
                        $('#lillinks').hide();
                        $('#status').load('/assets/inc/dismenu01.php');
                        } else {
                              $('#status').prepend('<a href="." title="Not Valid Info" id="tryagain">TRY AGAIN &gt;</a>');
                              $('#username').val('Customer ID');
                              $('#password').val('Zip Code');
                  }
            });
            return false;
      });


/*  hide/show login distributortop div */
    $('#distributortop').hide();
    $('#lillinks').click(function(){
        $('#distributortop').slideToggle();
            $("#tryagain").remove();

      $('#username').focus(function () {
            $("#tryagain").remove();
            if($(this).val() == 'Customer ID') $(this).val('');
            });
      $('#username').blur(function () {
            if($(this).val() == '') $(this).val('Customer ID');
            });
      $('#password').focus(function () {
            $("#tryagain").remove();
            if($(this).val() == 'Zip Code') $(this).val('');
            });
      $('#password').blur(function () {
            if($(this).val() == '') $(this).val('Zip Code');
            });
    });
   });
