showBuildingStatus = function(code){
	imgs=$('buildingStatusTooltip').childElements();
	$('buildingStatusTooltip').hide();
	imgs[0].innerHTML=code;
	for (var i=1; i<arguments.length; i++){
		var newSrc = imgs[i].src.replace(/\d\.png/, arguments[i]+'.png');
		 imgs[i].src=newSrc;
	}
	$('buildingStatusTooltip').show();
	return true;
}

function track(url){
	if (typeof pageTracker == 'object'){
	pageTracker._trackPageview(url);
	}
}

Event.observe(window, 'load', function(){
		buildingsToolTip = new Tooltip('Map','buildingStatusTooltip');
});

ACO = new Object();
ACO.containerId='content';
ACO.compat=true;
ACO.goToURL = function(url){
	if (typeof url=='object'){
		if (url.href){
			url=url.href;
			}
		else { return false; }
	}
	
	this.currUrl=this.url;
	this.url=url;
	if (this.compat){
	new Ajax.Updater(this.containerId, url, {
					 evalScripts: true,
					 onCreate: function(){
						 	$(ACO.containerId).setOpacity(0.3);
						 },
					 onFailure: function(){
						 	alert('nalaganje ni uspelo');
							$(ACO.containerId).setOpacity(1.0);
						 },
					onSuccess: function(response, json){
					 		ACO.currUrl = ACO.url;
							$(ACO.containerId).setOpacity(1.0);
							document.fire('Ajax:update', { response: response, json:json });
							track(ACO.currUrl);
							
						},
					onComplete: function(){ myLightbox.updateImageList(); initScroll(); }
					 } );
	}//END IF COMPAT
	else {
			window.location=url;
		}
}

ACO.onClick = function(obj){
	ACO.goToURL($(obj).href);
	}

ACO.bindHrefs = function(){
	$$('._AjaxLink').each(function(obj){
							Event.observe(obj, 'click', ACO.onClick.bind(ACO, obj));
							obj.onclick=function(){ return false; }
								  });
	}

Event.observe( window, 'load', ACO.bindHrefs);
