// File incluso per il funzionamento del menu e delle finestre pop-up

isamap = new Object();
isamap[0] = "_df"
isamap[1] = "_ov"
isamap[2] = "_ot"
isamap[3] = "_dn"

function isimgact(id, act)
{
	if(document.images) document.images[id].src = eval( "roll." + id + isamap[act] + ".src");
}

if (document.images) { // ensure browser can do JavaScript rollovers.
roll = new Object();
roll.rdk_df = new Image();
roll.rdk_df.src = "../shared_images/but_rdk.gif";

roll.rdk_ov = new Image();
roll.rdk_ov.src = "../shared_images/but_rdk02.gif";

roll.uomo_df = new Image();
roll.uomo_df.src = "../shared_images/menu/but_uomo.gif";

roll.uomo_ov = new Image();
roll.uomo_ov.src = "../shared_images/menu/but_uomo02.gif";

roll.donna_df = new Image();
roll.donna_df.src = "../shared_images/menu/but_donna.gif";

roll.donna_ov = new Image();
roll.donna_ov.src = "../shared_images/menu/but_donna02.gif";

roll.bambino_df = new Image();
roll.bambino_df.src = "../shared_images/menu/but_bambino.gif";

roll.bambino_ov = new Image();
roll.bambino_ov.src = "../shared_images/menu/but_bambino02.gif";

}

function openWindow(url) {

     popUpWin =
window.open(url,'product','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=285,height=313,screenX=110,screenY=10,left=110,top=10');

      if (!popUpWin.focus()) {
         popUpWin.focus();
      }

   popUpWin.location.href = url;
   popUpWin.opener = self
  }

function openWindowGift(url) {
		
    	popUpWin = window.open(url,'giftwrap','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=350,screenX=110,screenY=10,left=110,top=10');
		
}

function openWindowTell2(url) {
		
    	popUpWin = window.open(url,'tell','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=420,screenX=110,screenY=10,left=110,top=10');
}

function openWindowTaglie(url) {
		
    	popUpWin = window.open(url,'taglie','toolbar=0,location=0,scrollbars=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=580,height=440,screenX=110,screenY=10,left=110,top=10');
}

function openWindowValuta(url) {

     popUpWin = window.open(url,'valuta','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=500,height=560,screenX=110,screenY=10,left=110,top=10');
  }

function openWindowTell(url) {

     popUpWin = window.open(url,'tell','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=430,height=550,screenX=110,screenY=10,left=110,top=10');
  }

function openWindowDettagli(url) {

     popUpWin = window.open(url,'dettagli','toolbar=0,location=0,directories=0,scrollbars=1,status=0,menubar=0,scrollbars=1,resizable=1,width=750,height=400,screenX=110,screenY=10,left=20,top=100');
  }

function WinOpen(url,name,features) {
	popWin = window.open(url,name,features);
}

// Apre un popup (dimensioni parametrizzate)
function openWindowGeneral(l, t, w, h, URL, nome, scroll, redim) {
   var windowprops = "location=no,scrollbars=" + scroll + ",menubars=no,toolbars=no,resizable=" + redim +  ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
	 popUpWin = window.open(URL,nome,windowprops);
}
/* Funzione per il pop-up */
function popUpWin2(url,width,height,scroll) {

	parString= "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=0,width=" + width + ",height=" + height + ",screenX=200,screenY=100,left=200,top=100"
    window.open(url,"popUpWin",parString);
}
function popUpWin(url,width,height,scroll) {

	parString= "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=0,width=" + width + ",height=" + height + ",screenX=200,screenY=100,left=200,top=100"
    window.open(url,"popUpWin",parString);
}
function openWindowIMG(l, t, w, h,URL, nome, scroll, redim) 
{
var windowprops = "location=no,scrollbars=" + scroll + ",menubars=no,toolbars=no,statusbar=yes,resizable=" + redim +  ",left=" + l + ",top=" + t + ",width=" + w + ",height=" + h;
popUpWin = window.open(URL,nome,windowprops);
}
function rtrim (s)
{
	var rpatt = new RegExp( "^(.*[^ ]) *$" );
	var parse = s.match( rpatt );
	return parse;
}
function ToogleZoomer() {
    var zoomer = document.getElementById("zoomer-flash");

    if (zoomer.className == "zoomer-nascosto")
        zoomer.className = "zoomer-visibile";
    else
        zoomer.className = "zoomer-nascosto";
        
    /*if (zoomer.className == "zoomer-visibile")
        zoomer.className = "zoomer-nascosto";*/
}

var t_id = setInterval(animate,20);
var pos=0;
var dir=2;
var len=0;

function animate()
{
var elem = document.getElementById('progress');
if(elem != null) {
if (pos==0) len += dir;
if (len>32 || pos>79) pos += dir;
if (pos>79) len -= dir;
if (pos>79 && len==0) pos=0;
elem.style.left = pos;
elem.style.width = len;
}
}

function remove_loading() {
this.clearInterval(t_id);
var targelem = document.getElementById('loader_container');
targelem.style.display='none';
targelem.style.visibility='hidden';
var t_id = setInterval(animate,60);
}

function toogleBloccoModelli(idElement, prefisso) {

    closeAllElementes("lista-modelli", "block_");
    switchFreccina("lista-modelli", "block_");
    document.getElementById("block_" + idElement).className = "prodotto-visibile";
    document.getElementById("freccina_" + idElement).src = '/shared_images/freccia_piena-down.png';
}

function closeAllElementes(elementPadre, prefisso) {

    var divModelli = document.getElementById(elementPadre);
    var divCollection = divModelli.getElementsByTagName("div");

    for (var i = 0; i < divCollection.length; i++) {
        if (divCollection[i].getAttribute("id") != null) {
            var FindedId = divCollection[i].getAttribute("id");

            if (FindedId.indexOf(prefisso) >= 0) {
                document.getElementById(divCollection[i].getAttribute("id")).className = "nascosto";
            }
        }
    }   
}

function switchFreccina(elementPadre, prefisso) {

    var divModelli = document.getElementById(elementPadre);
    var imgCollection = divModelli.getElementsByTagName("img");

    for (var i = 0; i < imgCollection.length; i++) {
        if (imgCollection[i].getAttribute("id") != null) {
            var FindedId = imgCollection[i].getAttribute("id");

            if (FindedId.indexOf("freccina_") >= 0) {
                document.getElementById(imgCollection[i].getAttribute("id")).src = '/shared_images/freccia_vuota.png';
            }
        }
    }
}

/// Rollover sulle immagini 
///
function rollOver(img, img_src) {
    img.src = img_src;
}


//-->

