﻿public_indocpopup_sharedcontainer = "sharedpop";

/*****
* The following css is required by this class
*

.popup-sub
{
	text-align: center;
	top: 0px;
	left: 0px;
    position:absolute;
	z-index: 150;
	background-color: #000000;
	filter: alpha(opacity=50);
	opacity: 0.7;
	float:left;
}

.popup-container
{
    position: absolute;
	color: #000000;
	top: 0px;
    left: 0px;
    z-index: 151;
    text-align: center;
}

.popup-body
{
    position: relative;
	visibility:visible;
	background-color: #ffffff;
	border: 1px solid #000000;
	color: #000000;
	left: 0px;
	top: 60px;
	width: 600px;
	z-index: 200;
	padding: 15px;
	filter: alpha(opacity=100);
	opacity: 1;
}

*
*/

function indocpopup_show() {
    var subheight = 0;

    var docwrapper = $("wcglobaldocwrapper");

    if (docwrapper) {
        subheight = docwrapper.getHeight() + 10;
    }
    else {
        subheight = $(document.body).getHeight();

        if (subheight < 1200) {
            subheight = 1200;
        }
    }
    
    var workingSub = $("_docpop_sub" + public_indocpopup_sharedcontainer);
    
    if (!workingSub)
    {
	var html = "<div id=\"_docpop_sub" + public_indocpopup_sharedcontainer + "\">" +
                                "<div class=\"popup-sub\" id=\"_docpop_sub_" + this.name + "\" style=\"height:" + subheight + "px;width:100%\">" +
                                "</div>" + 
                                "<div class=\"popup-container\" style=\"height:" + subheight + "px;width:100%\">" +
                                    "<div class=\"popup-body\" id=\"" + this.name + "\">" +
                                    "</div>" +
                                "</div>" +
                            "</div>";

        $(document.body).insert({bottom: html});
    }
    else
    {
        workingSub.style.display = "block";
    }

    if (this.scrollmode == "top") {
        window.scroll(0, 0);
	$(this.name).style.top = "160px";
    }
    else { //center on the current viewport... get the current scroll
        //window.alert(document.viewport.getScrollOffsets().top);

        $(this.name).style.top = (document.viewport.getScrollOffsets().top + 160) + "px";
    }
}

function indocpopup_hide()
{
    var workingSub = $("_docpop_sub" + public_indocpopup_sharedcontainer);

    workingSub.style.display = "none";
}







function indocpopup(name)
{
    this.name = name;
    this.scrollmode = "top";

    this.show = indocpopup_show;
    this.hide = indocpopup_hide;
}



