﻿function openModal(w, h) {
    var w2;
    if(w==null) 
        w2 = 500 ;
    else
        w2 = w;
    if(h==null) h = false;
    removeClassName($("modal-page"), "close");
    
    $("modal-page").style.height = num(document.body.scrollHeight) + "px";
    
    
    if(w!=null) {
        $("modal-top").style.width = w + "px";
        $("modal-top").style.height = "20px"
        $("modal-body").style.width = w + "px";
        $("modal-box").style.width = w + "px";
    }    
    
    $("modal-box").style.top = num(document.documentElement.scrollTop) + 50 + "px";
    $("modal-box").style.left = (num(windowVisibleWidth()) - w2)/2  + "px";
    
    if(h) {
        $("modal-next").style.display = "none";
        $("modal-prev").style.display = "none";
    }
    
    //if(!window.attachEvent)
        //$("modal-body").style.height = "500px"; 
    
    return $("modal-body");
}

function closeModal() {
    addClassName($("modal-page"), "close");
    /*if(window.attachEvent)
        $("modal-body").childNodes(0).removeNode(true);
    else
        $("modal-body").removeChild($("modal-body").childNodes[0])//.removeNode(true); */
}
