if (typeof(oPopup) == "undefined"){
    var oPopup = window.createPopup();
}
var popupBody = oPopup.document.body;
var giBoxNum    = 0;
var TheRichMbox = null;
function stPack(title, cap, pic, width, height, msg, tip){
    this.Title  = title;
    this.Cap    = cap;
    this.Pic    = pic;
    this.Width  = width;
    this.Height = height;
    this.Msg    = msg;
    this.Tip    = tip;
}
var aTit = new Array();
var aCap = new Array();
var aPic = new Array();
var aWid = new Array();
var aHgt = new Array();
var aMsg = new Array();
var aTip = new Array();

function makeRichMbox(){
    var i = 0;
    for (var i=0; i<giBoxNum; i++){
        this[i] = new stPack( aTit[i], aCap[i], aPic[i], aWid[i], aHgt[i], aMsg[i], aTip[i] );
    }
    this.length = i;
}
function fnRichMsfBoxErr( sObjName ){
    var strErrMsg = "Fatal Error: Rich-Message-Box Object '" + sObjName + "' might be NOT defined in the HTML source code."
                  + "\n\n    Please contact with Mr H. Sekine at info@all.co.nz.";
    window.alert( strErrMsg );
}
function fnShowRichMbox(n){
    if (typeof( oBoxTitle) != "object"){ fnRichMsfBoxErr( "oBoxTitle" ); return; }
    if (typeof( oBoxMsg  ) != "object"){ fnRichMsfBoxErr( "oBoxMsg"   ); return; }
    if (typeof( oBoxCap  ) != "object"){ fnRichMsfBoxErr( "oBoxCap"   ); return; }
    if (typeof( oBoxPic  ) != "object"){ fnRichMsfBoxErr( "oBoxPic"   ); return; }
    if (typeof( oImgFrm  ) != "object"){ fnRichMsfBoxErr( "oImgFrm"   ); return; }
    if (typeof(TheRichMbox[n]) != "object"){	// Added: 2006/10/17(Tsu)-01:17:11 by skn23
    	alert("Sorry!, TheRichMbox[" + n + "] is still under construction.");
		return;
	}
    var TheBox = TheRichMbox[n];
    var lineWidth  = TheBox.Width  + 20;
    var lineHeight = TheBox.Height + 5;
    with(TheBox){
        oBoxTitle.innerHTML       = Title;
        oBoxMsg.innerHTML         = Msg;
        oBoxCap.innerHTML         = Cap;
        oBoxPic.src               = Pic;
        oBoxPic.title             = Tip;
        oBoxPic.style.pixelWidth  = Width;
        oBoxPic.style.pixelHeight = Height;
        oImgFrm.style.pixelWidth  = lineWidth;
        oImgFrm.style.pixelHeight = lineHeight;
    }
    fnShowPooupDialog();
}
function fnShowPooupDialog(){
    if (typeof( oRichMsgBox ) != "object"){
        fnRichMsfBoxErr( "oRichMsgBox" );
        return;
    }
    popupBody.innerHTML = oRichMsgBox.innerHTML;
    oPopup.show(0, 0, 300, 0);
    var realHeight = popupBody.scrollHeight;
    var realWidth  = popupBody.scrollWidth;
//  window.status = "W=" + realWidth + " H=" + realHeight;
    oPopup.hide();
    oPopup.show(100, 50, realWidth+10, realHeight+10);
//  oPopup.show(100, 50, 400, 300);
}

