$(document).ready(function () {
  
  $('#sHeader').keydown(function (e) {
        if (e.keyCode == 13) {
          var term = $('#sHeader').val();
          var hostname = window.location.hostname;
          window.location.href = '/search?q=' + escape(term);
        }
    });
  /* $('input[type="text"]').each(function(){ */
  $('input[name="sHeader"]').each(function(){    
   
      this.value = $(this).attr('title');
      $(this).addClass('text-label');
   
      $(this).focus(function(){
          if(this.value == $(this).attr('title')) {
              this.value = '';
              $(this).removeClass('text-label');
          }
      });
   
      $(this).blur(function(){
          if(this.value == '') {
              this.value = $(this).attr('title');
              $(this).addClass('text-label');
          }
      });
  });

  /* Ajax Busy Message */
  $('#busyMsg').dialog({ autoOpen: false, title: 'Working...'});

  $('#busyMsg').ajaxStart(function() {
    $(this).show();
  }).ajaxStop(function(){
    $(this).hide();    
  });

  /* Manage ajax/jquery posting */
  $.post("newslettermgmt");
  
  /* Newsletter Fields */
  $("#getSubStartDate").datepicker({ dateFormat: 'yy/mm/dd' });
  $("#getSubStartDate").datepicker('setDate', '-1d');
  $("#getSubStartDate").removeClass('text-label')  
  $("#getSubEndDate").datepicker({ dateFormat: 'yy/mm/dd' });
  $("#getSubEndDate").datepicker('setDate', '-1d');
  $("#getSubEndDate").removeClass('text-label')

  /* Homepage slidedhow */
  $('#slides').slides({
      effect: 'fade',
      preload: true,
      preloadImage: 'img/loading.gif',
      play: 5000,
      pause: 2500,
      hoverPause: true
  });    
});



