![](/Images/OutliningIndicators/ContractedBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/None.gif)
var TipBox=Class.create();
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
TipBox.prototype=
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
initialize: function(msg, _options)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
this.options=
{
delay:0,
elementName:"dd"
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}.extend(_options ||
{});
this.using=false;
this.removed=false;
this.text="";
this.box=document.createElementWithText(this.options.elementName,msg);
Element.addClassName(this.box,"tipBox");
this.spanClose=$se("span");
this.spanClose.innerHTML="<img src='img/imgClose.gif' alt='' title='Close'/>";
this.spanClose.className="close";
this.spanClose.onclick=this.hide.bind(this);
this.spanInfo=$se("span");
this.spanInfo.className="info";
this.box.appendChild(this.spanInfo);
this.box.appendChild(this.spanClose);
this.timeOutPtr=0;
if(this.options.padding)this.box.style.padding=this.options.padding;
if(this.options.color)this.box.style.color=this.options.color;
if(this.options.backgroundColor)this.box.style.backgroundColor=this.options.bgColor;
if(this.options.borderWidth)this.box.style.borderWidth="1px";
if(this.options.borderStyle)this.box.style.borderStyle="solid";
if(this.options.borderColor)this.box.style.borderColor=this.options.borderColor;
if(this.options.marginTop)this.box.style.marginTop=this.options.marginTop;
if(this.options.marginRight)this.box.style.marginRight=this.options.marginRight;
if(this.options.marginLeft)this.box.style.marginLeft=this.options.marginLeft;
if(this.options.marginBottom)this.box.style.marginBottom=this.options.marginBottom;
if(this.options.textAlign)this.box.style.textAlign=this.options.textAlign;
this.hide();
if(this.options.delay>0)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
this.timeOutPtr=window.setTimeout(this.hide,this.options.delay*1000);
}
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
setText:function(msg,noCloseButton)
{
this.text=msg;
this.spanInfo.innerHTML=msg;
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(noCloseButton)
{
if(this.box.childNodes.length>1)this.spanClose=this.box.removeChild(this.spanClose);
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
}else
{
this.box.appendChild(this.spanClose);
}
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
removeAfterSeconds:function(delay)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(!this.removed)
{
if(this.timeOutPtr)window.clearTimeout(this.timeOutPtr);
this.timeOutPtr=window.setTimeout(this.remove.bind(this),delay*1000);
}
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
hideAfterSeconds:function(delay)
{
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if(this.using)
{
if(this.timeOutPtr)window.clearTimeout(this.timeOutPtr);
this.timeOutPtr=window.setTimeout(this.hide.bind(this),delay*1000);
}
},
remove:function()
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
this.removed=true;
Element.remove(this.box);
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
show:function()
{
this.using=true;
Element.show(this.box);
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
hide:function()
{
this.using=false;
Element.hide(this.box);
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
clearDelay:function()
{
if(this.timeOutPtr)window.clearTimeout(this.timeOutPtr);
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
toggleText:function(msg,delay)
{
this.box.innerHTML=msg;
window.setTimeout(this.recoverText.bind(this),delay*1000);
},
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
recoverText:function()
{
this.box.innerHTML=this.text;
}
}
![](/Images/OutliningIndicators/None.gif)