<!--
	
	autoredirect = 0;
	checkcookies = 0;
	
	//

	if (checkcookies == 1) {
		document.cookie = "eDtest=test;"
		var tok = document.cookie.indexOf ("eDtest");
		if (tok < 0) {
			var sMsg = "Impossibile accedere ai cookies\n"; 
			sMsg = sMsg + "Il negozio non puo' essere utilizzato se non si consente l'invio di cookies!\n\n";
			sMsg = sMsg + "Unable to access cookies\n";
			sMsg = sMsg + "This shop requires your browser to accept cookies in order to work properly!\n\n";
			window.alert(sMsg);
		}
	}

	if (autoredirect == 1) {
		var myURL = document.URL;
		if ( myURL.indexOf('file://') == -1) {
			lpos = myURL.lastIndexOf('/');
			if (lpos <0) {
				lpos=0;
				myURL= "/" + myURL;
			}
			domainname=myURL.substring(0,lpos);
			pagename=myURL.substring(lpos,myURL.length);
        	        if (domainname != "http://www.occhialisportivi.com/shop" && myURL.indexOf("/edorder") < 0 && myURL.indexOf("/edsearch") < 0) {
				self.location = "http://www.occhialisportivi.com/shop" + pagename;
			}
		}
	}


	function SubmitSearchForm(ritorna) {
		var ok = 1;
		var ucod=document.edRicerca1.searchtext.value.toLowerCase();
		ucod=TrimSpaces(ucod);
		ucodmin=MinCar();
		if (ucod.length < ucodmin) {
			window.alert("Digitare i termini della ricerca");
			ok=0;
		}
		if (ok != 0) {
			document.edRicerca2.search.value = ucod;
			document.edRicerca2.submit();
		}
		if (ritorna == 1) {
			return false;
		}
	}
	
	function TrimSpaces(testo) {
		var ammessi="abcdefghijklmnopqrstuvwxyz0123456789אטילעש";
		var sleft = "#"; var sright = "#";
		while(testo.charAt(0) == " ") {
			lung=testo.length;
			testo = testo.substring(1,lung);
		}
		lung=testo.length;
		while(testo.charAt(lung-1) == " ") {
			testo = testo.substring(0,lung-1);
			lung=testo.length;
		}
		var n=0;
		var wasspace=0;
		var newTesto="";
		while (n < lung) {
			carattere=testo.charAt(n);
			if (carattere==" ") {
				if (wasspace==0) {
					newcar=sright + " " + sleft;
					wasspace=1;
				}
				else {
					newcar="";
				}
			}
			else {
				wasspace=0;
				newcar=carattere;
				if (ammessi.indexOf(newcar)<0) {
					newcar="";
				}
			}
			newTesto=newTesto + newcar;
			n=n+1;
		}
		testo=sleft + newTesto + sright;
		return testo;
	}

	function MinCar() {
		var sleft = "#"; var sright = "#";
		searchsepcar = sright + " " + sleft;
		searchmincar = searchsepcar.length;
		return searchmincar;
	}

	function RepGoTo() {
		selrepnum = document.edReparti.edRepartiMenu.selectedIndex;
		selrep = document.edReparti.edRepartiMenu.options[selrepnum].value;
		self.location = selrep;
	}

	function PopupImage(imageName, ww, wh) { 
		
		myNewWindow = window.open('', 'Dettaglio','width=' + ww +',height=' + wh + ',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0'); 
		myNewWindow.document.write("<HTML><HEAD><\/HEAD>");
		myNewWindow.document.write("<BODY leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>");
		myNewWindow.document.write("<IMG SRC='" + imageName + "'><\/BODY><\/HTML>");
		myNewWindow.document.close();
		myNewWindow.focus();
		
	} 
//-->

