/*--------------------------------------------------------------------------------
個別処理関数
ライブラリ：prototype.js
--------------------------------------------------------------------------------*/
//プルダウンメニュー
function pdmenu(itemid) {
    var showpdmenu = $('showpdmenu');
    var html = '';

    if(itemid == '2') {
        //html = '<div id="subpdmenubar">&nbsp;</div>';
        //html = '<a class="subpdmenu" href="index.php?pn=tour&amp;y=2006" title="2006年秋ツアー">2006年秋ツアー</a>';
        //html += '<a class="subpdmenu" href="index.php?pn=tour&amp;y=2007" title="2007年春ツアー">2007年春ツアー</a>';
        //Element.update(showpdmenu,html);
        var elem = $('pdmenu' + itemid);
        var retlefttop = Position.cumulativeOffset(elem);
        var retheight = Element.getHeight(elem);
/*
        showpdmenu.style.left = retlefttop[0];
        showpdmenu.style.top = retlefttop[1] + retheight + 1;
        showpdmenu.style.visibility = 'visible';
*/
        Element.setStyle(showpdmenu, {
            'left':retlefttop[0],
            'top':retlefttop[1] + retheight + 1,
            'zIndex':'100',
            'visibility':'visible'
        });
        new Effect.Opacity(showpdmenu,{from:0.5,to:1,duration:0.3});
/*
        dragrop = new Draggable("showpdmenu", {
            handle: "subpdmenubar"
        });
*/
    } else if(itemid == '0') {
        //html = '';
        //Element.update(showpdmenu,html);
        showpdmenu.style.visibility = 'hidden';
/*
        if(Element.visible(showpdmenu)) {
            new Effect.Opacity(showpdmenu,{
                from:1,
                to:0.1,
                duration:0.1,
                afterFinishInternal: function(effect) {
                    html = '';
                    Element.update(showpdmenu,html);
                    showpdmenu.style.visibility = 'hidden';
                }
            });
        }
*/
    }
}

/*--------------------------------------------------------------------------------
ページ読み込み時の処理
a.navi要素にイベントハンドラ（onmouseover,onmouseout）を追加
ライブラリ：prototype.js
--------------------------------------------------------------------------------*/
window.onload = function() {
    var anavi = document.getElementsByClassName("navi");
    if(anavi.length > 0) {
        anavi.each(
            function(item) {
                var itemid = item.id;
                item.onmouseover = function(){pdmenu('0');}
                //item.onmouseout = function(){pdmenu('0');}
                if(itemid == 'pdmenu2') {
                    item.onmouseover = function(){pdmenu('2');}
                }
            }
        );
    }
}


