$(document).ready(function() {
  
/* CACHE IMAGES
 var images = [ 'image1.jpg', 'image2.png', 'image3.gif' ];
  jQuery.each(images, function(i) {
    images[i] = new Image();
    images[i].src = this;
  });
*/
  
$('#slider').codaSlider({
   dynamicTabs: false,
   dynamicArrows: false,
   autoSlide: true
});
  
jQuery.validator.addMethod("phoneUS",  function(phone_number, element) {
  phone_number  = phone_number.replace(/\s+/g, "");
  return  this.optional(element) || phone_number.length > 9 &&  phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);}, "Invalid Phone number");
  $("#cForm").validate({
    invalidHandler: function(e, validator) {
      var errors = validator.numberOfInvalids();
      if (errors) {
        var message = errors == 1
          ? '</strong>Oops!</strong> there is <strong>1</strong> error. It has been highlighted above.'
          : '<strong>Oops!</strong> there are <strong>' + errors + '</strong> errors. They have been highlighted above';
        $("div#errorContainer").html(message);
        $("div#errorCOntainer").show();
      } else {
        $("div#errorContainer").hide();
      }
    },
    rules:{ phone:{ 
        required:true,
         phoneUS:true
    }}
});
    
jQuery.validator.addMethod("sbBt", function(field,element){if(element.value!==""){window.location = "http://"+window.location.host+"/thanks/";return false;}else{return true;}},"Thank You");
  
$('#slideshow').cycle({ fx: 'fade', random: 1 });
   $("#jsddm li a[href*=/service-center/client-access/]").attr('target', '_blank').attr('href', 'https://pciaonline.sharefile.com/');  
});

$(document).ready(function () {
  fnLeadSrcCheck();
  $('#homeProducts').dropDownMenu({
  timer: 1000,
  parentMO: 'parent-hover',
  childMO: 'child-hover1'
});  });

