﻿// File JScript

function ToggleMe(a){
//funzione per nascondere e visualizzare i tag DIV alternando Carrello e LogIN
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
} else {
e.style.display="none"
}
}

function GoToURL() { //v3.0
  var i, args=GoToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function NuovaFinestra(LINK){

    Finestra = window.open(LINK,'NewLink', 'menubar=yes, resizable=yes,toolbar=yes,scrollbars=yes,width=800,height=500,top=50,left=40');
    if (window.focus) {Finestra.focus()}
    return false;
}

function NuovaFinestra2(LINK){
    Finestra = window.open(LINK,'NewLink', 'menubar=no, resizable=no,toolbar=no,scrollbars=yes,width=750,height=160,top=50,left=40');
    if (window.focus) {Finestra.focus()}
    

}

function ChiudiFinestra() {
self.close();

}

function SwapImgRestore() {//v1.0
 var doc=document,i; if(doc.$imgSwaps) { for(i=0;i<doc.$imgSwaps.length;i++) {
  var elm=doc.$imgSwaps[i]; if(elm) { elm.src=elm.$src; elm.$src=null; } } 
  doc.$imgSwaps=null; }
}

function PreloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.imgs) d.imgs=new Array();
 for(var i=0; i<a.length; i++) { d.imgs[i]=new Image; d.imgs[i].src=a[i]; }
}

function SwapImg() {//v1.0
 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
 n+=2) { elm=GetObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function GetObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=GetObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=GetObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

