		function okMessage(testo){
			Shadowbox.open({
				player:     'html',
				content:    '<div style="background-color: #fff; height: 100px; width: 230px; text-align:center;"><br \/><br \/>'+testo+'<\/div>',
				height:     100,
				width:      230
			});
		}

		function pleaseWait(wait_msg,wx,hx){
			Shadowbox.open({
				player:     'html',
				content:    '<div style="background-color: #fff; height: '+(hx-2)+'px; width: '+(wx-2)+'px; text-align:center; font-size: 12px; color: #047391; text-transform: uppercase; border: 1px solid #047391;"><br \/><br \/>'+wait_msg+'<br \/><br \/><img src="img\/loader_wheel.gif" \/></div>',
				height: hx,
				width: wx,
				options: {
					modal: true,
					displayNav: false
				} 
			});
		}

//////////

	function rollOver(image, sfx) {
		var active = image.parentNode.getAttribute("activelink");
		if (active=="") {
			var imgSrc = image.src;
			var imgFile = new Array();
			var imgFile = imgSrc.split("/");
			var ix = imgFile.length-1;
			var myRegExp = new RegExp("\\..+", "gi");
			var imgExt = myRegExp.exec(imgFile[ix]);
			var newImgSrc = imgSrc.replace(imgExt, sfx+imgExt);
			image.src = newImgSrc;
		} else {
			image.parentNode.removeAttribute("href");
		}
	}

	function rollOut(image, sfx) {
		var active = image.parentNode.getAttribute("activelink");
		if (active=="") {
			var imgSrc = image.src;
			var imgFile = new Array();
			var imgFile = imgSrc.split("/");
			var ix = imgFile.length-1;
			var myRegExp = new RegExp("\\..+", "gi");
			var imgExt = myRegExp.exec(imgFile[ix]);
			var newImgSrc = imgSrc.replace(sfx+imgExt, imgExt);
			image.src = newImgSrc;
		} else {
			image.parentNode.removeAttribute("href");
		}
	}

	function showHide(theid){
	    var switch_id = document.getElementById(theid);
		if(switch_id.style.display == 'none') {
		   switch_id.style.display = 'list-item';
		}else{
		   switch_id.style.display = 'none';
		}
	}
	
//-->

	function posErrDiv(errorDivId) {
	
		errorDiv = document.getElementById(errorDivId);
	
		var scrollY = 0;
			if( document.documentElement && document.documentElement.scrollTop ) {
			scrollY = document.documentElement.scrollTop;
		}
			else if( document.body && document.body.scrollTop ) {
			scrollY = document.body.scrollTop;
		}
			else if( window.pageYOffset ) {
			scrollY = window.pageYOffset;
		}
			else if( window.scrollY ) {
			scrollY = window.scrollY;
		}
		
		errorDiv.style.top = scrollY+"px";
	}

//-->

	function addCart(inp,incr) {
		if (parseInt(inp.value)+incr>0) {
			inp.value=parseInt(inp.value)+incr;
		}
		return true;
	}

//-->

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			   string: navigator.userAgent,
			   subString: "iPhone",
			   identity: "iPhone/iPod"
	    },
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};

BrowserDetect.init();

	function modPag() {
		var ie7;
		if (BrowserDetect.browser=="Explorer" && parseInt(BrowserDetect.version)<=7) {ie7=true;} else {ie7=false;};
	
		var ritiro;
		var contrassegno;
		var scegli;
		var negozio;
		
		if (document.getElementById('ritirodiretto').checked) {
			ritiro = (!ie7) ? 'table-row' : "block";
			scegli = "inline"
			contrassegno = 'none';
			negozio = "";
		} else {
			ritiro = 'none';
			scegli = 'none';
			contrassegno = (!ie7) ? 'table-row' : "block";
			negozio = "negozio";
			document.form_acquista.comunicazioni.value="";
			document.getElementById('ritiro_msg').style.color="#FFF";
			document.getElementById('ritiro_msg').style.backgroundColor="#0084AB";
			document.getElementById('ritiro_msg').innerHTML="&nbsp;SCEGLIERE UN NEGOZIO&nbsp;";
			document.getElementById('lista_negozi').innerHTML=window.parent.document.getElementById('lista_negozi').innerHTML.replace("cambia","scegli");
		};
		document.getElementById('scegli_ritiro').style.display=scegli;
		document.getElementById('contrassegno_0').style.display=contrassegno;
		document.getElementById('contrassegno_1').style.display=contrassegno;
		document.getElementById('ritiro_1').style.display=ritiro;
		document.getElementById('ritiro_0').style.display=ritiro;
		
		document.form_acquista.negozio.value=negozio;
		
		document.form_acquista.modpag.value="";
		for ( i = 0; i < document.form_acquista.modalita_pagamento.length; i++ ) {
			document.form_acquista.modalita_pagamento[i].checked=false;
		}
	}

	function sceltaSped(opzione,totale,amt) {
		document.getElementById('importototale').innerHTML=totale;
		document.getElementById('selezsped').innerHTML='&nbsp;&nbsp;ATTENZIONE: SELEZIONARE UN METODO DI PAGAMENTO&nbsp;&nbsp;';
		opzione.form.amt_temp.value=amt; 
		opzione.form.amt.value=amt; 
		opzione.form.modsped.value=opzione.value;
	}
	
	function sceltaPagam(opzione,spese) {
		amt = opzione.form.amt_temp.value;
		amt = parseFloat(amt);
		amt = amt + parseFloat(spese);
		amt = amt.toFixed(2);

		totale = new String(amt);

		amt = "00000000"+String(amt);
		amt = amt.substring(amt.length-8);
		
		totale = totale.replace(/\./,",");
		x = totale.split(',');
		x1 = x[0];
		x2 = x.length > 1 ? ',' + x[1] : '';
		var rgx = /(\d+)(\d{3})/;
		while (rgx.test(x1)) {
			x1 = x1.replace(rgx, '$1' + '.' + '$2');
		}
		totale = x1 + x2;
		
		document.getElementById('importototale').innerHTML=totale;
		if (opzione.form.modsped.value!="") {
			document.getElementById('selezsped').innerHTML='';
		} else {
			document.getElementById('selezsped').innerHTML='&nbsp;&nbsp;ATTENZIONE: SELEZIONARE UN\'OPZIONE DI CONSEGNA&nbsp;&nbsp;';
		}
		opzione.form.amt.value=amt; 
		opzione.form.modpag.value=opzione.value;
	}














