

function loadContentPage(url)
{	
//	if(url != lastUrl)
	{
		showLoading();
		$('#bodyContent').load('/include/page/bodyContent.php?request_uri=' + escape(url));
		var pagehash = url.replace(/\//ig,'!!');
//		location.href = '#'+pagehash;
		lastUrl = url;
	}
}


var timeoutId = null;
/*timeoutId = setTimeout(setThisPageInMenu, 1000);*/
function setThisPageInMenu()
{
	var flashObj = document.getElementById('swfObject1');
	flashObj.changeMenuItem('<?=$pagina->getPathSEO();?>');
	clearTimeout ( timeoutId );
}

function showLoading()
{
	$('#bodyContent').html('<div id="loading">loading...</div>');
}

function setDocument(doctitle)
{
	document.title = doctitle;
	replaceRelativeHrefs();
}

function replaceRelativeHrefs()
{
	$("a[href^='/']").each(function(){
		if(!this.href.match(/\.\w{3,4}$/ig) && !this.href.match(/\.php/ig))
		{
			path = this.href.replace(/http:\/\/[^\/]+/ig,'');
			this.href = 'javascript:loadContentPage(\''+path+'\');';
		}
	});
}