﻿function f_clientHeight() {
    return f_filterResults(window.innerHeight ? window.innerHeight : 0, document.documentElement ? document.documentElement.clientHeight : 0, document.body ? document.body.clientHeight : 0);
}

function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function showPreview(e, img) {
    var x;
    var y;

    if (e.clientX != null && e.clientX > 0) {
        x = e.clientX + 1;
        y = e.clientY + 1;
    } else {
        if (e.pageX != null && e.pageY > 0) {
            x = e.pageX + 1;
            y = e.pageY + 1;
        }
    }

    if (document.documentElement.scrollLeft != null) {
        x += document.documentElement.scrollLeft;
        y += document.documentElement.scrollTop;
    } 

    document.getElementById('imgPreview').src = img;
    document.getElementById('divImgPreview').style.left = x + 'px';
    document.getElementById('divImgPreview').style.top = y + 'px';
    document.getElementById('divImgPreview').style.visibility = 'visible';
}

function hidePreview() {
    document.getElementById('divImgPreview').style.visibility = 'hidden';
}


