﻿//HP
var urlapplic
urlapplic = "http://www.websim.it/"
function ReutersLegenda() {
    window.open(urlapplic + "reutersdisclaimer.htm", null, "toolbar=0,resizable=0,height=420,width=380");
}
function mostraevidenza1() {
    document.getElementById("evidenza1").style.display = "block"
    document.getElementById("evidenza2").style.display = "none"
    document.getElementById("evidenza3").style.display = "none"
    document.getElementById("selezevidenza1").className = "primo_box_evidenza_selezionati"
    document.getElementById("selezevidenza2").className = "secondo_box_evidenza"
    document.getElementById("selezevidenza3").className = "terzo_box_evidenza"
}
function mostraevidenza2() {
    document.getElementById("evidenza1").style.display = "none"
    document.getElementById("evidenza2").style.display = "block"
    document.getElementById("evidenza3").style.display = "none"
    document.getElementById("selezevidenza1").className = "primo_box_evidenza"
    document.getElementById("selezevidenza2").className = "secondo_box_evidenza_selezionati"
    document.getElementById("selezevidenza3").className = "terzo_box_evidenza"
}
function mostraevidenza3() {
    document.getElementById("evidenza1").style.display = "none"
    document.getElementById("evidenza2").style.display = "none"
    document.getElementById("evidenza3").style.display = "block"
    document.getElementById("selezevidenza1").className = "primo_box_evidenza"
    document.getElementById("selezevidenza2").className = "secondo_box_evidenza"
    document.getElementById("selezevidenza3").className = "terzo_box_evidenza_selezionati"
}
function showoggipa() {
    document.getElementById("oggipa").style.display = "block"
    document.getElementById("oggiws").style.display = "none"
    document.getElementById("mostraoggipa").className = "selettore_selezionato_pa"
    document.getElementById("mostraoggiws").className = "selettore_non_selezionato_ws"
}
function showoggiws() {
    document.getElementById("oggipa").style.display = "none"
    document.getElementById("oggiws").style.display = "block"
    document.getElementById("mostraoggipa").className = "selettore_non_selezionato_pa"
    document.getElementById("mostraoggiws").className = "selettore_selezionato_ws"
}
//function menuAF() {
function apriBoxGiudizi(box,img) {
    if (document.getElementById(box).style.display == "none") {
        document.getElementById(box).style.display = "block";
        document.getElementById(img).src = urlapplic + "immagini/freccia_rassegna_aperto.png";
    }
    else {
        document.getElementById(box).style.display = "none";
        document.getElementById(img).src = urlapplic + "immagini/freccia_rassegna_chiuso.png";
    }
}
//FATTI EFFETTI E RASSEGNA STAMPA
function apriBoxSelezionatoFERS() {
    var url = window.location;
    var anchor = url.hash.substring(1);
    if (anchor != '') {
        var box = 'box' + anchor;
        var img = 'img' + anchor;
        apriBoxFERS(box, img, 'apri');
    }
}

function apriBoxFERS(box, img, forza) {
    if (forza == 'apri') {
        document.getElementById(box).style.display = "block";
        document.getElementById(img).src = urlapplic + "immagini/freccia_rassegna_aperto.png";
    } else {
        if (document.getElementById(box).style.display == "none") {
            document.getElementById(box).style.display = "block";
            document.getElementById(img).src = urlapplic + "immagini/freccia_rassegna_aperto.png";
        }
        else {
            document.getElementById(box).style.display = "none";
            document.getElementById(img).src = urlapplic + "immagini/freccia_rassegna_chiuso.png";
        }
    }
}

//MENU
function aprimenu(sottomenu) {
    if (document.getElementById(sottomenu).style.display == "none") {
        document.getElementById(sottomenu).style.display = "block";
    }
    else {
        document.getElementById(sottomenu).style.display = "none";
    }
}
//REDIRECT ANALISI FONAMENTALE
function redirAnaFond() {
    var index = document.getElementById("ddlCercaTitolo").selectedIndex
    if (document.getElementById("ddlCercaTitolo").options[index].value != "") {
        location = document.getElementById("ddlCercaTitolo").options[index].value;
    }
}
//STAMPA
function printSelection(node) {
    var content = document.getElementById(node).innerHTML
    var pwin = window.open('', 'print_content', 'width=600,height=500');

    pwin.document.open();
    pwin.document.write('<html><head><title>Websim</title><link rel="stylesheet" type="text/css" href="' + urlapplic + 'stampa.css" /></head><body onload="window.print()" style="padding:0 0 0 0;background-color:white;"><div style="width:650px;"><h1 style="color:black;">Websim.it</h1><hr />' + content + '</div><hr />Copyright © Websim.it</body></html>');
    pwin.document.close();

    setTimeout(function() { pwin.close(); }, 1000);
}
//DIV INVIA AMICO
function inviaAmico(vero, node) {
    document.getElementById("coprente").style.display = vero;
    document.getElementById("box_popup").style.display = vero;
    document.getElementById("div_chiudi").style.display = vero;
    document.getElementById("divConfermaInviaAmico").style.display = 'none';
    //QUI PRENDE CONTENUTO ARTICOLO
    //var content = document.getElementById(node).innerHTML;
    //QUI PRENDE URL ARTICOLO
    var content = window.location;
    var hfArticolo = document.getElementById("hfCorpoArticolo");
    hfArticolo.value = content;
}
//DIV CERCA
function inviaCerca() {
    var testo = document.getElementById('txtCercaTesto').value
    var titolo = document.getElementById('txtCercaTitolo').value
    var sezIndex = document.getElementById('ddlCercaSezione').selectedIndex;
    var sezione = document.getElementById('ddlCercaSezione').options[sezIndex].value;
    var urlredir = urlapplic + 'cerca-websim/cerca.wsml?te=' + encodeURIComponent(testo) + '&ti=' + encodeURIComponent(titolo) + '&se=' + encodeURIComponent(sezione);
    //alert(urlredir);
    window.location = urlredir;
    //window.navigate("http://www.infocentric.it");
}
