if(typeof Meetup==="undefined"){Meetup={}}Meetup.DiscreteInteractDialog=function(){return this.initialize(Meetup.DiscreteInteractDialog,this,arguments)};Meetup.DiscreteInteractDialog.prototype=new Meetup.DiscreteBase();Meetup.DiscreteInteractDialog.prototype.init=function(content){var tds,dimTR,dimBL,MKD=MochiKit.DOM,G1=MKD.getFirstElementByTagAndClassName,GED=MochiKit.Style.getElementDimensions,CON=MochiKit.Signal.connect,ELMS=this.elements,root=this.elements.root,bind=this.parent.bind;ELMS.head=G1("tr","top",root);ELMS.body=G1("tr","body",root);ELMS.foot=G1("tr","bot",root);tds=MKD.getElementsByTagAndClassName("td",undefined,root);ELMS["7"]=tds[0];ELMS["8"]=tds[1];ELMS["9"]=tds[2];ELMS["4"]=tds[3];ELMS["5"]=tds[4];ELMS["6"]=tds[5];ELMS["1"]=tds[6];ELMS["2"]=tds[7];ELMS["3"]=tds[8];ELMS.content=ELMS["5"];ELMS.tip=null;ELMS.xbutton=G1("div","x",ELMS["9"]);this.embody();dimTR=GED(ELMS[9]);dimBL=GED(ELMS[1]);this.cornerWidthRight=dimTR.w;this.cornerWidthLeft=dimBL.w;this.cornerHeightTop=dimTR.h;this.cornerHeightBot=dimBL.h;this.offsetX=true;this.offsetY=true;this.content(content);this.fixMSIE();this.bindEvents();this.bindedFunctions.actLoop=bind(this.actLoop,this);this.evPointers.onContentClick=CON(ELMS.content,"onclick",this.bindedFunctions.onContentClick);this.evPointers.onContentClick=CON(ELMS.xbutton,"onclick",this.bindedFunctions.onXClick);this.retrieveDimension(true);this.unembody();this.hasInitialized=true;return this.publicMethods()};Meetup.DiscreteInteractDialog.NAME="Meetup.DiscreteInteractDialog";Meetup.DiscreteInteractDialog.ROOT_CLASS_NAME="J_discreteDialog";Meetup.DiscreteInteractDialog.EVENT_NAMES=["onContentClick","onXClick","onBeforeSetContent","onAfterSetContent","onBeforeShow","onAfterShow","onBeforeHide","onAfterHide"];Meetup.DiscreteInteractDialog.PUBLIC_METHODS=["attach","detach","discard","getRoot","hide","hideX","isShowing","show","showX","content","dimension","opacity","offset","position","tip","tipOffset","zIndex","getCornerWidth","getCornerHeight"];Meetup.DiscreteInteractDialog.SERIALIZED_HTML='<table class="ddTable"><tbody class="ddBody"><tr class="top"><td class="left">&nbsp;</td><td class="center">&nbsp;</td><td class="right"><div class="x"></div></td></tr><tr class="body"><td class="left">&nbsp;</td><td class="center content"></td><td class="right">&nbsp;</td></tr><tr class="bot"><td class="left">&nbsp;</td><td class="center">&nbsp;</td><td class="right">&nbsp;</td></tr></tbody></table>';Meetup.DiscreteInteractDialog.ORIENT_N=8;Meetup.DiscreteInteractDialog.ORIENT_NE=9;Meetup.DiscreteInteractDialog.ORIENT_E=6;Meetup.DiscreteInteractDialog.ORIENT_SE=3;Meetup.DiscreteInteractDialog.ORIENT_S=2;Meetup.DiscreteInteractDialog.ORIENT_SW=1;Meetup.DiscreteInteractDialog.ORIENT_W=4;Meetup.DiscreteInteractDialog.ORIENT_NW=7;Meetup.DiscreteInteractDialog.DEFAULT_TIP=Meetup.DiscreteInteractDialog.ORIENT_S;Meetup.DiscreteInteractDialog.prototype.hasInitialized=false;Meetup.DiscreteInteractDialog.prototype.tipPosition=true;Meetup.DiscreteInteractDialog.prototype.tipOrientation=null;Meetup.DiscreteInteractDialog.prototype.tipDimension=null;Meetup.DiscreteInteractDialog.prototype.tipPixPosition=null;Meetup.DiscreteInteractDialog.prototype.tipOffsetX=0;Meetup.DiscreteInteractDialog.prototype.tipOffsetY=0;Meetup.DiscreteInteractDialog.prototype.cornerWidthLeft=0;Meetup.DiscreteInteractDialog.prototype.cornerWidthRight=0;Meetup.DiscreteInteractDialog.prototype.cornerHeightTop=0;Meetup.DiscreteInteractDialog.prototype.cornerHeightBot=0;Meetup.DiscreteInteractDialog.prototype.content=function(content){if(arguments.length!==0){this.onBeforeSetContent(this.elements.content);if(this.parent.isDOMNode(content)){this.parent.clearChildElements(this.elements.content);this.elements.content.appendChild(content)}else{this.elements.content.innerHTML=this.parent.stringify(content)}if(this.hasInitialized){this.retrieveDimension();this.resetPosition()}this.onAfterSetContent(this.elements.content)}return this.elements.content};Meetup.DiscreteInteractDialog.prototype.dimension=function(w,h){if(arguments.length===0){return this.retrieveDimension()}var d,pixOffset,coord,PR=this.parent,ELMS=this.elements,width=PR.getNumeric(w),height=PR.getNumeric(h),dw=width-this.getCornerWidth(),dh=height-this.getCornerHeight(),cs=ELMS.content.style,rs=ELMS.root.style;if(this.isShowing()){rs.visibility="hidden"}if(w===true||width===null||dw<0){cs.width="auto";rs.width="auto"}else{rs.width=width+"px";cs.width=dw+"px"}if(h===true||height===null||dh<0){cs.height="auto";rs.height="auto"}else{rs.height=height+"px";cs.height=dh+"px"}if(this.hasInitialized){if(this.isShowing()&&this.elements.tip){d=PR.smoothMochiKitPixelObject(MochiKit.Style.getElementDimensions(this.elements.root));this.w=d.w;this.h=d.h;switch(this.tipOrientation){case PR.ORIENT_S:pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.w,(d.w-this.getCornerWidth()));this.tipPixPosition=pixOffset;this.tipOffsetX=pixOffset+Math.round(this.tipDimension.w/2);this.tipOffsetY=0;this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=-(this.h);break;case PR.ORIENT_W:pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.h,(d.h-this.getCornerHeight()));this.tipPixPosition=pixOffset;this.tipOffsetX=0;this.tipOffsetY=pixOffset+Math.round(this.tipDimension.h/2);this.offsetX=0;this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case PR.ORIENT_E:pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.h,(d.h-this.getCornerHeight()));this.tipPixPosition=pixOffset;this.tipOffsetX=0;this.tipOffsetY=pixOffset+Math.round(this.tipDimension.h/2);this.offsetX=-(this.w);this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case PR.ORIENT_N:pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.w,(d.w-this.getCornerWidth()));this.tipPixPosition=pixOffset;this.tipOffsetX=pixOffset+Math.round(this.tipDimension.w/2);this.tipOffsetY=0;this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=0;break}coord=PR.translateCoordinate(this.x,this.y,this.w,this.h,this.offsetX,this.offsetY);rs.left=coord.x+"px";rs.top=coord.y+"px";rs.visibility="visible"}else{this.resetPosition()}}};Meetup.DiscreteInteractDialog.prototype.hideX=function(){this.elements.xbutton.style.display="none"};Meetup.DiscreteInteractDialog.prototype.offset=function(x,y){var tmp,current,result;if(this.elements.tip===null){if(arguments.length!==0){if(x===true){this.offsetX=true}else{tmp=this.parent.getNumeric(x);if(tmp){this.offsetX=tmp}else{this.offsetX=0}}if(y===true){this.offsetY=true}else{tmp=this.parent.getNumeric(y);if(tmp){this.offsetY=tmp}else{this.offsetY=0}}this.resetPosition()}result={x:this.offsetX,y:this.offsetY}}else{if(arguments.length!==0){current=this.parent.translateCoordinate(this.x,this.y,this.w,this.h,this.offsetX,this.offsetY);tmp=this.parent.getNumeric(x);x=(tmp===null)?0:tmp;tmp=this.parent.getNumeric(y);y=(tmp===null)?0:tmp;switch(this.tipOrientation){case this.parent.ORIENT_S:this.offsetX=x-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=y-this.h;break;case this.parent.ORIENT_W:this.offsetX=x;this.offsetY=y-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_E:this.offsetX=x-this.w;this.offsetY=y-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_N:this.offsetX=x-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=y;break}this.resetPosition()}else{switch(this.tipOrientation){case this.parent.ORIENT_S:x=this.offsetX+this.cornerWidthLeft+this.tipOffsetX;y=this.offsetY+this.h;break;case this.parent.ORIENT_W:x=this.offsetX;y=this.offsetY+this.cornerHeightTop+this.tipOffsetY;break;case this.parent.ORIENT_E:x=this.offsetX+this.w;y=this.offsetY+this.cornerHeightTop+this.tipOffsetY;break;case this.parent.ORIENT_N:x=this.offsetX+this.cornerWidthLeft+this.tipOffsetX;y=this.offsetY;break}}result={x:x,y:y}}return result};Meetup.DiscreteInteractDialog.prototype.showX=function(){this.elements.xbutton.style.display="block"};Meetup.DiscreteInteractDialog.prototype.tip=function(orientation){if(arguments.length===0){return this.elements.tip}if(typeof orientation!=="number"){LOG.error("You should use constants.  See documents.  You passed: "+orientation);orientation=this.parent.DEFAULT_TIP}if((orientation===this.parent.ORIENT_SW)||(orientation===this.parent.ORIENT_SE)||(orientation===this.parent.ORIENT_NW)||(orientation===this.parent.ORIENT_NE)){LOG.error("Not yet supported... Or most likely, I will not support this orientation..");return this.elements.tip}if(this.elements.tip!==null){this.elements.tip.parentNode.removeChild(this.elements.tip)}this.tipOrientation=orientation;var image,matched,tip,path,dimen;switch(this.tipOrientation){case this.parent.ORIENT_S:image=this.parent.getImageInfoFromCSS("div","discreteDialogTip bot");break;case this.parent.ORIENT_W:image=this.parent.getImageInfoFromCSS("div","discreteDialogTip left");break;case this.parent.ORIENT_E:image=this.parent.getImageInfoFromCSS("div","discreteDialogTip right");break;case this.parent.ORIENT_N:image=this.parent.getImageInfoFromCSS("div","discreteDialogTip top");break}matched=image.path.match(this.parent.REGEX_CSS_IMAGE);if(matched===null){throw new Error("Meetup.DiscreteInteractDialog.tip: You should check your CSS")}this.tipDimension=image.dimension;path=matched[1];if(path.match(this.parent.REGEX_ABSOLUTE_PATH)===null){path=this.parent.getAbsolutePath(path)}tip=this.parent.buildTip(path,image.dimension.w,image.dimension.h);var elmTipParent=this.elements[this.tipOrientation];this.parent.clearChildElements(elmTipParent);elmTipParent.appendChild(tip);this.fixForTip(tip);this.elements.tip=tip;var flag=this.embody();this.resetTipPosition(true);this.resetPosition(true);if(flag){this.unembody()}return tip};Meetup.DiscreteInteractDialog.prototype.tipOffset=function(position){if(arguments.length===0){return this.tipPixPosition}var dimen,tp=typeof position;if((tp==="undefined")||(tp==="object")||(tp==="function")){position=this.base.stringify(position)}this.tipPosition=position;var flag=this.embody();this.resetTipPosition(true);this.resetPosition(true);if(flag){this.unembody()}return this.tipPixPosition};Meetup.DiscreteInteractDialog.prototype.getCornerWidth=function(){return this.cornerWidthLeft+this.cornerWidthRight};Meetup.DiscreteInteractDialog.prototype.getCornerHeight=function(){return this.cornerHeightTop+this.cornerHeightBot};Meetup.DiscreteInteractDialog.prototype.fixForTip=function(elm){if(!(/msie/.test(navigator.userAgent.toLowerCase())&&!/opera/.test(navigator.userAgent.toLowerCase()))){return}var path=this.parent.getBackgroundImagePathByElement(elm);this.parent.swapBackgroundToFilter(elm,path)};Meetup.DiscreteInteractDialog.prototype.fixMSIE=function(){if(!(/msie/.test(navigator.userAgent.toLowerCase())&&!/opera/.test(navigator.userAgent.toLowerCase()))){return}var i,tag,path;for(i=1;i<10;++i){if(i===5){continue}tag=this.elements[i];path=this.parent.getBackgroundImagePathByElement(tag);this.parent.swapBackgroundToFilter(tag,path,((i%2)===0))}};Meetup.DiscreteInteractDialog.prototype.resetTipPosition=function(skipEmbody){var TS,dimParent,pixOffset,tipParent,ELMS=this.elements,PR=this.parent,result=false;skipEmbody=skipEmbody||false;if(ELMS.tip&&this.tipOrientation!==null){if(!skipEmbody){result=this.embody()}tipParent=ELMS[this.tipOrientation];dimParent=PR.smoothMochiKitPixelObject(MochiKit.Style.getElementDimensions(tipParent));TS=ELMS.tip.style;if((this.tipOrientation===PR.ORIENT_S)||(this.tipOrientation===PR.ORIENT_N)){pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.w,dimParent.w);if(this.tipPosition===true){TS.marginTop="0px";TS.marginBottom="0px";TS.marginLeft="auto";TS.marginRight="auto"}else{TS.marginTop="0px";TS.marginBottom="0px";TS.marginLeft=pixOffset+"px";TS.marginRight="0px"}this.tipPixPosition=pixOffset;this.tipOffsetX=pixOffset+Math.round(this.tipDimension.w/2);this.tipOffsetY=0}else{if((this.tipOrientation===this.parent.ORIENT_W)||(this.tipOrientation===this.parent.ORIENT_E)){pixOffset=PR.calculateTipCoordinate(this.tipPosition,this.tipDimension.h,dimParent.h);if(this.tipPosition===true){ELMS.tip.parentNode.style.verticalAlign="middle";TS.marginTop="auto";TS.marginBottom="auto";TS.marginLeft="0px";TS.marginRight="0px"}else{ELMS.tip.parentNode.style.verticalAlign="top";TS.marginTop=pixOffset+"px";TS.marginBottom="0px";TS.marginLeft="0px";TS.marginRight="0px"}this.tipPixPosition=pixOffset;this.tipOffsetX=0;this.tipOffsetY=pixOffset+Math.round(this.tipDimension.h/2)}else{LOG.error("this should not happen..?")}}}if(this.isShowing()){var current=this.parent.translateCoordinate(this.x,this.y,this.w,this.h,this.offsetX,this.offsetY);switch(this.tipOrientation){case this.parent.ORIENT_S:this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=-(this.h);break;case this.parent.ORIENT_W:this.offsetX=0;this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_E:this.offsetX=-(this.w);this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_N:this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=0;break}this.x=current.x-this.offsetX;this.y=current.y-this.offsetY}else{switch(this.tipOrientation){case this.parent.ORIENT_S:this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=-(this.h);break;case this.parent.ORIENT_W:this.offsetX=0;this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_E:this.offsetX=-(this.w);this.offsetY=-(this.cornerHeightTop+this.tipOffsetY);break;case this.parent.ORIENT_N:this.offsetX=-(this.cornerWidthLeft+this.tipOffsetX);this.offsetY=0;break}}if(result&&!skipEmbody){this.unembody();result=false}return result};Meetup.DiscreteInteractDialog.prototype.onAfterSetContent=function(content){if(this.hasInitialized===false){return}var i,len,events=this.events.onAfterSetContent;if(events){for(i=0,len=events.length;i<len;++i){events[i](content)}}};Meetup.DiscreteInteractDialog.prototype.onBeforeSetContent=function(content){if(this.hasInitialized===false){return}var i,len,events=this.events.onBeforeSetContent;if(events){for(i=0,len=events.length;i<len;++i){events[i](content)}}};Meetup.DiscreteInteractDialog.prototype.onContentClick=function(ev){var i,len,events=this.events.onContentClick;if(events){for(i=0,len=events.length;i<len;++i){events[i](ev)}}ev.stopPropagation()};Meetup.DiscreteInteractDialog.prototype.onXClick=function(ev){var i,len,events=this.events.onXClick;this.hide();if(events){for(i=0,len=events.length;i<len;++i){events[i](ev)}}ev.stopPropagation()};Meetup.DiscreteInteractDialog.buildTip=function(path,w,h){var div=DIV(),ds=div.style;ds.width=w+"px";ds.height=h+"px";ds.margin="0px";ds.padding="0px";ds.backgroundColor="transparent";ds.backgroundPosition="0 0";ds.backgroundRepeat="no-repeat";ds.backgroundAttachment="scroll";ds.backgroundImage=["url(",path,")"].join("");return div};Meetup.DiscreteInteractDialog.calculateTipCoordinate=function(position,size,parentSize){var tmp=Meetup.DiscreteBase.getNumeric(position),result=0;if(tmp!==null){if(position===true){result=Math.round((parentSize-size)/2)}else{if(typeof position==="string"){if(tmp<0){result=parentSize-size+tmp}else{result=tmp}}else{if(tmp<0){result=parentSize+Math.round((parentSize-size)*tmp)}else{result=Math.round((parentSize-size)*tmp)}}}}return result};Meetup.DiscreteInteractDialog.prototype.viewState=0;Meetup.DiscreteInteractDialog.prototype.epochLast=false;Meetup.DiscreteInteractDialog.prototype.timerPointer=false;Meetup.DiscreteInteractDialog.INT_INTERVAL=15;Meetup.DiscreteInteractDialog.prototype.hide=function(){--this.viewState;var e,interval=Meetup.DiscreteInteractDialog.INT_INTERVAL;e=+new Date();this.epochLast=Math.floor(interval*2)+e;if(this.timerPointer===false){this.timerPointer=window.setInterval(this.bindedFunctions.actLoop,interval)}};Meetup.DiscreteInteractDialog.prototype.show=function(){++this.viewState;var e,interval=Meetup.DiscreteInteractDialog.INT_INTERVAL;e=+new Date();this.epochLast=Math.floor(interval*2)+e;if(this.timerPointer===false){this.timerPointer=window.setInterval(this.bindedFunctions.actLoop,interval)}};Meetup.DiscreteInteractDialog.prototype.actLoop=function(){var e=+new Date();if(this.viewState<1&&this.boolShowing){this.actHide();this.actStopLoop()}else{if(this.viewState>0&&!this.boolShowing){this.actShow();this.actStopLoop()}else{if(this.epochLast<e){this.actStopLoop()}}}};Meetup.DiscreteInteractDialog.prototype.actStopLoop=function(){this.epochLast=false;window.clearInterval(this.timerPointer);this.timerPointer=false};Meetup.DiscreteInteractDialog.prototype.actHide=function(){Meetup.DiscreteBase.prototype.hide.apply(this)};Meetup.DiscreteInteractDialog.prototype.actShow=function(){Meetup.DiscreteBase.prototype.show.apply(this)};