

(function($){
  // Preloading Roll Over Images
  function preloadRollOverImages() {
    var o = new Object();
    $('img.swap').each(function(i) {
      var src  = this.src,
          sep  = src.lastIndexOf('.'),
          src2 = src.substr(0, sep)+'_ov'+src.substr(sep, 4);
      o[src]     = new Image();
      o[src].src = src2;
      $(this).hover(
        function() { this.src = src2; },
        function() { this.src = src; }
      );
    });
  }

  // window.onload
  $(document).ready(function(){
    preloadRollOverImages();

    $.smoothAnchors('fast');
    
    // megamenu
    var SelfLocation = window.location.href.split('?');
    switch (SelfLocation[1]) {
      case "justify_right":
      $(".megamenu").megamenu({ 'justify':'right' });
      break;
      case "justify_left":
      default:
      $(".megamenu").megamenu();
    }
  });
		
		//Background Fade in test
		$(document).ready(function(){
		  $("#branding").css("opacity", "0");
				$("#branding").css("filter","alpha(opacity=0)");
				$("#branding").animate({ opacity: 1 }, 2000 );
		});
		
})(jQuery);

