noFrames();
document.browser = new BrowserDetector();
window.addEvent('domready', runtime);
//new Asset.image('/_skin/_images/ajax/ajax-loader.gif');

function runtime()
{
	//pulsante chiudi ricerca
	initSearchCloseButton();
	
	if ( $('homeGoogle') ) 
	{
		initSearchDiv();
		return;
	}
	if (document.browser.ie55 || document.browser.ie6)  css3();
	if (!document.browser.ie && $('mininav'))
	{
		document.scroller = new PageScroller();
		
		$('moveDown').setStyle("display", "block");
		$('moveUp').setStyle("display", "block");
		
		$('moveDown').addEvent('click', function()
		{
			document.scroller.down();
		});
		
		$('moveUp').addEvent('click', function()
		{
			document.scroller.up();
		});
	}
	
	var cssName = /^.*\/([^\/]+)\.css$/; 
	document.cssPattern = new RegExp( $('layoutSkin').getProperty('href').replace(cssName, "$1") + "|" +  $('layoutTesto').getProperty('href').replace(cssName, "$1") + "|" + $('layoutSize').getProperty('href').replace(cssName, "$1"));
	
	initTips(true);
	initControls();
	if( !window.location.pathname.match(/^\/(index.jsp)?$/) ) initSearch();
	
	//tabbed link spot
	$$('#header-link a').each( function (el)
	{
		var id = "" + el.getProperty('id');
		
		if ( id.match(/^spot.*/gi) )
		{	
			el.addEvent('click', switchTab);
			el.setProperty("href", "javascript:foo()");
		}
	});
	
	//tabbed link servizi
	$$('#servizi a').each( function (el)
	{
		var id = "" + el.getProperty('id');
		
		if ( id.match(/^menu.*/gi) )
		{	
			el.addEvent('click', switchMenu);
			el.setProperty("href", "javascript:foo()");
		}
	});
	
	if ( $('link-spot') ) $('link-spot').fx = new Fx.Style('link-spot', 'opacity', {duration:500});
}
