/* CommonSpot CMS */

if (typeof(Prototype) == "undefined") 
    throw "loginState.js requires Prototype";

document.observe("dom:loaded", function(){
    var boxes = $$('div.equalHeight');
    var max_height = boxes.invoke('getHeight').max();
    boxes.invoke('setStyle', {
        height: (max_height) + 'px'
    });
});

function isCandidateLogged(handler){
    new Ajax.Request(handler, {
        method: 'post',
        onSuccess: function(transport){
            var data = transport.responseText.evalJSON();

            if (data.WELCOME_BOX_STATUS) {
                $("WelcomeBox").update(data.WELCOME_BOX);
                $("MetaNavigation").replace(data.META_NAVOGATION);
            }
        }
    });
}

function isRecruiterLogged(handler){
    new Ajax.Request(handler, {
        method: 'post',
        onSuccess: function(transport){
            var data = transport.responseText.evalJSON();

            if (data.WELCOME_BOX_STATUS) {
                $("WelcomeBox").update(data.WELCOME_BOX);
            	$("MetaNavigation").replace(data.META_NAVOGATION);
            } else {
                $("WelcomeBox").update(data.WELCOME_BOX);
            }
        }        
    });
}
