
if(typeof czen=='undefined')czen={};dojo.declare('czen.InlineHelp',null,{constructor:function(props){if(!props.toggler){try{czen.logError('InlineHelp');}catch(err){};return;};if(props.type=='toolTip'){throw new Error('czen.InlineHelp does not currently support toolTip');return;};dojo.mixin(this,props);this.offset=this.offset||{x:-75,y:-25};this.type=this.type||'popUp';this.baseClass=this.baseClass||(this.type=='popUp')?'ih337':'ih337';if(!this.templateString){if(this.type=='popUp')this.templateString='<div><div class=\"x\">Close</div><div class=\"top\"></div><div class=\"c\"></div><div class=\"base\"></div></div>';else this.templateString='';}
this.showing=false;czen.InlineHelp.counter++;this.widget_id='InlineHelp_'+czen.InlineHelp.counter;if(typeof this.content!='undefined'){if(typeof this.content=='object')this.content.parentNode.removeChild(this.content);}else{this.content='';}
if(this.content.style)this.content.style.display='block';this.domNode=null;this.contentContainer=null;this.buildDomNode();if(this.type=='popUp'){dojo.connect(this.toggler,'onclick',this,this.show);}else{}},show:function(evt){this.onBeforeShow();var evt=dojo.fixEvent(evt);this.position(evt);dojo.fadeIn({node:this.domNode,duration:dojo.isIE?1:200}).play();this.showing=true;dojo.stopEvent(evt);if(this.type=='popUp')czen.InlineHelp.closeAllOpen(this);this.onShow();},position:function(evt){dojo.style(this.domNode,{left:evt.pageX+this.offset.x+'px',top:evt.pageY+this.offset.y+'px'});},decideToHide:function(){},hide:function(){this.onBeforeHide();this.showing=false;dojo.fadeOut({node:this.domNode,duration:dojo.isIE?1:200,onEnd:dojo.hitch(this,function(){dojo.style(this.domNode,{top:'-1000px',left:'-1000px'});})}).play();this.onHide();},onBeforeShow:function(){},onBeforeHide:function(){},onShow:function(){},onHide:function(){},buildDomNode:function(){this.domNode=document.createElement('div');dojo.style(this.domNode,{position:'absolute',opacity:0,top:'-1000px',left:'-1000px'});this.domNode.innerHTML=this.templateString;dojo.body().appendChild(this.domNode);var containerDiv=this.domNode.getElementsByTagName('div')[0];containerDiv.style.display='block';containerDiv.className=this.baseClass;this.contentContainer=dojo.query('.c',this.domNode)[0];this.setContent(this.content);},setContent:function(content){var content=content||this.content;this.contentContainer.innerHTML='';if(typeof content=='string')this.contentContainer.innerHTML=content;else if(typeof content=='object')this.contentContainer.appendChild(content);}});czen.InlineHelp.counter=0;czen.inlineHelps=[];czen.InlineHelp.closeAllOpen=function(except){for(var i=0;i<czen.inlineHelps.length;i++){if(czen.inlineHelps[i].showing&&(!!except&&czen.inlineHelps[i].widget_id!=except.widget_id)){czen.inlineHelps[i].hide();}}}
dojo.connect(dojo.body(),'onclick',czen.InlineHelp.closeAllOpen);