function aprichiudi(value, tipologia) {
	div = document.getElementById('div_'+value);

	img = document.getElementById('img_'+value);
	img_su = document.getElementById('giu_'+value);

	//menu = document.getElementById('menu_'+value);
	if (div.style.display == 'block')
	{
		div.style.display = 'none';
		img.style.display = 'block';
		img_su.style.display = 'none';
		//menu.style.background = '#FCF1F9';
	} else 
	{
		div.style.display = 'block';
		img.style.display = 'none';
		img_su.style.display = 'block';
		//menu.style.background = '#ffffff';

	}
}

function subapertura(value, tipologia) {
	div = document.getElementById('sub_'+value);
	img = document.getElementById('imgsub_'+value);
	img_su = document.getElementById('giusub_'+value);

	//menu = document.getElementById('menu_'+value);
	if (div.style.display == 'block')
	{
		div.style.display = 'none';
		img.style.display = 'block';
		img_su.style.display = 'none';
		//menu.style.background = '#FCF1F9';
	} else 
	{
		div.style.display = 'block';
		img.style.display = 'none';
		img_su.style.display = 'block';
		//menu.style.background = '#ffffff';

	}
}

function load() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());

		map.setCenter(new GLatLng(45.446869, 9.221461), 14);
		map.openInfoWindow(map.getCenter(),
		   document.createTextNode("Via Cadolini, 32 - 20137 Milano"));

	}
}

function Registrazione() {
	if (document.registrazione.ragione_sociale.value == '')
	{
		alert('Attenzione, inserisci la ragione sociale');
		return(false);
	}
	if (document.registrazione.indirizzo.value == '')
	{
		alert("Attenzione, inserisci l'indirizzo");
		return(false);
	}
	if (document.registrazione.cap.value == '')
	{
		alert('Attenzione, inserisci il CAP');
		return(false);
	}
	if (document.registrazione.localita.value == '')
	{
		alert('Attenzione, inserisci la località');
		return(false);
	}
	if (document.registrazione.provincia.value == '')
	{
		alert('Attenzione, inserisci la provincia');
		return(false);
	}

	if (!document.registrazione.termini.checked)
	{
		alert('Attenzione, devi accettare i termini e le condizioni di vendita');
		return(false);
	}
}


function Aggiungi(id) {
	valore = document.getElementById(id).value;
	valore = valore*1;
	valore = valore+1;

	input = document.getElementById(id);

	input.value = valore;

}

function Sottrai(id) {
	valore = document.getElementById(id).value;
	valore = valore*1;

	if (valore != 0) {
		valore = valore-1;
		input = document.getElementById(id);
		input.value = valore;
	}
	
}

function ConfermaOrdine() {
	if (document.conferma_ordine.data.value == '')
	{
		alert('Attenzione, selezionare la data');
		return(false);
	}
}

function Ricerca() {
	if (document.ricerca.keyword.value == '')
	{
		alert('Attenzione, inserisci la keyword');
		return(false);
	}

	if (document.ricerca.keyword.value.length < 3)
	{
		alert('Attenzione, la keyword è troppo breve!');
		return(false);
	}
}

function PopUp(url){
msg=window.open(url);
}
