if (navigator.appVersion.match('MSIE 6.0')) {
    window.onresize=resizeBox;
    document.write('<style>.msg_box {position: absolute; top: expression( ( ignoreMe = document.documentElement.scrollTop ) + \'px\' );}</style>');
}

function resizeBox() {
    var myWidth = document.documentElement.clientWidth;
    if (myWidth < 760 ) myWidth = 800;
    $('msg_box').style.left  = -myWidth/2 + 380
    $('msg_box').style.width = (myWidth-22) + 'px';
}

var main = {
    showMessage: function(message) {
        $('msg_box_msg').innerHTML = message[0];
		$('msg_box').setAttribute('class', message[1]); //for all other browsers
		$('msg_box').setAttribute('className', message[1]); //for IE
        if ('ok' == message[1]) {
            $('msg_box').style.backgroundColor = "#daeff8";
            $('msg_box').style.border          = "1px solid #7cc7e4";
            $('msg_box').style.color           = "#0F80AB";
        } else {
            $('msg_box').style.backgroundColor = "#FFC7C7";
            $('msg_box').style.border          = "1px solid #FF7070";
            $('msg_box').style.color           = "#790000";
        }
        $('msg_box').style.display = "block";    
    }
}

window.addEvent('domready', function() {
    if ($('companySwitchId')) {
        $('companySwitchId').addEvent('change', function(event) {
            $('companySwitch').submit();
        });
    }
    if ($('branchSwitchId')) {
        $('branchSwitchId').addEvent('change', function(event) {
            $('branchSwitch').submit();
        });
    }
    if (window['message'] && message[0] && message[1]) {
        main.showMessage(message);
    }
});