(function($) {

  window.application = {

    init: function() {
      application.applyPngFix();
      application.buttonHoverState();
      application.enableTitleHints();
      application.roundCorners();
      application.cycleHomepageSlideshow();
      application.externalLinks();
    },

    applyPngFix: function() { $(document).pngFix(); },

    enableTitleHints: function() { $('input[title!=""]').hint(); },

    buttonHoverState: function() {
    	if( !$.browser.mozilla || !$.browser.safari ) return;

  	  $('.buttonOver').each(function() {
        $(this).hover(function() {
          $(this).stop().animate({ opacity: 0.5 }, 200);
        },

        function() {
          $(this).stop().animate({ opacity: 1 }, 200);
        });
      });
    },

    roundCorners: function() {
    	$('.widget').corner("5px");
    	$('.widget-stroke').corner("5px");
    	$('.tab-widget-top, .tab-widget-inner-top').corner("top 5px");
    	$('.tab-widget-content, .tab-widget-content-stroke').corner("bottom 5px").corner("tr 5px");
    },
    
    cycleHomepageSlideshow: function() {
      $('.slide-show').cycle({ 
        prev:    '.go-left', 
        next:    '.go-right', 
        speed:   1000,
        timeout: 10000
      });
    },

    externalLinks: function() {
      $("a[rel='external']").attr('target', '_blank');
    }

  };

  $(application.init);

})(jQuery);
