if(!dojo.hostenv.findModule("xg.shared.util",false)){ dojo.provide("xg.shared.util"); xg.append=function(_1){ return (document.getElementById("xj_baz17246")||document.body).appendChild(_1); }; xg.listen=function(_2,_3,_4,_5){ dojo.event.connect("string"==_2?dojo.byId(_2):_2,_3,"function"==typeof _4?_4:function(){ _5.apply(_4,arguments); }); }; xg.stop=function(_6){ dojo.event.browser.stopEvent(_6); }; xg.qh=function(_7){ if(typeof (_7)==="undefined"){ xg.shared.util.consoleLog("undefined was passed to xg.qh() (BAZ-32577)"); if(window.console&&window.console.trace){ window.console.trace(); } return ""; } return _7.replace(/&/g,"&").replace(//g,">").replace(/\"/g,"""); }; xg.toggle=function(_8,_9){ _8=dojo.byId(_8); if(arguments.length==1){ _9=(_8.style.display=="none"); } _8.style.display=_9?"":"none"; }; xg.$=function(_a,_b){ if(_a.substr(0,1)=="#"){ return dojo.byId(_a.substr(1)); } return xg.$$(_a,_b)[0]; }; xg.$$=function(_c,_d){ if(_c.substr(0,1)=="#"){ return [dojo.byId(_c.substr(1))]; } _c=_c.split(".",2); if("string"==typeof _d){ _d=document.getElementById(_d); } if(!_c[1]){ return (_d||document.body).getElementsByTagName(_c[0]); } return dojo.html.getElementsByClass(_c[1],_d,_c[0]); }; xg.parent=function(el,_f){ _f=(_f||"").split("."); var tag=_f[0].toUpperCase(); var cls=_f[1]?new RegExp("(^|\\s+)"+_f[1]+"(\\s+|$)"):""; while(el=el.parentNode){ if((!tag||el.tagName==tag)&&(!cls||el.className.match(cls))){ return el; } } return null; }; xg._xhr=function(_12,url,_14,cb1,cb2,_17){ cb1=cb1||function(){ }; var req={url:url,method:_12,encoding:"utf-8",mimetype:"text/plain",load:function(_19,ret,_1b){ "function"==typeof cb1?cb1(_1b,ret):cb2.call(cb1,_1b,ret); },error:_17}; if(_14){ if(_14.constructor!=Object){ req.formNode=_14; }else{ if("undefined"!=typeof _14["preventCache"]){ req.preventCache=_14["preventCache"]; delete _14["preventCache"]; } if("undefined"!=typeof _14["formNode"]){ req.formNode=_14["formNode"]; delete _14["formNode"]; } req.content=_14; } } return dojo.io.bind(req); }; xg.get=function(url,_1d,cb1,cb2,_20){ return xg._xhr("get",url,_1d,cb1,cb2,_20); }; xg.post=function(url,_22,cb1,cb2,_25){ return xg._xhr("post",url,_22,cb1,cb2,_25); }; xg.linkify=function(_26,_27){ if(!_26.match(/http|ftp|www|HTTP|FTP|WWW/)){ return _26; } var _28=(null==_27)?"":" target=\""+_27+"\""; var _29="(http|ftp|https):\\/\\/"; var _2a="[\\w\\-]+(\\.[\\w\\-]+)+"; var _2b="([\\w\\-\\.;,@?^=%&:\\/~\\+#]*[\\w\\-\\@?^=%&\\/~\\+#])?"; var _2c="(^|\\W)("+_29+_2a+_2b+")"; var _2d=_26.replace(new RegExp(_2c,"gi"),"$1$2"); _2a="www(\\.[\\w]+)+"; _2c="(^|[^/\\w])("+_2a+_2b+")"; _2d=_2d.replace(new RegExp(_2c,"gi"),"$1$2"); return _2d; }; xg.preventDefault=function(_2e,_2f){ return function(_30){ _30.preventDefault(); if(_2f){ _30.stopPropagation(); } _2e(); }; }; xg.renderHtml=function(_31,_32){ for(var i in _32){ if(_32.hasOwnProperty(i)){ _31=_31.replace(new RegExp("{"+i+"}","g"),_32[i]); } } return _31; }; xg.shared.util={ignoreOverlayHide:false,chatAppletContainerVisible:undefined,createElement:function(_34){ var el=document.createElement("div"); el.innerHTML=_34.replace(/^\s+/,"").replace(/\s+$/,""); return el.firstChild||undefined; },getOffset:function(el,_37){ var x=0,y=0; var _3a=[]; for(;_37;_37=_37.parentNode){ _3a.push(_37); } for(var cur=el;cur;cur=cur.offsetParent){ var p=dojo.style.getStyle(cur,"position"); if(p=="relative"||p=="absolute"){ var _3d=0; for(var i=0;i<_3a.length;i++){ if(cur==_3a[i]){ _3d=1; break; } } if(_3d){ break; } } x+=cur.offsetLeft||0; y+=cur.offsetTop||0; if(cur.tagName=="BODY"){ break; } } return {x:x,y:y}; },getOffsetX:function(el,_40){ var e=x$(el).offset(),n=x$(_40).offset(); return {x:e.left-n.left,y:e.top-n.top}; },_widgetParsingStrategy:0,safeBindUrl:function(url){ return url.replace(/\[/g,"%5B").replace(/\]/g,"%5D"); },isValidUrl:function(str){ var _45=/^(ftp|https?):\/\/(\w+(:\w*)?@?)?([a-zA-Z0-9_.-]+)(:\d+)?(\/([\w#!:.?+=&%@!\/-]*)?)?$/; return _45.test(str); },parseUrlParameters:function(url){ url=url+""; var _47=url.split("?"); var _48=new Object; if(_47.length>1){ var _49=_47[1].split("&"); for(var idx=0;idx<_49.length;idx++){ var kv=_49[idx].split("="); _48[kv[0]]=kv[1]; } } return _48; },parseWidgets:function(_4c){ var _4c=_4c||document.getElementsByTagName("body")[0]||document.body; var _4d=new dojo.xml.Parse(); var _4e=_4d.parseElement(_4c,null,true); dojo.widget.getParser().createComponents(_4e); },fixImagesInIE:function(_4f,_50,_51,_52){ if(!(dojo.render.html.ie50||dojo.render.html.ie55||dojo.render.html.ie60)){ return; } dojo.lang.forEach(_4f,function(img){ if(dojo.lang.inArray(xg.shared.util.fixedImageURLs,img.src)){ return; } var _54=function(){ var _55=new Image(); _55.onload=_55.onerror=_55.onabort=function(){ img.src=img.src; xg.shared.util.fixTransparencyInIEProper(img,_51,_52); xg.shared.util.fixedImageURLs.push(img.src); }; _55.src=img.src; }; if(_50){ _54(); }else{ window.setTimeout(_54,0); } }); },fixedImageURLs:[],fixTransparencyInIEProper:function(img,_57,_58){ if(img&&(dojo.render.html.ie50||dojo.render.html.ie55||dojo.render.html.ie60)&&img.src.match(/png/)&&dojo.style.isShowing(img)){ _57=_57?_57:img.width; _58=_58?_58:img.height; img.style.width=_57+"px"; img.style.height=_58+"px"; img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', sizingMethod='scale')"; img.src=xg.shared.util.cdn("/xn_resources/widgets/index/gfx/x.gif"); } if(img){ img.style.visibility="visible"; } },fixTransparencyInIE:function(_59){ if(dojo.render.html.ie50||dojo.render.html.ie55||dojo.render.html.ie60){ dojo.lang.forEach(_59.getElementsByTagName("img"),function(img){ xg.shared.util.fixTransparencyInIEProper(img); }); } },fixDialogPosition:function(dlg){ var _5c=xg.$("div.xg_floating_container",dlg); var vh=parseInt(dojo.html.getViewportHeight(),10); _5c.style.height="auto"; _5c.style.overflow="visible"; var h=parseInt(_5c.offsetHeight,10); if(h>vh*0.9){ _5c.style.height=parseInt(vh*0.9,10)+"px"; _5c.style.overflow="auto"; } var drh=dojo.render.html; _5c.style.marginTop=(drh.ie&&(drh.ie60||drh.ie55||drh.ie50)?0:-parseInt(_5c.offsetHeight/2,10))+"px"; },nl2br:function(s,_61){ s=s.replace(/\r\n/g,"\n"); result=""; dojo.lang.forEach(s.split("\n"),function(_62){ if(!_62.match(/<.?OBJECT\b|<.?EMBED\b|<.?PARAM\b|<.?APPLET\b|<.?IFRAME\b|<.?SCRIPT\b|<.?BR\b|<.?ADDRESS\b|<.?BLOCKQUOTE\b|<.?CENTER\b|<.?DIR\b|<.?DIV\b|<.?DL\b|<.?FIELDSET\b|<.?FORM\b|<.?H1\b|<.?H2\b|<.?H3\b|<.?H4\b|<.?H5\b|<.?H6\b|<.?HR\b|<.?ISINDEX\b|<.?MENU\b|<.?NOFRAMES\b|<.?NOSCRIPT\b|<.?OL\b|<.?P\b|<.?PRE\b|<.?TABLE\b|<.?UL\b|<.?DD\b|<.?DT\b|<.?FRAMESET\b|<.?LI\b|<.?TBODY\b|<.?TD\b|<.?TFOOT\b|<.?TH\b|<.?THEAD\b|<.?TR\b/i)){ if(_61){ result+="

"+_62+"

"; }else{ result+=_62+"
"; } }else{ result+=_62; } result+="\n"; }); return dojo.string.trim(result).replace(/(
)+$/,""); },showOverlay:function(){ var o=dojo.byId("xg_overlay"); if(o.style.display=="none"){ o.style.height=this.getPageHeight()+"px"; o.style.display="block"; } xg.shared.util.chatAppletContainerVisible=x$("#appletContainer").css("visibility"); x$("#appletContainer").css("visibility","hidden"); },hideOverlay:function(){ if(xg.shared.util.ignoreOverlayHide==true){ return; } var o=dojo.byId("xg_overlay"); if(o.style.display!="none"){ o.style.display="none"; } if(typeof xg.shared.util.chatAppletContainerVisible!="undefined"){ x$("#appletContainer").css("visibility",xg.shared.util.chatAppletContainerVisible); } },getPageHeight:function(){ var _65; if(window.innerHeight&&window.scrollMaxY){ _65=window.innerHeight+window.scrollMaxY; }else{ if(document.body.scrollHeight>document.body.offsetHeight){ _65=document.body.scrollHeight; }else{ _65=document.body.offsetHeight; } } var _66; if(self.innerHeight){ _66=self.innerHeight; }else{ if(document.documentElement&&document.documentElement.clientHeight){ _66=document.documentElement.clientHeight; }else{ if(document.body){ _66=document.body.clientHeight; } } } if(_65<_66){ pageHeight=_66; }else{ pageHeight=_65; } return pageHeight; },setMaxLength:function(_67,_68){ x$(_67).bind("keypress",function(e){ var key=e.which||e.keyCode; if(key!=8&&key!=46&&key!=37&&key!=39&&key!=38&&key!=40&&_67.value.length>=_68){ e.preventDefault(); } }); },setAdvisableMaxLength:function(_6b,_6c,_6d,_6e,_6f,_70){ if(!_6e){ _6e=function(){ return _6b.value; }; } var _71=0,_72=_6b.parentNode,_73=function(){ if(_6e().length>_6c){ _6f.innerHTML=xg.shared.nls.text("messageIsTooLong",_6e().length,_6c); dojo.html.addClass(_6f,"hint_textarea"); if(!_71){ dojo.html.addClass(_6b.parentNode,"error"); dojo.html.addClass(_6f,"error"); } _71=1; }else{ dojo.html.removeClass(_6f,"hint_textarea"); if(_71){ _6f.innerHTML=_6d||""; dojo.html.removeClass(_6b.parentNode,"error"); dojo.html.removeClass(_6f,"error"); } _71=0; } if(xg.shared.util.maxAdvisableLengthTimer!=null){ clearTimeout(xg.shared.util.maxAdvisableLengthTimer); xg.shared.util.maxAdvisableLengthTimer=null; } }; if(!_6f){ _6f=document.createElement("small"); _6b.nextSibling?_72.insertBefore(_6f,_6b.nextSibling):_72.appendChild(_6f,_6b); } dojo.html.addClass(_6f,"maxlength_advisement"); _6f.innerHTML=_6d||""; var _74=this.addOnChange(_6b,_73,_70); return _74.trigger; },maxAdvisableLengthTimer:null,setAdvisableMaxLengthWithCountdown:function(_75,_76,_77,_78){ var _79=0; if("undefined"==typeof _77){ _77=dojo.dom.nextElement(_75,"span"); } var _7a=_75.id+"_chars_left"; var _7b=dojo.byId(_7a); var _7c=function(){ var n=_76-_75.value.replace(/\r\n/g,"\n").length; if(!_78||n<0){ if(!_7b){ _7b=document.createElement("small"); x$(_7b).addClass("right"); _7b.id=_7a; _77.appendChild(_7b); } } if(_7b){ if(n>=0){ _7b.innerHTML=" "+n; }else{ _7b.innerHTML=" -"+Math.abs(n); } } if(_75.value.length>_76){ if(!_79){ dojo.html.addClass(_7b.parentNode,"simpleerrordesc"); } _79=1; }else{ if(_79){ dojo.html.removeClass(_7b.parentNode,"simpleerrordesc"); } _79=0; } }; this.addOnChange(_75,_7c); _7c(); return _7c; },addOnChange:function(_7e,_7f,_80){ var _81=this.createQuiescenceTimer(_80||50,_7f); dojo.event.connect(_7e,"onkeyup",_81.trigger); dojo.event.connect(_7e,"onkeypress",_81.trigger); dojo.event.connect(_7e,"onblur",_81.trigger); dojo.event.connect(_7e,"oncut",_81.trigger); dojo.event.connect(_7e,"onpaste",_81.trigger); dojo.event.connect(_7e,"onchange",_81.trigger); return _81; },modalDialog:function(_82){ x$(".xg_floating_module").remove(); x$(".dy-modal").remove(); if((typeof _82)=="string"){ args={bodyHtml:_82}; }else{ args=_82; } var _83=args.wideDisplay?" dy-modal-wide":""; var _84=args.title?"

"+xg.qh(args.title)+"

":""; var _85=args.titleHtml?args.titleHtml:_84; var _86=args.bodyHtml; var _87="
"+_85+"
"+_86+"
"; var _88=x$(_87)[0]; this.showOverlay(); xg.append(_88); this.fixDialogPosition(_88); if(args.noClose){ x$(".dy-modal-close",_88).hide(); }else{ x$(".xj_close",_88).click(function(_89){ _89.preventDefault(); if(x$(this).hasClass("disabled")){ return; } xg.shared.util.hideOverlay(); x$(_88).remove(); }); } return _88; },alert:function(_8a){ if(dojo.byId("xg_lightbox_alert")){ dojo.dom.removeNode(dojo.byId("xg_lightbox_alert")); } if((typeof _8a)=="string"){ args={bodyHtml:_8a}; }else{ args=_8a; } args.onOk=args.onOk?args.onOk:function(){ }; args.autoCloseTime=args.autoCloseTime?args.autoCloseTime:0; if(!args.okButtonText){ args.okButtonText=xg.shared.nls.text("ok"); } var _8b=args.wideDisplay?" xg_floating_container_wide":""; var _8c=args.customDisplayClass?" "+args.customDisplayClass:""; var _8d=args.title?"

"+dojo.string.escape("html",args.title)+"

":null; var _8e=args.titleHtml?args.titleHtml:_8d; var _8f=args.noHeader?args.noHeader:false; var _90=dojo.string.trim("
"+(_8f?"":"
"+(_8e?_8e:"")+"
")+"
"+((args.bodyHtmlRaw)?(args.bodyHtmlRaw):("

"+args.bodyHtml+"

"))); if(args.autoCloseTime<1&&!args.noButtons){ _90+=dojo.string.trim("

"); } _90+=dojo.string.trim("
"); var _91=dojo.html.createNodesFromText(_90)[0]; this.showOverlay(); xg.append(_91); this.fixDialogPosition(_91); if(args.noClose||args.autoCloseTime<1){ if(!args.noButtons){ dojo.event.connect(dojo.html.getElementsByClass("button",_91)[0],"onclick",dojo.lang.hitch(this,function(_92){ dojo.event.browser.stopEvent(_92); if(!args.noClose){ dojo.dom.removeNode(_91); this.hideOverlay(); } args.onOk(_91); })); } }else{ setTimeout(dojo.lang.hitch(this,function(){ dojo.dom.removeNode(_91); this.hideOverlay(); args.onOk(_91); }),args.autoCloseTime); } return _91; },progressDialog:function(_93){ if(dojo.byId("xg_lightbox_alert")){ dojo.dom.removeNode(dojo.byId("xg_lightbox_alert")); } var _94=dojo.string.trim("
"+(_93.title?"

"+dojo.string.escape("html",_93.title)+"

":"")+"

"+_93.bodyHtml+"

"); var _95=dojo.html.createNodesFromText(_94)[0]; this.showOverlay(); xg.append(_95); this.fixDialogPosition(_95); return {hide:dojo.lang.hitch(this,function(){ dojo.dom.removeNode(_95); this.hideOverlay(); })}; },showDialogAndRedirect:function(_96){ if(dojo.byId("xg_lightbox_alert")){ dojo.dom.removeNode(dojo.byId("xg_lightbox_alert")); } var _97=dojo.string.trim("
"+(_96.title?"

"+dojo.string.escape("html",_96.title)+"

":"")+"

"+_96.bodyHtml+"

"); var _98=dojo.html.createNodesFromText(_97)[0]; this.showOverlay(); xg.append(_98); window.location=_96.target; },confirm:function(_99){ _99.title=_99.title?_99.title:xg.shared.nls.text("confirmation"); _99.okButtonText=_99.okButtonText?_99.okButtonText:xg.shared.nls.text("ok"); if(!_99.cancelButtonText){ _99.cancelButtonText=xg.shared.nls.html("cancel"); } _99.onOk=_99.onOk?_99.onOk:function(){ }; _99.onCancel=_99.onCancel?_99.onCancel:function(){ }; if(_99.bodyText){ _99.bodyHtml="

"+dojo.string.escape("html",_99.bodyText)+"

"; } var _9a=_99.wideDisplay?" xg_floating_container_wide":""; var _9b=dojo.html.createNodesFromText(dojo.string.trim("

"+((_99.titleHtml)?(_99.titleHtml):(dojo.string.escape("html",_99.title)))+"

"+_99.bodyHtml+"

"+(_99.extraButton&&_99.extraButton.title?""+_99.extraButton.title+" ":"")+(""+_99.cancelButtonText+"")+"

"))[0]; if(!_99.noOverlay){ this.showOverlay(); } xg.append(_9b); this.fixDialogPosition(_9b); var _9c="