
// import Nevow.Athena
var gamma = {};

// gamma.LoginWidget = Nevow.Athena.Widget.subclass('gamma.LoginWidget');
// gamma.RegisterWidget = Nevow.Athena.Widget.subclass('gamma.RegisterWidget');

// IE FUCKS UP WITH MOCHIKIT
// can't use NodeByAttribute call - internally uses MochiKit
// (hopefully this wont be a long-term issue)

// OK - commenting out all of this below allows Safari to actually run
// but the refs to Nevow above are still nagging (needed for liveFragment stuff)
// even though not actually used yet... (same error comes from refs in athena javascripts)

// ----------------------------------------------------------------------------
// gamma.LoginWidget.method(
//     'setMsg',
//     function setMsg(self, toWhat) {
// //         Divmod.debug('some debug identifier', 'some debug msg');
//         var msgNode = window.document.getElementById('widget-msg');
// //         var msgNode = Nevow.Athena.NodeByAttribute(self.node, "id", "widget-msg");
//         msgNode.innerHTML = toWhat;
//     });
// 
// gamma.LoginWidget.method(
//     'goNext',
//     function goNext(self) {
//         return self.callRemote('goNext');
//     });
// 
// gamma.LoginWidget.method(
//     'forgotPassword',
//     function forgotPassword(self) {
//         self.callRemote('forgotPassword');
//     });
// 
// gamma.LoginWidget.method(
//     'doSubmit',
//     function doSubmit(self) {
//         var formNode = window.document.getElementById('login-form');
// //         var formNode = Nevow.Athena.NodeByAttribute(self.node, "id", "login-form");
//         formNode.submit();
//     });
// 

// ----------------------------------------------------------------------------
var mk_lp = null;
function toggle_mklogpane(inline) {
    inline = !(!inline);
    if (!mk_lp) {
        mk_lp = MochiKit.LoggingPane.createLoggingPane(inline);
        }
    else {
        mk_lp.closePane();
        mk_lp = null;
        }
    }   

function toggle_display(tid) {
    el = document.getElementById(tid);
    if(document.getElementById(tid).style.display == "none") {
        document.getElementById(tid).style.display = "";
        img = document.getElementById(tid + "_expander");
        img.src = img.src.replace('expand', 'collapse');
    }
    else {
        document.getElementById(tid).style.display = "none";
        img = document.getElementById(tid + "_expander");
        img.src = img.src.replace('collapse', 'expand');
    }
} 

// ----------------------------------------------------------------------------
function set_submit_btn(_id, ok) {
    if (ok) {
        document.getElementById(_id).disabled = false;
        document.getElementById(_id).className = "submit_enable";
        }    
    else {
        document.getElementById(_id).disabled = true;
        document.getElementById(_id).className = "submit_disable";
        }
    }

