     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)
	{
		//alert(qtamax);
		if (IsNumeric(document.forms["frmprod" + indiceform ].txtqta.value))
			 {
			if (document.forms["frmprod" + indiceform ].txtqta.value < qtamin)
				{
				alert('Rispettare la quantit&aacute; minima ordinabile.');
				return false;
				}
			else
				{
				if (document.forms["frmprod" + indiceform ].txtqta.value > qtamax)
					{
					alert('Quantita\' non disponibile a magazzino.');
					return false;
					}
				else
					{
					 //document.forms["frmprod" + indiceform ].submit();
					 return true;
					}
				}
			}
		else
		{
			alert('Quantità inserita non valida!')
			return false;
			 }
	}

	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
 
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
 
		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",
 
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",
 
		// Style formats
		style_formats : [
			{title : 'Bold text', inline : 'b'},
			{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
			{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
			{title : 'Example 1', inline : 'span', classes : 'example1'},
			{title : 'Example 2', inline : 'span', classes : 'example2'},
			{title : 'Table styles'},
			{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
		],
 
		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});

