jQuery(document).ready(function() {

	slide_bg();
	start_auto_slide();

	jQuery('a.external').click(function(e){
		jQuery(this).blur()
		window.open($(this).attr('href'));
		return false;  // prevent default action
	});
	
	jQuery("ul.sf-menu").supersubs({ 
      minWidth:    12,   // minimum width of sub-menus in em units 
      maxWidth:    27,   // 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({
			autoArrows:  false
	});  // call supersubs first, then superfish, so that subs are 
                   // not display:none when measuring. Call before initialising 
                   // containing tabs for same reason. 
  
});

function start_auto_slide() {
	jQuery(document).everyTime(8000, 'auto_slide', function() {
		slide_bg();
	});
}

function slide_bg() {
	jQuery('#moving_gradient')
		.stop()
		.animate({backgroundPosition: '-1600px bottom'}, {duration: 4000})
		.animate({backgroundPosition: '-500px bottom'}, {duration: 4000})
}
