//Event handling object
var Event = {
	attach: function(sEvent, fnFunction, oElement){
		if(!oElement) oElement = window;
		if(window.attachEvent) return oElement.attachEvent("on"+sEvent, fnFunction); //IE
		else return oElement.addEventListener(sEvent, fnFunction, false); //FF
	}
};

Event.attach("load", function(){
    // Hash elements id
    var Pool = {};
    function $(sId){
        var oValue = Pool[sId];
        if(oValue) return oValue;
        else{
        	oValue = document.getElementById(sId);
        	Pool[sId] = oValue;
        	return oValue;
        }
        return document.getElementById(sId);
    }
    
    //Simulate the _blank target for links
	var links = document.getElementsByTagName("a");
	for(i=0; i < links.length; i++){
		if(links[i].rel && links[i].rel.search("external") == 0){
			if(links[i].rel.search(":") != (-1)){
				aSplitted = links[i].rel.split(":");
				links[i].onclick = function(){
					window.open(this.href, "pop", "width="+aSplitted[1]+",height="+aSplitted[2]);
					return false;
				};
			}else{
				links[i].onclick = function(){
					window.open(this.href, "pop");
					return false;
				};
			}
		}
	}

    //Fix menu and content height
    if($("menu").offsetHeight < $("content").offsetHeight) $("menu").style.height = $("content").offsetHeight+"px";
	else $("content").style.height = $("menu").offsetHeight+"px";
});
