//var SettoreSelezionato;

function NavMenu(pag)
{
	document.getElementById("m"+pag).id = "current";
}


function NavCategorie(pag)
{
	document.getElementById("m-c"+pag).style.color = "#CC3300";
	document.getElementById("m-c"+pag).style.fontSize = "12";
	document.getElementById("m-c"+pag).focus();
}


function MostraCategorie(id)
{
	if(document.getElementById("tr-"+id).style.display == "none")
	{
		document.getElementById("tr-"+id).style.display = '';
	}
	else
	{
		document.getElementById("tr-"+id).style.display = "none";
	}
}


function ControlloAccesso()
{
	if(document.loginutente.loginusr.value == "")
	{
		alert("Attenzione: inserire il nome utente.");
		document.loginutente.loginusr.focus();
		return false;
	}
	
	if(document.loginutente.loginpwd.value == "")
	{
		alert("Attenzione: inserire la password.");
		document.loginutente.loginpwd.focus();
		return false;
	}
	
	document.loginutente.submit();
	return true;
}


function RegistrazioneTipoUtente(val)
{
	switch(val)
	{
		case "p":
			document.registra.nome.style.backgroundColor = "#CCFF66";
			document.registra.cognome.style.backgroundColor = "#CCFF66";
			document.registra.ragsoc.style.backgroundColor = "#FFFFFF";
			document.registra.piva.style.backgroundColor = "#FFFFFF";
			break;
		case "d":
			document.registra.nome.style.backgroundColor = "#CCFF66";
			document.registra.cognome.style.backgroundColor = "#CCFF66";
			document.registra.ragsoc.style.backgroundColor = "#CCFF66";
			document.registra.piva.style.backgroundColor = "#CCFF66";
			break;
		case "a":
			document.registra.nome.style.backgroundColor = "#FFFFFF";
			document.registra.cognome.style.backgroundColor = "#FFFFFF";
			document.registra.ragsoc.style.backgroundColor = "#CCFF66";
			document.registra.piva.style.backgroundColor = "#CCFF66";
			break;
	}
}


function CampiRegistrazione(obj, val)
{
	switch(obj)
	{
		case "indirizzo":
			if(document.registra.indirizzosped.value == "")
			{
				document.registra.indirizzosped.value = val;
			}
			break;
		case "comune":
			if(document.registra.comunesped.value == "")
			{
				document.registra.comunesped.value = val;
			}
			break;
		case "cap":
			if(document.registra.capsped.value == "")
			{
				document.registra.capsped.value = val;
			}
			break;
		case "provincia":
			if(document.registra.provinciasped.value == "")
			{
				document.registra.provinciasped.value = val;
			}
			break;
		case "stato":
			if(document.registra.statosped.value == "")
			{
				document.registra.statosped.value = val;
			}
			break;
	}
}



function ApriFoto(IdArt, Foto, Larghezza, Altezza, Livelli)
{
	var X = ((screen.width/2)-(Larghezza/2)); 
	var Y = ((screen.height/2)-(Altezza/2));
	var W = (parseInt(Larghezza) + 50);
	var H = (parseInt(Altezza) + 50);
	window.open(Livelli+'file/articoli/'+IdArt+'/'+Foto,'','toolbar=no, scrollbar=no, width='+W+', height='+H+', top='+Y+', left='+X+'');
}

/*function ApriFoto(Settore, Categoria, Foto, Larghezza, Altezza, Livelli)
{
	var X = ((screen.width/2)-(Larghezza/2)); 
	var Y = ((screen.height/2)-(Altezza/2));
	var W = (parseInt(Larghezza) + 50);
	var H = (parseInt(Altezza) + 50);
	window.open(Livelli+'file/articoli/s'+Settore+'-c'+Categoria+'/'+Foto,'','toolbar=no, scrollbar=no, width='+W+', height='+H+', top='+Y+', left='+X+'');
}*/



function ControlloVariantiArticolo()
{
	if(document.articoli.misure.disabled == false && document.articoli.misure.value == "def")
	{
		alert("Attenzione: è necessario selezionare una misura per aggiungere l'articolo al carrello");
		document.articoli.misure.focus();
		return false;
	}
	
	if(document.articoli.colori.disabled == false && document.articoli.colori.value == "0")
	{
		alert("Attenzione: è necessario selezionare un colore per aggiungere l'articolo al carrello");
		document.articoli.colori.focus();
		return false;
	}
	
	document.articoli.submit();
	return true;
}



/*function CambiaMappa(val, dir)
{
	switch(val)
	{
		case "-":
			document.getElementById("map-"+dir).src = "img/mappe/"+dir+"/mappa-1.jpg";
			break;
		case "+":
			document.getElementById("map-"+dir).src = "img/mappe/"+dir+"/mappa-2.jpg";
			break;
	}
}*/


function ApriMappa(tipo)
{
	var X=((screen.width/2)-350); 
	var Y=((screen.height/2)-250); 
	window.open("mappa-sede.php?t="+tipo, "", "toolbar=yes, scrollbars=yes, width=700, height=500, top="+Y+", left="+X+"");
}
