function initRollOverImages() {
  var image_cache = new Object();
  $("img.swap").each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
}

$(document).ready(initRollOverImages);



/*----------------
SCROLL
----------------------------------------------------*/

$(function() {  
  $('a.page_top').click(function() {  
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')  
      && location.hostname == this.hostname) {  
       var $target = $(this.hash);  
       $target = $target.length && $target  
         || $('[name=' + this.hash.slice(1) +']');  
       if ($target.length) {  
         var targetOffset = $target.offset().top - 20;  
         $('html,body')  
           .animate({scrollTop: targetOffset}, 1000);  
         return false;  
       }  
     }  
   });  
 }); 

/*----------------
TAB
----------------------------------------------------*/
$(document).ready(function() {
  $("#tab_menu a").click(function() {
    $($("#tab_menu a.sel").attr("href")).hide();
    $("#tab_menu a.sel").removeClass("sel");
    $(this).addClass("sel");
    $($(this).attr("href")).fadeIn("fast");
    return false;
  });
});

