function scrollPage(id) {
  new Effect.ScrollTo(id, {fps:60, duration: 1.2, decay: 0.4});
}

function initPic (img) {
  if (img.width > img.height) {
    Element.addClassName(img.parentNode, "horizontal");
  } else {
    Element.addClassName(img.parentNode, "vertical");
  }
}
//  alert("a")

function showPic (whichpic) {
  var item = $('itemDetailImage'); 
  Element.addClassName(item, "show"); 
  var rel = whichpic.getAttribute("rel");
  var cls = whichpic.getAttribute("class");
  $('idi').src = rel;
  
//  var cls = Element.classNames('idi')
  
  Element.addClassName($('idi'), cls);
  return true;
}

function hidePic () {
  var item = $('itemDetailImage'); 
  Element.removeClassName(item, "show"); 
  var item2 = $('idi'); 
  new Effect.Appear(item2);
}

function loadStage(base, id) {
  var param = 'update=detail';
  var url = base+'/'+id+'.html';

  var myAjax = new Ajax.Updater
    (
     {success: 'detail'},
     url,
     {
       parameters: param,
       onFailure: reportError,
       evalScripts: true
     });
}

function reportError() {

}

function showItem(num) {
  if (!$('items')) {
    return;
  }
  var items = $A($('items').getElementsByTagName('li'));
  items.each(function(li, i){
    if (i == num) {
      Element.show(li);
    } else {
      Element.hide(li);
    }
  });
  Element.setStyle($('items'), {display:'block'});
}


function showMapInfo(area){
  var area_array = ["hokkaido", "tohoku", "kanto", "chubu", "hokuriku", "kansai", "chugoku", "shikoku", "kyushu"];
  var areas = area_array.length;
  for (var i = 0; i < areas; i++) {
    Element.removeClassName(area_array[i], 'show');
  }
  Element.addClassName(area, 'show');
  var so = new SWFObject("../swf/movie/player.swf", "flash", "342", "284", "8", "#ffffff");
  so.addParam("quality", "best");
  so.addParam("wmode", "transparent");
  so.addVariable("flaPath", "../swf/movie/");
  if (area == "kanto") {
    so.addVariable("type", "movie");
  } else {
    so.addVariable("type", "image");
  }
  so.addVariable("element", "a_social_2_" + area);
  so.addVariable("mov", "a_social_2_" + area);
  so.addVariable("lang", "jp");
  so.write("movie");
}

function relTags() {
  if (document.getElementsByTagName) {
    var anchors = document.getElementsByTagName("a");
    for (var loop = 0;loop < anchors.length;loop++) {
      var anchor = anchors[loop];
      if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
        anchor.target = "_blank";
      } else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "popup") {
        anchor.onclick = function () {
        openPopUpWindow(this);
        return false;
        };
      }
    }
  }
}


//addOnLoadListener(relTags);
//addOnLoadListener(hookHover);
//addOnLoadListener(toolTip);

