
if(typeof(window.external) != 'undefined')
{
 // Se sto utilizzando IE definisco la funzione getElementsByName
 document.getElementsByName = function(name, tag){
  if(!tag) tag = '*';
  var elems = document.getElementsByTagName(tag);
  var res = []
  for(var i=0;i<elems.length;i++)
  {
   att = elems[i].getAttribute('name');
   if(att == name) res.push(elems[i]);
  }
  return res;
 }
}


function UrlCheck(strUrl)
	{
	if (strUrl.toLowerCase().substr(0,7) != "http://")
		{
		return false
		}
	else
		{
		return true
		}
	}

var dataOggi = new Date()

function valueSel(selElem)
	{
	tmpSel = selElem.options[selElem.selectedIndex].value
	return tmpSel
	}

function selSelect(selectElement, valueSelected)
	{
	if(selectElement=="" && valueSelected=="") return false;
	
	if(selectElement!="" && valueSelected=="")
		{
		if(selectElement.length > 0)
			{
			selectElement.options[0].selected = true
			}
		return false
		}
	 
	for(i=0;i<selectElement.length; i++)
		{
		if(selectElement.options[i].value == valueSelected)
			{
			selectElement.options[i].selected=true;
			return true;
			}
		}
	return false;
	}
	
function selRadio(miaCheck, mioVal)
	{
	if(miaCheck=="")
		return false;

	if (typeof miaCheck.length == "undefined")
		{
		if (miaCheck.value == mioVal)
			{
			miaCheck.checked=true;
			return true;
			}
		}
	else
		{
		for(i=0;i<miaCheck.length; i++)
			{
			if (miaCheck[i].value == mioVal)
				{
				miaCheck[i].checked=true;
				return true;
				}
			}
		}
	return false;
	}

function disableRadio(miaCheck, mioVal)
	{
	if(miaCheck=="")
		return false;

	if (typeof miaCheck.length == "undefined")
		{
		if (miaCheck.value == mioVal)
			{
			miaCheck.checked = false;
			miaCheck.disabled = true;
			return true;
			}
		}
	else
		{
		for(i=0;i<miaCheck.length; i++)
			{
			if (miaCheck[i].value == mioVal)
				{
				miaCheck[i].checked = false;
				miaCheck[i].disabled = true;
				return true;
				}
			}
		}
	return false;
	}



function getRadioValue(miaCheck)
{
  
	if(miaCheck=="")
		return -2;

	if (typeof miaCheck.length == "undefined")
	{
		if (miaCheck.checked == true)
		{
			return miaCheck.value;
		}
	}
	else
	{
		for(i=0;i<miaCheck.length; i++)
		{
			if (miaCheck[i].checked == true)
			{
				return miaCheck[i].value;
			}
		}
	}
	return -1;
	
}
	
function selCheck(miaCheck, mioVal)
	{
	if(miaCheck=="" || mioVal=="")
		return false;
	if (miaCheck.value == mioVal)
		{
		miaCheck.checked=true;
		// return true;
		}
	// return false;
	return true;
	}
	
function isValidDate(strData)
	{
	var g = 0
	var m = 0
	var a = 0
	if (strData == "")
		return true
		
	if (strData.indexOf("/") == -1)
		return false
	arrayData = strData.split("/")
	if (arrayData.dim < 3)
		return false
	
	g = arrayData[0]
	m = arrayData[1]
	a = arrayData[2]
	if ((g == "" || m == "" || a == "") || 
	    (isNaN(g) || isNaN(m) || isNaN(a)))
		{
		return false
		}
	g = parseInt(g, 10)		
	m = parseInt(m, 10)		
	a = parseInt(a, 10)		

	if (!(g>=1 && g<=31) || 
	    !(m>=1 && m<=12) || 
	    !(a>=1800 && a<=9999))
		{
		return false;
		}
	switch (m)
	{
		case 2:
			if (annoBisestile(a))
			{
				if (g>29)
				{
					return false;
				}
			}
			else
			{
				if (g>28)
				{
					return false;
				}
			}
			break;
		case 4: case 6: case 9: case 11:
			if (g>30)
				return false;
			break;
		default : 
			break;
	}
	
	return true;	
	}

function isDateBeforeToday(strData)
	{
	var g = 0
	var m = 0
	var a = 0
		
	arrayData = strData.split("/")
	g = arrayData[0]
	m = arrayData[1]
	a = arrayData[2]
	
	dataToCheck = new Date(a, m-1, g)
	if (dataToCheck > dataOggi)
		return false
	else
		return true
	}
	
function isDateBeforeDate(strData1,strData2)
		{
		var g1 = 0
		var m1 = 0
		var a1 = 0
		var g2 = 0
		var m2 = 0
		var a2 = 0
			
		arrayData1 = strData1.split("/")
		g1 = parseInt(arrayData1[0],10)
		m1 = parseInt(arrayData1[1],10)
		a1 = parseInt(arrayData1[2],10)
		
		arrayData2 = strData2.split("/")
		g2 = parseInt(arrayData2[0],10)
		m2 = parseInt(arrayData2[1],10)
		a2 = parseInt(arrayData2[2],10)
		
		if (a2 >= a1)
			return false
		else
			if (m2 >= m1)
				return false
			else
				if (g2 >= g1)
					return false
				else
					return true
		}

function annoBisestile(anno)
	{
	var annoMod4 = anno%4;
	var annoMod100 = anno%100;
	var annoMod400 = anno%400;
	
	return (annoMod4==0 && (annoMod400==0 ^ !annoMod100==0));	
	}
	
function isNumeric(strNum)
	{
	if (strNum == "")
		return true
	strNum=strNum.replace(/\./g, "");
	strNum = strNum.replace(/\,/g, ".")
	if (isNaN(strNum))
		return false;
	else
		return true;
	}
	
function attivaRadioTutti(nomeCampo, theObj, check_f_tutti)
	{
	goCheck = true
	if (!check_f_tutti)
		{
		goCheck = false
		if (confirm("ATTENZIONE!\nDalle indicazioni fornite dal Relatore\nrisulta che questa procedura deve essere attivata\nin modo diverso per le varie anagrafiche coinvolte.\nSi desidera proseguire ugualmente?"))
			goCheck = true
		}
	if (goCheck)
		{
		nomeForm = theObj.form.name
		eval(nomeForm + ".f_tutti_" + nomeCampo + "[0].checked = true")
		}
	}

function attivaRadioTasso(nomeCampo, theObj)
	{
	nomeForm = theObj.form.name
	eval(nomeForm + ".r_" + nomeCampo + "[0].checked = true")
	}
	
function disattivaTasso(nomeCampo, theObj)
	{
	nomeForm = theObj.form.name
	eval(nomeForm + ".v_" + nomeCampo + ".value = ''")
	}

function eliminaSelTutti(subAtto, tipo, theObj)
	{
	nomeForm = theObj.form.name
	switch (tipo)
		{
		case "D":
			eval(nomeForm + "." + subAtto + ".value=''")
			break;
		case "I":
			eval(nomeForm + "." + subAtto + ".value=''")
			break;
		case "P":
			eval(nomeForm + ".r_" + subAtto + "[0].checked = false")
			eval(nomeForm + ".r_" + subAtto + "[1].checked = false")
			eval(nomeForm + ".v_" + subAtto + ".value=''")
			eval(nomeForm + ".d_" + subAtto + ".value=''")
			break;
		case "X":
			eval(nomeForm + "." + subAtto + ".value=''")
			break;
		case "E":
			eval(nomeForm + ".v_" + subAtto + ".value=''")
			eval(nomeForm + ".d_" + subAtto + ".value=''")
			break;
		}
	}

function verificaValore(valore, tipo, mini, maxi) {
	if (tipo == "INTE") {
		if (isNaN(parseInt(valore))) return -1;
		if (mini != 'undefined' && maxi != 'undefined') {
			if (parseInt(valore) < mini) return -2;
			if (parseInt(valore) > maxi) return -3;
		}
	} else if (tipo == "DATA") {
		if (valore != "") {
			if ((isNaN(parseInt(valore.substring(0,2))) ||
        	parseInt(valore.substring(0,2)) > 31 ||
	        valore.substring(2,3) != "/" ||
    	    isNaN(parseInt(valore.substring(3,5))) ||
        	parseInt(valore.substring(3,5)) > 12 ||
	        valore.substring(5,6) != "/" ||
    	    isNaN(parseInt(valore.substring(6,10))) ||
        	(valore.length != 10))) {

 				alert ("Attenzione! il campo deve contenere una DATA nel formato GG/MM/AAAA");
	 			return -1;
			}
		}
	}
	return 1;
}


//
// Esegue il reset sul form (di solito lanciato dal pulsante "Ripristina")
//
function ripristina() {
	document.forms[0].reset();
	if (focusonload != '') {
		document.forms[0].elements[focusonload].focus();
	}
	return;
}

//
// Richiama la pagina stessa con l'elemento selezionato
//
function selezionato() {
	with(document.forms[0]) {
			Url = io+"?"+Codi+"="+elements[0][elements[0].selectedIndex].value;
			document.location = Url;
	}
}

//
// Cancella l'elemento selezionato
//
function cancella() {
	with (document.forms[0]) {
		if (elements[0][elements[0].selectedIndex].value != "0") {
			msg = "Eliminare " + elements[0][elements[0].selectedIndex].text + " ?";
			if (confirm(msg)) {
				action = dest;
				Azione.value = "DELETE";
				submit();
			}
		}
	}
}

//
// richiama la pagina senza parametri (per averla a campi vuoti)
//
function nuovo() {
	with(document.lista) {
		Url = io;
		document.location = Url;
	}
}

//
// Visualizza un messaggio per l'utente in una nuova finestra
//
function mostraMessaggio(Mesg) {

	Url = "mostra_messaggio.htm?Mesg="+escape(Mesg);
    win=window.open(Url,'finestraMessaggio','location=0,resizable=yes,toolbar=0,scrollbars=1,width=300,height=200');

}

//
// gestione dei campi in Euro
// INPUT: valore float o intero
// OUTPUT: valore con i punti separatori delle migliaia e due decimali fissi
//
function old_formattaEuro(f) {

	f1 = parseInt(100 * f);

//	alert("f="+f);
//	alert("f1="+f1);

	s=String(f1);
//	alert("s="+s);

	var lu=s.length;

//	alert("lu="+lu);

	if (lu==1) { s ="00"+s; lu=3; }
	if (lu==2) { s ="0"+s; lu=3; }

	// punti separatori delle migliaia
    if (lu>11) { s=s.substring(0,lu-11)+"."+s.substring(lu-11); lu++; }
    if (lu>8) { s=s.substring(0,lu-8)+"."+s.substring(lu-8); lu++; }
    if (lu>5) { s=s.substring(0,lu-5)+"."+s.substring(lu-5); lu++; }

	// virgola decimale
    s=s.substring(0,lu-2)+","+s.substring(lu-2);
	return (s);
}

function formattaEuro(f) {
	s = ""
	f_s=String(f);
	if (f_s.indexOf(".") != -1)
		{
		arrayS = f_s.split(".")
		p_intera = arrayS[0]
		p_decimale = arrayS[1]
		}
	else
		{
		p_intera = f_s
		p_decimale = "00"
		}
	if (p_intera.length == 0)
		p_intera = "0"
	if (p_decimale.length == 1)
		p_decimale += "0"

	s = p_intera
	lu = s.length

	// punti separatori delle migliaia
    if (lu>9) { s=s.substring(0,lu-9)+"."+s.substring(lu-9); lu++; }
    if (lu>6) { s=s.substring(0,lu-6)+"."+s.substring(lu-6); lu++; }
    if (lu>3) { s=s.substring(0,lu-3)+"."+s.substring(lu-3); lu++; }

	// virgola decimale
    s=s+","+p_decimale
	return (s);
}

function formattaEuroBack(cifra){

    cifra=cifra.replace(/\./g,"");
    cifra=cifra.replace(/\,/g,".");

    return cifra;
}


function linkpdf(idnorma)
{
  parametri="width=700,height=550,scrollbars=yes,menubar=no,toolbar=no,location=no,personalbar=no,status=no,resizable=yes";
  theUrl = "show_pdf.asp?idnormasel=" + idnorma
  hlinkpdf = window.open(theUrl, "wlinkpdf", parametri)
  hlinkpdf.focus()
}
	
function checkfrmprod()
{
	document.frm_argomenti.submit()
}
	

function checkformRic()
{
  if (document.frm_ric.str_ric_sito.value == "")
  {
    alert("Impossibile avviare una ricerca senza alcun testo. \nScrivere un testo da ricercare!")
    document.frm_ric.str_ric_sito.focus()
    return
  }
  if (document.frm_ric.str_ric_sito.value.length <= "3")
  {
    alert("Si prega di inserire piu' caratteri \nper consentire la ricerca al sistema!")
    document.frm_ric.str_ric_sito.focus()
    return
  }
  document.frm_ric.submit()
}

function linkIstat(nomeDoc)
{
	parametri="width=700,height=550,scrollbars=yes,menubar=no,toolbar=no,location=no,personalbar=no,status=no,resizable=yes"
	theUrl = "show_doc.asp?nomedoc=" + nomeDoc
	hPdf = window.open(theUrl, "wPdf", parametri)
	hPdf.focus()
}

function linkDoc(nomeDoc, visregistrato)
	{
	parametri="width=700,height=550,scrollbars=yes,menubar=no,toolbar=no,location=no,personalbar=no,status=no,resizable=yes"
	theUrl = "show_doc.asp?nomedoc=" + nomeDoc + "&vr=" + visregistrato
	hPdf = window.open(theUrl, "wPdf", parametri)
	hPdf.focus()
	}
	
function selArgo()
{
	valArgoSel = document.frm_ricerca.id_argo.value
	parametri="width=380,height=600,scrollbars=auto,menubar=no,toolbar=no,locationbar=no,personalbar=no,statusbar=no,resizable=yes"
	theUrl = "pop_argo.asp?nomeForm=frm_ricerca&valArgoSel=" + valArgoSel
	hArgo = window.open(theUrl, "wArgo", parametri)
}

function delArgo()
{
	document.frm_ricerca.id_argo.value = ""
	document.frm_ricerca.argo.value = ""
	return
}
		
function checkform()
{
	 if (document.frm_ricerca.testo_ric.value == "")
		{
		if (document.frm_ricerca.data_da.value == "")
			{
			if (document.frm_ricerca.data_a.value == "")
				{
				if (document.frm_ricerca.argo.value == "")
					{
					if (document.frm_ricerca.numNorma.value == "")
						{
						if (document.frm_ricerca.id_tipoNorma.options[document.frm_ricerca.id_tipoNorma.selectedIndex].value == "")
							{
							alert("Impossibile avviare una ricerca senza alcun parametro, \nSelezionare almeno un criterio di ricerca!")
							document.frm_ricerca.ricerca.value = 'false';
              document.frm_ricerca.testo_ric.focus()
							return
							}
						}
					} 
				}
			}
		}
	if (!isValidDate(document.frm_ricerca.data_da.value))
		{
		alert("Data inserita non valida!")
		document.frm_ricerca.data_da.focus()
		return
		}
	if (!isValidDate(document.frm_ricerca.data_a.value))
		{
		alert("Data inserita non valida!")
		document.frm_ricerca.data_a.focus()
		return
		}
	
  document.frm_ricerca.ricerca.value = 'true';
	document.frm_ricerca.submit()
	
}
	
function azzera()
{
	document.frm_ricerca.testo_ric.value = ""
	document.frm_ricerca.id_argo.value = ""
	document.frm_ricerca.argo.value = ""
	document.frm_ricerca.maxrisPage.value = "10"
	
	if (document.frm_ricerca.data_da)
	 document.frm_ricerca.data_da.value = ""
	if (document.frm_ricerca.data_a)
	 document.frm_ricerca.data_a.value = ""
	if (document.frm_ricerca.numNorma)
	 document.frm_ricerca.numNorma.value = ""
	if (document.frm_ricerca.id_tipoNorma)
	 document.frm_ricerca.id_tipoNorma.options[0].selected = true
	 
	if (document.frm_ricerca.autori)
	 document.frm_ricerca.autori.options[0].selected = true
	
	return
}
	
function azzera_newsletter()
{
	document.frm_ricerca.datainizio.value = "";
	document.frm_ricerca.datafine.value = "";
	document.frm_ricerca.idcliente.value = "";
	document.frm_ricerca.testo_ric.value = "";
	document.frm_ricerca.tipologia.value = "-1";
	document.frm_ricerca.maxrisPage.value = "5";
	return;
}
	
function apripref(titolo,linkPref,sezPaginaPref)
{
	parametri="width=380,height=200,scrollbars=auto,menubar=no,toolbar=no,locationbar=no,personalbar=no,statusbar=no,resizable=yes"
	theUrl = "pop_preferiti.asp?titolo=" + escape(titolo) + "&linkPref=" + escape(linkPref) + "&sezPaginaPref=" + sezPaginaPref
	hPref = window.open(theUrl, "wPref", parametri)
	hPref.moveTo(480, 250)
}

function InviaMail(urlPage,urlBack)
{
	parametri="width=730,height=300,scrollbars=auto,menubar=no,toolbar=no,locationbar=no,personalbar=no,statusbar=no,resizable=yes"
	theUrl = "mail.asp?urlPage=" + urlPage + "&urlBack=" + urlBack
	hInviaMail = window.open(theUrl, "wInviaMail", parametri)
}

function StampaPagina(ParamSez)
{
	parametri="width=550,height=600,resizable=yes,scrollbars=yes,menubar=no,toolbar=no,locationbar=no,personalbar=no,statusbar=no"
	switch (ParamSez)
	{
		case "info_blt":
			theUrl = "st_info_blt.asp"
			break
		case "info_abbonamento":
			theUrl = "st_info_abb.asp"
			break
		case "contatti":
			theUrl = "st_contatti.asp"
			break
		case "chi_siamo":
			theUrl = "st_chi_siamo.asp"
			break
		case "blt_on_line":
			theUrl = "st_blt.asp?<%=ParamStampa%>"
			break
		case "anticipazioni":
			theUrl = "st_antic.asp?<%=ParamStampa%>"
			break
		case "giurisprudenza":
			theUrl = "st_giuris.asp?<%=ParamStampa%>"
			break
		case "gazzetta_ufficiale":
			theUrl = "st_gazz_uff.asp?<%=ParamStampa%>"
			break
		case "bur":
			theUrl = "st_bur.asp?<%=ParamStampa%>"
			break
		case "indici_istat":
			theUrl = "st_istat.asp"
			break
		case "indice_normativa_n":
			theUrl = "st_nazionale.asp?<%=ParamStampa%>"
			break
		case "indice_normativa_r":
			theUrl = "st_regionale.asp?<%=ParamStampa%>"
			break
		case "sondaggi":
			theUrl = "st_sondaggio.asp?<%=ParamStampa%>"
			break
		case "rassegna_stampa":
			theUrl = "st_rassegna.asp?<%=ParamStampa%>"
			break
		case "shopping":
			theUrl = "st_scheda_prod.asp?<%=ParamStampa%>"
			break
		case "shopping_o":
			theUrl = "st_offerte.asp?<%=ParamStampa%>"
			break
		case "shopping_d":
			theUrl = "st_distributori.asp"
			break
		case "shopping_f":
			theUrl = "st_fornitori.asp?<%=ParamStampa%>"
			break
	}
	hStampa = window.open(theUrl, "wStampa", parametri)
}

function checkform_RicercaTitolo()
{
  document.frm_argomenti.ricerca.value = 'false';
  if((document.frm_argomenti.ric_titolo.value != "") ||
    (document.frm_argomenti.valore_argo_prod.value != "") )
	   document.frm_argomenti.ricerca.value = 'true';
	   
	document.frm_argomenti.submit()
}

function OpenWinHelp(id)
{
  parametri="width=400,height=300,scrollbars=auto,menubar=no,toolbar=no,locationbar=no,personalbar=no,statusbar=no,resizable=yes"
	theUrl = "popuphelp.asp?id=" + id 
  hOpenWinHelp = window.open(theUrl, "wOpenWinHelp", parametri)
  hOpenWinHelp.focus()
}



function verificaFormatoEuro(campo) {

	//var cifra = document.forms[0].elements[campo].value;
	var cifra = campo;
	
	var ritorno=true;

	// VIRGOLA
	virgola = cifra.indexOf(",");
	// se c'e'  pił di una virgola
	if (cifra.indexOf(",",virgola+1)>=0) {
		msg = "ATTENZIONE!! E' presente piu' di una virgola.";
		ritorno=false;
	}
	
	if (virgola == -1)
		limite = cifra.length;
	else
		limite = virgola;

	// PUNTO
	punto = cifra.lastIndexOf(".");
	while (punto!=-1) {
		if (limite -punto != 4) {
			msg = "ATTENZIONE!! Carattere punto in posizione non corretta.";
			ritorno = false;
			break;
		}
		limite = punto;
		punto = cifra.lastIndexOf(".",limite-1);
	}

	// se ci sono dei punti => ci devono essere tutti!
	if (ritorno && cifra.indexOf(".")>=0 && limite>3) {
		msg = "ATTENZIONE!! Carattere punto mancante.";
		ritorno = false;
	}

	// Verifico che sia un numero
	if (ritorno && isNaN(formattaEuroBack(cifra))) {
		msg = "ATTENZIONE!! Utilizzati caratteri non validi.";
		ritorno = false;
	}
	
	if (!ritorno) {
		msg += "\nSi ricordi che:\nVIRGOLA = separatore dei decimali;";
		msg += "\nPUNTO = separatore delle migliaia (opzionale).";
		alert(msg);
		//document.forms[0].elements[campo].select();
		//document.forms[0].elements[campo].focus();
	}
	return ritorno;
}

var min=10;
var max=20;

function zoom_on()
{
var aInput=document.getElementsByName("zoom");

   var p = $(".zoom");
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 14;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }  
   
}


function zoom_out()
{
   var p = $(".zoom");
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 14;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
  
}

function DisableAllHyperlink()
{
  $("a").attr("onClick","return false;");
  $(".printPreviewButton  a").attr("onClick","");
}


function CambiaTipologiaIndirizzo(index,form)
{  
  div_azienda = 'dati_azienda_' + form;
  div_privato = 'dati_privato_' + form;
  campo_obb_nome = 'campo_obb_nome_' + form;
  campo_obb_codfisc = 'campo_obb_codfisc_' + form;
  campo_obb_professione = 'campo_obb_professione_' + form;

  if(index==0)
  {
    document.getElementById(div_azienda).style.display = 'none';
    document.getElementById(div_privato).style.display  = 'block';
    
    if (document.getElementById(campo_obb_nome) != null)
      document.getElementById(campo_obb_nome).style.display = 'inline';
    if (document.getElementById(campo_obb_codfisc) != null)
      document.getElementById(campo_obb_codfisc).style.display = 'inline';
    if (document.getElementById(campo_obb_professione) != null)
      document.getElementById(campo_obb_professione).style.display = 'inline';
  }
  else
  {
    document.getElementById(div_azienda).style.display  = 'block';
    document.getElementById(div_privato).style.display = 'none';
    
    if (document.getElementById(campo_obb_nome) != null)
      document.getElementById(campo_obb_nome).style.display = 'none';
    if (document.getElementById(campo_obb_codfisc) != null)
      document.getElementById(campo_obb_codfisc).style.display = 'none';
    if (document.getElementById(campo_obb_professione) != null)
      document.getElementById(campo_obb_professione).style.display = 'none';
  }
  
}
function Trim(stringa)
   {
   reTrim=/\s+$|^\s+/g;
   return stringa.replace(reTrim,"");
   }

function verificaCodiceFiscale(codiceFiscale)
{
   var re = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/;
   Codice = Trim(codiceFiscale.toUpperCase());
   return re.test(Codice);
}

function verificaPartitaIva(sz_Codice)
   {
   /*
   sz_Codice = Trim(sz_Codice.toUpperCase());
   var n_Val,n_Som1=0,n_Som2=0,lcv;
   if (sz_Codice.length!=11 || isNaN(parseFloat(sz_Codice)) || parseFloat(sz_Codice)<parseFloat(0))
      return false;
   
   for (lcv=0;lcv<9;lcv+=2)
   {
      n_Val=parseInt(sz_Codice.charAt(lcv));
      n_Som1+=n_Val;
      n_Val=parseInt(sz_Codice.charAt(lcv+1));
      n_Som1+=Math.floor(n_Val/5) + (n_Val<<1) % 10;
   }
   n_Som2 = 10 - (n_Som1 % 10);
   n_Val=parseInt(sz_Codice.charAt(10));
   if (n_Som2==n_Val)
      return true;
   return false;
   */
   
   if (sz_Codice.length!=11 || isNaN(parseFloat(sz_Codice)) || parseFloat(sz_Codice)<parseFloat(0))
      return false;
   
   return true;
   }

function AddCart(id_prod,id_offerta,id_catal)
{
  if (id_offerta != "")
    $("#id_prod_sel").val(id_offerta + ',' + id_prod);
  else
    $("#id_prod_sel").val(id_prod);
  $("#id_catal").val(id_catal);
  // frm submit o chiamata ajax
  $("form[name='frm_formula_sing']").submit();
}
