    function SwitchPrezzoVisibile(IdCombo, IdPrezzoA, IdLblPrezzoDa, IdLblPrezzoA)
    {
        var objCombo = document.getElementById(IdCombo);
        var objPrezzoA = document.getElementById(IdPrezzoA);
        var objLblPrzDa = document.getElementById(IdLblPrezzoDa);
        var objLblPrzA = document.getElementById(IdLblPrezzoA);

        for (var i=0; i < objCombo.options.length; i++)
        {
            if(objCombo.options[i].selected)
            {
                var Value = objCombo.options[i].value;
                if (Value == 3)
                {
                    objPrezzoA.style.display = "";
                    objLblPrzA.style.display = "";
                    objLblPrzDa.innerHTML = "Prezzo Da:";
                    objLblPrzA.innerHTML = "A:";
                    break;
                }
                else
                {
                    objLblPrzA.style.display = "none";
                    objPrezzoA.style.display = "none";
                    objLblPrzDa.innerHTML = "Prezzo:";
                    objLblPrzDa.style.display = "";
                    break;
                }
            }
        }
    }
    
    function GoRisultatiAccessoDiretto(hf_IN, hf_WHERE, strIN, strWHERE)
    {
       
        var objHF_IN = document.getElementById(hf_IN);
        var objHF_WHERE = document.getElementById(hf_WHERE);
        
        objHF_IN.value = strIN;
        objHF_WHERE.value = strWHERE;
    }
   
    function CaricaFoto(img){
      foto1= new Image();
      foto1.src=(img);
      Controlla(img);
    }
    function Controlla(img){
      if((foto1.width!=0)&&(foto1.height!=0)){
        viewFoto(img);
      }
      else{
        funzione="Controlla('"+img+"')";
        intervallo=setTimeout(funzione,20);
      }
    }
    function viewFoto(img){
      largh=foto1.width+20;
      altez=foto1.height+20;
      stringa="width="+largh+",height="+altez;
      nome="zoom"
      finestra=window.open(img,nome,stringa);
    }
	 
// STAMPA CONTENUTI
function CallPrint(divID) {
  var WinPrint;
  var prtContent = document.getElementById(divID);
  var WinPrint = window.open('','','left=0,top=0,width=10,height=10,toolbar=0,scrollbars=yes,status=0');
  
  WinPrint.document.bgColor='EEEEEE';
  WinPrint.document.write('<LINK rel=stylesheet type="text/css" href="custom/portal.css">');
  WinPrint.document.write('<LINK rel=stylesheet type="text/css" href="custom/client.css">');
  WinPrint.document.write('<LINK rel=stylesheet type="text/css" href="custom/condivisionedoc.css">');
  
  WinPrint.document.write(prtContent.innerHTML);
  WinPrint.document.close();
  WinPrint.focus();
  WinPrint.print();
  WinPrint.close();
} 

function ControllaQtMinima(obj, QtMin, InScatola, QtOrd, QtMax)
{
    var Msg = "";
    var noSetValue = false;
    
    if (isNaN(obj.value))
        Msg = "La Quantita' deve essere un Numero!";
    else
        if (obj.value < QtMin)
            Msg = "La Quantita' Minima di Acquisto del Prodotto e': " + QtMin;

    if (Msg.length == 0 && InScatola)
        if ((obj.value % QtMin) != 0) /* devo controllare che obj.value sia multiplo della QtMin */
            Msg = "Il Prodotto e' in vendita in Scatole da: " + QtMin;
            
    if (Msg.length == 0 && QtMax > 0)
        if ((Number(obj.value) + QtOrd) > QtMax)
        {
            Msg = "Massima Quantita' Ordinabile Raggiunta!";
            obj.value = QtMax;
            noSetValue = true;
        }
   
    if (Msg.length > 0)
    {
        if (!noSetValue)
            obj.value = QtMin;
        alert(Msg);
        obj.focus();
        obj.select();
    }
}

function openPopUp(url, width, height) 
{
   var winW = width;
   var winH = height;
   var x = (window.screen.width - winW) / 2;
   var y = (window.screen.height - winH) / 2;
   if (x < 0) {x = 0;}
   if (y < 0) {y = 0;}

   winParams = "scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,left=" + x + ",top=" + y + ",width=" + winW + ",height=" + winH;
   editorWin = window.open(url, "editorWin", winParams);
}
