//
//  -- Harley-Davidson --
//  onloadイベント関数（ニューモデル各ファミリーページ用）
//  要prototype.js
//  要effects.js(script.aculo.us)
//
//  2008/09/29 (c) Tetra▽unit
//

window.onload =
function() {
  // エレメントオブジェクトの取得
  var rollScreen = document.getElementById('rollScreen');
  var toggleSwitch = document.getElementById('toggle');
  // フラグの初期化
  var showFlag = '';
  // イベントハンドラへアタッチ
  toggleSwitch.onclick =
  function() {
    // フラグがnullならスクリーンをアップし、▼にする
    if(!showFlag) {
      new Effect.Morph(rollScreen, {style:'bottom:0', duration:0.4, afterFinish:function(){toggleSwitch.style.background = 'url(../common/parts/roll_up_down.png) right -20px no-repeat';}});
//      rollScreen.morph('bottom:0;', {duration:0.4, afterFinish:function(){toggleSwitch.style.background = 'url(../common/parts/roll_up_down.png) right -20px no-repeat';}});
      showFlag = 1;
    } else
    // フラグが１ならスクリーンをダウンし、▲にする
    if(showFlag) {
      new Effect.Morph(rollScreen, {style:'bottom:-310px;', duration:0.4, afterFinish:function(){toggleSwitch.style.background = 'url(../common/parts/roll_up_down.png) right top no-repeat';}});
//      rollScreen.morph('bottom:-310px;', {duration:0.4, afterFinish:function(){toggleSwitch.style.background = 'url(../common/parts/roll_up_down.png) right top no-repeat';}});
      showFlag = '';
    }
  }
}
