/**
 * @author fabio.bonetti
 */

function browserHeight(){
	if (document.documentElement.clientHeight) { return document.documentElement.clientHeight;}
	if (window.innerHeight) { return window.innerHeight; }
}

function initNav(){
	document.getElementById("navProdotti").onmouseover = function(){
		showSubMenu("subProdotti");
	};
	document.getElementById("navProdotti").onmouseout = function(){
		hideSubMenu("subProdotti");
	};
	document.getElementById("navConfig").onmouseover = function(){
		showSubMenu("subConfig");
	};
	document.getElementById("navConfig").onmouseout = function(){
		hideSubMenu("subConfig");
	};
	document.getElementById("navAzienda").onmouseover = function(){
		showSubMenu("subAzienda");
	};
	document.getElementById("navAzienda").onmouseout = function(){
		hideSubMenu("subAzienda");
	};
	
	function showSubMenu(obj){
		document.getElementById(obj).style.display = "block";
	}
	function hideSubMenu(obj){
		document.getElementById(obj).style.display = "none";
	}
}

function openWindow(url){
	window.open(url,'popup','width=600, height=500, scrollbars=1, toolbars=0');
}

var activeTab = "id1000btr";

function parziale(label,prezzo,qta)
{
	var re = new RegExp("[0-9]*");
	var id = "parziale" + label;
	
	if(qta.match(re) == qta){
		
		tot = prezzo * qta;
		if (tot == 0)
			document.getElementById(id).innerHTML = "";
		else
			document.getElementById(id).innerHTML = tot.toFixed(2);
		
	} else {
		document.getElementById(label).value = 0;
		document.getElementById(id).innerHTML = "";
	}
	
	loadUrl("../images/savesessioncart.php","label="+label+"&qta="+qta);

}

function showTab(id)
{
	document.getElementById(activeTab).style.display = "none";
//	document.getElementById(activeTab + "_li").style.background = "#dddddd";
	document.getElementById(activeTab + "_li").className = "notactivetab";
	activeTab = id;
	document.getElementById(id + "_li").className = "activetab";
//	document.getElementById(id + "_li").style.background = "#ffffff";

	document.getElementById(id).style.display = "block";
	
//	document.getElementById(id).style.position = "absolute";
	document.getElementById(id).style.position = "relative";
	
	
}

