﻿function loadSize(obj, subobj) {
    var sub = '_pnlhomeSfondo';
    sub = subobj.toString() + sub.toString();
    var detail = '_pnlhomeDescrizione';
    detail = subobj.toString() + detail.toString();
    var img = '_imgbgImg';
    img = subobj.toString() + img.toString();
    var myWidth = 0, myHeight = 0, scrollHeight = 0;
    var nonIE = false;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        //scrollHeight = window.scrollHeight;
        scrollHeight = document.body.scrollHeight;
        nonIE = true;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
        scrollHeight = document.documentElement.scrollHeight;        
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible 
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        scrollHeight = document.body.scrollHeight;
    }
    var page_content = document.getElementById(obj);
    var img_content = document.getElementById(sub);
    var det_content = document.getElementById(detail);
    if (det_content == null) {
        detail = subobj.toString() + '_pnlhomeResult';
        det_content = document.getElementById(detail);
    }
    if (det_content == null) {
        detail = subobj.toString() + '_pnlProdotti'; 
        det_content = document.getElementById(detail);
    }

    var img_img = document.getElementById(img);
    
    if (myHeight >= scrollHeight) {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130 +"px";
                det_content.style.minHeight = myHeight - 130 + "px";
                page_content.style.height = myHeight - 130 + "px";
                det_content.style.height = myHeight - 130 + "px";
            }
        }
        if (img_content != null) {
            img_content.style.minHeight = myHeight - 130 + "px";
            img_img.style.minHeight = myHeight - 130 + "px";
            img_content.style.height = myHeight - 130 + "px";
            img_img.style.height = myHeight - 130 + "px";
        }
    } else {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130 + "px";
                det_content.style.minHeight = scrollHeight - 130 + "px";
            } else {
            page_content.style.minHeight = scrollHeight - 130 + "px";
            det_content.style.minHeight = scrollHeight - 130 + "px";
            }
        }
        if (img_content != null) {
            if (det_content.clientHeight < myHeight - 130) {
                img_content.style.minHeight = myHeight - 130 + "px";
                img_img.style.minHeight = myHeight - 130 + "px";
            } else {
                img_content.style.minHeight = det_content.clientHeight;
                if (img_img!=null) img_img.style.minHeight = det_content.clientHeight;            
            }
        }            
    }
//        var test_scroll = getScrollY();
//        var test_scroll = scrollHeight
//        if (test_scroll == 0) {
//            if (page_content.cells[1].childNodes[0] != null) {
//                page_content.cells[1].childNodes[0].style.height = myHeight - 130;
//            }
//        }
}

function reSize(obj, subobj) {
    var sub = '_pnlhomeSfondo';
    sub = subobj.toString() + sub.toString();
    var detail = '_pnlhomeDescrizione';
    detail = subobj.toString() + detail.toString();
    var img = '_imgbgImg';
    img = subobj.toString() + img.toString();
    var myWidth = 0, myHeight = 0, scrollHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        scrollHeight = document.body.scrollHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
        scrollHeight = document.documentElement.scrollHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible 
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        scrollHeight = document.body.scrollHeight;
    }
    var page_content = document.getElementById(obj);
    var img_content = document.getElementById(sub);
    var det_content = document.getElementById(detail);
    var img_img = document.getElementById(img);

    if (myHeight >= scrollHeight) {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130 + "px";
                det_content.style.minHeight = myHeight - 130 + "px";
                page_content.style.height = myHeight - 130 + "px";
                det_content.style.height = myHeight - 130 + "px";
            }
        }
        if (img_content != null) {
            img_content.style.minHeight = myHeight - 130 + "px";
            img_img.style.minHeight = myHeight - 130 + "px";
            img_content.style.height = myHeight - 130 + "px";
            img_img.style.height = myHeight - 130 + "px";
        }
    } else {
//        if (det_content != null) {
//            if (det_content.clientHeight <= myHeight - 130) {
//                page_content.style.minHeight = myHeight;
//                det_content.style.minHeight = myHeight;
//                //page_content.style.height = myHeight - 130;
//                //det_content.style.height = myHeight - 130;
//            }
//            if (img_content != null) {
//                img_content.style.minHeight = myHeight;
//                img_img.style.minHeight = myHeight;
//                //img_content.style.height = myHeight - 130;
//                //img_img.style.height = myHeight - 130;
//            }
//        }
    }
    //        var test_scroll = getScrollY();
    //        var test_scroll = scrollHeight
    //        if (test_scroll == 0) {
    //            if (page_content.cells[1].childNodes[0] != null) {
    //                page_content.cells[1].childNodes[0].style.height = myHeight - 130;
    //            }
    //        }
}


function getScrollY() {
    var scrOfX = 0, scrOfY = 0;
    if (typeof (window.pageYOffset) == 'number') {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
    return scrOfY;
}

function loadSize_App(obj, subobj) {
    var sub = '_pnlhomeSfondo';
    sub = subobj.toString() + sub.toString();
    var detail = '_pnlhomeDescrizione';
    detail = subobj.toString() + detail.toString();
    var img = '_imgbgImg';
    img = subobj.toString() + img.toString();
    var myWidth = 0, myHeight = 0, scrollHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        scrollHeight = window.scrollHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
        scrollHeight = document.documentElement.scrollHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible 
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        scrollHeight = document.body.scrollHeight;
    }
    var page_content = document.getElementById(obj);
    var img_content = document.getElementById(sub);
    var det_content = document.getElementById(detail);
    var img_img = document.getElementById(img);

    if (myHeight >= scrollHeight) {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130;
                det_content.style.minHeight = myHeight - 130;
                page_content.style.height = myHeight - 130;
                det_content.style.height = myHeight - 130;
            }
        }
        if (img_content != null) {
            img_content.style.minHeight = myHeight - 130;
            img_img.style.minHeight = myHeight - 130;
            img_content.style.height = myHeight - 130;
            img_img.style.height = myHeight - 130;
        }
    } else {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130;
                det_content.style.minHeight = myHeight - 130;
            }
        }
        if (img_content != null) {
            img_content.style.minHeight = myHeight - 130;
            img_img.style.minHeight = myHeight - 130;
        }
    }
    //        var test_scroll = getScrollY();
    //        var test_scroll = scrollHeight
    //        if (test_scroll == 0) {
    //            if (page_content.cells[1].childNodes[0] != null) {
    //                page_content.cells[1].childNodes[0].style.height = myHeight - 130;
    //            }
    //        }
}

function reSize_App(obj, subobj) {
    var sub = '_pnlhomeSfondo';
    sub = subobj.toString() + sub.toString();
    var detail = '_pnlhomeDescrizione';
    detail = subobj.toString() + detail.toString();
    var img = '_imgbgImg';
    img = subobj.toString() + img.toString();
    var myWidth = 0, myHeight = 0, scrollHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        scrollHeight = window.scrollHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
        scrollHeight = document.documentElement.scrollHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible 
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        scrollHeight = document.body.scrollHeight;
    }
    var page_content = document.getElementById(obj);
    var img_content = document.getElementById(sub);
    var det_content = document.getElementById(detail);
    var img_img = document.getElementById(img);

    if (myHeight >= scrollHeight) {
        if (det_content != null) {
            if (det_content.clientHeight <= myHeight - 130) {
                page_content.style.minHeight = myHeight - 130;
                det_content.style.minHeight = myHeight - 130;
                page_content.style.height = myHeight - 130;
                det_content.style.height = myHeight - 130;
            }
        }
        if (img_content != null) {
            img_content.style.minHeight = myHeight - 130;
            img_img.style.minHeight = myHeight - 130;
            img_content.style.height = myHeight - 130;
            img_img.style.height = myHeight - 130;
        }
    } else {
        //        if (det_content != null) {
        //            if (det_content.clientHeight <= myHeight - 130) {
        //                page_content.style.minHeight = myHeight;
        //                det_content.style.minHeight = myHeight;
        //                //page_content.style.height = myHeight - 130;
        //                //det_content.style.height = myHeight - 130;
        //            }
        //            if (img_content != null) {
        //                img_content.style.minHeight = myHeight;
        //                img_img.style.minHeight = myHeight;
        //                //img_content.style.height = myHeight - 130;
        //                //img_img.style.height = myHeight - 130;
        //            }
        //        }
    }
    //        var test_scroll = getScrollY();
    //        var test_scroll = scrollHeight
    //        if (test_scroll == 0) {
    //            if (page_content.cells[1].childNodes[0] != null) {
    //                page_content.cells[1].childNodes[0].style.height = myHeight - 130;
    //            }
    //        }
}

