﻿function getPageSize() {

    var xScroll, yScroll;

    if (window.innerHeight && window.scrollMaxY) {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }

    var windowWidth, windowHeight;
    if (self.innerHeight) {	// all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }

    // for small pages with total height less then height of the viewport
    if (yScroll < windowHeight) {
        pageHeight = windowHeight;
    } else {
        pageHeight = yScroll;
    }

    // for small pages with total width less then width of the viewport
    if (xScroll < windowWidth) {
        pageWidth = windowWidth;
    } else {
        pageWidth = xScroll;
    }


    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight)
    return arrayPageSize;
}
function getScrollY() {
    var scrOfY = 0;
    if (typeof (window.pageYOffset) == 'number') {
        //Netscape compliant
        scrOfY = window.pageYOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
    }
    return scrOfY;
}


function mailing_focus(obj) {
    if (obj.value == txt_mailing)
        obj.value = "";
}
function mailing_blur(obj) {
    if (obj.value == "")
        obj.value = txt_mailing;
}

function mail_friend(fuoco) {
    if (document.getElementById("cartina"))
        document.getElementById("cartina").style.visibility = "hidden";
    document.getElementById("popup_overlay_mailfriend").style.height = (getPageSize()[1]).toString() + "px"
    document.getElementById("popup_content_mailfriend").style.top = (240 + getScrollY()).toString() + "px"
    document.getElementById("popup_content_mailfriend").style.display = "block"
    document.getElementById("popup_overlay_mailfriend").style.display = "block"
    if ((fuoco) && (document.getElementById("ctl00_ContentPlaceHolder1_mailfriend1_txtMailAmico")))
        document.getElementById("ctl00_ContentPlaceHolder1_mailfriend1_txtMailAmico").focus();
}
function close_mail_friend() {
    if (document.getElementById("cartina"))
        document.getElementById("cartina").style.visibility = "visible";
    document.getElementById("popup_content_mailfriend").style.display = "none";
    document.getElementById("popup_overlay_mailfriend").style.display = "none";
}
