﻿//function xGetElementById(e) {
//    if (typeof (e) == 'string') {
//        if (document.getElementById) e = document.getElementById(e);
//        else if (document.all) e = document.all[e];
//        else e = null;
//    }
//    return e;
//}

function xStr(s) {
    for (var i = 0; i < arguments.length; ++i) { if (typeof (arguments[i]) != 'string') return false; }
    return true;
}

function xGetElementById(e, d) {
    var dd = (d ? d : document);
    if (typeof (e) != 'string') return e;
    if (dd.getElementById) e = dd.getElementById(e);
    else if (dd.all) e = dd.all[e];
    else e = null;
    return e;
}

function xInnerHtml(e, h, d) {
    if (!(e = xGetElementById(e, d))) return null;
    if (!xStr(e.innerHTML)) return null;
    var s = e.innerHTML;
    if (xStr(h)) { e.innerHTML = h; }
    return s;
}

function pageWidth() {
    return parseInt("0" + (window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth), 10);
}

function pageHeight() {
    return parseInt("0" + (window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight), 10);
}

function setDisplay(id, stato) {
    var e;
    e = xGetElementById(id);
    e.style.display = stato;
}

function VisualizzaMessaggioIniziale() {
    //setDisplay("messIniziale","");
    setDisplay("iPag","none");
}

function VisualizzaFinestra() {
    //setDisplay("messIniziale","none");
    setDisplay("iPag","");
}

var id_img = 0;
function display_foto(src,alt,wdth,cls) {
    id_img++;
    document.write('<a href="javascript:void(0)" onclick="apriFoto(\'imgc' + id_img.toString() + '\'); return false;">');
    document.write('<img id="imgc' + id_img.toString() + '" src="images/' + src + '" alt="' + alt + '" width="' + wdth + '" class="' + cls + '" />');
    document.write("</a>");
}

function display_space(n) {
    var i = 1;
    if (n) i = n;
    while (i > 0) {
        document.write('&nbsp;');
        i--;
    }
}

var wFoto = null;

function apriFoto(t) {
//    var w = null;
    var i = xGetElementById(t);
    if (i) {
//        var h = '<img src="' + i.src + '" alt="non solo donna" />';
//        var d = xGetElementById("innerFoto");
//        xInnerHtml(d, h);
//        d = xGetElementById("divFoto");
//        d.style.display = '';
        var v = '';
        v = v + 'channelmode=1,';
        v = v + 'fullscreen=0,';
        v = v + 'location=0,';
        v = v + 'menubar=0,';
        v = v + 'resizable=0,';
        v = v + 'scrollbars=0,';
        v = v + 'status=0,';
        v = v + 'titlebar=0,';
        v = v + 'toolbar=0';
        wFoto = window.open('VisualizzaFoto.aspx?foto=' + i.src, 'FOTONSD', v);
        if (wFoto) {
            wFoto.focus();
        }
    }
    return wFoto;
}

function test_foto() {
    if (wFoto) {
        wFoto.close();
    }
}

