// DHTML implementation of mbedlets
// (c) 1997 mBED Software, Inc.

function Mbedlet_StartServiceScript()
{
if ((typeof(parentLayer) == "undefined") ||
(typeof(parentLayer.parentLayer) == "undefined") ||
(typeof(parentLayer.parentLayer.MBEDLET) == "undefined"))
{
this._DI = "MBEDLET.Service()";
}
}
function _Bw(_Bu)
{
if (MBEDLET._CA != null)
{
if (_Bw.arguments.length == 0)
return MBEDLET._CA._DE(MBEDLET.parentName);
else
return MBEDLET._CA._DE(_Bu);
}
}
_DT = _Bw;
function _a(_b)
{
var _Cl = document.all.tags("DIV");
var _Bv;
if (_Cl!=null) 
{
    for (_Bv=_Cl.length-1; _Bv>=0; _Bv--) 
if (_Cl[_Bv].id == _b.NAME + "Layer")
return _Bv;
}
return -1;
}
function _Cn(_b)
{
var _Cl = document.all.tags("DIV");
var _Bv;
if (_Cl!=null) 
{
    for (_Bv=_Cl.length-1; _Bv>=0; _Bv--) 
if (_Cl[_Bv].id == _b.NAME + "Layer")
return _Cl[_Bv];
}
return -1;
}
function _DR(_b)
{
var _Cl = document.all.tags("DIV");
var _Bv;
if (_Cl!=null) 
{
    for (_Bv=_Cl.length-1; _Bv>=0; _Bv--) 
if (_Cl[_Bv].id == _b.NAME + "DIV")
return _Cl[_Bv];
}
return -1;
}
function _Co(_b,_Cq)
{
var _Cl = document.all.tags(_Cq);
var _Bv = 0;
var _Cs;
if (_Cl!=null) 
{
    for (_Cs=_Cl.length-1; _Cs>=0; _Cs--) 
if (_b.contains(_Cl[_Cs]) && _b.id!=_Cl[_Cs].id)
{
_Bv++;
}
}
return _Bv;
}
function _Cp(_b,_Cq,_Cr)
{
var _Cl = document.all.tags(_Cq);
var _Bv = 0;
var _Cs;
if (_Cl!=null) 
{
    for (_Cs=_Cl.length-1; _Cs>=0; _Cs--) 
if (_b.contains(_Cl[_Cs]) && _b.id!=_Cl[_Cs].id)
{
if (_Bv == _Cr)
return _Cl[_Cs];
else
_Bv++;
}
}
return null;
}
function _V(_CY,_C0,_c)
{
var _Cl = document.all.tags("DIV");
var _DB;
var _DA;
if (_V.arguments.length == 3)
_DB = _a(_c)-1;
else
_DB = _Cl.length-1;
var _Bv;
for (_Bv=_DB;_Bv>=0;_Bv--)
{
var len = _Cl[_Bv].id.length;
if (_Cl[_Bv].id.substring(len-5,len) == "Layer")
_DA = 5;
else
_DA = 0;
if (_DA > 0)
{
if (_Cl[_Bv].style.visibility != "hidden")
{
if ((_CY>=_Cl[_Bv].offsetLeft) && (_CY<=(_Cl[_Bv].offsetLeft+_Cl[_Bv].offsetWidth)) &&
                    (_C0>=_Cl[_Bv].offsetTop) && (_C0<=(_Cl[_Bv].offsetTop +_Cl[_Bv].offsetHeight)))
{
_b = eval(_Cl[_Bv].id.substring(0,_Cl[_Bv].id.length-_DA));
if (!_b.NOMESSAGES)
{
return _b;
}
}
}
}
}
return null;
}
function _Cv()
{
var _Cl = document.all.tags("DIV");
_DB = _Cl.length-1;
var _Cz;
for (_Cz=_DB;_Cz>=0;_Cz--)
{
len = _Cl[_Cz].id.length;
if (_Cl[_Cz].id.substring(len-5,len) == "Layer")
_DA = 5;
else
_DA = 0;
if (_DA > 0)
{
_b = eval(_Cl[_Cz].id.substring(0,_Cl[_Cz].id.length-_DA));
if (typeof(_b._Ct) != "undefined")
{
_b._Ct();
}
}
}
}
function _Z(_g)
{
_h=_g.split(",")
if (_h.length == 1)
top.location = _g;
else
document.frames[_h[1]].src=_h[0];
}
function _A5(_9)
{
_DC = _DR(this);
_Bv = _Cp(_DC,"OBJECT",0);
if (this._DQ)
{ 
if (_Bv.ReadyState>1)
{
_Bv.Run();
this._DQ = false;
}
}
else
{
if (_Bv.CurrentState==0)
{
if (this.PLAYFOREVER)
{
this.PLAY();
return true;
}
return false;
}
}
return true;
}
function _A4()
{
_DC = _DR(this);
_Bv = _Cp(_DC,"OBJECT",0);
if (_Bv.ReadyState>=0)
{
this._BX = true;
this._DQ = true;
MBEDLET._K(this);
}
}
function _A6(_5, show)
{
if (this.TYPE == "SCROLL" || this.TYPE == "COVER")
{
if (_5._CC != null && _5._CC != this)
{
MBEDLET._L(_5._CC);
_5._CC._A9();
}
if (this._6)
this._A9()
else
MBEDLET._K(this);
_5._CC=this;
this.show = show;
this._5 = _5;
this._Aa = _5.NAME+"Layer";
this._8 = MBEDLET._9;
var _Bv = _5.GetRect();
this._Ab = _Bv.left;
this._Ac = _Bv.top;
this._Ad = _Bv.right-_Bv.left;
this._Ae = _Bv.bottom-_Bv.top;
if (show)
{
eval(this._Aa).style.visibility = "visible";
var _DC = document.all.item(this._Aa);
if (this.DIRECTION == "RIGHT")
{
_DC.style.left=this._Ab-this._Ad
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae+" "+this._Ad+")";
}
else if (this.DIRECTION == "LEFT")
{
_DC.style.left=this._Ab+this._Ad
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 0 "+this._Ae+" "+"0)";
}
else if (this.DIRECTION == "DOWN")
{
_DC.style.top=this._Ac-this._Ae
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect("+this._Ae+" "+this._Ad+" "+this._Ae+" 0)";
}
else if (this.DIRECTION == "UP")
{
_DC.style.top=this._Ac+this._Ae
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" 0 0)";
}
}
}
else
{
if (this.TYPE == "ZOOM")
typestring = this.DIRECTION == "IN" ? 0 : 1;
else if (this.TYPE == "WIPE")
typestring = this.DIRECTION == "UP" ? "4" : (this.DIRECTION == "DOWN" ? "5" : (this.DIRECTION  == "RIGHT" ? "6" : "7"));
else
typestring = "12";
_Bv = eval(_5.NAME+"Layer");
_Bv.style.filter = "revealTrans(Duration=" + this.DURATION/1000 +", Transition=" + typestring + ")"
if (_Bv.filters.item(0).Status != 0)
_Bv.filters.item(0).Stop();
_Bv.filters.item(0).Apply();
_5._Ap(show);
_Bv.filters.item(0).Play();
}
}
function _A7(_9)
{
if (this.TYPE != "SCROLL" && this.TYPE != "COVER")
return FALSE;
_AF = (_9 - this._8)/this.DURATION;
if (_AF > 1.0) 
_AF = 1.0;
var _DC = document.all.item(this._Aa);
if (this.show)
{
if (this.DIRECTION == "RIGHT")
{
_DC.style.left=this._Ab-this._Ad*(1-_AF)
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae+" "+this._Ad*(1-_AF)+")";
}
else if (this.DIRECTION == "LEFT")
{
_DC.style.left=this._Ab+this._Ad*(1-_AF)
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad*_AF+" "+this._Ae+" "+"0)";
}
else if (this.DIRECTION == "DOWN")
{
_DC.style.top=this._Ac-this._Ae*(1-_AF)
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect("+this._Ae*(1-_AF)+" "+this._Ad+" "+this._Ae+" 0)";
}
else if (this.DIRECTION == "UP")
{
_DC.style.top=this._Ac+this._Ae*(1-_AF)
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae*_AF+" 0)";
}
}
else
{
if (this.DIRECTION == "RIGHT")
{
_DC.style.left=this._Ab+this._Ad*_AF
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad*(1-_AF)+" "+this._Ae+" "+"0)";
}
else if (this.DIRECTION == "LEFT")
{
_DC.style.left=this._Ab-this._Ad*_AF
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae+" "+this._Ad*_AF+")";
}
else if (this.DIRECTION == "DOWN")
{
_DC.style.top=this._Ac+this._Ae*_AF
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae*(1-_AF)+" 0)";
}
else if (this.DIRECTION == "UP")
{
_DC.style.top=this._Ac-this._Ae*_AF
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect("+this._Ae*_AF+" "+this._Ad+" "+this._Ae+" 0)";
}
}
if (_AF < 1.0)
return true;
else
{
this._A9();
if (!this.show)
eval(this._Aa).style.visibility = "hidden";
return false;
}
}
function _A8()
{
if (this.TYPE == "SCROLL" || this.TYPE == "COVER")
{
var _DC = document.all.item(this._Aa);
if (this.TYPE == "SCROLL")
_DC.style.clip = "rect(0 "+this._Ad+" "+this._Ae+" 0)";
_DC.style.left=this._Ab
_DC.style.top=this._Ac
}
this._5._CC = null;
}
function Visible_GetRect()
{
var _DC = document.all.item(this.NAME+"Layer");
return new Rect(_DC.offsetLeft,
             _DC.offsetTop,
             _DC.offsetLeft+_DC.offsetWidth,
             _DC.offsetTop+ _DC.offsetHeight);
}
function Visible_OSDSetLocation(_CY,_C0)
{
var _DC = document.all.item(this.NAME+"Layer");
_DC.style.left = _CY;
_DC.style.top = _C0;
}
function _Ao(_v)
{
eval(this.NAME+"Layer").style.visibility = _v ? "visible" : "hidden";
}
function Visible_GetVisible(_v)
{
return (eval(this.NAME+"Layer").style.visibility != "hidden");
}
function _A3(_5, _A2)
{
_Cm = eval(_5.NAME+"Layer").style.zIndex;
var _Cl = document.all.tags("DIV");
var _Bv;
if (_Cm > _A2)
{
    for (_Bv=_Cl.length-1; _Bv>=0; _Bv--) 
{
if ((n= _Cl[_Bv].id.indexOf("Layer")) != -1)
{
_Bv = _Cl[_Bv].style.zIndex;
if (_A2<=_Bv && _Bv<_Cm)
{
_Cl[_Bv].style.zIndex++;
}
}
}
eval(_5.NAME+"Layer").style.zIndex = _A2;
}
else if (_Cm < _A2)
{
    for (_Bv=_Cl.length-1; _Bv>=0; _Bv--) 
{
if ((n= _Cl[_Bv].id.indexOf("Layer")) != -1)
{
_Bv = _Cl[_Bv].style.zIndex;
if (_Cm<_Bv && _Bv<=_A2)
{
_Cl[_Bv].style.zIndex--;
}
}
}
eval(_5.NAME+"Layer").style.zIndex = _A2;
}

}
function _Au(_Al)
{
_Al = _Al.toUpperCase();
if (_Au.arguments.length == 0)
{
var _Cl = document.all.tags("DIV");
_A3(this,_Cl.length);
}
else
{
_A2 = eval(_Al+"Layer").style.zIndex;
_Cm = eval(this.NAME+"Layer").style.zIndex;
if (_A2 < _Cm)
_A2++;
_A3(this, _A2);
}
}
function _Av(_Al)
{
_Al = _Al.toUpperCase();
if (_Av.arguments.length == 0)
{
var _Cl = document.all.tags("DIV");
_A3(this,1);
}
else
{
_A2 = eval(_Al+"Layer").style.zIndex;
if (_A2 > 0)
_A2--;
_Cm = eval(this.NAME+"Layer").style.zIndex;
if (_A2 < _Cm)
_A2++;
_A3(this, _A2);
}
}
function _BK(_g)
{
_DC = _Cn(this);
_Bv = _Cp(_DC,"IMG",0);
if (_Bv==null)
return;
if (this.SCALETOFIT)
{
_CY = _Bv.width;
_C0 = _Bv.height;
_Bv.src = _g;
_Bv.width = _CY;
_Bv.height = _C0;
}
else
{
_Bv.src = _g;
}
}
function _BL()
{
var _Cl = eval(this.NAME+"Layer").document.all.tags("IMG");
if (_Cl.length > 0)
_Cl[0].src = null;
}
function _BM(_g)
{
_DC = _Cn(this);
_Bv = _Cp(_DC,"IFRAME",0);
_Bv.src = _g;
}
function _BN()
{
_DC = _Cn(this);
_Bv = _Cp(_DC,"IFRAME",0);
_Bv.src = "";
}
function _Bz(_9)
{
_Bu = eval(this.NAME+"Frame").MBEDLET;
if (typeof(_Bu) != "undefined")
{
if (!this.GetVisible())
_Bu._9 = _9;
else
_Bu.Service(_9);
}
return true;
}
function _DG()
{
return eval(this.NAME+"Frame");
}
function _Bq(_CY,_C0)
{
return false;
}
function _Br(_CY,_C0)
{
return true;
}
function _Bs(_CY,_C0)
{
return true;
}
function _DF()
{
if (typeof(eval(this.NAME+"Frame").MBEDLET) != "undefined")
{
eval(this.NAME+"Frame").MBEDLET._CA = MBEDLET;
eval(this.NAME+"Frame").MBEDLET.parentName = this.NAME;
}
}
function _BU()
{
this._BX = eval(this.NAME+"OCX").CanStop();
}
function _BW()
{
this._BX = eval(this.NAME+"OCX").DoStop();
}
function _Cj()
{
this._Ci = true;
}
function _BO()
{
this._BT()
if (!this._BX || this._BY)
{
eval(this.NAME+"OCX").DoPlayPause();
this._BY = false
this._BX = true
}
}
function _BQ()
{
this._BT()
if (this._BX && !this._BY)
{
eval(this.NAME+"OCX").DoPlayPause();
this._BY = true
}
}
function _BP()
{
this._BT()
if (this._BX)
{
this._BV();
this._BX = false
}
}
function _BR(asset)
{
this._BT()
if (this._BX)
{
this._BV();
this._BX = false;
}
eval(this.NAME+"OCX").Source = asset;
}
function _BS()
{
this._BT()
if (this._BX)
{
this._BV();
this._BX = false;
}
eval(this.NAME+"OCX").Source = "";
}
function _BZ(_9)
{
if (_9 >= this._AZ + this.FLIPINTERVAL)
{
_DC = _Cn(this);
_Cs = _Co(_DC,"DIV");
this.FORWARD("WRAP");
this._AZ = _9;
if (this.FLIPINDEX == _Cs)
return (this.PLAYFOREVER || ((this.PLAYCOUNT != 0) && (++this._7 < this.PLAYCOUNT)))
else
return true;
}
}
function _Cw()
{
_DC = _Cn(this);
_Cs = _Co(_DC,"DIV")-1;

while (_Cs >= 0)
{
subdiv = _Cp(_DC, "DIV", _Cs);
_Cy = _Cp(subdiv,"IMG",0);
if (_Cy != null)
{
_DC.style.width = _Cy.width;
_DC.style.height = _Cy.height;
return;
}
_Cs--;
}
}
function _B1(_B5)
{
_DC = _Cn(this);
_Cs = _Co(_DC,"DIV");
if (_B5 > _Cs)
_B5 = _Cs;
if (_B1.arguments.length == 0)
_B5 = (this.FLIPINDEX < _Cs) ?  this.FLIPINDEX+1 : 1;
if (_B5 != this.FLIPINDEX)
{
_Bv = _Cp(_DC,"DIV",_Cs-this.FLIPINDEX);
_Bv.style.visibility = "hidden";
this.FLIPINDEX = _B5;
_Bv = _Cp(_DC,"DIV",_Cs-this.FLIPINDEX);
_Bv.style.visibility = "inherit";
}
}
function _B2(_B6)
{
_DC = _Cn(this);
_Cs = _Co(_DC,"DIV");
this.FLIP((this.FLIPINDEX < _Cs) ? this.FLIPINDEX+1 : 
                 ((_B2.arguments.length == 0) ? this.FLIPINDEX : 1))
}
function _DM(_B6)
{
var _DC = _Cn(this);
_Cs = _Co(_DC,"DIV");
this.FLIP((this.FLIPINDEX > 1) ? this.FLIPINDEX-1 : 
                 ((_DM.arguments.length == 0) ? this.FLIPINDEX : _Cs))
}
function _Bl()
{
_DC = _Cn(this);
if (_DC==null) 
return;
_Bm = "";
_Bn = this.FONTSIZE;
if (typeof(this.VALUE) == "number")
{
_Bm = this.VALUE;
}
else if (typeof(this.VALUE) == "string")
{
if (this.VALUE.indexOf("<") == -1 && this.VALUE.indexOf(">") == -1)
_Bm += this.VALUE
else
{
newString = this.VALUE;
var _Bv;
while (true)
{
_Bv = newString.indexOf("<");
if (_Bv < 0) 
break;
newString = newString.substring(0,_Bv) + "&lt;" + newString.substring(_Bv+1, newString.length);
}
while (true)
{
_Bv = newString.indexOf(">");
if (_Bv < 0) 
break;
newString = newString.substring(0,_Bv) + "&gt;" + newString.substring(_Bv+1, newString.length);
}
_Bm += newString;
}
}
_DC.innerText = _Bm;
if (this.ITALIC)
_DC.style.fontStyle = "italic";
else
_DC.style.fontStyle = "";
if (this.SERIF)
_DC.style.fontFamily = "serif";
else
_DC.style.fontFamily = "sans-serif";
_DC.style.color = this.COLOR;
_DC.style.fontSize = _Bn;
if (this.BOLD)
_DC.style.fontWeight = "bold";
else
_DC.style.fontWeight = "normal";
if (this.JUSTIFY == "CENTER")
_DC.style.textAlign = "center";
else if (this.JUSTIFY == "RIGHT")
_DC.style.textAlign = "right";
else
_DC.style.textAlign = "left"
}
