
var rollimgs, preimgs;
function hp_preloadimgs() {
    rollimgs = new Array("advertising2,png", "blu_icon2.gif", "contacts2.png", "history2.png", "localization2.png", "multimedia2.png", "newsbtn2.png", "studios2.png", "yell_icon2.gif");
    preimgs = new Array();
    for (i = 0; i < rollimgs.length; i++) {
        preimgs[i] = new Image;
        preimgs[i].src = "images/" + rollimgs[i];
    }   
}

function history_preloadimgs() {
    rollimgs = new Array("downloadbtn2.png", "advertising2,png", "blu_icon2.gif", "contacts2.png", "history2.png", "localization2.png", "multimedia2.png", "newsbtn2.png", "studios2.png"); // ridondante per menu?
    preimgs = new Array();
    for (i = 0; i < rollimgs.length; i++) {
        preimgs[i] = new Image;
        preimgs[i].src = "images/" + rollimgs[i];
    }   
}

function roll(what,how) {
    imgurl = "images/" + what + how + ".png";
    eval("document.images." + what).src = imgurl;
    //alert(what);
    if ((what == "multimedia") || (what == "advertising") || (what == "localization") || (what == "multimedia_eng") || (what == "advertising_eng") || (what == "localization_eng")) icolor = "blu";
    else icolor = "yell";
    
    iconurl = "images/" + icolor + "_icon" + how + ".gif";
    //eval("document.images." + what + "_icon").src = iconurl;
}

function rollicon(what,how) {
    icolor = "blu";
    
    iconurl = "images/" + icolor + "_icon" + how + ".gif";
    eval("document.images." + what + "_icon").src = iconurl;
}

function rollbtn(what,how) {    
    eval("document.images." + what).src = "images/" + what + how + ".png";
}

var n; // counter per l'array delle news, serve anche per il link
var currentnews; var newsint;

var tickers;

function init_news() {

    // costruzione dei ticker
    tickers = new Array();
    for (t = 0; t < newstit.length; t++) {
        tickers[t] = "<B>" + newstit[t] + "</B> - " + newsbody[t];
        tickers[t] = tickers[t].substr(0,160) + " ..."; // 160 è il limite oltre al quale si tronca con "..."
    }
    //

    n = 0;
    currentnews = tickers[n];
    newsint = setInterval(writenews, 35);
}

var w; w = 0; // counter per stringa currentnews;

function writenews() {
    towrite = currentnews.substr(0, w);
    w++;
    if (currentnews.charAt(w) == "<") {
        while (currentnews.charAt(w) != ">") {
            w++;
        }
    }
    if (w <= currentnews.length+1) {
        //newsboxtxt.innerHTML = towrite;
        document.getElementById("newsboxtxt").innerHTML = towrite;
    } else if (w > 300) {
        w = 0;
        n++;
        if (n >= tickers.length) {
            n = 0;
        }
        currentnews = tickers[n];
    }
}

function go_news() {
    window.location.href = "news.htm#news" + n; // richiama news corrispondente dal ticker alla pag news.htm - TESTARE on-line (offline funge)!
}

function go_news_eng() {
    window.location.href = "news_eng.htm#news_eng" + n; // richiama news corrispondente dal ticker alla pag news.htm - TESTARE on-line (offline funge)!
}

function create_news() {
    
    titoli = ""; corpi = "";
    for (c = 0; c < newstit.length; c++) {
    // TITOLI - LINK
        titoli += '<DIV class="content_txt" id="par_news"><A href="#news' +c+ '" id="newslink">&gt;&nbsp;' +newstit[c]+ '</A></DIV>';
    // DATE - CORPI
        corpi  += '<DIV class="news_spacer"><img src="images/hr.gif" width="501" height="28" alt="" border="0"></DIV>                       <DIV class="content_txt"><A name="news' +c+ '"><STRONG style="text-transform:uppercase">' +newstit[c]+ '</STRONG></A><BR><I style="color:#939499">' +newsdate[c]+ '</I><BR><DIV class="content_txt">' +newsbody[c]+ '</DIV>';
    }
    //newstd.innerHTML = titoli + corpi;
    document.getElementById("newstd").innerHTML = titoli + corpi;
}

// funzione per la visualizzazione delle mappe delle sedi jinglebell

 function map(quale) {
    if (quale == 0) {
        div_map.innerHTML = '';
        } else {
        imgstring = '<a href="#" id="mappa" onClick="javascript:map(0);">Chiudi mappa</a><IMG src="images/mappa' + quale + '.jpg" width="502" height="390" alt="" border="0" >';
        div_map.innerHTML = imgstring;
        }
}

 function map_eng(quale) {
    if (quale == 0) {
        div_map.innerHTML = '';
        } else {
        imgstring = '<a href="#" id="mappa" onClick="javascript:map(0);">Close map</a><IMG src="images/mappa' + quale + '.jpg" width="502" height="390" alt="" border="0" >';
        div_map.innerHTML = imgstring;
        }
}

// funzione per la visualizzazione del rollover di immagini in studios.htm
function imgstudi(quale) {
  if (quale == 0) {
    div_imgstudi.innerHTML = '<IMG src="images/background_banners.jpg" width="500" height="223" alt="" border="0" usemap="#studi_imgmap">';
    } else {
    imgstring = '<IMG src="images/mi_studi' + quale + '.jpg" width="500" height="223" alt="" border="0" onMouseout="javascript:imgstudi(0);">';
    div_imgstudi.innerHTML = imgstring;
    }
}