//{{{ function initButtons()
initButtons = function () {

    var class1 = ['cButtonFocused', 'cButtonClicked']; 
    var class2 = ['btl', 'btc', 'btr', 'bml', 'bmc', 'bmr', 
                  'bbl', 'bbc', 'bbr'];

    for ( var i = 0; i < class1.length; i++ ) {

        var c0 = document.createElement('div');
        c0.className = class1[i];

        for ( var j = 0; j < class2.length; j++ ) {

            var c1 = document.createElement('div');
            c1.className = class2[j];
            c0.appendChild(c1);

        }

        document.body.appendChild(c0);
        document.body.removeChild(c0);

    }

}
//}}}

//{{{ function initButton( id, onclick)
initButton = function ( id, onclick) {

    var func;

    func = new Function('e', 'Event.stop(e); var d = document.getElementById(\''+id+'\'); if ( d.className != \'cButtonFocused\' ) d.className = \'cButtonFocused\';');
    Event.observe(id, 'mouseover', func);

    func = new Function('e', 'Event.stop(e); var d = document.getElementById(\''+id+'\'); if ( d.className != \'cButton\' ) d.className = \'cButton\';');
    Event.observe(id, 'mouseout', func);

    func = new Function('e', 'Event.stop(e); var d = document.getElementById(\''+id+'\'); if ( d.className != \'cButtonClicked\' ) d.className = \'cButtonClicked\';');
    Event.observe(id, 'mousedown', func);

    func = new Function('e', 'Event.stop(e); var d = document.getElementById(\''+id+'\'); if ( d.className != \'cButtonFocused\' ) d.className = \'cButtonFocused\';');
    Event.observe(id, 'mouseup', func);

    if ( onclick == 'submit' )
        func = new Function('e', 'Event.stop(e); document.getElementById(\'baseform\').submit();');

    else
        func = new Function('e', 'Event.stop(e); '+onclick);

    Event.observe(id, 'click', func);

}
//}}}

