<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

//-->
<!--
function goToSelectPage(elem) {
	location.href = elem.value;
}

function changePage(theform) {
// riceve opzione selezionata
num = theform.tendina1.selectedIndex;

//riceve il value dell'opzione selezionata
pagina = theform.tendina1[num].value;

//se qualcosa e' selezionato go to

if (pagina!="nothing") {

                 top.location.href=pagina;
                 theform.tendina1.selectedIndex = 0;
                       }

}
//-->

// funzione che cambia lo stile dei div attraverso l'id.
function selezionato(idDiv,idStyle) {
	div = document.getElementById(idDiv);
	div.className = idStyle;
}


// funzione che apre e chiude i div delle sezioni dei prodotti
function visualizza(sezione) {
	return;
	sez = document.getElementById(sezione);
	if (sez.style.display == 'none') {
		sez.style.display = '';
		sezb = document.getElementById(sezione + "b");
		sezdett = document.getElementById(sezione + "dett");
		sezb.style.display = 'none';
		sezdett.style.display = '';
	}
	else {
		sez.style.display = 'none';
		sezb = document.getElementById(sezione + "b");
		sezdett = document.getElementById(sezione + "dett");
		sezb.style.display = '';
		sezdett.style.display = 'none';
	}
}

function visualizzaAltreLingue() { //v2.0
document.getElementById('imgLingua2').style.display="inline";
document.getElementById('imgLingua3').style.display="inline";
document.getElementById('imgLingua4').style.display="inline";
document.getElementById('imgLingua5').style.display="inline";
document.getElementById('imgLingua6').style.display="inline";
document.getElementById('imgLingua7').style.display="inline";
document.getElementById('imgClose').style.display="none";
document.getElementById('imgLingua1').style.display="inline";
document.getElementById('freccia').style.display="inline";

}

function chiudiVisualizzaAltreLingue() { //v2.0
document.getElementById('imgLingua2').style.display="none";
document.getElementById('imgLingua3').style.display="none";
document.getElementById('imgLingua4').style.display="none";
document.getElementById('imgLingua5').style.display="none";
document.getElementById('imgLingua6').style.display="none";
document.getElementById('imgLingua7').style.display="none";
document.getElementById('imgClose').style.display="inline";
document.getElementById('imgLingua1').style.display="none";
document.getElementById('freccia').style.display="none";

}

function mostraPrezzo(clientID)
{
    var dropDownList=document.getElementById(clientID);
    if (dropDownList!= null)
    {
        var valore = dropDownList.value;
        for (var i=0; i < dropDownList.options.length; i++) 
        {
            var ddlValue = dropDownList.options[i].value.split('£');
            var Id = ddlValue[0];
            var lblPrezzo = document.getElementById(Id);
            lblPrezzo.style.display='none'; 
            if (dropDownList.options[i].value==valore)
            {
                lblPrezzo.style.display='block'; 
            }
        } 
    }
}

function mostraTotale(param1, ddlQuantitaId, lblTotaleID, catalogo, btnOrdinaID)
{
        // se il catalogo è di tipo 1 param1 è l'id della ddlConfezioni
        // se il catalogo è di tipo 2 param1 è la stringa del prezzo netto
        
        var prezzoNetto = 0;
        
        if (catalogo == "1")
        {
            var ddlConfezioni = document.getElementById(param1);
            if (ddlConfezioni != null)
            {
                var ddlValue = ddlConfezioni.value.split('£');
                prezzoNetto = parseFloat(ddlValue[2].replace(",","."));
            }
        }
        else if (catalogo == "2")
        {
            prezzoNetto = parseFloat(param1.replace(",","."));        
        }   
        var ddlQuantita = document.getElementById(ddlQuantitaId);
        if (ddlQuantita!=null)
        {
            var quantita = parseFloat(ddlQuantita.value);
         }
        
        var lblTotale = document.getElementById(lblTotaleID);
        var totale = quantita * prezzoNetto;
        var btnOrdina = document.getElementById(btnOrdinaID);
        totale = totale * Math.pow(10,2);
        totale = Math.round(totale);
        
        if (totale != 0)
        {
            totale =  (totale / Math.pow(10,2)).toString().replace(".",",");
            var tmp_totale = totale.split(',');
            var string_totale = "";
            
            if (tmp_totale.length > 1)
            {
                string_totale = tmp_totale[0];
                if (tmp_totale[1].length == 1)
                {
                    string_totale = string_totale + "," + tmp_totale[1] + "0";
                }
                else
                {
                    string_totale = string_totale + "," + tmp_totale[1];
                }
            }
            else
            {
                string_totale = tmp_totale[0] + ",00";
            }
            
            if (ddlQuantita!=null)
            {
                ddlQuantita.style.display='block';
            }
            if (btnOrdina!=null)
            {
                btnOrdina.style.display='block'; 
            }
            if(lblTotale!=null)
            {
                lblTotale.innerHTML  = "<b>€ " + string_totale + "</b>";
            }
        }
        else
        {
            if (ddlQuantita!=null)
            {
                ddlQuantita.style.display='none';
            }
            if (btnOrdina!=null)
            {
                btnOrdina.style.display='none'; 
            }
            if(lblTotale!=null)
            {
                lblTotale.innerHTML  = "";
            }
        }
}

function mostraTotaleSingleProd(labelPrezzoID, ddlQuantitaId, lblTotaleID, catalogo, btnOrdinaID)
{
        var prezzoNetto = 0;
        
        var labelDescrizioneProdotto = document.getElementById(labelPrezzoID);
        if (labelDescrizioneProdotto != null)
        {
            var lblValue = labelDescrizioneProdotto.value.split('£');
            prezzoNetto = parseFloat(lblValue[2].replace(",","."));
        }

        var ddlQuantita = document.getElementById(ddlQuantitaId);
        if (ddlQuantita!=null)
        {
            var quantita = parseFloat(ddlQuantita.value);
         }
        
        var lblTotale = document.getElementById(lblTotaleID);
        var totale = quantita * prezzoNetto;
        var btnOrdina = document.getElementById(btnOrdinaID);
        totale = totale * Math.pow(10,2);
        totale = Math.round(totale);
        
        if (totale != 0)
        {
            totale =  (totale / Math.pow(10,2)).toString().replace(".",",");
            var tmp_totale = totale.split(',');
            var string_totale = "";
            
            if (tmp_totale.length > 1)
            {
                string_totale = tmp_totale[0];
                if (tmp_totale[1].length == 1)
                {
                    string_totale = string_totale + "," + tmp_totale[1] + "0";
                }
                else
                {
                    string_totale = string_totale + "," + tmp_totale[1];
                }
            }
            else
            {
                string_totale = tmp_totale[0] + ",00";
            }
            
            if (ddlQuantita!=null)
            {
                ddlQuantita.style.display='block';
            }
            if (btnOrdina!=null)
            {
                btnOrdina.style.display='block'; 
            }
            if(lblTotale!=null)
            {
                lblTotale.innerHTML  = "<b>€ " + string_totale + "</b>";
            }
        }
        else
        {
            if (ddlQuantita!=null)
            {
                ddlQuantita.style.display='none';
            }
            if (btnOrdina!=null)
            {
                btnOrdina.style.display='none'; 
            }
            if(lblTotale!=null)
            {
                lblTotale.innerHTML  = "";
            }
        }
}



function controllaChange()
{
    radioButton = $$('input');

    for (i = 0; i < radioButton.length; i++)
    {
        if (radioButton[i].type == "radio") 
        
        if (radioButton[i].checked)
        {
            window.location=("?scf=" + radioButton[i].value);
        }
    }
}

function AggiungiAlCarrello(param1, quantitaID, catalogo)
{
   // se il catalogo è di tipo 1 param1 è l'id della ddlConfezioni
   // se il catalogo è di tipo 2 param1 è il codice confezione

    var valoreSelezionatoDDL;
    var codConf;
    var quantita;
    var dropDownQuantita=document.getElementById(quantitaID);
    var dropDownList=document.getElementById(param1);
    quantita = dropDownQuantita.value;
    
    if (catalogo == '1')
    {
        valoreSelezionatoDDL=dropDownList.value.split('£');
        codConf=valoreSelezionatoDDL[1];
    }
    else if (catalogo == '2')
    {
        codConf = param1;
    }        

    addToCart('OC$@$' + quantita + '-' + codConf);
}

function AggiungiAlCarrelloSingleProd(param1, quantitaID)
{
    var valoreSelezionatoLBL;
    var codConf;
    var quantita;
    var dropDownQuantita=document.getElementById(quantitaID);
    var lblDescrizioneProd=document.getElementById(param1);
    quantita = dropDownQuantita.value;
    
    valoreSelezionatoLBL=lblDescrizioneProd.value.split('£');
    codConf=valoreSelezionatoLBL[1];

    addToCart('OC$@$' + quantita + '-' + codConf);
}

function replaceText(obj)
{
    if(obj.getAttribute('type')=='text')
    { 
        var browserName= navigator.appName;
        if (browserName=='Microsoft Internet Explorer')
        {
                var newO=document.createElement('input');
                newO.setAttribute('type','password');
                newO.setAttribute('size','15');
                newO.setAttribute('maxLength','10');
                newO.setAttribute('value', '');
                newO.setAttribute('className', 'password');
                newO.setAttribute('name', obj.getAttribute('name'));
                
                newO.onfocus = function(){replaceText(this)};
                newO.onblur = function(){replacePassword(this)};
                
                obj.parentNode.replaceChild(newO,obj); 
                setTimeout(function() { newO.focus(); }, 10); 
        }
        else
        {
            obj.type = 'password';
            obj.value = "";
            obj.focus();
        }
    }
}

function replacePassword(obj)
{
    var x = obj.value;
    
    if( (obj.getAttribute('type')=='password') && ((x == null) || (x.length < 1)))
    { 
        var browserName= navigator.appName;
        if (browserName=='Microsoft Internet Explorer')
        {
            var newO=document.createElement('input');
            newO.setAttribute('type','text');
            newO.setAttribute('name',obj.getAttribute('name'));
            newO.setAttribute('value', 'password');
            newO.setAttribute('className', 'password');
            newO.setAttribute('size','15');
            newO.setAttribute('maxLength','10');
            
            newO.onfocus=function(){replaceText(this)};
            newO.onblur=function(){replacePassword(this)};
            
            obj.parentNode.replaceChild(newO,obj);
        }
        else
        {
            obj.type = 'text';
            obj.value ="password";
        }
    }
}

function onFocus_GestisciInputUsername(obj)
{
    if (obj.value == 'username')
    {
        obj.value = '';
        var browserName= navigator.appName;
    }
}

function onBlur_GestisciInputUsername(obj)
{
    if (obj.value == '')
    {
        obj.value = 'username';
    }
}
