/* CommonSpot CMS */

if (typeof(Prototype) == "undefined") 
    throw "loginState.js requires Prototype";

document.observe("dom:loaded", function() {
	boxes = $$('div.boxes');
	
	if(boxes.length > 0) {
		for(i=0;i<boxes.length;i++) {			
			var childs = boxes[i].childElements('div.equalHeight');

			if(childs.length > 0) {
				var maximum = childs.invoke('getHeight').max();
				childs.invoke('setStyle', {height: (maximum-20) + 'px'});
			}
			
		}
	}

});

function isCandidateLogged(handler){
    new Ajax.Request(handler, {
        method: 'post',
        onSuccess: function(transport, json) {
            if(json.WELCOME_BOX_STATUS) {
                $("candidates-login").replace(decodeURIComponent(json.WELCOME_BOX));
            }
        }
    });
}
