﻿//iDepth 為起始值(遞迴在計算深度用的)， iMax 為終止值, 如果是第一層 ifr 的話，設 (self, 0, 2)，如果是第二層就設 (self, 0, 3)，如果是第三層就設 (self, 0, 4)
var objIfrMain = false;
function resizeIfr(oSelf,iDepth, iMax, ifrId)
{
    iDepth += 1;
    if (!(iDepth >= iMax))
    {
        if (!oSelf.parent.objIfrMain)
        {
            oSelf.parent.objIfrMain = parent.document.getElementById(ifrId);
        }

        oSelf.parent.objIfrMain.height = oSelf.document.body.scrollHeight + 20 + "px"; //window.document.body.scrollHeight+50,
        //alert(oSelf.parent.objIfrMain.src + " = " + oSelf.parent.objIfrMain.height );

        if ((oSelf.parent == null) || (oSelf.parent == undefined))
        {
            alert('給定之oSelf或iDepth或iMax有錯誤，請重新設定，套用此元件 iframe id 參數必需指定其 id');
        }
        else
        {
            oSelf.parent.resizeIfr(oSelf.parent,iDepth, iMax, ifrId);
        }

    }
}
// JScript 檔

    function myConfirm(strTitle,strMessage,intType,intWidth,intHeight)
    {  
        var strDialogFeatures = 'status=no;center=yes;help=no;dialogWidth='+intWidth+';dialogHeight='+intHeight+';scroll=yes;resize=no';
        var args = new Array();
        args[args.length] = strTitle;
        args[args.length] = strMessage;
        args[args.length] = intType;
        var result = showModalDialog('./base/myConfirm/myConfirm.htm',args,strDialogFeatures);
        return result;
    }        
    

    function getId(strId)
    {
        return document.getElementById(strId);
    }
