function ShowCodeWindow(url, width, height){
	window.open(url, 'Code', 'width='+width+',height='+height);
}

Event.observe(window, 'load', function() {

    // This will run after DOM is fully loaded;
    // thus, preventing any "is null" errors.

    //  Observe all input type text
    //  Code taken from the original todolister source
    var inputs = document.getElementsByTagName('input');
    for (i=0;inputs.length>i;i++) {if (inputs[i].type=='text') {Event.observe(inputs[i], 'focus', function (event) {this.value=''}, false);Event.observe(inputs[i], 'blur', function (event) {if (this.value.blank()) this.value=this.defaultValue}, false);}}

    // Stores the current active tab
    var activeTab = 'tab_user';
    var actions = new Array();
    actions['tab_user']     = 'users.php?a=doLogin';
    actions['tab_sponsor']  = 'sponsors.php?a=doLogin';

    // Observe the tabs
    $('tab_sponsor').observe('click', toggleTabs);
    $('tab_user').observe('click', toggleTabs);

    function toggleTabs (event) {
        element = event.element();

        // Make sure nothing is done if clicked tab is active already
        if (activeTab!=element.id) {
            // Make previous activeTab inactive
            $(activeTab).removeClassName('active');
            // Make clicked tab active and set it as activeTab
            element.addClassName('active');
            activeTab = element.id;
            // Change form action for the propper login file
            $('loginform').action = actions[element.id];
        }
    }

});
