     function zoom(apri) {
  		var stile = "top=10, left=10, width=450, height=570, status=no, menubar=no, toolbar=no scrollbar=no";
        window.open(apri, "", stile);
	}
     function OpenPdf(apri) {
  		var stile = "top=10, left=10, , , status=no, menubar=no, toolbar=no scrollbar=no";
        window.open(apri, "", stile);
	}
var over="#FFFFFF";
var out="#EEEEEE";

function msg(testo, urlsi)
{
	var  risp; 
	risp  =  window.confirm(testo); 
	
	if(risp==true) 
	{ 
	document.location.href=urlsi; 
	} 
}


function ApriPopup(url, titolo)
{
    newWin = window.open(url, titolo,'left=100,top=50,width=340,height=340,toolbar=0,resizable=0,scrollbars=0,menubar=0');
    newWin.focus();
}

function seleziona(id,colore) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = colore;
}
function deseleziona(id,colore) {
  if (!document.getElementById) return;
  selDiv = document.getElementById(id);
  selDiv.style.color = colore;
}

function IsNumeric(sText)
{
   var ValidChars = "123456789";
   var IsNumber = true;
   var Char;
   var CommaCount = 0;
   
   sReturn = '';
   
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i);
      
      if (Char == ',')
         CommaCount ++;
      
      if ((ValidChars.indexOf(Char) == -1) || (CommaCount > 1))
         IsNumber = false;
      
      if (IsNumber)
        sReturn = sReturn + Char;
   }
         
   return sReturn;
}

function valuta()
{
var tasto = window.event.keyCode;
if (tasto >= 49 && tasto <= 57 || tasto >= 96 && tasto <= 105 || tasto==8 
|| tasto==13 || tasto==48 || tasto==9 || tasto==188)
{
return true;
}
else
{
return false;
}
}

function solonumeri()
{
var tasto = window.event.keyCode;
//alert(window.event.keyCode);
if (tasto >= 49 && tasto <= 57 || tasto >= 96 && tasto <= 105 || tasto==8 
|| tasto==13 || tasto==48 || tasto==9)
{
return true;
}
else
{
return false;
}
}

function notesto()
{
var tasto = window.event.keyCode;
//alert(window.event.keyCode);
//if (tasto >= 49 && tasto <= 57 || tasto >= 96 && tasto <= 105 || tasto==8 
//|| tasto==13 || tasto==48 || tasto==9)
//{
//return true;
//}
//else
//{
tasto==0
return false;
//}
}

function solotesto()
{
var tasto = window.event.keyCode;
if (tasto >= 49 && tasto <= 57 || tasto >= 96 && tasto <= 105 )
{
return false;
}
else
{
return true;
}
}

function movein(which, colore){
which.style.background=colore;
}

function moveout(which, colore){
which.style.background=colore;
}

function vai(url)
{
document.location.href = url;
}

	
function cercatipo()
	{
	if (document.frmcercatipo.txtmarca.value == '' && document.frmcercatipo.txtdes.value == '')
		{
		alert('Digitare la marca o la descrizione del prodotto, per effettuare la ricerca!');
		}
	else
		{
		if (document.frmcercatipo.txtmarca.value != '' && document.frmcercatipo.txtdes.value != '')
			{
			alert('Scrivere in un solo campo per la ricerca!');
			}
		else
			{
			document.frmcercatipo.submit();
			}
		}
	}
	function inviarichiesta()
	{
	if (document.frmrichiesta.txt1.value == '' || document.frmrichiesta.txt1.value == '' || document.frmrichiesta.txt3.value == '' || document.frmrichiesta.txt4.value == '')
		{
		alert('Tutti i campi sono obbligatori');
		}
	else
		{
		if (document.frmrichiesta.chkconsenso.checked == true)
			{
			document.frmrichiesta.submit();
			}
		else
			{
			alert('Autorizzare il trattamento dati per la privacy!');
			}
		}
	}

function InvioPremuto(nomeform)
{
	//alert(window.event.keyCode);
	if (window.event.keyCode == 13) 
		document.forms[nomeform].submit();
	else if (window.event.keyCode == 39 || window.event.keyCode == 37 || window.event.keyCode == 42) 
		window.event.keyCode = 0;

}

	
function inviareg()
	{
	if (document.frmregistra.txtmail.value == '' || document.frmregistra.txttel.value == '')
		{
		alert('Immetti valori validi!');
		}
	else
		{
			if (document.frmregistra.chkconsenso.checked == false)
				{
				alert('Autorizzare il trattamento dati per la privacy!');
				}
			else
				{
				document.frmregistra.submit();
				}
		}
	}
	
function mousein()
{
	document.frmcat.modifica.style.background='#ffffff';
	document.frmcat.modifica.style.backgroundimage=url('/icone/icn_aggiungi.gif');
	}


function QtaValida(indiceform, qtamin, qtamax)
	{
		if (IsNumeric(document.forms["frmprod" + indiceform ].txtqta.value))
			 {
			if (document.forms["frmprod" + indiceform ].txtqta.value < qtamin)
				{
				alert('Rispettare la quantità minima ordinabile.')
				return false;
				}
			else
				{
				if (document.forms["frmprod" + indiceform ].txtqta.value > qtamax)
					{
					alert('Quantità non disponibile a magazzino.')
					return false;
					}
				else
					{
					 //document.forms["frmprod" + indiceform ].submit();
					 return true;
					}
				}
			}
		else
		{
			alert('Quantità inserita non valida!')
			return false;
			 }
	}
	
function cambia_bordo (x)
	{ document.getElementById(x).style.border='solid 1px #0081ff'; }

function torna_bordo (y)
	{ document.getElementById(y).style.border='solid 1px #DDCCA4'; }

