// Global Variable Declaration
document.mapImgs = new Object;
siteURL = 'http://www.go-nagano.net/tw';

// Preload area map images
function preloadMaps() {
  var o = document.mapImgs;
  o['1'] = new Image;
  o['1'].src = siteURL + '/themes/custom/images/sidemap_northern.gif';
  o['2'] = new Image;
  o['2'].src = siteURL + '/themes/custom/images/sidemap_matsumoto.gif';
  o['3'] = new Image;
  o['3'].src = siteURL + '/themes/custom/images/sidemap_eastern.gif';
  o['4'] = new Image;
  o['4'].src = siteURL + '/themes/custom/images/sidemap_suwa.gif';
  o['5'] = new Image;
  o['5'].src = siteURL + '/themes/custom/images/sidemap_kisovalley.gif';
  o['6'] = new Image;
  o['6'].src = siteURL + '/themes/custom/images/sidemap_southern.gif';
  o['7'] = new Image;
  o['7'].src = siteURL + '/themes/custom/images/sidemap_allon.gif';
  o['all_off'] = new Image;
  o['all_off'].src = siteURL + '/themes/custom/images/sidemap_alloff.gif';
}

// Flip the area map image
function flipAreaMap(area) {
  var o, n = 'areamap';
  o = document[n]
      ? document[n]
      : ( document.all && ! window.mmIsOpera )
        ? document.all[n]
        : document.getElementById
          ? document.getElementById( n )
          : null;
  if ( o != null ) {
    if ( document.mapImgs.hasOwnProperty(area) ) {
      o.src = document.mapImgs[area].src;
    } else {	// If not initialized yet
      setTimeout("flipAreaMap('" + area + "');",500);
    }
  }
}

// Change Image Source
function chgImgSrc(id, source) {
 obj = document[id]
       ? document[id]
       : (document.all && ! window.mmIsOpera)
         ? document.all[id]
         : document.getElementById
           ? document.getElementById(id)
           : null;
 if (obj != null) {
  obj.src = source;
 }
}

