﻿// File JScript

function sidemenuon(id) {
    var idsidemenu = id;
    document.getElementById(idsidemenu).style.color = '#ffffff';
    document.getElementById(idsidemenu).style.backgroundPosition = "0 20px";
    document.getElementById(idsidemenu).style.cursor = 'pointer';
    if (idsidemenu == "ml8") {
        document.getElementById('sidepop').style.display = "block";
        document.getElementById('sidepop').style.top = "308px";
        document.getElementById('sidepop').style.position = "absolute";
       	document.getElementById('spcell1').innerHTML = "TVCC/Security 2010";
       	document.getElementById('sp1').style.display = "block";
       	document.getElementById('spcell2').innerHTML = "TVCC 2009";
       	document.getElementById('sp2').style.display = "block";
       	document.getElementById('spcell3').innerHTML = "TVCC 2008";
       	document.getElementById('sp3').style.display = "block";
       	document.getElementById('spcell4').innerHTML = "TVCC 2007";
       	document.getElementById('sp4').style.display = "block";
       	document.getElementById('sp5').style.display = "none";
    }
}

function sidemenuon2(id) {
    var idsidemenu = id;
    if (idsidemenu == "ml1") {
        document.getElementById(idsidemenu).style.color = '#f47920';
    }
    else if (idsidemenu == "ml2") {
        document.getElementById(idsidemenu).style.color = '#0071bc';
    }
    document.getElementById(idsidemenu).style.backgroundPosition = "0 20px";
    document.getElementById(idsidemenu).style.cursor = 'pointer';
}

function sidemenuoff(id) {
    var idsidemenu = id;
    document.getElementById(idsidemenu).style.color = '#0072bc';
    document.getElementById(idsidemenu).style.backgroundPosition = "0 0";
    document.getElementById('sidepop').style.display = "none";
}

function sidemenuoff2(id) {
    var idsidemenu = id;
    document.getElementById(idsidemenu).style.color = '#ffffff';
    document.getElementById(idsidemenu).style.backgroundPosition = "0 0";
    document.getElementById('sidepop').style.display = "none";
}


function sidemenuclick(id) {
    var idsidemenu = id;
    if (idsidemenu == "ml1") {
        window.location.href = "tvcc/tvcc_index.aspx";
    }
    else if (idsidemenu == "ml2") {
        window.location.href = "index.aspx";
    }
    else if (idsidemenu == "ml3") {
        window.location.href = "rivista.aspx";
    }
    else if (idsidemenu == "ml4") {
        window.location.href = "attualita.aspx";
    }
    else if (idsidemenu == "ml5") {
        window.location.href = "approfondimenti.aspx";
    }
    else if (idsidemenu == "ml6") {
        window.location.href = "prodotti.aspx";
    }
    else if (idsidemenu == "ml7") {
        window.location.href = "aziende.aspx";
    }
    else if (idsidemenu == "ml9") {
        window.location.href = "newsletter.aspx";
    }
    else if (idsidemenu == "ml10") {
        window.open('http://www.epc.it/ArchivioRivisteOnline.aspx?id=02', '_blank');
    }
    else if (idsidemenu == "ml11") {
        window.location.href = "gare.aspx";
    }
    else if (idsidemenu == "ml12") {
        window.location.href = "normativa.aspx";
    }
    else if (idsidemenu == "ml13") {
        window.location.href = "contattaci.aspx";
    }
    else if (idsidemenu == "ml14") {
        window.location.href = "digitalbooks.aspx";
    }
    else if (idsidemenu == "ml15") {
        window.location.href = "video.aspx";
    }
}
function layeron(id) {
    var idlayer = id;
    document.getElementById(idlayer).style.background = '#0072bc';
    document.getElementById(idlayer).style.color = '#ffffff';
    //document.getElementById('ml8').style.backgroundPosition = '0 25px';
    //document.getElementById('ml8').color = '#ffffff';
    document.getElementById('sidepop').style.cursor = "pointer";
}
function layeroff(id) {
    var idlayer = id;
    //document.getElementById(idlayer).style.backgroundImage="url('img/sfondocolsx.jpg')";
    document.getElementById(idlayer).style.background = '#ffffff';
    //document.getElementById(idlayer).style.backgroundImage = "img/sfondocolsx.jpg";
    document.getElementById(idlayer).style.color = '#0072bc';    
    //document.getElementById('ml8').style.backgroundPosition = '0 0px';
    //document.getElementById('ml8').color = '#0072bc';
}
function dison() {
    document.getElementById('sidepop').style.display = "block";
    if (document.getElementById('spcell1').innerHTML == "Tvcc 2009") {
        document.getElementById('ml8').style.color = '#FFFFFF';
        document.getElementById('ml8').style.backgroundPosition = "0 25px";
    }
}
function disoff() {
    document.getElementById('sidepop').style.display = "none";
    if (document.getElementById('spcell1').innerHTML == "Tvcc 2009") {
        document.getElementById('ml8').style.color = '#0072bc';
        document.getElementById('ml8').style.backgroundPosition = "0 0";
    }
}

function vaia(id) {
    var idvar = id;
    if (idvar == "sp1") {
        if (document.getElementById('spcell1').innerHTML == "TVCC/Security 2010") 
        {
            window.open('http://www.insic.it/eventi/tvcc2010/index.htm', '_blank');
        }
    }
    else if (idvar == "sp2") {
        if (document.getElementById('spcell2').innerHTML == "TVCC 2009") 
        {
            window.open('http://www.insic.it/eventi/tvcc2009/index.htm', '_blank');
        }
    }
    else if (idvar == "sp3") {
        if (document.getElementById('spcell3').innerHTML == "TVCC 2008") 
        {
            window.open('http://www.insic.it/eventi/tvcc2008/index.htm', '_blank');
        }
    }
    else if (idvar == "sp4") {
        if (document.getElementById('spcell4').innerHTML == "TVCC 2007") 
        {
            window.open('http://www.insic.it/speciali/tvcc2007/index.htm', '_blank');
        }
    }
}


function fixheight() {
    var maxH = 0;
    var ids = ["sinistra","contenuto","destra"];
    //find the highest column
    for (var i=0;i<ids.length;i++) {
        var d = document.getElementById(ids[i]);
        if (d.offsetHeight > maxH) maxH = d.offsetHeight;
    }
    //set them all to be that height
    for (var i=0;i<ids.length;i++) {
        var d=document.getElementById(ids[i]);
        d.style.height = maxH+"px";
    }
}

function gohome() {
        window.location.href = "index.aspx";
}

function logodown() 
{
            window.open('logoantifurto2.rar', '_blank');
}

function abbonati() 
{
            window.open('antifurto.rtf', '_blank');
}
function apribanner(link,id) {
    window.open("bannerstat.aspx?link=" + link + "&idb=" + id, "_blank");
}
function validareg() {
    if (document.getElementById('ctl00_ContentPlaceHolder1_check1').checked == true) {
        return true;
    }
    else 
    {
        alert("Per registrarti devi accettare il trattamento dei tuoi dati secondo il decreto sulla Privacy");
        return false;
    }
    return false;
}
function printSelection(node)
{

  var content=node.innerHTML
  var pwin=window.open('','print_content','width=400,height=600');

  pwin.document.open();
  pwin.document.write('<html><body onload="window.print()">'+content+'</body></html>');
  pwin.document.close();
 
  setTimeout(function(){pwin.close();},1000);

}
