function _jsw_isDefined(A){return(typeof A!="undefined")}function _jsw_iterateOverArray(A,C){for(var B=0;B<A.length;B++){C(A[B])}}function _Widget(A){this.wf=A;this.baseUrl=A.base_url;this.rootDIV="";this.init();if(!_jsw_isDefined(this.baseUrl)){this.baseUrl=""}}_Widget.prototype={init:function(){var B=this;var A=B.wf;var C=A.base_css_prefs;B.hoverStyle=(C.link_class||!_jsw_isDefined(C.link_hover_style))?"":C.link_hover_style},setStyle:function(B,A,E){var C=this;var D=C.wf.base_css_prefs;if(A){B.setAttribute((document.all?"className":"class"),A)}else{if(E){if(B.style.setAttribute){B.style.setAttribute("cssText",E);if((B.tagName=="A")&&C.hoverStyle){B.onmouseover=function(){this.style.setAttribute("cssText",E+";"+C.hoverStyle)};B.onmouseout=function(){this.style.setAttribute("cssText",E)}}}else{B.setAttribute("style",E);if((B.tagName=="A")&&C.hoverStyle){B.onmouseover=function(){this.setAttribute("style",E+";"+C.hoverStyle)};B.onmouseout=function(){this.setAttribute("style",E)}}}}else{if((B.tagName=="A")&&(D.link_style||D.link_class)){C.setStyle(B,D.link_class,D.link_style)}}}},createElement:function(D,B,C){var A=document.createElement(D);this.setStyle(A,B,C);return A},computeExpr:function(str,dataObj){function fetchExprValue(w,d,vRef){return eval(vRef.substring(1,vRef.length-1).replace(/\$util\./g,"w.helpers.").replace(/\$\./g,"d.").replace(/\$/g,""))}var widget=this;var widgetFormat=this.wf;var refs=str.match(/\{.*?\}/g);if(refs){_jsw_iterateOverArray(refs,function(arrayElt){str=str.replace(arrayElt,fetchExprValue(widget,dataObj,arrayElt))})}return str},processNewDOMElement:function(B,K,J,E,L,G){var F=this;var I=F.wf.base_css_prefs;var H=F.baseUrl;if(!E){E=document.createTextNode(K)}else{if(E.tagName=="IMG"){var A=(L&&L.src)?F.computeExpr(L.src,B):H;if(A.indexOf("http://")==-1){A=H+A}E.src=A;E.alt=K}else{if(E.tagName!="A"){if(G){E.innerHTML=K}}else{var C=(L&&L.url)?F.computeExpr(L.url,B):H;if(C.indexOf("http://")==-1){C=H+C}E.href=C;E.target=I.link_target;if(G){var D=(L&&L.text)?L.text:K;E.innerHTML=F.computeExpr(D,B)}if(!L.clazz&&!L.style){F.setStyle(E,I.link_class,I.link_style)}}}}return E},buildDataElementContainer:function(B,K,L){var I=this;var E="";var A="";var J=_jsw_isDefined(L.how)?L.how:[];var H=J.length;for(var G=0;G<H;G++){var F;var D=J[G];var C;if(D.elt=="dom_tree"){C=I.buildWidgetSectionDOM(D.root_elt,B,D);this.processNewDOMElement(B,"",[],C,D,false)}else{C=this.createElement(D.elt,D.clazz,D.style);F=(G==(H-1));this.processNewDOMElement(B,K,L,C,D,F)}if(!E){E=C}else{A.appendChild(C)}A=C}if(H==0){E=this.processNewDOMElement(B,K,L,"",D,true)}return E},addSeparator:function(A,B){if(B){if(B.substring(0,1)=="\n"){A.appendChild(document.createElement("br"));B=B.substring(1)}if(B){A.appendChild(document.createTextNode(B))}}},addDataElement:function(C,F,E){var G=this;var D=_jsw_isDefined(F.what)?F.what:"";if(_jsw_isDefined(F.if_true)){var H=G.computeExpr(F.if_true,C);if(H=="undefined"||!H){return }}if(D){var A=G.computeExpr(D,C);if(!A){return }}if(F.prefix){G.addSeparator(E,F.prefix)}var B=G.buildDataElementContainer(C,A,F);if(B){E.appendChild(B)}if(F.suffix){G.addSeparator(E,F.suffix)}},buildWidgetSectionChildren:function(D,A,B){var C=this;_jsw_iterateOverArray(A,function(E){C.addDataElement(D,E,B)})},buildWidgetSectionDOM:function(C,A,B){var D=this.createElement(C,B.clazz,B.style);this.buildWidgetSectionChildren(A,B.dom_nodes,D);return D},buildWidgetSection:function(sectionFormat){var secData=eval(sectionFormat.data);if(sectionFormat.loop){var secDIV=this.createElement("div","","");var count=0;var numReqdItems=sectionFormat.num_items;for(var i=0;i<secData.length;i++){if((count==numReqdItems)){break}secDIV.appendChild(this.buildWidgetSectionDOM("div",secData[i],sectionFormat));count++}return secDIV}else{return this.buildWidgetSectionDOM("div",secData,sectionFormat)}},generateWidgetDiv:function(){var D=this;var C=D.baseUrl;var A=D.wf;var E=A.base_css_prefs;var B=D.createElement("div",E.base_class,E.base_style);_jsw_iterateOverArray(A.sections,function(F){B.appendChild(D.buildWidgetSection(A[F]))});D.rootDIV=B;return B},installOver:function(A){A.parentNode.replaceChild(this.generateWidgetDiv(),A)},refresh:function(){this.installOver(this.rootDIV)},helpers:{truncateTextChars:function(A,D,B,C){if(!A||(A.length<=D)){return A}else{A=A.substring(0,D);var E=A.lastIndexOf(C);if(E>B){A=A.substring(0,E)}else{if(C!=" "){E=A.lastIndexOf(" ");if(E>B){A=A.substring(0,E)}}}return A+" ..."}},smartTruncate:function(B,A){return this.truncateTextChars(B,A,A-15," ")},trimString:function(B,A){return(!A)?B:this.smartTruncate(B,A)},formatDate:function(D,F,P,H){var A=["January","February","March","April","May","June","July","August","September","October","November","December"];function G(M,Q){for(i=0;i<Q.length;i++){if(Q[i]==M){return i}}return 0}if(!P||!H){return D}var B=P.split(F);var L=D.split(F);var K=L[G("y",B)];var E=L[G("m",B)];var O=L[G("d",B)];var C=E.replace(/^0/,"");var J=O.replace(/^0/,"");var N=A[C-1];var I=N.substr(0,3);return H.replace(/y/,K).replace(/dd/,O).replace(/d/,J).replace(/mm/,E).replace(/m/,C).replace(/MM/,N).replace(/M/,I)}}};