function DefinitionPopup(anchor){this.elemId=null;this.calloutId=null;this.calloutPadding=0;this.dropShadowId=null;this.color=null;this.xOffset=null;this.yOffset=null;this.blur={iRadius:null,iSigma:null};this.opacity=null;this.xShrink=null;this.yShrink=null;this.shadowStyle=null;this.images=new Array;this.setBlur=DropShadowInterface_SetBlur;this.timer=null;this.visible=false;this.delay=null;this.linked=new Array;this.cancelTimer=DelayedPopupInterface_CancelTimer;this.hide=DelayedPopupInterface_Hide;this.toggle=PopupInterface_Toggle;this.anchorId=anchor||null;this.disableScroll=true;this.getAnchorX=AnchoredInterface_GetAnchorX;this.getAnchorY=AnchoredInterface_GetAnchorY;this.getAnchorZ=AnchoredInterface_GetAnchorZ;this.getAnchorWidth=AnchoredInterface_GetAnchorWidth;this.getAnchorHeight=AnchoredInterface_GetAnchorHeight;this.getAnchorPosition=AnchoredInterface_GetAnchorPosition;this.getElemWidth=AnchoredInterface_GetElemWidth;this.getElemHeight=AnchoredInterface_GetElemHeight;this.setAnchor=AnchoredInterface_SetAnchor;this.cornerStyle=null;this.cornersDrawn=false;this.erase=DefinitionPopup_Erase;this.draw=DefinitionPopup_Draw;this.init=DefinitionPopup_Init;this.show=DefinitionPopup_Show;this.alignElement=DefinitionPopup_AlignElement;this.implement(DropShadowInterface);this.implement(CalloutInterface);this.implement(DelayedPopupInterface);this.implement(AnchoredInterface);this.implement(RoundedCornersInterface);this.setElement=DefinitionPopup_SetElement;this.setDefinition=DefinitionPopup_SetDefinition;this.setTerm=DefinitionPopup_SetTerm;this.setTermColor=DefinitionPopup_SetTermColor;this.id='DefinitionPopup';this.style='Default';this.delay=500;this.elemId=this.id;this.defId=this.elemId+'_def';this.termId=this.elemId+'_term';this.init();}
DefinitionPopup.prototype=new BaseObject;DefinitionPopup.prototype.constructor=DefinitionPopup;DefinitionPopup.superclass=BaseObject.prototype;DefinitionPopup.styles={Default:{term:{font:{family:'Arial, Helvetica, sans-serif',size:'13px',weight:'bold'},color:'#589c1c'},font:{family:'Arial, Helvetica, sans-serif',size:'13px',weight:'normal'},backgroundColor:'#ffffff',color:'#656565'}}
function DefinitionPopup_SetElement(elem){this.elemId=elem.id;}
function DefinitionPopup_Init(){var elem=document.getElementById(this.elemId);if(!elem){elem=document.createElement('div');document.getElementsByTagName('body')[0].appendChild(elem);elem.id=this.elemId;}
var term=document.getElementById(this.termId);if(!term){term=document.createElement('div');elem.appendChild(term);term.id=this.termId;}
var def=document.getElementById(this.defId);if(!def){def=document.createElement('div');elem.appendChild(def);def.id=this.defId;}
elem.style.backgroundColor=DefinitionPopup.styles[this.style].backgroundColor;term.style.color=DefinitionPopup.styles[this.style].term.color;term.style.paddingBottom='5px';term.style.fontFamily=DefinitionPopup.styles[this.style].term.font.family;term.style.fontSize=DefinitionPopup.styles[this.style].term.font.size;term.style.fontWeight=DefinitionPopup.styles[this.style].term.font.weight;def.style.color=DefinitionPopup.styles[this.style].color;def.style.fontFamily=DefinitionPopup.styles[this.style].font.family;def.style.fontSize=DefinitionPopup.styles[this.style].font.size;def.style.fontWeight=DefinitionPopup.styles[this.style].font.weight;this.calloutPadding=20;this.cornerStyle='Default';RoundedCornersInterface_Init.call(this);this.shadowStyle='Default';DropShadowInterface_Init.call(this);}
function DefinitionPopup_Erase(){CalloutInterface_Erase.call(this);DropShadowInterface_Erase.call(this);RoundedCornersInterface_Erase.call(this);this.linked=new Array;}
function DefinitionPopup_Draw(){var elem=document.getElementById(this.elemId);if(!elem)throw new Error('Unable to find element: '+this.elemId);var term=document.getElementById(this.termId);if(!term)throw new Error('Unable to find element: '+this.termId);var def=document.getElementById(this.defId);if(!def)throw new Error('Unable to find element: '+this.defId);this.linked=new Array;bHeight=2;elem.style.border='1px solid '+DefinitionPopup.styles[this.style].backgroundColor;elem.style.backgroundColor=DefinitionPopup.styles[this.style].backgroundColor;elem.style.color=DefinitionPopup.styles[this.style].color;RoundedCornersInterface_Draw.call(this);CalloutInterface_Draw.call(this);DropShadowInterface_Draw.call(this);window.addEvent(elem,'mouseover',this.cancelTimer,this,true);window.addEvent(elem,'mouseout',this.hide,this,true);elem.style.border='none';elem.style.backgroundColor='transparent';this.linked.push(this.dropShadowId);this.linked.push(this.calloutId);}
function DefinitionPopup_Show(){this.cancelTimer();var wasVisible=this.visible;if(this.visible){PopupInterface_Hide.call(this);this.erase();}
this.draw();var anchor=document.getElementById(this.anchorId);if(!anchor)throw new Error('Unable to find anchor element: '+this.anchorId);var elem=document.getElementById(this.elemId);if(!elem)throw new Error('Unable to find element: '+this.elemId);var dropShadow=document.getElementById(this.dropShadowId);if(!elem)throw new Error('Unable to find drop shadow element: '+this.dropShadowId);var callout=document.getElementById(this.calloutId);if(!callout)throw new Error('Unable to find callout element: '+this.calloutId);var zIndex=parseInt(DomUtils.getZIndex(anchor));if(zIndex==0){zIndex=1000;anchor.style.zIndex=zIndex;}
dropShadow.style.zIndex=zIndex+1;callout.style.zIndex=zIndex+2;elem.style.zIndex=zIndex+3;this.alignElement();if(wasVisible)PopupInterface_Show.call(this);else DelayedPopupInterface_Show.call(this);return true;}
function DefinitionPopup_AlignElement(){AnchoredInterface_AlignElement.call(this)
CalloutInterface_AlignElement.call(this);DropShadowInterface_AlignElement.call(this);}
function DefinitionPopup_SetDefinition(definition){var defElem=document.getElementById(this.defId);if(!defElem)throw new Error('Unable to find definition element: '+this.defId);while(defElem.hasChildNodes())DomUtils.removeElement(defElem.firstChild);var txtDef=document.createTextNode(definition);defElem.appendChild(txtDef);}
function DefinitionPopup_SetTerm(term){var termElem=document.getElementById(this.termId);if(!termElem)throw new Error('Unable to find term element: '+this.termId);while(termElem.hasChildNodes())DomUtils.removeElement(termElem.firstChild);var txtTerm=document.createTextNode(term);termElem.appendChild(txtTerm);}
function DefinitionPopup_SetTermColor(color){var term=document.getElementById(this.termId);if(!term)throw new Error('Unable to find term element: '+this.termId);term.style.color=color;}
DefinitionPopup.instance=null;DefinitionPopup.getInstance=function(){if(!DefinitionPopup.instance)DefinitionPopup.instance=new DefinitionPopup();return DefinitionPopup.instance;}
DefinitionPopup.show=function(anchor,term,def){DefinitionPopup.getInstance().setAnchor(anchor);DefinitionPopup.getInstance().setDefinition(def);DefinitionPopup.getInstance().setTerm(term);DefinitionPopup_Show.call(DefinitionPopup.getInstance());}
DefinitionPopup.hide=function(){DelayedPopupInterface_Hide.call(DefinitionPopup.getInstance());}
DefinitionPopup.toggle=function(anchor,term,def){if(DefinitionPopup.getInstance().visible)DefinitionPopup.hide();else DefinitionPopup.show(anchor,term,def);}

