// the sweet news slideshow
jQuery(function() {
    
	$('#slideshow')
	.before('<div id="slidenav">')
	.cycle({ 
    	fx:     'fade', 
    	speed:   1400, 
    	timeout: 9000,  
    	pause:   1,
    	next: '#slideshow',
    	pager: '#slidenav'
	
	});
});

// slick nav time
jQuery(document).ready(function() { 
        jQuery('ul#nav_591134').supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    47,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish({
        	delay:       1000,                            // one second delay on mouseout 
            animation:   {opacity:'show'},  // fade-in and slide-down animation 
            speed:       'fast',                          // faster animation speed 
            autoArrows:  false,                           // disable generation of arrow mark-up 
            dropShadows: false                            // disable drop shadows 
        
        });  // call supersubs first, then superfish, so that subs are 

}); 




// FORM Love
$(function () {

$.fn.hint = function (blurClass) {
  if (!blurClass) { 
    blurClass = 'blur';
  }
    
  return this.each(function () {
    // get jQuery version of 'this'
    var $input = $(this),
    
    // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = $(this.form),
      $win = $(window);

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass);
      }
    }

    // only apply logic if the element has the attribute
    if (title) { 
      // on blur, set value to title attr if text is blank
      $input.blur(function () {
        if (this.value === '') {
          $input.val(title).addClass(blurClass);
        }
      }).focus(remove).blur(); // now change all inputs to title
      
      // clear the pre-defined text when form is submitted
      $form.submit(remove);
      $win.unload(remove); // handles Firefox's autocomplete
    }
  });
};

});

//ACTIVATE THE INPUT SWEETNESS
$(function(){ 
	// find all the input elements with title attributes
	$('input[title!=""]').hint();
});

// DATE FIXER ...courtesy http://addisonhalldesign.com/
$(function() {
	$('span.date').each(function() {
		var dateArray = $(this).text().split('-');
		var newDay = dateArray[0];
		var newMonth = dateArray[1];
		var newYear = dateArray[2];
		var newDateFormat = "" + newMonth + " " + newDay + ", " + newYear;
	$(this).html(newDateFormat);
	});
});
