$(document).ready(function() {
  
  $(".top_content_box").hide();
      $("#top_01").show();
  
      function wImgOver(e, force) {
            if (force == false && $(e).parent().hasClass("current")) {
              return;
            }
            
            var t = $(e).attr("src");
            $(e).attr("src", $(e).attr("rel"));
            $(e).attr("rel", t);
            
      }
      
      $("#top_content_menu li a img")
        .mouseover(function() {wImgOver($(this), false);})
        .mouseout(function() {wImgOver($(this), false);})
        .click(function() {wImgOver($(this), true);});
      
      wImgOver($("#top_content_menu li a.current img"), true);
      

      $(".tpm01").click(function(){
        $(".top_content_box").hide();
        $("#top_01").show("slow");
        $("#top_content_menu a").removeClass("current");
        wImgOver($("#top_content_menu li a img"), true);
        $(".tpm01 a").addClass("current");
      });
      $(".tpm02").click(function(){
        $(".top_content_box").hide();
        $("#top_02").show("slow");
        $("#top_content_menu a").removeClass("current");
        wImgOver($("#top_content_menu li a img"), true);
        $(".tpm02 a").addClass("current");  
      });
      $(".tpm03").click(function(){
        $(".top_content_box").hide();
        $("#top_03").show("slow");
        $("#top_content_menu a").removeClass("current");    
        $(".tpm03 a").addClass("current");
      });
      $(".tpm04").click(function(){
        $(".top_content_box").hide();
        $("#top_04").show("slow");
        $("#top_content_menu a").removeClass("current"); 
        $(".tpm04 a").addClass("current");
      }); 
                   
  /*
   $(".top_content_box").hide();
   $("#top_01").show();
   
   $("#top_content_menu a").click(function() {
     var mIdx = $("#top_content_menu a").index(this);
     
     var menuElements= $("#top_content_menu a img");
     var menu = new Array();
     
     for (i =0; i< menuElements.length; i++) {
        menu[i]  = new Array($(menuElements[i]).attr("rel"), $(menuElements[i]).attr("href"));
     }
      
    $("#top_content_menu a img").attr("src", menu[mIdx][0]);
     
    });
    */
   
  
});

