<!--
top.window.moveTo(0,0);
if (document.all) 
{
	top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) 
{
	if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
	{
		top.window.outerHeight = screen.availHeight;
		top.window.outerWidth = screen.availWidth;
	}
}

function getElementHeight(Elem) 
{
	if(document.getElementById) 
	{
		var elem = document.getElementById(Elem);
	} 
	else if (document.all)
	{
		var elem = document.all[Elem];
	}
	var xPos = elem.offsetHeight;
	return xPos;
}

function getElementWidth(Elem) 
{
	if(document.getElementById) 
	{
		var elem = document.getElementById(Elem);
	} 
	else if (document.all)
	{
		var elem = document.all[Elem];
	}
	var xPos = elem.offsetWidth;
	return xPos;
}

function getBodyHeight()
{
	return document.getElementsByTagName('body')[0].offsetHeight;
	return document.body.scrollHeight;
}

function findLeft(id)
{
	var obj = document.getElementById(id);
	return obj.offsetLeft;
}

function findTop(id)
{
	var obj = document.getElementById(id);
	return obj.offsetTop;
}

function setHeights()
{
	var colH = getElementHeight('superContainer')-131;
	document.getElementById('boxNews').style.height = colH+'px';
	document.getElementById('boxAzienda').style.height = colH+'px';
	document.getElementById('menuContent').style.height = colH+'px';
}

function setHeightsReduce()
{
	var colH = getElementHeight('superContainer')-131;
	document.getElementById('menuContent').style.height = colH+'px';
	document.getElementById('homeContent').style.height = colH+'px';
}

window.onresize = setHeights;

var AnimationSpeed = 1;

function vediNews()
{
	if(document.getElementById('vediNews').style.display == 'block' || document.getElementById('vediNews').style.display == '')
	{
		JSTweener.addTween(boxNews.style, {time: AnimationSpeed, left: 127 });
		JSTweener.addTween(boxAzienda.style, {time: AnimationSpeed, left: 487 });
		JSTweener.addTween(newsMover.style, {time: AnimationSpeed, left: 127 });
		document.getElementById('vediNews').style.display = 'none';
		document.getElementById('backNews').style.display = 'block';
		document.getElementById('espandiNews').style.display = 'block';
		document.getElementById('richiudiNews').style.display = 'none';
	}
	else
	{
		JSTweener.addTween(boxNews.style, {time: AnimationSpeed, left: 667 });
		JSTweener.addTween(boxAzienda.style, {time: AnimationSpeed, left: 1027 });
		JSTweener.addTween(newsMover.style, {time: AnimationSpeed, left: 667 });
		document.getElementById('backNews').style.display = 'none';
		document.getElementById('vediNews').style.display = 'block';
		document.getElementById('espandiNews').style.display = 'block';
		document.getElementById('richiudiNews').style.display = 'none';
	}
}

function espandiProdotti()
{
	if(document.getElementById('espandiNews').style.display == 'block' || document.getElementById('espandiNews').style.display == '')
	{
		JSTweener.addTween(boxNews.style, {time: AnimationSpeed, left: 1027 });
		JSTweener.addTween(boxAzienda.style, {time: AnimationSpeed, left: 1387 });
		JSTweener.addTween(newsMover.style, {time: AnimationSpeed, left: 1027 });
		document.getElementById('espandiNews').style.display = 'none';
		document.getElementById('richiudiNews').style.display = 'block';
	}
	else
	{
		JSTweener.addTween(boxNews.style, {time: AnimationSpeed, left: 667 });
		JSTweener.addTween(boxAzienda.style, {time: AnimationSpeed, left: 1027 });
		JSTweener.addTween(newsMover.style, {time: AnimationSpeed, left: 667 });
		document.getElementById('espandiNews').style.display = 'block';
		document.getElementById('richiudiNews').style.display = 'none';
	}
}

/////////////////////////////
// MENU CATEGORIE PRODOTTO //
/////////////////////////////

function showArrow() { document.getElementById('pmenuTitle').style.backgroundPosition = '0px 37px'; }
function hideArrow() { document.getElementById('pmenuTitle').style.backgroundPosition = '0px -20px'; }

var oCat = undefined;
var lastCat = undefined;
var oSubCat = undefined;

function openCat(id)
{
	if(id != oCat)
	{
		if(oCat != undefined)
		{
			if(oSubCat != undefined)
			{
				openSubCat(oSubCat, lastCat);	
			}
			document.getElementById('main'+oCat).className = 'pmenuMainCat';
			document.getElementById('sub'+oCat).style.display = 'none';
		}
		var goTo = findTop('main'+id)-6;
		oCat = id;
		JSTweener.addTween(document.getElementById('segnalatore').style, {time:0.2, transition:'linear', top: goTo, onComplete:openSubMenu});
	}
	else
	{
		if(oSubCat != undefined)
		{
			openSubCat(oSubCat, lastCat);	
		}
		document.getElementById('main'+oCat).className = 'pmenuMainCat';
		document.getElementById('sub'+oCat).style.display = 'none';
		JSTweener.addTween(document.getElementById('segnalatore').style, {time:0.2, transition:'linear', top: 30});
		oCat = undefined;
	}
}

function openSubMenu()
{
	document.getElementById('main'+oCat).className = 'pmenuMainCatOn';
	document.getElementById('sub'+oCat).style.display = 'block';
}

function openSubCat(id, mid)
{
	if(id != oSubCat || mid != lastCat)
	{
		if(oSubCat != undefined)
		{
			document.getElementById('main'+oCat+'_sub'+oSubCat).style.display = 'none';
			document.getElementById('main'+oCat+'_link'+oSubCat).className = 'pmenuSubVoci';
		}
		oSubCat = id;
		document.getElementById('main'+oCat+'_sub'+oSubCat).style.display = 'block';
		document.getElementById('main'+oCat+'_link'+oSubCat).className = 'pmenuSubVociOn';
		lastCat = mid;
	}
	else
	{
		document.getElementById('main'+oCat+'_sub'+oSubCat).style.display = 'none';
		document.getElementById('main'+oCat+'_link'+oSubCat).className = 'pmenuSubVoci';
		oSubCat = undefined;
	}
}

/////////////////////
// SCHEDA PRODOTTO //
/////////////////////

function getViewWidth()
{
	var viewportwidth;
	var viewportheight;
	if (typeof window.innerWidth != 'undefined')
	{
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	}
	else if (typeof document.documentElement != 'undefined'
	&& typeof document.documentElement.clientWidth !=
	'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportwidth = document.documentElement.clientWidth,
		viewportheight = document.documentElement.clientHeight
	}
	else
	{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	return viewportwidth;
}

function getViewHeight()
{
	var viewportwidth;
	var viewportheight;
	if (typeof window.innerWidth != 'undefined')
	{
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	}
	else if (typeof document.documentElement != 'undefined'
	&& typeof document.documentElement.clientWidth !=
	'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportwidth = document.documentElement.clientWidth,
		viewportheight = document.documentElement.clientHeight
	}
	else
	{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	return viewportheight;
}

function openScheda()
{
	//document.getElementById('schedaIFRAME').src = 'scheda_prodotto.php?id='+id;
	document.getElementById('schedaProdotto').style.display = 'block';
	document.getElementById('schedaBG').style.display = 'block';
	var lmargin = (getViewWidth()/2) - 440;
	var tmargin = (getViewHeight()/2) - 270;
	document.getElementById('schedaProdotto').style.left = lmargin+'px';
	document.getElementById('schedaProdotto').style.top = tmargin+'px';
}

function chiudiScheda()
{
	document.getElementById('schedaProdotto').style.display = 'none';
	document.getElementById('schedaBG').style.display = 'none';
	document.getElementById('schedaIFRAME').src = '';
}

////////////////
// SCHEDE BOX //
////////////////

function openBox(ref, dim)
{
	if(dim == 'big') { document.getElementById('bgBox').src = 'images/sfondo_box.png'; } 
	else { document.getElementById('bgBox').src = 'images/sfondo_minibox.png'; } 
	document.getElementById('schedaProdotto').style.display = 'block';
	document.getElementById('schedaBG').style.display = 'block';
	var lmargin = (getViewWidth()/2) - 440;
	var tmargin = (getViewHeight()/2) - 270;
	document.getElementById('schedaProdotto').style.left = lmargin+'px';
	document.getElementById('schedaProdotto').style.top = tmargin+'px';
	document.getElementById('schedaIFRAME').src = ref;
}

function chiudiBox()
{
	document.getElementById('bgBox').src = '';
	document.getElementById('schedaProdotto').style.display = 'none';
	document.getElementById('schedaBG').style.display = 'none';
	document.getElementById('schedaIFRAME').src = '';
}
//-->
















