function setTitles(p,d,m)
{
	window.document.menu.SetVariable("HeaderMain",p);
	window.document.menu.SetVariable("HeaderSub",d);
	window.document.menu.SetVariable("Page",m);
	document.title=p+(d?' - '+d:'')+' | Tworzenie stron www ephp.pl';
}

function getAjaxPage(pg,nGa,par)
{
	History.Observer.stop();
	pg=pg.replace('http://www.new.ephp.pl','').replace('http://www.ephp.pl','');
 	window.scrollTo(0,0);
	$('Content').update('');
	$('wait').show();
	new Ajax.History.Updater('Content',pg,
	{
		parameters: par,
		history: 
		{
			id: 'p',
			state: pg.replace(/\//g,'_')
		},
		evalScripts:true,onComplete:function()
		{
			$('wait').hide();
			if(!nGa) {pageTracker._trackPageview(pg);
			}
		}
	});
}

Event.observe(window,'load',function()
{
	History.Observer.delay = 1;
	var pg=History.get('p');
	if(typeof pg!='undefined' || pgG)
	{
		if(pgG) getAjaxPage(pgG,true);
		else if(pg!='_') getAjaxPage(pg.replace(/_/g,'/'),true);
	}
	else getAjaxPage('/',true);
	
	$$('#FooterLinks a').each(function(a)
	{
		 a.onclick=function()
		 {
		 	this.blur();
		 	getAjaxPage(this.href);
		 	return false;
		 }
	});
});