///////////////////////////////
// MVSD popup.js
// Version: 1.0.0 10-12-2004
// Preconditions:
//		-	The page which includes this file, has to have a cute-editor.
//		Naar de volgende files wordt in deze file verwezen.
//		-	popuphyper.asp
//		-	popupbookmark.htm
//		-	popupbookmarkmanager.asp
//		-	bookmarklist.asp
//		-	bookmarklist.htm
// Dependencies:
//		-	none
// Description:
// Provides functionality for the 3 custombuttons on the EasyWebEdit cute editor.
//	1.	Hyperlinkbutton :		showHyperlinkDialog()
//	2.	BookmarkInsertButton:	showBookmarkDialog()
//	3.	BookmarkEditButton:		showBookmarkManageDialog()
//	De andere functies zijn ondersteunend.
///////////////////////////////

function showPopupDiv(popupTekst, objPicture) {
    var objPictureOffset = calculateOffset(objPicture);
    var objPictureOffsetTop = calculateOffsetTop(objPicture);

    document.getElementById('InfoDivContent').innerHTML = popupTekst;
    document.getElementById('InfoDiv').style.left = objPictureOffset;
    document.getElementById('InfoDiv').style.zIndex = 999;
    document.getElementById('InfoDiv').style.top = objPictureOffsetTop;
    document.getElementById('InfoDiv').style.visibility = 'visible';
}

function showHelpDialog(isSubFolder) {
    if (isSubFolder) {
        window.open("../../Help.aspx", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=550, height=450");
    }
    else {
        window.open("Help.aspx", "_blank", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=550, height=450");
    }
}

///this function pops up a modal dialog(popup.asp). This popup lets you choose and insert
/// hyperlinks (custom & cms) 
function showHyperlinkDialog(editor, intPageId, strPath) {
    var parameters = new Array();
    parameters[0] = editor;
    parameters[1] = intPageId;

    if (-1 == intPageId) {
        if (document.forms[0].elements.Title) {
            parameters[2] = document.forms[0].elements.Title.value
            if ("" == parameters[2]) {
                parameters[2] = "(huidige pagina)";
            }
        }
    }
    else {
        parameters[2] = null
    }

    var attr = "status:no;dialogWidth:450px;dialogHeight:450px;scroll:no;resizable:no;help:no";
    var page = strPath + "InsertHyperLink.aspx";

    editor.ShowDialog(null, page + "?_rand=" + new Date().getTime(), parameters, attr);
}

function calculateOffset(objItem) {
    var totalOffset = 0;
    var lastOffset = 0;

    if (document.getElementById) {
        var item = objItem;
        do {
            if (item.tagName != 'BODY') {
                lastOffset = item.offsetLeft;
                totalOffset += lastOffset;
                item = eval('item.offsetParent');
            }
            else {
                //totalOffset -= lastOffset;
                item = null;
            }

        } while (item != null);
    }
    else if (document.all) {
        var item = eval('objItem');
        do {
            if (item.tagName != 'BODY') {
                lastOffset = eval('item.offsetLeft');
                totalOffset += lastOffset;
                item = eval('item.offsetParent');
            }
            else {
                totalOffset -= lastOffset;
                item = null;
            }
        } while (item != null);
    }
    return totalOffset;
}

function calculateOffsetTop(objItem) {
    var totalOffset = 0;
    var lastOffset = 0;

    if (document.getElementById) {
        var item = objItem;
        do {
            if (item.tagName != 'BODY') {
                lastOffset = item.offsetTop;
                totalOffset += lastOffset;
                item = eval('item.offsetParent');
            }
            else {
                //totalOffset -= lastOffset;
                item = null;
            }

        } while (item != null);
    }
    else if (document.all) {
        var item = eval('objItem');
        do {
            if (item.tagName != 'BODY') {
                lastOffset = eval('item.offsetTop');
                totalOffset += lastOffset;
                item = eval('item.offsetParent');
            }
            else {
                //totalOffset -= lastOffset;
                item = null;
            }
        } while (item != null);
    }
    return totalOffset;
}
				

