function Microcontent(B,C,D,A){this.element=$(B);this.type=C;this.source=D;this.openEvent="click";this.closeEvent="click";this.isOpen=false;this.styled=false;this.response=null;this.options=A;this.bindOpenEvent()}Microcontent.prototype.bindOpenEvent=function(){var A=this;this.element.bind(this.openEvent,function(B){A.open(B);return false})};Microcontent.prototype.open=function(A){this.elementFocused=true;this.microcontentFocused=false;this.eventX=A.pageX;this.eventY=A.pageY;A.stopPropagation();if(this.isOpen==false){if(this.microcontent==null){this.createMarkup()}this.getContent();if(navigator.appVersion.indexOf("MSIE 7.")!=-1){this.getContent()}}};Microcontent.prototype.createMarkup=function(){this.microcontent=$('<div class="microcontent"></div>');this.microcontentWrapper=$('<div class="microcontentWrapper"></div>');this.header=$('<div class="header"></div>');this.headerLeft=$('<div class="headerLeft"></div>');this.headerRight=$('<div class="headerRight close"><a class="close">Close</a></div>');this.main=$('<div class="main"></div>');this.mainLeft=$('<div class="mainLeft"></div>');this.mainCenter=$('<div class="mainCenter"></div>');this.mainRight=$('<div class="mainRight"></div>');this.footer=$('<div class="footer"></div>');this.footerLeft=$('<div class="footerLeft"></div>');this.footerRight=$('<div class="footerRight"></div>');this.microcontent.append(this.microcontentWrapper);this.microcontentWrapper.append(this.header);this.microcontentWrapper.append(this.main);this.microcontentWrapper.append(this.footer);this.header.append(this.headerLeft);this.header.append(this.headerRight);this.main.append(this.mainLeft);this.main.append(this.mainCenter);this.main.append(this.mainRight);this.footer.append(this.footerLeft);this.footer.append(this.footerRight)};Microcontent.prototype.getContent=function(){if(this.response!=null){this.show(this.response)}else{if(this.type=="inline"){this.clone=$(this.source).clone();this.show(this.clone)}else{if(this.type=="ajax"){var A=this;$.ajax({url:this.source,type:"GET",success:function(B){A.show(B)}})}}}};Microcontent.prototype.show=function(A){this.response=A;this.appendContent();this.bindCloseEvent();this.bindFocusEvent();this.microcontent.appendTo("body");if(this.styled==false){this.styled=this.buildLayout()}this.determineLocation();this.isOpen=true;this.microcontent.show();if(this.options&&this.options.showCallback){this.options.showCallback(this)}};Microcontent.prototype.appendContent=function(){if(this.type=="inline"){this.mainCenter.append(this.response)}else{if(this.type=="ajax"){this.mainCenter.empty().append(this.response)}}};Microcontent.prototype.bindCloseEvent=function(){var A=this;this.microcontent.find(".close").each(function(){if($(this).isAttached==null){$(this).bind("click",function(B){A.close(B)});$(this).isAttached=true}})};Microcontent.prototype.bindFocusEvent=function(){if(this.closeEvent!="click"){var A=this;this.element.bind("mouseout",function(B){A.clearElementFocus(B)});this.microcontent.bind("mouseover",function(B){A.setMicrocontentFocus(B)});this.microcontent.bind("mouseout",function(B){A.clearMicrocontentFocus(B)})}};Microcontent.prototype.close=function(){this.elementFocused=false;this.microcontentFocused=false;if(this.isOpen){this.microcontent.remove();this.isOpen=false}};Microcontent.prototype.checkFocus=function(){setTimeout(function(){if(this.microcontentFocused==false&&this.elementFocused==false&&this.isOpen){this.close()}}.bind(this),400)};Microcontent.prototype.clearElementFocus=function(){this.elementFocused=false;this.checkFocus()};Microcontent.prototype.setMicrocontentFocus=function(){this.microcontentFocused=true};Microcontent.prototype.clearMicrocontentFocus=function(){this.microcontentFocused=false;this.checkFocus()};Microcontent.prototype.buildLayout=function(){this.beakPosition="left";this.beak=$('<div class="beakLeft"></div>');this.microcontentWrapper.append(this.beak);this.mainLeft.css("height",this.mainCenter.height()+"px");this.mainCenter.css("height",this.mainCenter.height()+"px");this.mainRight.css("height",this.mainCenter.height()+"px");if(this.beak.overlap==null){this.beak.overlap={border:parseInt(this.beak.css("right")),element:parseInt(this.beak.css("margin-left"))};this.beak.css({"margin-left":0,right:0})}this.microcontentWrapper.css("width",this.main.width()+"px");this.headerLeft.css("width",this.main.width()-this.headerRight.width()+"px");this.footerLeft.css("width",this.main.width()-this.footerRight.width()+"px");if(jQuery.browser.msie){this.headerLeft.hide();this.headerLeft.show();this.footerLeft.hide();this.footerLeft.show()}return true};Microcontent.prototype.determineLocation=function(){var D=0;var B=9;this.getElementPosition();var C=this.element.top-this.headerRight.height()+this.element.height();this.microcontent.css("top",C+"px");var A=this.beak.width()-this.beak.overlap.border-this.mainLeft.width();this.beak.css("left",0);this.beak.removeClass("beakLeft").removeClass("beakRight");if(this.element.left+this.element.width()+this.microcontent.width()<=$(window).width()){this.beakPosition="left";this.beak.addClass("beakLeft");this.microcontentWrapper.css("padding","0 0 0 "+A+"px");this.microcontent.css("margin-left",0-this.beak.overlap.element+"px");D=this.element.width()+this.element.left+this.beak.width()-80}else{this.beakPosition="right";this.beak.addClass("beakRight");this.beak.css("left",this.main.width()-this.mainLeft.width()-this.beak.overlap.border+"px");this.microcontentWrapper.css("padding","0 "+A+"px 0 0");this.microcontent.css("margin-left",this.beak.overlap.element+"px");D=this.element.left-this.microcontent.width()-this.beak.width()}this.microcontent.css("left",D+"px")};Microcontent.prototype.getElementPosition=function(A){var A=this.element[0];var B=0;var C=55;while(A!=null){B+=A.offsetTop;C+=A.offsetLeft;A=A.offsetParent}this.element.top=B;this.element.left=C};