function MarketingBubble(E,B)
{
 var B=
 {
  width:B.width||300,title:B.title||"",content:B.content||E.innerHTML||"",arrowDir:B.arrowDir||"right",offset:
  {
   x:(B.offset&&B.offset.x)?B.offset.x:0,y:(B.offset&&B.offset.y)?B.offset.y:0
  }
  ,uiSetting:B.uiSetting||null,showEvent:B.showEvent||null,next:B.next||null,onNext:B.onNext||null
 }
 ;
 var C=B.title.match(/\[\s*(\S+)\s*\]/);
 var F=(C!=null)?C[1]:"";
 B.title=(F)?'<span class="new-feature">'+F+"</span> "+B.title.replace(/\[\s*\S+\s*\]\s*/,""):B.title;
 var A=document.createElement("div");
 A.className="marketing-bubble bubble-pos-"+B.arrowDir;
 A.innerHTML=['<div class="bubble-wrap"><div class="bubble-close-button"></div>',(B.title)?"<h3>"+B.title+"</h3>":"",'<div class="bubble-body"><p class="bubble-content">',B.content,(B.onNext&&B.next)?'<span class="next-bubble">'+B.next+"&nbsp;&raquo;</span>":"",'</p></div><div class="bubble-arrow"></div></div>'].join("");
 YAHOO.util.Dom.insertAfter(A,E);
 YAHOO.util.Dom.setStyle(A,"width",B.width+"px");
 YAHOO.util.Dom.setStyle(YAHOO.util.Dom.getFirstChild(A),"width",(B.width-2)+"px");
 var H=YAHOO.util.Dom.getXY(E);
 YAHOO.util.Dom.setXY(A,[H[0]+B.offset.x,H[1]+B.offset.y]);
 YAHOO.util.Event.on(A,"mouseover",this.mouseover);
 YAHOO.util.Event.on(A,"mouseout",this.mouseout);
 YAHOO.util.Event.on(YAHOO.util.Dom.getElementsByClassName("bubble-close-button","div",A)[0],"click",this.close,B.uiSetting);
 if(B.next&&B.onNext)
 {
  YAHOO.util.Event.on(YAHOO.util.Dom.getElementsByClassName("next-bubble","span",A)[0],"click",this.showNext,
  {
   bubble:A,onNext:B.onNext
  }
  );
 }
 var D=E.parentNode;
 D.removeChild(E);
 if(B.showEvent)
 {
  YAHOO.util.Dom.addClass(A,"bubble-hidden");
  Page.subscribeToEvent(B.showEvent,G);
 }
 function G()
 {
  YAHOO.util.Dom.removeClass(A,"bubble-hidden");
 }
}
MarketingBubble.prototype=
{
 showNext:function(A,B)
 {
  YAHOO.util.Dom.addClass(B.bubble,"bubble-hidden");
  Page.publishEvent(B.onNext);
 }
 ,close:function(B,D)
 {
  var A=YAHOO.util.Dom.getAncestorByClassName(YAHOO.util.Event.getTarget(B),"marketing-bubble");
  var C=A.parentNode;
  C.removeChild(A);
  if(D&&oUISettings&&oUISettings.saveSettings)
  {
   oUISettings.saveSettings(D,"hidden");
  }
 }
 ,mouseout:function()
 {
  YAHOO.util.Dom.removeClass(this,"hover-next");
 }
 ,mouseover:function()
 {
  YAHOO.util.Dom.addClass(this,"hover-next");
 }
}
;
