@set @DEBUG = 9 // Program Debug Flag: ON(>=1)/OFF(==0)/(==9) Test Release Mode

var P_WIDTH     = 250;  // PouUp Message Width
var P_HEIGHT    = 113;  // PouUp Message Height
var P_WCNTXT    = 207;  // Contex-Menu Width
var P_HCNTXT    = 310;  // Contex-Menu Height

if (typeof(oPopup) == "undefined"){
    var oPopup = window.createPopup();
}
function onDone(src){
    oPopup.document.write(src);
}
function goPop(oHeight){
    var oPopupBody = oPopup.document.body;
    with(event){
        var lefter = clientY + 10;
        var topper = clientX + 10;
    }
    oPopupBody.innerHTML = styleDiv.innerHTML;
    oPopup.show(topper, lefter, P_WIDTH, oHeight, document.body);
    document.body.onmouseup = closePopup;
}
function goContext(){
    var oPopupBody = oPopup.document.body;
    with(event){
        var lefter = clientY + 10;
        var topper = clientX + 10;
    }
    oPopupBody.innerHTML = oContext.innerHTML;
    oPopup.show(0, 0, P_WCNTXT, 0);
    var realHeight = oPopupBody.scrollHeight;
    oPopup.hide();
    oPopup.show(topper, lefter, P_WCNTXT, realHeight, document.body);
    document.body.onmouseup = closePopup;
}
function closePopup(){
  oPopup.hide();
}
function fillPopup(titler, texter, linker){
    oTitle.innerText     = titler;
    oText.innerText      = texter;
    oLinkStore.innerText = linker;
}
function fillPopup2(aCast){
    var oTL = F[ "oTitle" ];
    var oTX = F[ "oText" ];
    var oL1 = F[ "oLinkStore1" ];
    var oL2 = F[ "oLinkStore2" ];
    if (oTL == null || oTX == null || oL1 == null || oL2 == null) return;
    var sid = (aCast.substr(0,1) == "N") ? aCast : getCastID(aCast);
    aCast = (aCast.substr(0,1) == "N") ? getCastName(sid) : aCast;
//  var sid = getCastID(aCast);
//  @if (@DEBUG == 9) window.status = "fillPopup2>> SID=" + sid + " for " + aCast; @end
    oTL.innerText = getCastName(sid);
    oTX.innerText = getCastCapTip(sid);
    oL1.innerText = getCastUrlByID(sid);    // Fisrt appeared page
    oL2.innerText = NAMELIST + "#" + sid;   // Introduction page
    goPop(P_HEIGHT);
}
function fillPopup3(aCast){
    var oTL = F[ "oTitle" ];
    var oTX = F[ "oText" ];
    var oL1 = F[ "oLinkStore1" ];
    var oL2 = F[ "oLinkStore2" ];
    if (oTL == null || oTX == null || oL1 == null || oL2 == null) return;
    var sid = (aCast.substr(0,1) == 'H') ? aCast : getHanyaID(aCast);
    aCast = (aCast.substr(0,1) == 'H') ? getHanyaName(sid) : aCast;
    @if (@DEBUG == 9) window.status = "fillPopup3>> SID=" + sid + " for " + aCast; @end
    oTL.innerText = getHanyaName(sid);
    oTX.innerText = getHanyaCapTip(sid);
    oL1.innerText = getHanyaUrlByID(sid);   // Fisrt appeared page
    oL2.innerText = HANYALIST + "#" + sid;  // Introduction page
    goPop(P_HEIGHT);
}
var RetCd;
function fnFireEvents(sid, func){
    var x = F[sid];
    if (x != null){
//      RetCd = x.fireEvent(func);
        @if (@DEBUG == 9 || @DEBUG == 1) window.status = "fnFireEvents(" + func + ") for [" + sid + "] >> RetCd=" + RetCd; @end
        @if (@DEBUG == 1)
            var strMsg = "";
            with(event){
                strMsg  = "cancelBubble\t= " + cancelBubble;
                strMsg += "returnValue\t= "  + returnValue;
                strMsg += "srcElement\t= "   + srcElement;
                strMsg += "type\t\t= "       + type;
            }
            alert(strMsg);
        @end
    }
}

