text: (function(){var g=window;if(!g.Kekule){Kekule={}}Kekule.Browser={IE:!!(window.attachEvent&&!window.opera),Opera:!!window.opera,WebKit:navigator.userAgent.indexOf("AppleWebKit/")>-1,Gecko:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("like Gecko")<0&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),language:navigator.language||navigator.browserLanguage};Kekule.BrowserFeature={typedArray:(typeof(ArrayBuffer)!=="undefined"),svg:!!window.SVGSVGElement,canvas:!!window.CanvasRenderingContext2D,webgl:(function(){var l=(function(){try{var m=document.createElement("canvas");return !!window.WebGLRenderingContext&&(m.getContext("webgl")||m.getContext("experimental-webgl"))}catch(n){return false}})();return !!l})(),downloadHref:(function(l){return"download" in l.createElement("a")})(document),blob:!!window.Blob,workers:!!window.Worker,fileapi:!!(window.File&&window.FileReader&&window.FileList&&window.Blob),sessionStorage:(function(){try{return !!window.sessionStorage}catch(l){return false}})(),localStorage:(function(){try{return !!window.localStorage}catch(l){return false}})(),cssTransition:(function(l){return"transition" in l||"WebkitTransition" in l||"MozTransition" in l||"msTransition" in l||"OTransition" in l})(document.createElement("div").style),cssTranform:(function(l){return"transform" in l||"WebkitTransform" in l||"MozTransform" in l||"msTransform" in l||"OTransform" in l})(document.createElement("div").style),html5Form:{placeholder:(function(l){return"placeholder" in l})(document.createElement("input")),supportType:function(m){var n=document.createElement("input");n.setAttribute("type",m);var l=n.type===m;var p=["text","url","search"];if(l&&(p.indexOf(m.toLowerCase())<0)){var o=":)";n.value=o;l=n.value!==o}return l}},mutationObserver:window.MutationObserver||window.MozMutationObserver||window.WebkitMutationObserver};Kekule.X={};var a=Kekule.X;var i=function(l){return((l===null)||(typeof(l)==="undefined"))};var h=function(l){return !i(l)};var j=function(l){var m=window.getComputedStyle?window.getComputedStyle(l,null).position:l.currentStyle?l.currentStyle.position:null;if(!m){return false}else{if(!m){return false}else{m=m.toString().toLowerCase();return(m==="relative")||(m==="absolute")}}};a.MutationObserver=window.MutationObserver||window.MozMutationObserver||window.WebkitMutationObserver;a.Event={MOUSE_BTN_LEFT:0,MOUSE_BTN_RIGHT:2,MOUSE_BTN_MID:1,MOUSE_BTN_LR:3};a.Event.MouseButton={LEFT:0,RIGHT:2,MID:1,LR:3};a.Event.KeyCode={BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPSLOCK:20,ESC:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRTSC:44,INS:45,DEL:46,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SCROLLLOCK:145};a.Event.isSupported=(function(){var l={};return function(n){var p={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img",unload:"win",resize:"win"},q=n.replace(/^on/,"");if(l[q]){return l[q]}var o=p[q]=="win"?window:document.createElement(p[q]||"div");n="on"+q;var m=(n in o);if(!m){o.setAttribute(n,"return;");m=typeof o[n]=="function"}o=null;l[q]=m;return m}})();a.Event.Methods={getType:function(l){return l.__$type__||l.type},getTarget:function(l){var m=l.target||l.srcElement;if(m.nodeType==3){m=m.parentNode}return m},getCurrentTarget:function(l){return l.currentTarget},getEventPhase:function(l){return l.eventPhase},getAltKey:function(l){return l.altKey},getCtrlKey:function(l){return l.ctrlKey},getShiftKey:function(l){return l.shiftKey},getCharCode:function(l){return h(l.charCode)?l.charCode:l.keyCode},getKeyCode:function(l){return l.keyCode},getClientX:function(m){var l;if(m.touches){var n=m.touches[0];l=n&&n.clientX}else{l=m.clientX}return l},getClientY:function(m){var l;if(m.touches){var n=m.touches[0];l=n&&n.clientY}else{l=m.clientY}return l},getScreenX:function(m){var l;if(m.touches){var n=m.touches[0];l=n&&n.screenX}else{l=m.screenX}return l},getScreenY:function(m){var l;if(m.touches){var n=m.touches[0];l=n&&n.screenY}else{l=m.screenY}return l},getPageX:function(m){if(m.touches){var o=m.touches[0];if(o&&h(o.pageX)){return o.pageX}}else{if(h(m.pageX)){return m.pageX}}var n=a.Event.getTarget(m).ownerDocument||a.Event.getTarget(m);var l=n?n.body:null;return a.Event.getClientX(m)+(n&&n.scrollLeft||l&&l.scrollLeft||0)-(n&&n.clientLeft||l&&l.clientLeft||0)},getPageY:function(m){if(m.touches){var o=m.touches[0];if(o&&h(o.pageY)){return o.pageY}}else{if(h(m.pageY)){return m.pageY}}var n=a.Event.getTarget(m).ownerDocument||a.Event.getTarget(m);var l=n?n.body:null;return a.Event.getClientY(m)+(n&&n.scrollTop||l&&l.scrollTop||0)-(n&&n.clientTop||l&&l.clientTop||0)},getOffsetX:function(n){if(h(n.offsetX)){return n.offsetX}else{var m=a.Event.getTarget(n);if(m.defaultView&&m.body){m=m.body}if(h(n.layerX)&&j(m)&&!n.touches){return n.layerX}else{var l=a.Event.getClientX(n);return Math.round(l-m.getBoundingClientRect().left)}}},getOffsetY:function(n){if(h(n.offsetY)){return n.offsetY}else{var m=a.Event.getTarget(n);if(m.defaultView&&m.body){m=m.body}if(h(n.layerY)&&j(m)&&!n.touches){return n.layerY}else{var l=a.Event.getClientY(n);return Math.round(l-m.getBoundingClientRect().top)}}},getWindowX:function(m){var l=a.Event.getPageX(m);var o=m.target.ownerDocument||m.target;var n=o&&o.defaultView;var p=(n&&n.scrollX)||0;return l-p},getWindowY:function(l){var p=a.Event.getPageY(l);var n=l.target.ownerDocument||l.target;var m=n&&n.defaultView;var o=(m&&m.scrollY)||0;return p-o},getRelXToCurrTarget:function(n){var m=a.Event.getCurrentTarget(n);if(m.defaultView&&m.body){m=m.body}var l=a.Event.getClientX(n);return Math.round(l-m.getBoundingClientRect().left)},getRelYToCurrTarget:function(n){var m=a.Event.getCurrentTarget(n);if(m.defaultView&&m.body){m=m.body}var l=a.Event.getClientY(n);return Math.round(l-m.getBoundingClientRect().top)},getTouches:function(l){return l.touches}};a.Event._MouseEventEx={isMouseEnterLeaveEvent:function(l){return(l==="mouseenter")||(l==="mouseleave")},addMouseEnterLeaveListener:function(p,o,q,l){var n=((o==="mouseenter")&&a.Event.isSupported("mouseenter"))||((o==="mouseleave")&&a.Event.isSupported("mouseleave"));if(n){return p.addEventListener(o,q,l)}else{var r=function(w){var v=w.getTarget?w.getTarget():w.target;var s=w.getCurrentTarget?w.getCurrentTarget():w.currentTarget;if((v===s)||(Kekule.DomUtils.isDescendantOf(v,s))){var u=w.getRelatedTarget?w.getRelatedTarget():w.relatedTarget;if((!u)||(!Kekule.DomUtils.isDescendantOf(u,s))){var t=new MouseEvent(o,{view:window,bubbles:false,cancelable:true,target:s,currentTarget:s,relatedTarget:u});q.call(s,t)}}};q.__$mouseExListenerWrapper__=r;var m=(o==="mouseenter")?"mouseover":"mouseout";return p.addEventListener(m,r,l)}},removeMouseEnterLeaveListener:function(o,n,p){var m=((n==="mouseenter")&&a.Event.isSupported("mouseenter"))||((n==="mouseleave")&&a.Event.isSupported("mouseleave"));if(m){return o.removeEventListener(n,p,useCapture)}else{var l=(n==="mouseenter")?"mouseover":"mouseout";return o.removeEventListener(l,p.__$mouseExListenerWrapper__||p)}}};a.Event._W3C={addListener:function(n,m,o,l){if(a.Event._MouseEventEx.isMouseEnterLeaveEvent(m)){return a.Event._MouseEventEx.addMouseEnterLeaveListener(n,m,o,l)}else{return n.addEventListener(m,o,l)}},removeListener:function(n,m,o,l){if(a.Event._MouseEventEx.isMouseEnterLeaveEvent(m)&&o.__$listenerWrapper__){return a.Event._MouseEventEx.removeMouseEnterLeaveListener(n,m,o.__$listenerWrapper__)}else{return n.removeEventListener(m,o,l)}},stopPropagation:function(l){l.stopPropagation()},preventDefault:function(l){l.preventDefault()}};a.Event._W3CMethods={getRelatedTarget:function(l){return l.relatedTarget},getButton:function(l){return l.button}};a.Event._Gecko={addListener:function(n,m,o,l){if(a.Event._MouseEventEx.isMouseEnterLeaveEvent(m)){return a.Event._MouseEventEx.addMouseEnterLeaveListener(n,m,o,l)}if((m==="mousewheel")){var p=function(q){q.wheelDeltaY=q.wheelDelta=-q.detail*40;q.__$type__="mousewheel";o.call(n,q)};o.__$mousewheelListenerWrapper__=p;n.addEventListener("DOMMouseScroll",p,l)}else{n.addEventListener(m,o,l)}},removeListener:function(n,m,o,l){if((m==="mousewheel")&&o.__$mousewheelListenerWrapper__){n.removeEventListener("DOMMouseScroll",o.__$mousewheelListenerWrapper__,l)}else{n.removeEventListener(m,o,l)}}};a.Event._IE={_handlers:{},WIN_UNLOAD_FLAG_FIELD:"__$win_unload_linked__",addListener:function(n,m,o,l){if(a.Event.findHandlerIndex(n,m,o)>=0){return}var r=(function(s){if(!s){s=window.event}s.currentTarget=n;s.eventPhase=(s.srcElement===n)?2:3;if(!c){Object.extend(s,f)}o.call(n,s)});n.attachEvent(a.Event.getEventName(m),r);a.Event.registerHandler(n,m,o,r);var q=n.ownerDocument||n;var p=q.parentWindow||q;a.Event._linkUnloadEvent(p)},removeListener:function(o,n,p,l){var m=a.Event.findHandlerIndex(o,n,p);if(m>=0){var q=a.Event._handlers[n][m].wrapper;o.detachEvent(a.Event.getEventName(n),q);a.Event._handlers[n].splice(m,1)}},stopPropagation:function(l){l.cancelBubble=true},preventDefault:function(l){l.returnValue=false},removeAllListeners:function(q){var r=a.Event._handlers;if(!r){return}for(var p in r){if(r.hasOwnProperty(p)){var n=r[p];if(n&&n.length){var l=a.Event.getEventName(p);for(var m=n.length-1;m>=0;--m){var o=n[m];if((!q)||(o.element.ownerDocument===q)){o.element.detachEvent(l,o.wrapper);n.splice(m,1)}}}}}},getEventName:function(l){return"on"+l},registerHandler:function(o,n,p,q){var l=a.Event._handlers;if(!l[n]){l[n]=[]}var m=l[n];m.push({element:o,handler:p,wrapper:q})},unregisterHandler:function(o,n,p){if(!handlers[n]){return}var m=handlers[n];var l=a.Event.findHandlerIndex(o,n,p);if(l>=0){m.splice(l,1)}},findHandlerIndex:function(q,p,s){var o=a.Event._handlers[p];if(!o){return -1}for(var n=0,m=o.length;n<m;++n){var r=o[n];if((r.element===q)&&(r.handler===s)){return n}}return -1},_linkUnloadEvent:function(l){var m=a.Event.WIN_UNLOAD_FLAG_FIELD;if(l[m]){return}else{l.attachEvent("onunload",a.Event.reactWinUnload);l[m]=true}},reactWinUnload:function(){var l=this.ownerDocument;a.Event.removeAllListeners(l)}};a.Event._IEMethods={getRelatedTarget:function(l){return l.fromElement||l.toElement},getButton:function(l){switch(l.button){case 1:return 0;case 2:return 2;case 4:return 1;case 3:return 3;default:return l.button}},stopPropagation:function(l){l.cancelBubble=true},preventDefault:function(l){l.returnValue=false}};if(document.addEventListener){a.Event=Object.extend(a.Event,a.Event._W3C);a.Event.Methods=Object.extend(a.Event.Methods,a.Event._W3CMethods);if(Kekule.Browser.Gecko){a.Event=Object.extend(a.Event,a.Event._Gecko)}}else{if(document.attachEvent){a.Event=Object.extend(a.Event,a.Event._IE);a.Event.Methods=Object.extend(a.Event.Methods,a.Event._IEMethods);if(window.Element){var e=window.Element.prototype;e.addEventListener=a.Event.addListener.methodize();e.removeEventListener=a.Event.removeListener.methodize()}}}Object.extend(a.Event,a.Event.Methods);var d=null;if(window.Event){d=window.Event.prototype}if(!d){if(document.createEvent){d=document.createEvent("HTMLEvents").__proto__}}var c=!!d;var f={};var b=a.Event.Methods;for(name in b){if(b.hasOwnProperty(name)&&(typeof(b[name])==="function")){f[name]=b[name].methodize()}}if(d){Object.extend(d,f)}a.Ajax={XMLHttpFactories:[function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")}],_availableFactoryIndex:-1,createXMLHTTPObject:function(){var n=false;var o=a.Ajax.XMLHttpFactories;var l=a.Ajax._availableFactoryIndex;if(l>=0){n=o[l]()}else{for(var m=0;m<o.length;m++){try{n=o[m]();a.Ajax._availableFactoryIndex=m}catch(p){continue}break}}return n},preparePostData:function(m){var l=m;if(typeof(m)==="object"){l=Kekule.UrlUtils.generateSearchString(m)}return l},sendRequest:function(n,u,p,r,o){var m=false;var q=true;var t=a.Ajax.createXMLHTTPObject();if(!t){return}var l=(p)?"POST":"GET";t.open(l,n,true);t.setRequestHeader("User-Agent","XMLHTTP/1.0");if(p){t.setRequestHeader("Content-type","application/x-www-form-urlencoded")}if(r){try{t.responseType=r}catch(s){}if((r==="arraybuffer")||(r==="blob")){m=true}if(t.responseType!==r){q=false}}if(m&&(!q)&t.overwriteMimeType){t.overrideMimeType("text/plain; charset=x-user-defined")}if(o&&t.overwriteMimeType){t.overwriteMimeType(o)}t.onreadystatechange=function(){if(t.readyState!=4){return}if(t.status!=200&&t.status!=304){u(null,t,false);throw"HTTP error "+t.status;return}u(t.response||t.responseText,t,true)};if(t.readyState==4){return}t.send(a.Ajax.preparePostData(p));return t},getResponseMimeType:function(l){return l.getResponseHeader("content-type")||""}};Kekule.Ajax=Kekule.X.Ajax;Kekule.X.DomReady={isReady:false,funcs:[],domReady:function(m){k.initReady();if(!k.isReady){var l=document&&document.readyState;if(l==="complete"||l==="loaded"||(l==="interactive"&&!Kekule.Browser.IE)){k.isReady=true}}if(k.isReady){m()}else{k.funcs.push(m)}},fireReady:function(){if(k.isReady){return}k.isReady=true;for(var n=0,m=k.funcs.length;n<m;++n){var o=k.funcs[n];o()}k.funcs.length=0},initReady:function(){if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);k.fireReady()},false)}else{if(document.getElementById){document.write('<script id="ie-domReady" defer="defer" src="//:"><\/script>');document.getElementById("ie-domReady").onreadystatechange=function(){if(this.readyState==="complete"){k.fireReady();this.onreadystatechange=null;this.parentNode.removeChild(this)}}}}}};var k=Kekule.X.DomReady;Kekule.X.domReady=k.domReady})();(function(){Kekule.NativeServices={MODE_OPEN:"open",MODE_SAVE:"save",FILTER_ALL_SUPPORT:"all",FILTER_ANY:"any",showFilePickerDialog:function(c,d,b){if(Kekule.NativeServices.doShowFilePickerDialog){return Kekule.NativeServices.doShowFilePickerDialog(c,d,b)}},canLoadFileData:function(b){return !!a.doLoadFileData||!!a.doShowFilePickerDialog},loadFileData:function(e,f,c){if(Kekule.NativeServices.doLoadFileData){return Kekule.NativeServices.doLoadFileData(e,f,c)}var d=Object.create(c||{});d.multiple=false;d.mode=a.MODE_OPEN;var b=function(h,i,j){if(!h||!i){f(h,null,null)}else{if(Kekule.BrowserFeature.fileapi){var l=i.name;var k=d.binaryDetector&&d.binaryDetector(l,i);var g=new FileReader();g.onload=function(n){var m=g.result;if(f){f(true,m,l)}};g.onerror=function(){if(f){f(false)}Kekule.error(Kekule.$L("ErrorMsg.ERROR_LOADING_FILE"+l))};if(k){g.readAsArrayBuffer(i)}else{g.readAsText(i)}}else{Kekule.error(Kekule.$L("ErrorMsg.FILE_API_NOT_SUPPORTED"))}}};a.showFilePickerDialog(e,b,d)},canSaveFileData:function(b){return !!a.doSaveFileData},saveFileData:function(d,c,e,b){if(Kekule.NativeServices.doSaveFileData){return Kekule.NativeServices.doSaveFileData(d,c,e,b)}}};var a=Kekule.NativeServices;Kekule.HtmlNativeServiceImpl={doShowFilePickerDialog:function(d,e,b){var c=Kekule.HtmlNativeServiceImpl._createFileInputElem(d,e,b||{});c.click()},_createFileInputElem:function(k,m,o){var p=k.createElement("input");p.setAttribute("type","file");var c=o||{};if(c.multiple){p.setAttribute("multiple","multiple")}if(c.filters){var d=[];for(var h=0,f=c.filters.length;h<f;++h){var e=c.filters[h];if(e===Kekule.NativeServices.FILTER_ALL_SUPPORT||e===Kekule.NativeServices.FILTER_ANY){continue}var g=e.filter;if(g){d.push(g)}}var n=d.join(",");p.setAttribute("accept",n)}var b=p.style;b.position="absolute";b.left="-100000px";b.opacity=0;k.body.appendChild(p);var j=function(r){var q=r.getTarget();var l=q.files;var i=l&&l[0];if(m){m(true,i,l)}Kekule.X.Event.removeListener(q,"change",j);q.ownerDocument.body.focus();if(q.parentNode){}};Kekule.X.Event.addListener(p,"change",j);return p},doSaveFileData:function(e,d,g,c){var f=c.initialFileName||null;var b=Kekule.HtmlNativeServiceImpl._createDataElem(e,d,f);b.click();b.parentNode.removeChild(b);if(g){g(null,null)}},_createDataElem:function(f,e,g){var c=f.createElement("a");var d="data:application/octet-stream,"+encodeURIComponent(e);c.setAttribute("href",d);c.setAttribute("download",g||"");var b=c.style;c.position="absolute";c.left="-100000px";c.opacity=0;f.body.appendChild(c);return c},doSaveFileDataIe:function(f,e,h,d){var g=d.initialFileName||null;if(Kekule.BrowserFeature.blob&&window.navigator.msSaveOrOpenBlob){var b=new Blob([e]);window.navigator.msSaveBlob(b,g)}else{var c=Kekule.HtmlNativeServiceImpl._createAndExecDataIframe(f,e,g);c.parentNode.removeChild(c)}if(h){h(null,null)}},_createAndExecDataIframe:function(f,e,g){var b=f.createElement("iframe");f.body.appendChild(b);var d=b.contentWindow||b.contentDocument;d.document.open("text/html","replace");var c=e.toString();d.document.write(c);d.document.close();d.focus();d.document.execCommand("SaveAs",true,Kekule.UrlUtils.extractFileCoreName(g));return b}};if(Kekule.BrowserFeature.fileapi){a.doShowFilePickerDialog=Kekule.HtmlNativeServiceImpl.doShowFilePickerDialog}if(Kekule.Browser.IE||window.navigator.msSaveOrOpenBlob){a.doSaveFileData=Kekule.HtmlNativeServiceImpl.doSaveFileDataIe}else{if(Kekule.BrowserFeature.downloadHref){a.doSaveFileData=Kekule.HtmlNativeServiceImpl.doSaveFileData}}})();Kekule.PredefinedResLoader=Class.create(ObjectEx,{CLASS_NAME:"Kekule.PredefinedResLoader",initialize:function($super,c,b,a){$super();if(!b){Kekule.Error(Kekule.$L("ErrorMsg.EMPTY_RESURI"))}else{this.setPropStoreFieldValue("resUri",b);this.setDoc(c);if(a){this.setResType(a)}}},initProperties:function(){this.defineProp("doc",{dataType:DataType.OBJECT,serializable:false});this.defineProp("resUri",{dataType:DataType.STRING,serializable:false,setter:null});this.defineProp("resType",{dataType:DataType.STRING,serializable:false})},getLinkedResUrl:function(b){var a=b.tagName.toLowerCase();if(a==="link"){return b.getAttribute("href")}else{if(a==="script"){return b.getAttribute("src")}else{return null}}},getElemResType:function(a){return a.getAttribute("type")},load:function(k){var e=this.getResUri();var h,a;var d=Kekule.PredefinedResReferer.ID_MARK;if(e.startsWith(d)){var c=e.substr(d.length).trim();h=this.getDoc().getElementById(c);if(h){a=this.getLinkedResUrl(h);var j=this.getElemResType(h);if(j){this.setResType(j)}}}else{a=e}var f={resType:this.getResType(),resUri:e};if(a){Kekule.X.Ajax.sendRequest(a,function(o,n,p){if(p){f=Object.extend(f,{data:o,text:n.responseText,success:true});if(!f.resType){f.resType=Kekule.X.Ajax.getResponseMimeType(n);if(f.resType===Kekule.IO.MimeType.OCTSTREAM){var m=Kekule.UrlUtils.extractFileExt(a);if(m){var l=Kekule.IO.DataFormatsManager.findFormat(null,m);if(l){f.resType=l.mimeType}}}}k(f,p)}else{k(f,false)}},null,null,this.getResType()||null)}else{if(h){var i=h.innerHTML;var g=2;var b=i.indexOf("\r\n");if(b<0){b=i.indexOf("\n");g=1}if(b===0){i=i.substring(g)}f=Object.extend(f,{data:i,text:i,resType:f.resType||"text/plain",success:true});k(f,true)}else{k(f,false)}}}});Kekule.PredefinedResReferer={REFER_PATTERN:/^\s*url\((\S+)\)\s*$/,ID_MARK:"#",isResValue:function(a){return Kekule.PredefinedResReferer.isResReferrer(a)},isResReferrer:function(a){return Kekule.PredefinedResReferer.REFER_PATTERN.test(a)},extractReferedValue:function(c){var a=Kekule.PredefinedResReferer.REFER_PATTERN.exec(c);if(a){var b=a[1];if(b){b=Kekule.StrUtils.unquote(b);return b}}return null},loadResource:function(d,g,b,e){if(!e){e=document}var c=Kekule.PredefinedResReferer;var a=c.extractReferedValue(d);var f;f=new Kekule.PredefinedResLoader(e,a);if(f){if(b){f.setResType(b)}f.load(g)}}};if(Kekule.IO){Kekule.IO.loadResourceData=function(b,d,a,c){Kekule.PredefinedResReferer.loadResource(b,function(e,f){var g;if(f){g=Kekule.IO.loadTypedData(e.data,e.resType,e.resUri)}if(d){d(g,f)}},a,c)}}(function(){Kekule.DomUtils={namespaceMatched:function(b,a,c){if(c===undefined){c=true}return((b.namespaceURI==a)||(c&&(!b.namespaceURI)))},isElement:function(a){return(a&&a.tagName&&a.nodeType)},getElementText:function(d){var a="";for(var c=0,b=d.childNodes.length;c<b;++c){if(d.childNodes[c].nodeType==3){a+=d.childNodes[c].nodeValue}}return a},setElementText:function(d,f){var a="";for(var c=0,b=d.childNodes.length;c<b;++c){if(d.childNodes[c].nodeType==3){d.childNodes[c].nodeValue=f;return f}}var e=d.ownerDocument.createTextNode(f);d.appendChild(e);return f},getLocalName:function(a){return a.localName||a.baseName||a.nodeName},getChildNodesOfTypes:function(f,b){var a=[];var e=Kekule.ArrayUtils.toArray(b);for(var d=0,c=f.childNodes.length;d<c;++d){var g=f.childNodes[d];if(!b||(e.indexOf(g.nodeType)>=0)){a.push(g)}}return a},getFirstChildElem:function(g,e,b,c){for(var d=0,a=g.childNodes.length;d<a;++d){var f=g.childNodes[d];if(f.nodeType===Node.ELEMENT_NODE){if((e&&(e.toLowerCase()===f.tagName.toLowerCase()))||(b&&(b.toLowerCase()===Kekule.DomUtils.getLocalName(f).toLowerCase()))||((!e)&&(!b))){if((!c)||Kekule.DomUtils.namespaceMatched(f,c)){return f}}}}},getDirectChildElems:function(h,f,c,d){var a=[];for(var e=0,b=h.childNodes.length;e<b;++e){var g=h.childNodes[e];if(g.nodeType===Node.ELEMENT_NODE){if((f&&(f.toLowerCase()===g.tagName.toLowerCase()))||(c&&(c.toLowerCase()===Kekule.DomUtils.getLocalName(g).toLowerCase()))||((!f)&&(!c))){if((!d)||Kekule.DomUtils.namespaceMatched(g,d)){a.push(g)}}}}return a},getDirectChildElemsOfAttribValues:function(e,p,c,g,b){var a=Kekule.DomUtils.getDirectChildElems(e,c,g,b);var q=[];for(var n=0,f=a.length;n<f;++n){var o=true;for(var m=0,h=p.length;m<h;++m){var d=Kekule.ObjUtils.getOwnedFieldNames(p[m])[0];if(a[n].getAttribute(d)!=p[m][d]){o=false;break}}if(o){q.push(a[n])}}return q},isDescendantOf:function(b,a){try{if(b&&a){if(b.documentElement){return false}if(b.ownerDocument===a){return true}var c=b.parentNode;while(c){if(c===a){return true}c=c.parentNode}}return false}catch(d){return false}},isOrIsDescendantOf:function(b,a){return(b===a)||Kekule.DomUtils.isDescendantOf(b,a)},getNearestAncestorByTagName:function(e,d,c){var b=d.toLowerCase();if(c&&(e.tagName.toLowerCase()===b)){return e}var a=e.parentNode;while(a&&a.tagName){if(a.tagName.toLowerCase()===b){return a}a=a.parentNode}return null},getSameNSAttributeValue:function(d,c,b){var a=d.getAttribute(c);return a},setSameNSAttributeValue:function(d,c,e,b){var a=d.setAttribute(c,e);return a},fetchAttributeValuesToArray:function(c,b,d){var k=[];for(var h=0,f=c.attributes.length;h<f;++h){var g=c.attributes[h];if(b&&(!Kekule.DomUtils.namespaceMatched(g,b,true))){continue}var a;if(d){try{a=Kekule.DomUtils.getLocalName(g)}catch(j){a=g.name}}else{a=g.name}k.push({name:a,value:g.value})}return k},fetchAttributeValuesToJson:function(c,b,d){var k={};for(var h=0,f=c.attributes.length;h<f;++h){var g=c.attributes[h];if(b&&(!Kekule.DomUtils.namespaceMatched(g,b,true))){continue}var a;if(d){try{a=Kekule.DomUtils.getLocalName(g)}catch(j){a=g.name}}else{a=g.name}k[a]=g.value}return k},hasAttribute:function(b,a){if(b.hasAttribute){return b.hasAttribute(a)}else{var c=b.getAttribute(a);return !!c}},isDataAttribName:function(a){return a.toString().startsWith("data-")},getDataAttribCoreName:function(a){if(Kekule.DomUtils.isDataAttribName(a)){return a.substr(5)}else{return null}},getDataAttrib:function(b,a){if(b.dataset){return b.dataset[a]}else{return b.getAttribute("data-"+a.toString().hyphenize())}},setDataAttrib:function(b,a,c){if(b.dataset){b.dataset[a]=c}else{b.setAttribute("data-"+a.toString().hyphenize(),c)}},getDataset:function(e){if(e.dataset){return e.dataset}else{var a={};var g=e.attributes;for(var d=0,b=g.length;d<b;++d){var f=g[d];var c=f.name;if(c.toLowerCase().indexOf("data-")===0){var h=c.substring(5).camelize();a[h]=f.value}}return a}},clearChildContent:function(a){var c=Kekule.ArrayUtils.toArray(a.childNodes);for(var b=c.length-1;b>=0;--b){var d=c[b];if(d.nodeType===Node.ATTRIBUTE_NODE){continue}a.removeChild(d)}return a},replaceTagName:function(c,d){if(c.tagName.toLowerCase()!==d.toLowerCase()){var h=c.ownerDocument.createElement(d);var a=Kekule.DomUtils.fetchAttributeValuesToArray(c);for(var f=0,e=a.length;f<e;++f){h.setAttribute(a[f].name,a[f].value)}var b=Kekule.DomUtils.getDirectChildElems(c);for(var f=0,e=b.length;f<e;++f){h.appendChild(b[f])}var g=c.parentNode;var j=c.nextSibling;g.removeChild(c);if(j){g.insertBefore(h,j)}else{g.appendChild(h)}return h}else{return c}},setElemAttributes:function(d,f){var c=Kekule.ObjUtils.getOwnedFieldNames(f);for(var b=0,a=c.length;b<a;++b){var g=c[b];var e=f[g];if(g&&e){d.setAttribute(g,e)}}return d},isInDomTree:function(b,c){if(!b){return false}if(!c){c=b.ownerDocument}if(c){var a=c.documentElement;return Kekule.DomUtils.isDescendantOf(b,a)||b===a}else{return false}}};Kekule.StyleUtils={removeStyleProperty:function(a,b){if(a.removeProperty){a.removeProperty(b)}else{if(a.removeAttribute){a.removeAttribute(b)}else{a[b]=null}}},analysisUnitsValue:function(e){var d={};d.total=e;d.value=parseFloat(e);var a;if(e&&e.length&&(d.value!==undefined)&&(d.value!==NaN)){a="";for(var b=e.length-1;b>=0;--b){var g=e.charAt(b);var f=(g>="0")&&(g<="9");if((!f)&&(g!==".")&&(g!=="-")){a=g+a}}}d.units=a||"";return d},multiplyUnitsValue:function(b,c){var a=Kekule.StyleUtils.analysisUnitsValue(b);a.value*=c;return""+a.value+a.units},colorStrToValue:function(f){var b=f.length>4;var d=b?f.substr(1,2):f.substr(1,1);var c=b?f.substr(3,2):f.substr(2,1);var e=b?f.substr(5,2):f.substr(3,1);if(!b){d+=d;c+=c;e+=e}var a=(parseInt(d,16)<<16)+(parseInt(c,16)<<8)+parseInt(e,16);return a},getComputedStyle:function(c,d){var b;var a=c.ownerDocument.defaultView;if(a&&a.getComputedStyle){b=a.getComputedStyle(c,null)}else{if(c.currentStyle){b=c.currentStyle}}if(b){return d?b[d]:b}else{return null}},isShown:function(b){var a=Kekule.StyleUtils;return(a.isDisplayed(b)&&a.isVisible(b))},isDisplayed:function(a){return(Kekule.StyleUtils.getComputedStyle(a,"display")||"").toLowerCase()!=="none"},getDisplayed:function(a){return Kekule.StyleUtils.getComputedStyle(a,"display")},setDisplay:function(a,b){if(a){if(typeof(b)==="string"){a.style.display=b}else{a.style.display=(!!b)?"":"none"}}},isVisible:function(a){return(Kekule.StyleUtils.getComputedStyle(a,"visibility")||"").toLowerCase()!=="hidden"},getVisibility:function(a){return Kekule.StyleUtils.getComputedStyle(a,"visibility")},setVisibility:function(a,b){if(a){if(typeof(b)==="string"){a.style.visibility=b}else{a.style.visibility=(!!b)?"":"hidden"}}}};Kekule.HtmlElementUtils={getClassNames:function(a){return Kekule.StrUtils.splitTokens(a.className)},hasClass:function(b,a){var c=Kekule.HtmlElementUtils.getClassNames(b);return(c.indexOf(a)>=0)},addClass:function(e,d){var b=Kekule.HtmlElementUtils;var f=Kekule.ArrayUtils.isArray(d)?d:Kekule.StrUtils.splitTokens(d);for(var c=0,a=f.length;c<a;++c){if(!b.hasClass(e,f[c])){e.className+=" "+f[c]}}return b},removeClass:function(e,d){var a=Kekule.HtmlElementUtils;var f=Kekule.ArrayUtils.isArray(d)?d:Kekule.StrUtils.splitTokens(d);var g=a.getClassNames(e);for(var c=g.length;c>=0;--c){var b=f.indexOf(g[c]);if(b>=0){g.splice(c,1)}}e.className=g.join(" ");return a},toggleClass:function(e,d){var b=Kekule.HtmlElementUtils;var f=Kekule.ArrayUtils.isArray(d)?d:Kekule.StrUtils.splitTokens(d);for(var c=0,a=f.length;c<a;++c){if(b.hasClass(e,f[c])){b.removeClass(e,f[c])}else{b.addClass(e,f[c])}}return b},getInnerText:function(a){return a.innerText||a.textContent},resizeElem:function(d,b,a,c){d.style.width=b+(c||"px");d.style.height=a+(c||"px")},getElemClientDimension:function(a){return{width:a.clientWidth,height:a.clientHeight}},getElemScrollDimension:function(a){return{width:a.scrollWidth,height:a.scrollHeight}},getElemComputedDimension:function(e){var c=Kekule.StyleUtils;var f={width:c.getComputedStyle(e,"width"),height:c.getComputedStyle(e,"height")};var d=c.analysisUnitsValue(f.width);var b=c.analysisUnitsValue(f.height);var a={};if(d.units==="px"){a.width=d.value}if(b.units==="px"){a.height=d.value}return a},getElemOffsetDimension:function(a){return{width:a.offsetWidth,height:a.offsetHeight}},getViewportDimension:function(b){var a;if(b){if(b.ownerDocument){a=b.ownerDocument.defaultView}else{if(b.defaultView){a=b.defaultView}else{a=b}}}a=a||window;if(a.innerWidth!=null){return{width:a.innerWidth,height:a.innerHeight}}var c=a.document;if(c.compatMode=="CSS1Compat"){return{width:c.documentElement.clientWidth,height:c.documentElement.clientHeight}}return{width:c.body.clientWidth,height:c.body.clientHeight}},getElemBoundingClientRect:function(d,c){var b=Object.extend({},d.getBoundingClientRect());if(Kekule.ObjUtils.isUnset(b.width)){b.width=b.right-b.left}if(Kekule.ObjUtils.isUnset(b.height)){b.height=b.bottom-b.top}if(c){var f=d.ownerDocument;var e=f.documentElement.scrollTop||f.body.scrollTop||0;var g=f.documentElement.scrollLeft||f.body.scrollLeft||0;b.left+=g;b.right+=g;b.top+=e;b.bottom+=e}var a=b;a.x=a.left;a.y=a.top;return a},getElemPagePos:function(c){var a=0;var f=0;if(c.getBoundingClientRect){var e=c.getBoundingClientRect();var i=c.ownerDocument;var g=i.body;var b=i.documentElement;var d=b.clientTop||g.clientTop||0;var h=b.clientLeft||g.clientLeft||0;f=e.top+(window&&window.pageYOffset||b&&b.scrollTop||g.scrollTop)-d,a=e.left+(window&&window.pageXOffset||b&&b.scrollLeft||g.scrollLeft)-h}else{while(c){a+=(c.offsetLeft-c.scrollLeft+c.clientLeft);f+=(c.offsetTop-c.scrollTop+c.clientTop);c=c.offsetParent}}return{x:a,y:f}},getElemPageRect:function(a){var c=Kekule.HtmlElementUtils.getElemPagePos(a);var b=Kekule.HtmlElementUtils.getElemClientDimension(a);return{x:c.x,y:c.y,left:c.x,top:c.y,width:b.width,height:b.height}},getElemViewportPos:function(b){var a=Kekule.HtmlElementUtils.getElemBoundingClientRect(b);return{x:a.left,y:left.top}},makePositioned:function(a){var b=Kekule.StyleUtils.getComputedStyle(a,"position");if(!b||b.toLowerCase()==="static"){a.style.position="relative"}},isFormCtrlElement:function(b){var c=["input","button","textarea","select"];var a=b.tagName.toLowerCase();return c.indexOf(a)>=0}};Kekule.DocumentUtils={getClientDimension:function(a){if(a.compatMode=="BackCompat"){return{width:a.body.clientWidth,height:a.body.clientHeight}}else{return{width:a.documentElement.clientWidth,height:a.documentElement.clientHeight}}},getScrollPosition:function(b){var a={left:b.documentElement.scrollLeft||b.body.scrollLeft||0,top:b.documentElement.scrollTop||b.body.scrollTop||0};a.x=a.left;a.y=a.top;return a}};Kekule.DataSrcAttribUtils={isUrlBasedValue:function(b){var a=b.toLowerCase().indexOf("url(");return(a===0)},getUrl:function(d){var a=d.trim();var c=a.toLowerCase().indexOf("url(");if(c===0){var b=a.lastIndexOf(")");a=a.substring(4,b);return a}else{return null}},getElementContent:function(b){if(!b){return null}var a=b.innerHTML;a=a.ltrim();return a},getElementMimeType:function(a){return a.getAttribute("type")}};Kekule.ScriptFileUtils={_existedScriptUrls:new Kekule.MapEx(),appendScriptFile:function(d,b,e){var c=Kekule.ScriptFileUtils._existedScriptUrls.get(d);if(!c){c=[];Kekule.ScriptFileUtils._existedScriptUrls.set(d,c)}if(c.indexOf(b)>=0){if(e){e()}return}var a=d.createElement("script");a.src=b;a.onload=a.onreadystatechange=function(g){if(a._loaded){return}var f=a.readyState;if(f===undefined||f==="loaded"||f==="complete"){a._loaded=true;a.onload=a.onreadystatechange=null;c.push(b);if(e){e()}}};(d.getElementsByTagName("head")[0]||d.body).appendChild(a);return a},appendScriptFiles:function(d,c,e){var b=[].concat(c);var a=function(h,g,i){if(g.length<=0){if(i){i()}return}var f=g.shift();Kekule.ScriptFileUtils.appendScriptFile(h,f,function(){Kekule.ScriptFileUtils.appendScriptFiles(h,g,i)})};a(d,b,e)}}})();Kekule.DomHelper=Class.create(ObjectEx,{CLASS_NAME:"Kekule.DomHelper",NAMESPACE_DEFINE_PREFIX:"xmlns",NAMESPACE_DELIMITER:":",ERR_EMPTY_DOC:"Document is empty",ERR_ELEMENT_NOTSET:"Element not set",initialize:function($super,a){$super();this._supportNsMethods=null;if(a){this.setDocument(a)}},initProperties:function(){this.defineProp("document",{dataType:DataType.OBJECT,serializable:false,getter:function(){var a=this.getPropStoreFieldValue("document");if(!a){var b=this.getPropStoreFieldValue("rootElement");a=b?b.ownerDocument:null}return a},setter:function(a){if(a!=this.getPropStoreFieldValue("document")){this.setPropStoreFieldValue("document",a);this.analysisRootElem()}}});this.defineProp("rootElement",{dataType:DataType.OBJECT,serializable:false,getter:function(){var a=this.getPropStoreFieldValue("rootElement");if(!a){var b=this.getPropStoreFieldValue("document");a=b?b.documentElement:null}return a},setter:function(a){this.setPropStoreFieldValue("rootElement",a);this.analysisRootElem()}});this.defineProp("namespaces",{dataType:DataType.ARRAY,serializable:false,getter:function(){if(!this.getPropStoreFieldValue("namespaces")){this.setPropStoreFieldValue("namespaces",[])}return this.getPropStoreFieldValue("namespaces")}});this.defineProp("defNamespaceURI",{dataType:DataType.STRING,serializable:false});this.defineProp("forceAnalysisDoc",{dataType:DataType.BOOL})},analysisRootElem:function(){this.setNamespaces([]);this.setDefNamespaceURI(null);var b=this.getRootElement();if(!b){return}var j=b.ownerDocument;this._supportNsMethods=!!j.getElementsByTagNameNS;if((!this._supportNsMethods)||(this.getForceAnalysisDoc())){for(var f=0,d=b.attributes.length;f<d;++f){var e=b.attributes[f];var c=e.name;if(c&&c.indexOf(this.NAMESPACE_DEFINE_PREFIX)>=0){var h=e.value;var a=c.indexOf(this.NAMESPACE_DELIMITER);var g=(a>=0)?c.substring(a+1):null;this.getNamespaces().push({namespaceURI:h,prefix:g});if(!g){this.setDefNamespaceURI(h)}}}}},_getEmptyDocErrorMsg:function(){return !Kekule.hasLocalRes()?this.ERR_EMPTY_DOC:Kekule.$L("ErrorMsg.EMPTY_DOC")},_getElementNotSetErrorMsg:function(){return !Kekule.hasLocalRes()?this.ELEMENT_NOTSET:Kekule.$L("ErrorMsg.ELEMENT_NOTSET")},assertDocAvailable:function(a){if(!a){Kekule.raise(this._getEmptyDocErrorMsg());return false}else{return true}},assertElementAvailable:function(a){if(!a){Kekule.raise(this._getElementNotSetErrorMsg());return false}else{return true}},getNsPrefix:function(b){if(b==this.getDefNamespaceURI()){return""}var d=this.getNamespaces();for(var c=0,a=d.length;c<a;++c){if(d[c].namespaceURI==b){return d[c].prefix}}return null},getQualifiedName:function(b,a){var c=this.getNsPrefix(b);if(c===null){return null}else{return c?c+this.NAMESPACE_DELIMITER+a:a}},createElementNS:function(a,c){var b=this.getDocument();if(!this.assertDocAvailable(b)){return null}if(this._supportNsMethods){return b.createElementNS(a,c)}else{return b.createElement(c)}},getElementsByTagNameNS:function(c,b,d){var a=this.getPropStoreFieldValue("document")||this.getPropStoreFieldValue("rootElement");var f=this.getDocument();if(!this.assertDocAvailable(f)){return null}if(this._supportNsMethods){if(d){return d.getElementsByTagNameNS(c,b)}else{return a.getElementsByTagNameNS(c,b)}}else{var e=this.getQualifiedName(c,b);if(e===null){return[]}else{if(d){return d.getElementsByTagName(e)}else{return a.getElementsByTagName(e)}}}},getAttributeNodeNS:function(b,a,c){if(!this.assertElementAvailable(c)){return null}if(this._supportNsMethods){return c.getAttributeNodeNS(b,a)}else{var d=this.getQualifiedName(b,a);if(d===null){return null}else{return c.getAttributeNode(d)}}},getAttributeNS:function(b,a,c){if(!this.assertElementAvailable(c)){return null}if(this._supportNsMethods){return c.getAttributeNS(b,a)}else{var d=this.getQualifiedName(b,a);if(d===null){return null}else{return c.getAttribute(d)}}},setAttributeNS:function(b,a,d,c){if(!this.assertElementAvailable(c)){return null}if(this._supportNsMethods){return c.setAttributeNS(b,a,d)}else{var e=this.getQualifiedName(b,a);if(e===null){return null}else{return c.setAttribute(e,d)}}}});