﻿

function TableHideShow(id, cloaking) {
    if (document.getElementById) {
        obj = document.getElementById(id);
        if (obj == null) {
            obj = window.parent.document.getElementById(id);
        }
        if (obj != null) {
            if (obj.style.display == "") {
                TableHide(id, cloaking);
            } else {
                TableShow(id, cloaking);
            }
        }
    }
}

function TableShow(id, cloaking) {
    if (document.getElementById) {
        obj = document.getElementById(id);
        if (obj == null) {
            obj = window.parent.document.getElementById(id);
        }
        if (obj != null) {
            obj.style.display = "";
            if (cloaking == true) cloak("viewer");
        }
    }
}

function TableHide(id, cloaking) {
    if (document.getElementById) {
        obj = document.getElementById(id);
        if (obj == null) {
            obj = window.parent.document.getElementById(id);
        }
        if (obj != null)
            obj.style.display = "none";
        if (cloaking == true) cloakhide("normal");
    }
}

function cloak(classe) {
    if (typeof document.body.style.maxHeight === "undefined") {
        var root = document.getElementsByTagName("html");
        root[0].className = classe;
        if (classe == "viewer") {
            root[0].style.overflow = "hidden";
        } else {
            root[0].style.overflow = "";
        }
    } else {
        var obj = window.parent.document;
        if (obj == null) {
            obj = window.document;
        }

        if (obj != null) {
            obj.body.className = "popupDiv hideScrollbar";
            obj.body.scroll = "no";
        }
    }
}

function cloakhide(classe) {
    if (typeof document.body.style.maxHeight === "undefined") {
        var root = window.parent.document.getElementsByTagName("html");
        root[0].className = classe;
        if (classe == "viewer") {
            root[0].style.overflow = "hidden";
        } else {
            root[0].style.overflow = "";
        }
    } else {
        var obj = window.parent.document;
        if (obj == null) {
            obj = window.document;
        }

        if (obj != null) {
            obj.body.className = "popupDiv showScrollbar";
            obj.body.scroll = "yes";
        } 
    }
}

function modalWindowProduct(ProductID) {
	
    formProduit = document.getElementById("FormProduct");
    formProduit.src = "produit.aspx?ID=" + ProductID;
	
}

function modalWindowProductIE6(ProductID) {
    window.scrollTo(0, 0);  
    formProduit = document.getElementById("FormProduct");
    formProduit.src = "produit.aspx?ID=" + ProductID;
    modalWindow();      
}

function modalWindowNotIE6(ProductID) {
    if (!(typeof document.body.style.maxHeight === "undefined")) {
        modalWindow();
    }    
}

function hideModalWindowProduct() {
    window.location = "/content/produits/blank.html";
    var parent = window.parent;
    modalWindow();
}

/* PAGE SOLUTIONS*/
function modalWindow() {
    TableHideShow("modalOverlay", true);
    TableHideShow("modalContainer", false);
}