jQuery(function(){

   var basepath = function(){
      if (document.location.protocol == "https:")
         return "https://ssltrustgate.com/hittours.net/diving/";
      else
         return "http://www.hittours.net/diving/"; }
   
   var suffix = function(obj){
      if (obj.hasClass("in") && is_here(obj)) return "_in";
         else return "";}
   
   var is_here = function(obj){
      return (obj.attr("id").match(/bt_(.+?)_n/) &&
              (location.href.match(obj.attr("id").match(/bt_(.+?)_n/)[1]) ||
               location.href.match(
                                   function(){
                                      switch (obj.attr("id").match(/bt_(.+?)_n/)[1]){
                                         case "license":
                                         return "\/3_";
                                         case "fun":
                                         return "\/2_";
                                         case "taiken":
                                         return "\/1_";}}())));}
         
   
   jQuery(".jgif").each(function(){
      jQuery(this).jQIR( suffix(jQuery(this)) + ".gif", basepath() + "images/header/" );});
   jQuery(".jpng").each(function(){
      jQuery(this).jQIR( suffix(jQuery(this)) + ".png", basepath() + "images/header/" );});
   jQuery(".jjpg").each(function(){
      jQuery(this).jQIR( suffix(jQuery(this)) + ".jpg", basepath() + "images/header/" );});   
   
});
