var $j = jQuery.noConflict();

$j(document).ready(function () {
  Date.firstDayOfWeek = 1;
  Date.format = 'mm/dd/yyyy';
  $j(function()
  {
    $j('.dp-applied').datePicker({startDate: '01/01/1970'})
  });

  //Form Validation
  //For required field, add 'required' to class
  $j('form').each(function() { 
    if (!$j(this).hasClass("no_validate")) {
      $j(this).validate(); 
    }
  });

  $j('*').click(function() {
    $j('#sa_flash').hide();
  });

  $j("input, select").focus(function() {
    var n = $j(this).next();
    if (n.hasClass("inline-errors")) {
      n.css({fontSize: '12px'});
    }
  });

  $j("input, select").blur(function() {
    var n = $j(this).next();
    if (n.hasClass("inline-errors")) {
      n.css({fontSize: '0px'});
    }
  });
  $j(".phone").change(function() {
    this.value = formatPhone(this.value);
  });
});
