/* $Id: bm.js 1575 2007-01-19 12:31:53Z josh $ */
var BM = {
    newWinStyle : {
        'imagePop' : [
          'imagePop',
          'scrollbars=yes,resizable=yes,status=yes,toolbar=yes,'
          + 'location=yes,menubar=yes'
          
        ],
        'newsite' : [
          '', //fill to force target name
          'scrollbars=yes,resizable=yes,status=yes,toolbar=yes,'
          + 'location=yes,menubar=yes'
        ],
        'popup' : [
          '', //fill to force target name
          'width=550,height=350,scrollbars=yes,resizable=yes,status=yes,toolbar=yes,'
          + 'location=yes,menubar=yes'
        ]
    },
    newWin : function(link,styleName,customStyle) {
        var targ = link.target || 'newsite';
        if (!styleName) styleName = targ;
        var attr = customStyle;
        if (!attr) {
            if (!styleName) styleName = 'newsite';
            attr = BM.newWinStyle[styleName] || BM.newWinStyle.popup;
        }
        targ = attr[0] || targ;
        var newWin = window.open(link.href, targ, attr[1]);
        newWin.focus();
        return false;
    },
    imagePop : function(link,width) {
        if (!width) width = 800;
        width += 50;
        var height = width > 500 ? 600 : width + 100;
        var attr = 'width=' + width + ',height=' + height + ','
          + BM.newWinStyle.imagePop[1];
        BM.newWin(link,'imagePop', ['imagePop', attr]);
        return false;
    },
    activeSubNav : {}, // for subnavigation highlighting
    updateSubNav : function() {
        $H(BM.activeSubNav).keys().each( function(slug) {
            $$('li.bmn_sec-' + slug).each( function(li) {
                Element.addClassName(li,'bmn_active');
            });
        });
    },
    dispTip : function(tips) {
        if (!tips || !tips.length) return;
        var i = (60 / tips.length);
        var d= new Date(); var s= d.getSeconds();
        var show = Math.floor(s/i);
        if (show >= tips.length) show = show -1;
        $$('div.bmw_tip' + tips[show]).each(function(tip) {
          tip.style.display = 'block';
        });
    }
};
Event.observe(window,"load",BM.updateSubNav,false);