
function MM_openBrWindow(theURL,winName,features)
{ //v2.0
window.open(theURL,winName,features);
}

function goHome()
{ //v2.0
	document.location.href('prodotti.asp?SessionID=<%=SessionID%>');
}

function goPage(chiave)
{ //v2.0
	document.location.href('pagina.asp?SessionID=<%=SessionID%>&PageKey='+chiave);
}

function convertSpaces(str)
{
	var out = "", flag = 0;
	for (i = 0; i < str.length; i++)
		{
		if (str.charAt(i) != " ")
			{
			out += str.charAt(i);
			flag = 0;
			}
			else
				{
				if(flag == 0)
					{
					out += "%20";
					flag = 1;
					}
				}
		}
	return out;
}				

function PopupPic(sPicURL)
{ 
	window.open("popup.htm?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
}

function MM_findObj(n, d)
	{ //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

function MM_showHideLayers()
{ //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	obj.visibility=v; }
}

function ctrlNumero() {
// I CARATTERI UNICODE COMPRESI TRA 48 E 57 SONO LE CIFRE DA 0 A 9.

if ((event.keyCode < 48) || (event.keyCode > 57)) {
return false;
}
else {
return true;
}
}

function ctrlData() {
// I CARATTERI UNICODE COMPRESI TRA 48 E 57 SONO LE CIFRE DA 0 A 9 PIU' LA BARRA /.

if ((event.keyCode < 47) || (event.keyCode > 57)) {
return false;
}
else {
return true;
}
}

function aprichiudi(item) {

elem=document.getElementById(item);
visibile=(elem.style.display!="none");

if (visibile) {
elem.style.display="none";
} else {
elem.style.display="block";
}
}

function mostraAvanzata(obj)
{
if (obj.checked)
document.getElementById("div_avanzata").style.display = "";
else
document.getElementById("div_avanzata").style.display = "none";
}

