var NUI={Lang:{},Util:{},Widget:{},Ajax:{},Quill:{Entity:{},Processor:{},Render:{},Designer:{},Filler:function(){},Proxy:function(){}},Debug:{},Layout:{}};var $W;NUI.Lang={isNumber:function(vValue){return typeof(vValue)==="number";},isBoolean:function(vValue){return typeof(vValue)==="boolean";},isFunction:function(vValue){return typeof(vValue)==="function";},isString:function(vValue){return typeof(vValue)==="string";},isUndefined:function(vValue){return typeof(vValue)==='undefined';},isNull:function(vValue){return vValue===null;},isObject:function(vValue){return(vValue&&(typeof(vValue)==='object'||NUI.Lang.isFunction(vValue)))||false;},isArray:function(vValue){if(vValue){var l=NUI.Lang;return l.isNumber(vValue.length)&&l.isFunction(vValue.splice);}return false;},DateFormat:(function(){var _dateFormat=function(){var	token=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,timezone=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,timezoneClip=/[^-+\dA-Z]/g,pad=function(val,len){val=String(val);len=len||2;while(val.length<len)val="0"+val;return val;};return function(date,mask,utc){var dF=NUI.Lang.DateFormat;if(arguments.length==1&&(typeof date=="string"||date instanceof String)&&!/\d/.test(date)){mask=date;date=undefined;}date=date?new Date(date):new Date();if(isNaN(date))throw new SyntaxError("invalid date");mask=String(dF.masks[mask]||mask||dF.masks["default"]);if(mask.slice(0,4)=="UTC:"){mask=mask.slice(4);utc=true;}var	_=utc?"getUTC":"get",d=date[_+"Date"](),D=date[_+"Day"](),m=date[_+"Month"](),y=date[_+"FullYear"](),H=date[_+"Hours"](),M=date[_+"Minutes"](),s=date[_+"Seconds"](),L=date[_+"Milliseconds"](),o=utc?0:date.getTimezoneOffset(),flags={d:d,dd:pad(d),ddd:dF.i18n.dayNames[D],dddd:dF.i18n.dayNames[D+7],m:m+1,mm:pad(m+1),mmm:dF.i18n.monthNames[m],mmmm:dF.i18n.monthNames[m+12],yy:String(y).slice(2),yyyy:y,h:H%12||12,hh:pad(H%12||12),H:H,HH:pad(H),M:M,MM:pad(M),s:s,ss:pad(s),l:pad(L,3),L:pad(L>99?Math.round(L/10):L),t:H<12?"a":"p",tt:H<12?"am":"pm",T:H<12?"A":"P",TT:H<12?"AM":"PM",Z:utc?"UTC":(String(date).match(timezone)||[""]).pop().replace(timezoneClip,""),o:(o>0?"-":"+")+pad(Math.floor(Math.abs(o)/60)*100+Math.abs(o)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10]};return mask.replace(token,function($0){return $0 in flags?flags[$0]:$0.slice(1,$0.length-1);});};}();Date.prototype.format=function(mask,utc){return _dateFormat(this,mask,utc);};return{masks:{"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},i18n:{dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},format:function(vDate,mask,utc){return _dateFormat(vDate,mask,utc);}};})(),getUniqueId:(function(){var g_minId=0,g_maxId=4294967295;return function(){var count=0;if(g_minId>=g_maxId){NUI.Widget.Alert("Error : can not get legal unique id");return null;}g_minId++;return g_minId;};})()};String.prototype.supplant=function(vObj){var lang=NUI.Lang;return this.replace(/\{([^{}]*)\}/g,function(a,b){var r=vObj[b];return(lang.isString(r)||lang.isNumber(r)||lang.isBoolean(r))?r:a;});};String.prototype.trim=function(){return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/,"$1");};String.prototype.dump=function(){return this.replace(/\\/g,"\\\\").replace(/\t/g,"\\t").replace(/\r/g,"\\r").replace(/\n/g,"\\n");};String.prototype.map=function(){var retval=this;for(var i=0;i<arguments.length;i++)retval=retval.replace(new RegExp("%"+(i+1),"gm"),arguments[i]);return retval;};String.prototype.controlId=function(){var t=this.lastIndexOf("_");return parseInt(this.substr(t+1));};String.prototype.controlIdStr=function(){var t=this.lastIndexOf("_");return this.substr(t+1);};String.prototype.controlName=function(){var t=this.lastIndexOf("_");return this.substr(0,t);};String.prototype.rootName=function(vIndex){if(vIndex==null){return this.split("_")[0];}try{return this.split("_")[vIndex];}catch(ex){return this.split("_")[0];}};String.prototype.createControl=function(id){return this+"_"+id;};String.prototype.htmlDecode=function(){return this.replace(/&amp;/,"&").replace(/&lt;/,"<").replace(/&gt;/,">").replace(/&nbsp;/," ").replace(/\<br \/\>/,"\r\n");};String.prototype.htmlEncode=function(){return this.replace(/&/,"&amp;").replace(/\</,"&lt;").replace(/\>/,"&gt;").replace(/\s/,"&nbsp;").replace(/\\r\\n/,"<br \/>");};String.prototype.contain=function(vSubStr){if(vSubStr==null){return false;}return(this.indexOf(vSubStr)>=0);};Array.prototype.contain=function(vElement){var len=this.length;for(var i=0;i<len;i++){if(this[i]==vElement){return true;}}return false;};Array.prototype.insertUnique=function(vElement){if(this.contain(vElement))return;this[this.length]=vElement;};Array.prototype.isIndexLegal=function(vIndex){return(NUI.Lang.isNumber(vIndex)&&vIndex>=0&&vIndex<this.length);};Array.prototype.addAt=function(vPosition,vElemt){if(!this.isIndexLegal(vPosition)&&vPosition!=this.length){return false;}this.splice(vPosition,0,vElemt);return true;};Array.prototype.addRangeAt=function(vArray,vPosition){if(vArray==null||!NUI.Lang.isArray(vArray)){return false;}var pos=vPosition;if(pos==null){pos=this.length;}if(!this.isIndexLegal(pos)&&pos!=this.length){return false;}for(var i=vArray.length-1;i>=0;i--){this.splice(pos,0,vArray[i]);}return true;};Array.prototype.update=function(vPosition,vNewElemt){if(!this.isIndexLegal(vPosition)){return false;}this[vPosition]=vNewElemt;return true;};Array.prototype.remove=function(vObj){var len=this.length;for(var i=0;i<len;i++){if(this[i]==vObj){this.splice(i,1);i--;len--;}}};Array.prototype.removeAt=function(vPosition){if(!this.isIndexLegal(vPosition)){return false;}this.splice(vPosition,1);return true;};Array.prototype.getIndex=function(vObj){var len=this.length;for(var i=0;i<len;i++){if(this[i]==vObj){return i;}}return-1;};Array.prototype.trimRight=function(){var i=this.length-1;for(;i>=0;i--){if(this[i]!=null){break;}}this.splice(i+1,this.length-i-1);return this;};Array.prototype.trimLeft=function(){var i=0;for(;i<this.length;i++){if(this[i]!=null){break;}}this.splice(0,i);return this;};Array.prototype.trim=function(){this.trimLeft();this.trimRight();return this;};if(window.addEventListener){if(window.navigator.userAgent.indexOf("Safari")<0){window.constructor.prototype.__defineGetter__("event",function(){var o=arguments.callee.caller;var e;while(o!=null){e=o.arguments[0];if(e&&(e.constructor==Event||e.constructor==MouseEvent||e.constructor==KeyboardEvent))return e;o=o.caller;}return null;});}Event.prototype.__defineGetter__("srcElement",function(){return this.target;});}var Element={show:function(obj){if(typeof(obj)=="string")obj=NUI.Util.DomService.getNode(obj);obj.style.display="";},hide:function(obj){if(typeof(obj)=="string")obj=NUI.Util.DomService.getNode(obj);obj.style.display="none";}};NUI.Util={ObjectService:{walkObject:function(){},searchObject:function(){},annex:function(){},clone:function(){},sameAs:function(){},remove:function(){},hasValue:function(){}},StringService:{StringBuilder:function(vInitValue){},increaseChar:function(vChar,vIncreasement){}},MathService:{toInt:function(vValue){},toFloat:function(vValue){}},WindowService:{Geometry:{},getNodeRect:function(vNode){},getFrameWindow:function(vFrame){},getSelectedText:function(vWindow){},Path:{imagePath:function(vSubPath){},jsPath:function(vSubPath){},flashPath:function(vSubPath){},urlPath:function(vSubPath){},pageName:function(){},getParam:function(vKey){},setParam:function(vKey,vValue){},getAnchor:function(vKey){},setAnchor:function(vKey,vValue){}}},EnvService:{browser:{}},DomService:{walkTheDom:function(vNode,vFunc){},searchTheDOM:function(vNode,vStopFunc){},createNode:function(vTag,vAttributes,vDocument){},getNode:function(vNode,vParent){},appendNode:function(vParent,vNode){},pushNode:function(vParent,vNode){},insertBefore:function(vTarget,vNode){},insertBehind:function(vTarget,vNode){},replaceNode:function(vTarget,vNode){},removeNode:function(vNode){},removeChildren:function(vNode){},destroyNode:function(vNode){},destroyChildren:function(vNode){},setChild:function(vParent,vChild){},getParent:function(vChild){},setAttributes:function(vNode,vAttributes){},setInnerHTML:function(vNode,vHtml){},getNodeByCssClass:function(vClassName){},getCssClasses:function(vNode){},hasCssClass:function(vNode,vClassName){},addCssClass:function(vNode,vClassName){},removeCssClass:function(vNode,vClassName){},setCssClass:function(vNode,vClassNames){},replaceCssClass:function(vNode,vOldClassName,vNewClassName){},show:function(vNodes){},hide:function(vNodes){},isButton:function(vNode){},isTextInput:function(vNode){},isTextArea:function(vNode){},isImage:function(vNode){},isDiv:function(vNode){},isCheckBox:function(vNode){},isRadio:function(vNode){},isLink:function(vNode){},isSpan:function(vNode){}},EventService:{purgeEventHandlers:function(vNode,vExcludeParent){},attachEventHandler:function(vNode,vEventType,vFunc){},appendTemporarily:function(vNode,vEventType,vFunc){},cancelBubble:function(){},attachEnterDownEvent:function(vNode,vFunc){}},DataStructure:{HashTable:function(){},Sheet:function(){}}};NUI.Util.ObjectService={walkObject:function(vObj,vFunc){if(vObj==null){return;}for(var name in vObj){if(vObj.hasOwnProperty(name)){vFunc(name);}}},searchObject:function(vObj,vStopFunc){if(vObj==null){return;}for(var name in vObj){if(vObj.hasOwnProperty(name)){if(vStopFunc(name)){break;}}}},annex:function(vObjA,vObjB){if(vObjA==null||vObjB==null){return;}NUI.Util.ObjectService.walkObject(vObjB,function(vName){vObjA[vName]=vObjB[vName];});return vObjA;},clone:function(vObj){function _clone(obj){if(obj==null||typeof(obj)!='object'){return obj;}var retval=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key)){retval[key]=_clone(obj[key]);}}return retval;}var newObj=_clone(vObj);return newObj;},sameAs:function(vObjA,vObjB){function _same(objA,objB){if(objA===null){return(objB===null);}else if(objB===null){return false;}else{if(typeof(objA)!="object"){if(typeof(objB)!="object"){return(objA===objB);}else{return false;}}else if(typeof(objB)!="object"){return false;}else{for(var keyA in objA){if(objA.hasOwnProperty(keyA)){if(!_same(objA[keyA],objB[keyA])){return false;}}}for(var keyB in objB){if(objB.hasOwnProperty(keyB)){if(!_same(objA[keyB],objB[keyB])){return false;}}}}}return true;}return _same(vObjA,vObjB);},remove:function(vObj,vName){if(vObj==null){return;}delete vObj[vName];},hasValue:function(vObj,vValue){if(vObj==null){return false;}var find=false;NUI.Util.ObjectService.searchObject(vObj,function(vName){find=(vObj[vName]===vValue);return find;});return find;}};NUI.Util.StringService.StringBuilder=function(vInitValue){var lang=NUI.Lang,m_value=[];function _isValueLegal(vValue){return lang.isString(vValue)||lang.isNumber(vValue)||lang.isBoolean(vValue);}if(_isValueLegal(vInitValue)){m_value[m_value.length]=vInitValue;}return{append:function(){var len=arguments.length;for(var i=0;i<len;i++){var v=arguments[i];if(_isValueLegal(v)){m_value[m_value.length]=v;}}},toString:function(){return m_value.join("");}};};NUI.Util.StringService.increaseChar=function(vChar,vIncreasement){var lang=NUI.Lang;if(!lang.isString(vChar)||!lang.isNumber(vIncreasement)){return null;}if(vChar.length!=1){return null;}return String.fromCharCode(vChar.charCodeAt(0)+vIncreasement);};NUI.Util.MathService=(function(){return{toInt:function(vValue){return parseInt(vValue,10);},toFloat:function(vValue){return parseFloat(vValue);}};})();NUI.Util.WindowService.Geometry=(function(){var that={};if(window.screenLeft){that.getWindowX=function(){return window.screenLeft;};that.getWindowY=function(){return window.screenTop;};}else if(window.screenX){that.getWindowX=function(){return window.screenX;};that.getWindowY=function(){return window.screenY;};}if(window.innerWidth){that.getViewportWidth=function(){return window.innerWidth;};that.getViewportHeight=function(){return window.innerHeight;};that.getHorizontalScroll=function(){return window.pageXOffset;};that.getVerticalScroll=function(){return window.pageYOffset;};}else if(document.documentElement&&document.documentElement.clientWidth){that.getViewportWidth=function(){return document.documentElement.clientWidth;};that.getViewportHeight=function(){return document.documentElement.clientHeight;};that.getHorizontalScroll=function(){return document.documentElement.scrollLeft;};that.getVerticalScroll=function(){return document.documentElement.scrollTop;};}else if(document.body.clientWidth){that.getViewportWidth=function(){return document.body.clientWidth;};that.getViewportHeight=function(){return document.body.clientHeight;};that.getHorizontalScroll=function(){return document.body.scrollLeft;};that.getVerticalScroll=function(){return document.body.scrollTop;};}if(document.documentElement&&document.documentElement.scrollWidth){that.getDocumentWidth=function(){return document.documentElement.scrollWidth;};that.getDocumentHeight=function(){return document.documentElement.scrollHeight;};}else if(document.body.scrollWidth){that.getDocumentWidth=function(){return document.body.scrollWidth;};that.getDocumentHeight=function(){return document.body.scrollHeight;};}NUI.Util.ObjectService.annex(that,{getAbsoluteRect:function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return null;}var pos={left:0,top:0,width:0,height:0};pos.width=node.offsetWidth;pos.height=node.offsetHeight;while(node!=null){pos.left+=node.offsetLeft;pos.top+=node.offsetTop;node=node.offsetParent;}return pos;}});return that;})();NUI.Util.WindowService.getNodeRect=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(node==null){return null;}var pos={left:0,top:0,width:0,height:0};pos.width=node.offsetWidth;pos.height=node.offsetHeight;while(node!=null){pos.left+=node.offsetLeft;pos.top+=node.offsetTop;node=node.offsetParent;}return pos;};NUI.Util.WindowService.getFrameWindow=function(vFrame){var lang=NUI.Lang;var obj=null;if(lang.isObject(vFrame)){obj=vFrame;}else if(lang.isString(vFrame)){obj=NUI.Util.DomService.getNode(vFrame);}if(obj!=null){try{obj=obj.contentWindow;}catch(ex){}}return obj;};$W=$W||NUI.Util.WindowService.getFrameWindow;NUI.Util.WindowService.getSelectedText=function(vWindow){if(vWindow==null){vWindow=window;}var retval=null;if(vWindow.getSelection){retval=vWindow.getSelection().toString();}else if(vWindow.document.getSelection){retval=vWindow.document.getSelection();}else if(vWindow.document.selection){var rge=vWindow.document.selection.createRange();rge.select();retval=rge.text;}return retval;};NUI.Util.WindowService.Path=(function(){var m_imagePre="/Public/image/",m_jsPre="/Public/javascript/",m_flashPre="/Public/flash/",m_urlPre="/Page/";return{imagePath:function(vSubPath){return m_imagePre+vSubPath;},jsPath:function(vSubPath){return m_jsPre+vSubPath;},flashPath:function(vSubPath){return m_flashPre+vSubPath;},urlPath:function(vSubPath){return m_urlPre+vSubPath;},pageName:function(){var p=location.href;var retval=p.substr(p.lastIndexOf("/")+1);retval=retval.substr(0,retval.indexOf("."));return retval;},getParam:function(vKey){if(vKey==null){return null;}var searchstr=location.search;if(searchstr==null||searchstr.trim()==""){return null;}var params=searchstr.substr(1,searchstr.length-1).split("&");for(var i=0;i<params.length;i++){var keyandvalue=params[i].split("=");if(keyandvalue[0]==vKey){return unescape(keyandvalue[1]);}}return null;},setParam:function(vKey,vValue){if(arguments==null){return;}var ht=new NUI.Util.DataStructure.HashTable();var searchstr=location.search;if(searchstr!=null){var params=searchstr.substr(1,searchstr.length-1).split("&");for(var i=0;i<params.length;i++){if(params[i]==null||params[i].trim()==""){continue;}var keyandvalue=params[i].split("=");if(keyandvalue[0].trim()!=""){ht.setValue(keyandvalue[0],unescape(keyandvalue[1]));}}}for(var i=0;i+1<arguments.length;i+=2){var key=arguments[i],value=arguments[i+1];if(key==null||value==null||key.trim()==""){continue;}ht.setValue(key,value);}location.search=(function(){var retval="";ht.walkTable(function(vName,vValue){retval+="&"+vName+"="+escape(vValue);});if(retval!=""){retval=retval.substr(1,retval.length-1);}return retval;})();},getAnchor:function(vKey){if(vKey==null){return null;}var anchorstr=location.hash;if(anchorstr==null||anchorstr.trim()==""){return null;}var params=anchorstr.substr(1,anchorstr.length-1).split("&");for(var i=0;i<params.length;i++){var keyandvalue=params[i].split("=");if(keyandvalue[0]==vKey){return unescape(keyandvalue[1]);}}return null;},setAnchor:function(vKey,vValue){if(vKey==null||vValue==null){return null;}var anchorstr=location.hash;if(anchorstr==null||anchorstr.trim()==""){location.hash=vKey+"="+escape(vValue);return;}var params=anchorstr.substr(1,anchorstr.length-1).split("&");var anchor_new_value=vKey+"="+escape(vValue);for(var i=0;i<params.length;i++){if(params[i]==null||params[i].trim()==""){continue;}var keyandvalue=params[i].split("=");if(keyandvalue[0]!=vKey){anchor_new_value+="&"+keyandvalue[0]+"="+keyandvalue[1];}}location.hash=anchor_new_value;}};})();NUI.Util.EnvService.browser=(function(){var userAgent=userAgent||navigator.userAgent.toLowerCase();return{version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),ie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};})();NUI.Util.DomService.walkTheDOM=function(vNode,vFunc){if(!vFunc){return;}var node=NUI.Util.DomService.getNode(vNode);function _walk(_node,_func){if(!_node){return;}_func(_node);_node=_node.firstChild;while(_node){_walk(_node,_func);_node=_node.nextSibling;}}_walk(node,vFunc);};NUI.Util.DomService.searchTheDOM=function(vNode,vStopFunc){if(!vStopFunc){return;}var node=NUI.Util.DomService.getNode(vNode);function _search(_node,_stopfunc){if(!_node){return false;}var stop=_stopfunc(_node);if(stop){return true;}_node=_node.firstChild;while(!stop&&_node){stop=_search(_node,_stopfunc);_node=_node.nextSibling;}return stop;}return _search(node,vStopFunc);};NUI.Util.DomService.createNode=function(vTag,vAttributes,vDocument){if(!vTag||!NUI.Lang.isString(vTag)){return;}var doc=vDocument||document;var retval=doc.createElement(vTag);NUI.Util.DomService.setAttributes(retval,vAttributes);return retval;};NUI.Util.DomService.getNode=function(vNode,vParent){if(!vNode){return null;}var doc=(vParent&&vParent.document)||document;var root=vParent&&vParent.root;switch(typeof vNode){case"string":var retval=null;if(root){NUI.Util.DomService.searchTheDOM(root,function(_node){if(_node.id==vNode){retval=_node;return true;}return false;});}else{retval=doc.getElementById(vNode);}return retval;case"object":if(NUI.Lang.isArray(vNode)){return null;}else{return vNode;}break;default:return null;}};NUI.Util.DomService.appendNode=function(vParent,vNode){var parent=NUI.Util.DomService.getNode(vParent);if(!parent||!vNode){return;}parent.appendChild(vNode);};NUI.Util.DomService.pushNode=function(vParent,vNode){var parent=NUI.Util.DomService.getNode(vParent);if(!parent||!vNode){return;}var first_child=vParent.firstChild;if(first_child==null){parent.appendChild(vNode);}else{parent.insertBefore(vNode,vParent.firstChild);}};NUI.Util.DomService.insertBefore=function(vTarget,vNode){var target=NUI.Util.DomService.getNode(vTarget);if(!target||!vNode){return;}var p=target.parentNode;if(!p){return;}p.insertBefore(vNode,target);};NUI.Util.DomService.insertBehind=function(vTarget,vNode){var target=NUI.Util.DomService.getNode(vTarget);if(!target||!vNode){return;}var p=target.parentNode,s=target.nextSibling;if(!p){return;}if(!s){p.appendChild(vNode);}else{p.insertBefore(vNode,s);}};NUI.Util.DomService.replaceNode=function(vTarget,vNode){var target=NUI.Util.DomService.getNode(vTarget);if(!target||!vNode){return;}var p=target.parentNode;if(!p){return;}p.replaceChild(vNode,target);};NUI.Util.DomService.removeNode=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}var p=node.parentNode;if(p){p.removeChild(node);}};NUI.Util.DomService.removeChildren=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}var child=node.firstChild;while(child){node.removeChild(child);child=node.firstChild;}};NUI.Util.DomService.destroyNode=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}NUI.Util.EventService.purgeEventHandlers(node);var p=node.parentNode;if(p){p.removeChild(node);}};NUI.Util.DomService.destroyChildren=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}NUI.Util.EventService.purgeEventHandlers(node,true);node.innerHTML="";};NUI.Util.DomService.setChild=function(vParent,vChild){var parent=NUI.Util.DomService.getNode(vParent);if(!parent){return;}if(vChild){var m_lang=NUI.Lang,m_dom=NUI.Util.DomService;if(m_lang.isObject(vChild)){m_dom.destroyChildren(parent);m_dom.appendNode(parent,vChild);}else if(m_lang.isString(vChild)||m_lang.isNumber(vChild)||m_lang.isBoolean(vChild)){m_dom.setInnerHTML(parent,vChild);}}};NUI.Util.DomService.getParent=function(vChild){var child=NUI.Util.DomService.getNode(vChild);if(!child){return;}return child.parentNode;};NUI.Util.DomService.setAttributes=function(vNode,vAttributes){var node=NUI.Util.DomService.getNode(vNode);if(!node||!vAttributes){return;}NUI.Util.ObjectService.walkObject(vAttributes,function(name){var v=vAttributes[name];switch(typeof v){case"string":case"number":case"boolean":node[name]=v;break;case"function":NUI.Util.EventService.attachEventHandler(node,name,v);break;case"object":NUI.Util.DomService.setAttributes(node[name],v);break;}});};NUI.Util.DomService.setInnerHTML=function(vNode,vHtml){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vHtml)){return;}NUI.Util.DomService.destroyChildren(node);node.innerHTML=vHtml;return node.firstChild;};NUI.Util.DomService.getNodeByCssClass=function(vClassName){if(!NUI.Lang.isString(vClassName)){return[];}var cssclass=vClassName.trim();if(cssclass==""){return[];}var results=[];NUI.Util.DomService.walkTheDom(document.body,function(node){if(NUI.Util.DomService.hasCssClass(node,cssclass)){results[results.length]=node;}});return results;};NUI.Util.DomService.getCssClasses=function(vNode){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}var classes=node.className,retval=[];if(classes){var splits=classes.split(" ");for(var i=0;i<splits.length;i++){if(splits[i]!=""){retval[retval.length]=splits[i];}}}return retval;};NUI.Util.DomService.hasCssClass=function(vNode,vClassName){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vClassName)){return;}var classes=node.className;if(classes){var reg=new RegExp("(\\s|^)"+vClassName+"(\\s|$)","g");return reg.test(classes);}};NUI.Util.DomService.addCssClass=function(vNode,vClassName){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vClassName)){return;}if(NUI.Util.DomService.hasCssClass(node,vClassName)){return;}var classes=node.className;if(classes){node.className=classes+" "+vClassName;}else{node.className=vClassName;}};NUI.Util.DomService.removeCssClass=function(vNode,vClassName){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vClassName)){return false;}if(!NUI.Util.DomService.hasCssClass(node,vClassName)){return false;}var classes=node.className;if(classes){var regexp=new RegExp(vClassName,"g");node.className=classes.replace(regexp,"");return true;}return false;};NUI.Util.DomService.setCssClass=function(vNode,vClassNames){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vClassNames)){return;}node.className=vClassNames;};NUI.Util.DomService.replaceCssClass=function(vNode,vOldClassName,vNewClassName){var node=NUI.Util.DomService.getNode(vNode);if(!node||!NUI.Lang.isString(vOldClassName)||!NUI.Lang.isString(vNewClassName)){return false;}if(!NUI.Util.DomService.hasCssClass(node,vOldClassName)){return false;}var classes=node.className;if(classes){var regexp=new RegExp(vOldClassName,"g");node.className=classes.replace(regexp,vNewClassName);return true;}return false;};NUI.Util.DomService.show=function(vNodes){if(arguments==null){return;}var len=arguments.length,dom=NUI.Util.DomService;for(var i=0;i<len;i++){var node=dom.getNode(arguments[i]);if(node!=null){dom.removeCssClass(node,"hide");}}};NUI.Util.DomService.hide=function(vNodes){if(arguments==null){return;}var len=arguments.length,dom=NUI.Util.DomService;for(var i=0;i<len;i++){var node=dom.getNode(arguments[i]);if(node!=null){dom.addCssClass(node,"hide");}}};NUI.Util.DomService.isButton=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="input"&&node.type.toLowerCase()=="button");};NUI.Util.DomService.isTextInput=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="input"&&node.type.toLowerCase()=="text");};NUI.Util.DomService.isTextArea=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="textarea");};NUI.Util.DomService.isImage=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="img");};NUI.Util.DomService.isDiv=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="div");};NUI.Util.DomService.isCheckBox=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="input"&&node.type.toLowerCase()=="checkbox");};NUI.Util.DomService.isRadio=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="input"&&node.type.toLowerCase()=="radio");};NUI.Util.DomService.isLink=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="a");};NUI.Util.DomService.isSpan=function(vNode){var node=NUI.Util.DomService.getNode(vNode);return(node&&node.tagName.toLowerCase()=="span");};NUI.Util.EventService.purgeEventHandlers=function(vNode,vExcludeParent){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}var clearElementProps=['data','onmouseover','onmouseout','onmousedown','onmouseup','ondblclick','onclick','onselectstart','oncontextmenu'];function clear(vElmt){var len=clearElementProps.length;for(var i=0;i<len;i++){if(vElmt[clearElementProps[i]]){vElmt[clearElementProps[i]]=null;}}}if(!vExcludeParent){NUI.Util.DomService.walkTheDOM(node,clear);}else{node=node.firstChild;while(node){NUI.Util.DomService.walkTheDOM(node,clear);node=node.nextSibling;}}};NUI.Util.EventService.attachEventHandler=function(vNode,vEventType,vFunc){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}node[vEventType]=vFunc;};NUI.Util.EventService.appendTemporarily=function(vNode,vEventType,vFunc){var node=NUI.Util.DomService.getNode(vNode);if(!node){return;}var backup=node[vEventType];node[vEventType]=function(){try{vFunc.call(node);}catch(ex1){}node[vEventType]=backup;try{node[vEventType].call(node);}catch(ex2){}};};NUI.Util.EventService.cancelBubble=function(){if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}};NUI.Util.EventService.attachEnterDownEvent=function(vNode,vFunc){var dom=NUI.Util.DomService,node=dom.getNode(vNode),func=vFunc?vFunc:function(){};if(!dom.isTextInput(node)&&!dom.isTextArea(node)){return;}NUI.Util.EventService.attachEventHandler(node,"onkeydown",function(){var keyCode=event.keyCode?event.keyCode:event.which?event.which:event.charCode;if(keyCode==13){func(node.value.trim());}});};NUI.Util.DataStructure.HashTable=function(){var lang=NUI.Lang,m_collection={},m_count=0;function _isKeyLegal(vKey){return lang.isString(vKey)||lang.isNumber(vKey)||lang.isBoolean(vKey);}function _key(vKey){return vKey+"";}var that={count:function(){return m_count;},keys:function(){var retval=[],id=0;NUI.Util.ObjectService.walkObject(m_collection,function(m_key){var m_value=m_collection[m_key];if(!lang.isUndefined(m_value)){retval[id++]=m_key;}});return retval;},values:function(){var retval=[],id=0;NUI.Util.ObjectService.walkObject(m_collection,function(m_key){var m_value=m_collection[m_key];if(!lang.isUndefined(m_value)){retval[id++]=m_value;}});return retval;},elements:function(vKeyName,vValueName){var keyName=vKeyName?vKeyName:"key",valueName=vValueName?vValueName:"value",retval=[],id=0;NUI.Util.ObjectService.walkObject(m_collection,function(m_key){var m_value=m_collection[m_key];if(!lang.isUndefined(m_value)){retval[id]={};retval[id][keyName]=m_key;retval[id][valueName]=m_value;id++;}});return retval;},exist:function(vKey){if(!_isKeyLegal(vKey)){return false;}return!lang.isUndefined(m_collection[_key(vKey)]);},getValue:function(vKey){if(_isKeyLegal(vKey)){var retval=m_collection[_key(vKey)];if(!lang.isUndefined(retval)){return retval;}}return null;},setValue:function(vKey,vValue){if(!_isKeyLegal(vKey)){return false;}var key=_key(vKey);if(lang.isUndefined(m_collection[key])){m_count++;}m_collection[key]=vValue;return true;},setValues:function(vElems,vKeyName,vValueName){if(vElems==null||vElems.length==0){return 0;}var keyName=(vKeyName!=null)?vKeyName:"key",valueName=(vValueName!=null)?vValueName:"value",len=vElems.length,retval=0;for(var i=0;i<len;i++){var elem=vElems[i];if(elem!=null){if(that.setValue(elem[keyName],elem[valueName])){retval++;}}}return retval;},remove:function(vKey){if(!_isKeyLegal(vKey)){return false;}var key=_key(vKey);if(!lang.isUndefined(m_collection[key])){delete m_collection[key];m_count--;}return true;},resetKey:function(vOldKey,vNewKey){if(!_isKeyLegal(vOldKey)||!_isKeyLegal(vNewKey)){return false;}var oldKey=_key(vOldKey),newKey=_key(vNewKey),ovalue=m_collection[oldKey],nvalue=m_collection[newKey];if(lang.isUndefined(ovalue)||!lang.isUndefined(nvalue)){return false;}NUI.Util.ObjectService.remove(m_collection,oldKey);m_collection[newKey]=ovalue;return true;},walkTable:function(vFunc){NUI.Util.ObjectService.walkObject(m_collection,function(m_key){vFunc(m_key,m_collection[m_key]);});},searchTable:function(vStopFunc){NUI.Util.ObjectService.searchObject(m_collection,function(m_key){return vStopFunc(m_key,m_collection[m_key]);});}};return that;};NUI.Util.DataStructure.Sheet=(function(){var g_lang=NUI.Lang;return function(vData){var m_data=[];if(g_lang.isArray(vData)){for(var i=0;i<vData.length;i++){if(g_lang.isArray(vData[i])){m_data[m_data.length]=NUI.Util.ObjectService.clone(vData[i]);m_data[m_data.length-1].trimRight();}else{m_data[m_data.length]=[];}}_trimY();}function _trimY(){var i=m_data.length-1;for(;i>=0;i--){if(m_data[i]!=[]){break;}}m_data.splice(i+1,m_data.length-i-1);}var that={fill:function(vX,vY,vSheet,vIsRotated){},clear:function(vX,vY,vXCount,vYCount){},extend:function(vX,vY,vSheet,vIsRotated){},shrink:function(vX,vY,vXCount,vYCount){},getLengthX:function(){var retval=0;for(var i=0;i<m_data.length;i++){if(m_data[i].length>retval){retval=m_data[i].length;}}return retval;},getLengthY:function(){return m_data.length;},getValue:function(vX,vY){var retval=null;try{retval=m_data[vY][vX];}catch(ex){}return retval;},setValue:function(vX,vY,vValue){if(!g_lang.isNumber(vX)||vX<0||!g_lang.isNumber(vY)||vY<0){return;}while(m_data.length<=vY){m_data[m_data.length]=[];}var row=m_data[vY];while(row.length<=vX){row[row.length]=null;}row[vX]=vValue;row.trimRight();_trimY();}};return that;};})();NUI.Ajax=(function(){var g_lang=NUI.Lang;function _call(vMethod,vParameters){if(!g_lang.isString(vMethod)){return;}var m_method=vMethod,m_args=[],m_func={},m_timeout=60000,m_end=false;if(vParameters!=null){m_args=(vParameters.args!=null)?vParameters.args:m_args;if(g_lang.isFunction(vParameters.func)){NUI.Util.ObjectService.annex(m_func,{success:vParameters.func});}else{NUI.Util.ObjectService.annex(m_func,vParameters.func);}m_timeout=(vParameters.timeout!=null)?vParameters.timeout:m_timeout;}m_args[m_args.length]=function(res){if(m_end){return;}if(res!=null){m_end=true;if(m_func.success){m_func.success(res.value);}}else{if(m_func.failed){m_func.failed();}else{}}};function _run(){if(!Environment.Page||!Environment.Page[m_method]){return;}Environment.Page[m_method].apply(Environment.Page,m_args);setTimeout(function(){if(m_end){return;}if(m_func.expire){m_func.expire(_run);}else{}},m_timeout);}_run();}return{call:_call};})();NUI.Widget=(function(){var g_ht=NUI.Util.DataStructure.HashTable,g_dom=NUI.Util.DomService,g_minId=0,g_maxId=4294967295;function _getUsableId(){var count=0;while(NUI.Util.DomService.getNode("nuiwidget_"+g_minId)&&count<g_maxId){count++;g_minId++;if(g_minId>=g_maxId)g_minId=0;}if(count==g_maxId){NUI.Widget.Alert("Error : can not get legal widget id");return null;}return"nuiwidget_"+(g_minId++);};return{Base:function(vSecret){vSecret=vSecret||{};vSecret.id=vSecret.id||_getUsableId();vSecret.document=vSecret.document||document;vSecret.nameSpace=vSecret.nameSpace||NUI.Widget;var m_childrenCache=new g_ht();NUI.Util.ObjectService.annex(vSecret,{getChild:function(vId){var obj=m_childrenCache.getValue(vId);function _linkToTop(vNode){var parent=vNode;while(parent!=null&&parent!=that.nodeEntity){parent=parent.parentNode;}return(parent==that.nodeEntity);};if(obj==null||!_linkToTop(obj)){obj=g_dom.getNode(vId,{root:that.nodeEntity});m_childrenCache.setValue(vId,obj);}return obj;}});var that={getId:function(){return(vSecret&&vSecret.id)?vSecret.id:null;},nodeEntity:null,attachTo:function(vNode){var parent=g_dom.getNode(vNode);if(!parent)return;if(this.nodeEntity){g_dom.removeChildren(parent);g_dom.appendNode(parent,this.nodeEntity);}},appendTo:function(vNode){var parent=g_dom.getNode(vNode);if(!parent)return;if(this.nodeEntity){g_dom.appendNode(parent,this.nodeEntity);}},appendBehind:function(vNode){if(!vNode)return;if(this.nodeEntity){g_dom.insertBehind(vNode,this.nodeEntity);}},destroy:function(){g_dom.destroyNode(this.nodeEntity);}};return that;},RichEditor:{},Button:{},Input:{},Panel:{},Dropdown:function(vChild,vAttributes){},Fog:function(vSecret){},Alert:function(vMsg,vAttribute){},Confirm:function(vMsg,vFunc,vAttribute){},Popup:function(vChild,vAttribute){},Waiting:{start:function(vMsg){},end:function(){}},MediaPlayer:{},Accessory:{},TimeSelector:function(){},AccountSelector:function(){},ServiceSelector:function(){},Ofc:function(vDataUrl,vAttributes){},FusionCharts:function(swf,id,w,h,debugMode,registerWithJS,c,scaleMode,lang,detectFlashVersion,autoInstallRedirect){},Table:{},DatePicker:function(){},DatespanSelector:function(){},Source:{},Query:{}};})();NUI.Layout=(function(){var m_PageLoadEvents=[];var m_OnLoad=function(){NUI.Layout.ComponentMenu.initialize();for(var i=0;i<m_PageLoadEvents.length;i++)m_PageLoadEvents[i]();};var m_BindLoadEvent=function(e){if(typeof(e)=="function")m_PageLoadEvents.push(e);};return{onLoad:m_OnLoad,bindLoadEvent:m_BindLoadEvent,ComponentMenu:{}};})();NUI.Layout.ComponentMenu=(function(){var RES_PREFIX="component-button-";var m_SelectedId=0;var m_HoveredId=0;var m_Update=function(selected_id,hovered_id){for(var i=1;i<=4;i++)NUI.Util.DomService.getNode(RES_PREFIX+i).style.backgroundPositionY=(((selected_id==i)?0:-90)+((hovered_id==i)?-45:0))+"px";for(var i=1;i<4;i++)NUI.Util.DomService.getNode(RES_PREFIX+"separator-"+i).style.backgroundPositionY=(((i==selected_id)?0:((i+1==selected_id)?-135:-270))+((i==hovered_id)?-45:0)+((i+1==hovered_id)?-90:0))+"px";};var m_UpdateCurrent=function(){m_Update(m_SelectedId,m_HoveredId);};var m_GetId=function(res){return parseInt(res.id.substring(RES_PREFIX.length));};var m_OnButtonMouseOver=function(res){m_HoveredId=m_GetId(res);m_UpdateCurrent();};var m_OnButtonMouseOut=function(res){m_HoveredId=0;m_UpdateCurrent();};var m_BindEvents=function(){for(var i=1;i<=4;i++){var obj=NUI.Util.DomService.getNode(RES_PREFIX+i);obj.onmouseover=function(){NUI.Layout.ComponentMenu.onButtonMouseOver(this);};obj.onmouseout=function(){NUI.Layout.ComponentMenu.onButtonMouseOut(this);};}};var m_Initialize=function(){if(NUI.Util.DomService.getNode("component-menu")==null)return;m_BindEvents();if(typeof(Environment.CurrentComponent)!="undefined")m_SelectedId=Environment.CurrentComponent;m_UpdateCurrent();};return{initialize:m_Initialize,onButtonMouseOver:m_OnButtonMouseOver,onButtonMouseOut:m_OnButtonMouseOut};})();NUI.Widget.Button={ButtonStatus:{mouseout:0,mouseover:1,mousedown:2},ImageButton:function(vAttributes){},SpanButton:function(vImageInfo,vAttributes){}};NUI.Widget.Button.ImageButton=(function(){var g_dom=NUI.Util.DomService;function _onmouseover(){this.src=this.src.replace(/_[02]\./g,"_1.");}function _onmouseout(){this.src=this.src.replace(/_[12]\./g,"_0.");}function _onmousedown(){this.src=this.src.replace(/_[01]\./g,"_2.");}function _onmouseup(){this.src=this.src.replace(/_[12]\./g,"_0.");}return function(vAttributes){var m_attributes=vAttributes||{};var m_secret={id:m_attributes.id};var that=NUI.Widget.Base(m_secret);m_attributes.id=m_secret.id;m_attributes.src=m_attributes.src||m_attributes.image||"radio";m_attributes.src=NUI.Util.WindowService.Path.imagePath(m_attributes.src+"_0.gif");m_attributes.onmouseover=_onmouseover;m_attributes.onmouseout=_onmouseout;m_attributes.onmousedown=_onmousedown;m_attributes.onmouseup=_onmouseup;NUI.Util.ObjectService.annex(that,{nodeEntity:(function(){return g_dom.createNode("img",m_attributes);})()});return that;};})();NUI.Widget.Button.SpanButton=(function(){var g_dom=NUI.Util.DomService,g_status=NUI.Widget.Button.ButtonStatus;return function(vImageInfo,vAttributes){var m_index=0,m_width=24,m_height=24,m_image="widget/buttons.gif",m_attributes=vAttributes||{},m_secret={id:m_attributes.id},m_status=g_status.mouseout,m_locked=false;if(vImageInfo){if(vImageInfo.index!=null){m_index=vImageInfo.index;}if(vImageInfo.width!=null){m_width=vImageInfo.width;}if(vImageInfo.height!=null){m_height=vImageInfo.height;}if(vImageInfo.image!=null){m_image=vImageInfo.image;}}var that=NUI.Widget.Base(m_secret);function __getX(vXIndex){return(-1)*vXIndex*m_width;}function __getY(vYIndex){return(-1)*vYIndex*m_height;}m_attributes.id=m_secret.id;m_attributes.className="inlineBlock";m_attributes.style=m_attributes.style||{};NUI.Util.ObjectService.annex(m_attributes.style,{width:m_width+"px",height:m_height+"px",backgroundImage:"url("+NUI.Util.WindowService.Path.imagePath(m_image)+")",backgroundPosition:"0px "+__getY(m_index)+"px"});function __getBgPosition(vXIndex,vYIndex){var x=__getX(vXIndex),y=__getY(vYIndex);return x+"px "+y+"px";}function _setStatusBgimage(vObj,vStatus){if(!m_locked){m_status=vStatus;vObj.style.backgroundPosition=__getBgPosition(vStatus,m_index);}}m_attributes.onmouseover=m_attributes.onmouseover||function(){_setStatusBgimage(this,g_status.mouseover);};m_attributes.onmouseout=m_attributes.onmouseout||function(){_setStatusBgimage(this,g_status.mouseout);};m_attributes.onmousedown=m_attributes.onmousedown||function(){_setStatusBgimage(this,g_status.mousedown);};m_attributes.onmouseup=m_attributes.onmouseup||function(){_setStatusBgimage(this,g_status.mouseover);};var m_node=g_dom.createNode("span",m_attributes);NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,lockStatus:function(vStatus){if(!NUI.Util.ObjectService.hasValue(g_status,vStatus)){return;}m_node.style.backgroundPosition=__getBgPosition(vStatus,m_index);m_locked=true;},unlockStatus:function(){m_node.style.backgroundPosition=__getBgPosition(m_status,m_index);m_locked=false;}});return that;};})();NUI.Widget.Panel={ColorPanel:function(vAttributes){},RoundConnerSize:{small:0,large:1},RoundConner:function(vAttributes){},TabPanel:function(){}};NUI.Widget.Panel.ColorPanel=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_xCount=8,g_yCount=8,g_rgb=["00","55","AA","FF"],g_htmlTmplt=(function(){var m_sb=new g_sb();m_sb.append("<div class=\"colorPanel\"><div class=\"left\">");for(var y=0;y<g_yCount;y++){for(var x=0;x<g_xCount;x++){var color=_getColor(y*8+x);m_sb.append("<div class=\"colorCell\" ","onmouseover=\"NUI.Util.DomService.addCssClass(this, 'colorCellActive');","NUI.Util.DomService.getNode('{ID}_show').style.background = '#"+color+"';\" ","onmouseout=\"NUI.Util.DomService.removeCssClass(this, 'colorCellActive');","NUI.Util.DomService.getNode('{ID}_show').style.background = 'transparent';\" >","<div class=\"color\" style=\"background-color:#"+color+";\"></div>","</div>");}}m_sb.append("</div><div id=\"{ID}_show\" class=\"right\"></div></div>");return m_sb.toString();})();function _getColor(vValue){var r=Math.round(vValue/16-0.5),g=Math.round((vValue-r*16)/4-0.5),b=vValue-r*16-g*4;return[g_rgb[r],g_rgb[g],g_rgb[b]].join("");}return function(vAttributes){var m_secret={},m_func=function(){};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.func!=null){m_func=vAttributes.func;}}var that=NUI.Widget.Base(m_secret);var m_attributes={id:m_secret.id,className:"colorPanel",onclick:function(){var src=event.srcElement;if(src){if(g_dom.hasCssClass(src,"color")){m_func(src.style.backgroundColor);}else if(g_dom.hasCssClass(src,"colorCell")){var _src=src.firstChild;if(_src){m_func(_src.style.backgroundColor);}}}}};var m_node=g_dom.createNode("div",m_attributes,m_secret.document);g_dom.setInnerHTML(m_node,g_htmlTmplt.supplant({ID:m_secret.id}));NUI.Util.ObjectService.annex(that,{nodeEntity:m_node});return that;};})();NUI.Widget.Panel.RoundConner=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_lang=NUI.Lang,g_tmplt="<div style=\"background:{BACKGROUND}; height:1px; line-height:1px; border:solid {BORDER}; border-width:0 {BORDER_WIDTH}px; margin:0 {MARGIN}px; font-size:1px;\" ></div>";return function(vAttributes){var m_border="#999",m_background="#ccc",m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.border){m_border=vAttributes.border;}if(vAttributes.background){m_background=vAttributes.background;}}var that=NUI.Widget.Base(m_secret);var m_innerNode=g_dom.createNode("div",{style:{padding:"0 5px",height:"100%",borderWidth:"0 1px",borderStyle:"solid",borderColor:m_border,background:m_background}}),m_node=(function(){var retval=g_dom.createNode("div",{id:m_secret.id}),b1=g_tmplt.supplant({BACKGROUND:m_border,BORDER:m_border,BORDER_WIDTH:1,MARGIN:5}),b2=g_tmplt.supplant({BACKGROUND:m_background,BORDER:m_border,BORDER_WIDTH:2,MARGIN:3}),b3=g_tmplt.supplant({BACKGROUND:m_background,BORDER:m_border,BORDER_WIDTH:1,MARGIN:2}),b4=g_tmplt.supplant({BACKGROUND:m_background,BORDER:m_border,BORDER_WIDTH:1,MARGIN:1}),b5=g_tmplt.supplant({BACKGROUND:m_background,BORDER:m_border,BORDER_WIDTH:1,MARGIN:1}),sb=new g_sb();sb.append(b1,b2,b3,b4,b5);g_dom.setInnerHTML(retval,sb.toString());g_dom.appendNode(retval,m_innerNode);sb=new g_sb();sb.append(b5,b4,b3,b2,b1);var foot=g_dom.createNode("div");g_dom.setInnerHTML(foot,sb.toString());g_dom.appendNode(retval,foot);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,setInnerNode:function(vNode){if(g_lang.isString(vNode)){g_dom.setInnerHTML(m_innerNode,vNode);}else if(g_lang.isObject(vNode)){g_dom.removeChildren(m_innerNode);g_dom.appendNode(m_innerNode,vNode);}}});return that;};})();NUI.Widget.Panel.TabPanel=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_lang=NUI.Lang,g_htmlTmplt=(function(){var sb=new g_sb();sb.append("<div class=\"tabs\"><div class=\"l\"><div class=\"r\"><div class=\"c\">","<div id=\"{ID}_tabs\"></div>","</div></div></div></div>","<div id=\"{ID}_contents\" class=\"contents\" style=\"width:{WIDTH}px;height:{HEIGHT}px\"></div>","<div class=\"foot\"><div class=\"l\"><div class=\"r\"><div class=\"c\">","</div></div></div></div>");return sb.toString();})(),g_tabTmplt=(function(){var sb=new g_sb();sb.append("<div class=\"l\"><div class=\"r\"><div class=\"c\">","<div>{CAPTION}</div>","</div></div></div>");return sb.toString();})();return function(vAttributes){var m_secret={},m_width=650,m_height=200;if(vAttributes){if(vAttributes.id){m_secret.id=vAttributes.id;}if(vAttributes.width>0){m_width=vAttributes.width;}if(vAttributes.height>0){m_height=vAttributes.height;}}var that=NUI.Widget.Base(m_secret),m_id=m_secret.id;var m_node=(function(){var retval=g_dom.createNode("div",{className:"tabPanel",style:{width:m_width+10+"px",height:m_height+50+"px"}});g_dom.setInnerHTML(retval,g_htmlTmplt.supplant({ID:m_id,WIDTH:m_width,HEIGHT:m_height}));return retval;})();var m_index=0,m_crtIndex=-1;function _getTabId(vIndex){return m_id+"_tab_"+vIndex;}function _getContentId(vIndex){return m_id+"_content_"+vIndex;}function _addTab(vCaption,vContent){if(!g_lang.isString(vCaption)){return;}var tabCon=m_secret.getChild(m_id+"_tabs"),cntCon=m_secret.getChild(m_id+"_contents");if(!tabCon||!cntCon){return;}var tab=g_dom.createNode("div",{id:_getTabId(m_index),className:"tab",onmouseover:function(){g_dom.addCssClass(this,"tabhover");},onmouseout:function(){g_dom.removeCssClass(this,"tabhover");},onclick:function(){var idx=this.id.controlId();_clickTab(idx);}});g_dom.setInnerHTML(tab,g_tabTmplt.supplant({CAPTION:vCaption}));g_dom.appendNode(tabCon,tab);var cnt=g_dom.createNode("div",{id:_getContentId(m_index),className:"cnt"});if(g_lang.isObject(vContent)){g_dom.appendNode(cnt,vContent);}else if(g_lang.isString(vContent)){g_dom.setInnerHTML(cnt,vContent);}g_dom.hide(cnt);g_dom.appendNode(cntCon,cnt);_clickTab(m_index);m_index++;}function _clickTab(vIndex){if(m_crtIndex==vIndex){return;}if(m_crtIndex>=0){var ctab=m_secret.getChild(_getTabId(m_crtIndex)),ccontent=m_secret.getChild(_getContentId(m_crtIndex));if(ctab!=null){g_dom.removeCssClass(ctab,"tabselected");}if(ccontent!=null){g_dom.hide(ccontent);}}var tab=m_secret.getChild(_getTabId(vIndex)),content=m_secret.getChild(_getContentId(vIndex));if(tab!=null){g_dom.addCssClass(tab,"tabselected");}if(content!=null){g_dom.show(content);}m_crtIndex=vIndex;}NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,addTab:function(vCaption,vContent){var cap=vCaption,cnt=vContent;if(!g_lang.isString(cap)){return;}if(g_lang.isNull(cnt)){cnt="";}else if(!g_lang.isObject(cnt)&&!g_lang.isString(cnt)){return;}_addTab(cap,cnt);},triggerTab:function(vIndex){if(!g_lang.isNumber(vIndex)&&!vIndex>=0){return;}_clickTab(vIndex);}});return that;};})();NUI.Widget.Input={Base:function(){},Options:function(vOptHtmls,vFunc,vAttributes){},Matrix:function(vRoptHtmls,vCoptHtmls,vFunc,vAttributes){},MatrixInput:function(vRoptHtmls,vCoptHtmls,vFunc,vAttributes){},TextInputType:{STRING:{id:1,value:"String",text:"字符串"},INT:{id:2,value:"Int",text:"整数"},FLOAT:{id:3,value:"Float",text:"浮点数"},EMAIL:{id:4,value:"Email",text:"邮箱"}},TextInput:function(vType,vMin,vMax,vFunc){},RankBarType:{apple0:0,apple1:1,apple2:2,apple3:3,sun0:4,sun1:5,moon0:6,moon1:7,cloud0:8,cloud1:9,snow:10,rain:11,butterfly:12,fire:13,heart:14,leaf_green:15,leaf_red:16,music:17,pine:18,star0:19,star1:20,umbrella:21},RankBar:function(){},SortPanel:function(){},ArrangeType:{horizontal:0,vertical:1},ConstBarType:{blue:0,yellow:1,green:2,pink:3,orange:4,purple:5,red:6,gray:7},ConstBar:function(){},Location:function(){}};NUI.Widget.Input.Base=(function(){var g_dom=NUI.Util.DomService,g_ht=NUI.Util.DataStructure.HashTable;return function(vSecret){var m_secret=vSecret||{},that=NUI.Widget.Base(m_secret);NUI.Util.ObjectService.annex(m_secret,{domCache:new g_ht(),getDom:function(vId){var obj=m_secret.domCache.getValue(vId);if(obj==null){obj=g_dom.getNode(vId,{root:that.nodeEntity});if(obj==null){obj=g_dom.getNode(vId);}m_secret.domCache.setValue(vId,obj);}return obj;},node:(function(){var retval=g_dom.createNode("div",{className:"inputCon"}),innerHTML="<div class=\"info\">"+"<span class=\"msg hide\" id=\""+m_secret.id+"_msg\"></span>"+"<span class=\"note\" id=\""+m_secret.id+"_note\"></span>"+"</div>";g_dom.setInnerHTML(retval,innerHTML);return retval;})(),showMsg:function(vMsg){if(vMsg==null){return;}var obj=m_secret.getDom(m_secret.id+"_msg");if(obj!=null){obj.innerHTML=vMsg;if(vMsg.trim()==""){g_dom.hide(obj);}else{g_dom.show(obj);}}},setNote:function(vNote){if(vNote==null){return;}var obj=m_secret.getDom(m_secret.id+"_note");if(obj!=null){obj.innerHTML=vNote;}}});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Widget.Input.Options=(function(){var g_lang=NUI.Lang,g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_incrChar=NUI.Util.StringService.increaseChar,g_ht=NUI.Util.DataStructure.HashTable;return function(vOptHtmls,vFunc,vAttributes){var m_optHtmls=NUI.Util.ObjectService.clone(vOptHtmls),m_min=1,m_max=1,m_column=1,m_other=false,m_func=vFunc?vFunc:function(){},m_resultIndexes=(function(){var retval=[],len=m_optHtmls?m_optHtmls.length:0;for(var i=0;i<len;i++){retval[i]=0;}if(m_other){retval[retval.length]=0;}return retval;})(),m_resultOtherValue="",m_random=false,m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.min>0){m_min=vAttributes.min;}if(vAttributes.max>0){m_max=vAttributes.max;}if(vAttributes.column>0){m_column=vAttributes.column;}if(vAttributes.hasOther){m_other=true;}if(vAttributes.initIndexes!=null){m_resultIndexes=vAttributes.initIndexes;}if(vAttributes.initOtherValue!=null){m_resultOtherValue=vAttributes.initOtherValue;}m_random=(vAttributes.random?true:false);}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id;if(m_other){var isSelected=m_resultIndexes[m_resultIndexes.length-1]>0;m_optHtmls[m_optHtmls.length]="<input id=\""+m_id+"_other\" type=\"text\" "+"value=\""+((isSelected)?m_resultOtherValue:"其他(请填写)")+"\" disabled=\""+((isSelected)?"false":"true")+"\" class=\""+((isSelected)?"enabled":"disabled")+"\" />";}var m_isRadio=(m_min==1&&m_max==1),m_optTmplt="<div><label style=\"cursor:pointer;\"><input type=\"{OPT_TYPE}\" name=\""+m_id+"_opt\" id=\"{OPT_ID}\" style=\"cursor:pointer;\" {OPT_ADDITIONAL} />"+"<span class=\"optTag\">{OPT_INDEX}.&nbsp;</span>"+"<div id=\"{OPT_ID}_CNT\" style=\"display:inline;\">{OPT_HTML}</div></label></div>";function _getOptId(vIndex){return m_id+"_opt_"+vIndex;}function _setupResult(){function __getOtherValue(){if(!m_other){return null;}var ipt=m_secret.getDom(m_id+"_other");if(ipt){return ipt.value;}return null;}var opts=[],len=m_optHtmls.length;for(var i=0;i<len;i++){var opt=m_secret.getDom(_getOptId(i));opts[i]=(opt!=null&&opt.checked)?1:0;}m_resultIndexes=opts;m_resultOtherValue=__getOtherValue();}var _clickEvent=m_isRadio?function(){var src=event.srcElement;if(src){if(g_dom.isRadio(src)){if(m_other){var other=m_secret.getDom(m_id+"_other");if(other!=null){if(src.id.controlId()==m_optHtmls.length-1){other.disabled=false;other.focus();g_dom.setCssClass(other,"enabled");}else{other.disabled=true;g_dom.setCssClass(other,"disabled");}}}_setupResult();if(m_func!=null){m_func(m_resultIndexes,m_resultOtherValue);}}}}:function(){var src=event.srcElement;if(src){if(g_dom.isCheckBox(src)){if(m_other){var other=m_secret.getDom(m_id+"_other");if(other!=null){if(src.id.controlId()==m_optHtmls.length-1){if(src.checked){other.disabled=false;other.focus();g_dom.setCssClass(other,"enabled");}else{other.disabled=true;g_dom.setCssClass(other,"disabled");}}}}_setupResult();var msg="";if(src.checked){msg=_checkMax(m_resultIndexes);if(msg!=""){m_secret.showMsg(msg);src.checked=false;return;}}m_secret.showMsg(msg);if(m_func!=null){m_func(m_resultIndexes,m_resultOtherValue);}}}};function _checkMax(vOptIdxes){if(vOptIdxes==null){return"选项值有误";}var count=0,len=vOptIdxes.length;for(var i=0;i<len;i++){if(vOptIdxes[i]==1){count++;}}return(count>m_max)?"最多只能选择"+m_max+"个选项":"";}function _checkMin(vOptIdxes){if(vOptIdxes==null){return"选项值有误";}var count=0,len=vOptIdxes.length;for(var i=0;i<len;i++){if(vOptIdxes[i]==1){count++;}}return(count<m_min)?"最少必须选择"+m_min+"个选项":"";}var m_node=(function(){var retval=m_secret.node,opts=g_dom.createNode("div",{id:m_id,className:"choice",onclick:_clickEvent});var idxUsed=new g_ht();function _getRandomIdx(){var count=m_optHtmls.length;if(idxUsed.count()>=count){return-1;}var retval=Math.floor(Math.random()*count);while(true){if(retval<0||retval>=count){retval=0;}else if(idxUsed.exist(retval)){retval++;}else{idxUsed.setValue(retval,true);return retval;}}}var sb=new g_sb(),rCount=Math.ceil(m_optHtmls.length/m_column),count=rCount*m_column,optType=m_isRadio?"radio":"checkbox";sb.append("<table cellpadding=\"0\" cellspacing=\"0\" >");for(var r=0;r<rCount;r++){sb.append("<tr>");for(var c=0;c<m_column;c++){sb.append("<td>");var idx=m_random?_getRandomIdx():(r*m_column+c);html=m_optHtmls[idx];if(html!=null){sb.append(m_optTmplt.supplant({OPT_TYPE:optType,OPT_ID:_getOptId(idx),OPT_INDEX:r*m_column+c+1+"",OPT_HTML:html,OPT_ADDITIONAL:(m_resultIndexes[idx]>0)?"checked=\"true\"":""}));}sb.append("</td>");}sb.append("</tr>");}sb.append("</table>");g_dom.setInnerHTML(opts,sb.toString());g_dom.appendNode(retval,opts);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;},getOptDivDom:function(vIndex){var opt=m_secret.getDom(_getOptId(vIndex)+"_CNT");return opt;}});NUI.Util.EventService.attachEventHandler(m_secret.getDom(m_id+"_other"),"onblur",function(){_setupResult();if(m_func!=null){m_func(m_resultIndexes,m_resultOtherValue);}});(function(){var html="";if(m_min==1&&m_max==1){html="";}else if(m_min==m_max){html="(请选择"+m_min+"个选项)";}else{html="(请选择"+m_min+"到"+m_max+"个选项)";}m_secret.setNote(html);})();return that;};})();NUI.Widget.Input.Matrix=(function(){var g_dom=NUI.Util.DomService,g_incrChar=NUI.Util.StringService.increaseChar,g_sb=NUI.Util.StringService.StringBuilder,g_ht=NUI.Util.DataStructure.HashTable,g_optType={row:"row",col:"col"};return function(vRoptHtmls,vCoptHtmls,vFunc,vAttributes){var m_optHtmls={row:NUI.Util.ObjectService.clone(vRoptHtmls),col:NUI.Util.ObjectService.clone(vCoptHtmls)},m_min={row:1,col:1},m_max={row:1,col:1},m_other={row:((vAttributes&&vAttributes.rhasOther)?true:false),col:((vAttributes&&vAttributes.chasOther)?true:false)},m_resultIndexes=(function(){var retval=[],rowCount=m_optHtmls.row.length+(m_other.row?1:0),colCount=m_optHtmls.col.length+(m_other.col?1:0);for(var r=0;r<rowCount;r++){retval[r]=[];for(var c=0;c<colCount;c++){retval[r][c]=0;}}return retval;})(),m_resultOtherValue={row:"其他(请填写)",col:"其他(请填写)"},m_func=vFunc?vFunc:function(){},m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.rmin>=0){m_min[g_optType.row]=vAttributes.rmin;}if(vAttributes.rmax>=0){m_max[g_optType.row]=vAttributes.rmax;}if(vAttributes.cmin>=0){m_min[g_optType.col]=vAttributes.cmin;}if(vAttributes.cmax>=0){m_max[g_optType.col]=vAttributes.cmax;}if(vAttributes.initIndexes!=null){var rowCount=m_resultIndexes.length;if(rowCount>0){var colCount=m_resultIndexes[0].length;for(var r=0;r<rowCount;r++){if(vAttributes.initIndexes[r]==null){continue;}for(var c=0;c<colCount;c++){if(vAttributes.initIndexes[r][c]!=null)m_resultIndexes[r][c]=vAttributes.initIndexes[r][c];}}}}if(vAttributes.initRowOtherValue!=null){m_resultOtherValue.row=vAttributes.initRowOtherValue;}if(vAttributes.initColOtherValue!=null){m_resultOtherValue.col=vAttributes.initColOtherValue;}}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id;NUI.Util.ObjectService.walkObject(g_optType,function(vName){var name=g_optType[vName];if(m_other[name]){var htmls=m_optHtmls[name];htmls[htmls.length]="<input id=\""+m_id+"_"+name+"_other\" value=\""+m_resultOtherValue[name]+"\" type=\"text\" class=\"enabled\" />";}});var m_optTmplt="<div><input type=\"checkbox\" id=\"{OPT_ID}\" style=\"cursor:pointer;\" "+"title=\"{TOOL_TIP}\" {OPT_ADDITIONAL} /></div>";function _getOptId(vRindex,vCindex){return m_id+"_opt_"+vRindex+"_"+vCindex;}function _getLabelId(vType,vIndex){return m_id+"_"+vType+"_"+vIndex;}function __getOtherValue(vType){if(!m_other[vType]){return null;}var ipt=m_secret.getDom(m_id+"_"+vType+"_other");if(ipt){return ipt.value;}return null;}function _setupResult(vCheckBox){if(!vCheckBox){return;}var c=vCheckBox.id.controlId(),r=vCheckBox.id.controlName().controlId();m_resultIndexes[r][c]=vCheckBox.checked?1:0;m_resultOtherValue.row=__getOtherValue(g_optType.row);m_resultOtherValue.col=__getOtherValue(g_optType.col);}function _clickEvent(){var src=event.srcElement;if(src){if(g_dom.isCheckBox(src)){_setupResult(src);var msg="";if(src.checked){msg=_checkMax(m_resultIndexes);if(msg!=""){m_secret.showMsg(msg);src.checked=false;var c=src.id.controlId(),r=src.id.controlName().controlId();m_resultIndexes[r][c]=0;return;}}var td=src.parentNode.parentNode;if(td){if(src.checked){g_dom.addCssClass(td,"selected");}else{g_dom.removeCssClass(td,"selected");}}m_secret.showMsg(msg);if(m_func!=null){m_func(m_resultIndexes,m_resultOtherValue.row,m_resultOtherValue.col);}}}}var m_time_counter=0;function _checkMax(vOptIndexes){var tc=m_time_counter;m_time_counter++;setTimeout(function(){m_time_counter--;},1000);if(tc>0){return"您回答的速度太快了，请看清题目，确保回答正确。";}if(vOptIndexes==null||vOptIndexes.length==0){return"选项值有误";}var rlen=vOptIndexes.length,clen=vOptIndexes[0].length,msg=new g_sb("");for(var r1=0;r1<rlen;r1++){var rcount=0;for(var c1=0;c1<clen;c1++){if(vOptIndexes[r1][c1]==1){rcount++;}}var max1=m_max[g_optType.row];if(rcount>max1){msg.append("第",r1+1,"行最多选",max1,"个选项\r\n");}}for(var c2=0;c2<clen;c2++){var ccount=0;for(var r2=0;r2<rlen;r2++){if(vOptIndexes[r2][c2]==1){ccount++;}}var max2=m_max[g_optType.col];if(ccount>max2){msg.append("第",c2+1,"列最多选",max2,"个选项\r\n");}}return msg.toString().trim();}function _checkMin(vOptIndexes){if(vOptIndexes==null||vOptIndexes.length==0){return"选项值有误";}var rlen=vOptIndexes.length,clen=vOptIndexes[0].length,msg=new g_sb("");for(var r1=0;r1<rlen;r1++){var rcount=0;for(var c1=0;c1<clen;c1++){if(vOptIndexes[r1][c1]==1){rcount++;}}var min1=m_min[g_optType.row];if(rcount<min1){msg.append("第",r1+1,"行至少选",min1,"个选项\r\n");}}for(var c2=0;c2<clen;c2++){var ccount=0;for(var r2=0;r2<rlen;r2++){if(vOptIndexes[r2][c2]==1){ccount++;}}var min2=m_min[g_optType.col];if(ccount<min2){msg.append("第",c2+1,"列至少选",min2,"个选项\r\n");}}return msg.toString().trim();}var m_node=(function(){var retval=m_secret.node,opts=g_dom.createNode("div",{id:m_id,className:"matrix",onclick:_clickEvent});var sb=new g_sb(),rhtmls=m_optHtmls[g_optType.row],chtmls=m_optHtmls[g_optType.col],rlen=rhtmls.length,clen=chtmls.length;sb.append("<div>");sb.append("<table cellpadding=\"0\" cellspacing=\"0\"><tr class=\"A\"><td>&nbsp;</td>");for(var c0=0;c0<clen;c0++){sb.append("<td><span class=\"optTag\">",g_incrChar("A",c0),".</span>","<div id=\"",_getLabelId(g_optType.col,c0),"\" style=\"display:inline\">",chtmls[c0],"</div></td>");}sb.append("</tr>");var alter=false;for(var r=0;r<rlen;r++){var className=alter?"A":"B";alter=!alter;sb.append("<tr class=\"",className,"\"><td><span class=\"optTag\">",(r+1),".</span>","<div id=\"",_getLabelId(g_optType.row,r),"\" style=\"display:inline\">",rhtmls[r],"</div></td>");for(var c=0;c<clen;c++){var ischecked=(m_resultIndexes[r][c]>0);sb.append("<td class=\"normal ",ischecked?"selected":"","\" onmouseover=\"NUI.Util.DomService.replaceCssClass(this, 'normal', 'hover');\" ","onmouseout=\"NUI.Util.DomService.replaceCssClass(this, 'hover', 'normal');\" >",m_optTmplt.supplant({OPT_ID:_getOptId(r,c),TOOL_TIP:g_incrChar("A",c)+(r+1),OPT_ADDITIONAL:ischecked?"checked=\"true\"":""}),"</td>");}sb.append("</tr>");}sb.append("</table></div>");g_dom.setInnerHTML(opts,sb.toString());g_dom.appendNode(retval,opts);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;},getRoptDivDom:function(vIndex){var id=_getLabelId(g_optType.row,vIndex);return m_secret.getDom(id);},getCoptDivDom:function(vIndex){var id=_getLabelId(g_optType.col,vIndex);return m_secret.getDom(id);}});NUI.Util.ObjectService.walkObject(g_optType,function(vName){var name=g_optType[vName];if(m_other[name]){NUI.Util.EventService.attachEventHandler(m_secret.getDom(m_id+"_"+name+"_other"),"onblur",function(){m_resultOtherValue.row=__getOtherValue(g_optType.row);m_resultOtherValue.col=__getOtherValue(g_optType.col);if(m_func!=null){m_func(m_resultIndexes,m_resultOtherValue.row,m_resultOtherValue.col);}});}});(function(){var html="(",rmin=m_min.row,rmax=m_max.row,cmin=m_min.col,cmax=m_max.col;if(rmin==rmax){html+="每行可选"+rmin+"个选项&nbsp;";}else{html+="每行可选"+rmin+"到"+rmax+"个选项&nbsp;";}if(cmin==cmax){html+="每列可选"+cmin+"个选项)";}else{html+="每列可选"+cmin+"到"+cmax+"个选项)";}m_secret.setNote(html);})();return that;};})();NUI.Widget.Input.MatrixInput=(function(){var g_dom=NUI.Util.DomService,g_incrChar=NUI.Util.StringService.increaseChar,g_sb=NUI.Util.StringService.StringBuilder,g_ht=NUI.Util.DataStructure.HashTable,g_optType={row:"row",col:"col"};return function(vRoptHtmls,vCoptHtmls,vFunc,vAttributes){var m_optHtmls={row:NUI.Util.ObjectService.clone(vRoptHtmls),col:NUI.Util.ObjectService.clone(vCoptHtmls)},m_other={row:((vAttributes&&vAttributes.rhasOther)?true:false),col:((vAttributes&&vAttributes.chasOther)?true:false)},m_resultValues=(function(){var retval=[],rowCount=m_optHtmls.row.length+(m_other.row?1:0),colCount=m_optHtmls.col.length+(m_other.col?1:0);for(var r=0;r<rowCount;r++){retval[r]=[];for(var c=0;c<colCount;c++){retval[r][c]="";}}return retval;})(),m_resultOtherValue={row:"其他(请填写)",col:"其他(请填写)"},m_func=vFunc?vFunc:function(){},m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.initValues!=null){var rowCount=m_resultValues.length;if(rowCount>0){var colCount=m_resultValues[0].length;for(var r=0;r<rowCount;r++){if(vAttributes.initValues[r]==null){continue;}for(var c=0;c<colCount;c++){if(vAttributes.initValues[r][c]!=null)m_resultValues[r][c]=vAttributes.initValues[r][c];}}}}if(vAttributes.initRowOtherValue!=null){m_resultOtherValue.row=vAttributes.initRowOtherValue;}if(vAttributes.initColOtherValue!=null){m_resultOtherValue.col=vAttributes.initColOtherValue;}}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id;NUI.Util.ObjectService.walkObject(g_optType,function(vName){var name=g_optType[vName];if(m_other[name]){var htmls=m_optHtmls[name];htmls[htmls.length]="<input id=\""+m_id+"_"+name+"_other\" value=\""+m_resultOtherValue[name]+"\" type=\"text\" class=\"enabled\" />";}});var m_optTmplt="<div><input type=\"text\" id=\"{OPT_ID}\" style=\"color:#B88906\" value=\"{OPT_VALUE}\" "+"title=\"{TOOL_TIP}\" /></div>";function _getOptId(vRindex,vCindex){return m_id+"_opt_"+vRindex+"_"+vCindex;}function _getLabelId(vType,vIndex){return m_id+"_"+vType+"_"+vIndex;}function __getOtherValue(vType){if(!m_other[vType]){return null;}var ipt=m_secret.getDom(m_id+"_"+vType+"_other");if(ipt){return ipt.value;}return null;}function _setupResult(vInputBox){if(!vInputBox){return;}var c=vInputBox.id.controlId(),r=vInputBox.id.controlName().controlId();m_resultValues[r][c]=vInputBox.value;m_resultOtherValue.row=__getOtherValue(g_optType.row);m_resultOtherValue.col=__getOtherValue(g_optType.col);}var m_node=(function(){var retval=m_secret.node,opts=g_dom.createNode("div",{id:m_id,className:"matrix"});var sb=new g_sb(),rhtmls=m_optHtmls[g_optType.row],chtmls=m_optHtmls[g_optType.col],rlen=rhtmls.length,clen=chtmls.length;sb.append("<div>");sb.append("<table cellpadding=\"0\" cellspacing=\"0\"><tr class=\"A\"><td>&nbsp;</td>");for(var c0=0;c0<clen;c0++){sb.append("<td><span class=\"optTag\">",g_incrChar("A",c0),".</span>","<div id=\"",_getLabelId(g_optType.col,c0),"\" style=\"display:inline\">",chtmls[c0],"</div></td>");}sb.append("</tr>");var alter=false;for(var r=0;r<rlen;r++){var className=alter?"A":"B";alter=!alter;sb.append("<tr class=\"",className,"\"><td><span class=\"optTag\">",(r+1),".</span>","<div id=\"",_getLabelId(g_optType.row,r),"\" style=\"display:inline\">",rhtmls[r],"</div></td>");for(var c=0;c<clen;c++){sb.append("<td class=\"normal ","\" onmouseover=\"NUI.Util.DomService.replaceCssClass(this, 'normal', 'hover');\" ","onmouseout=\"NUI.Util.DomService.replaceCssClass(this, 'hover', 'normal');\" >",m_optTmplt.supplant({OPT_ID:_getOptId(r,c),TOOL_TIP:g_incrChar("A",c)+(r+1),OPT_VALUE:m_resultValues[r][c]}),"</td>");}sb.append("</tr>");}sb.append("</table></div>");g_dom.setInnerHTML(opts,sb.toString());g_dom.appendNode(retval,opts);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;},getRoptDivDom:function(vIndex){var id=_getLabelId(g_optType.row,vIndex);return m_secret.getDom(id);},getCoptDivDom:function(vIndex){var id=_getLabelId(g_optType.col,vIndex);return m_secret.getDom(id);}});var rlen=m_optHtmls[g_optType.row].length,clen=m_optHtmls[g_optType.col].length;for(var r=0;r<rlen;r++){for(var c=0;c<clen;c++){NUI.Util.EventService.attachEventHandler(m_secret.getDom(_getOptId(r,c)),"onblur",function(){_setupResult(this);if(m_func!=null){m_func(m_resultValues,m_resultOtherValue.row,m_resultOtherValue.col);}});}}NUI.Util.ObjectService.walkObject(g_optType,function(vName){var name=g_optType[vName];if(m_other[name]){NUI.Util.EventService.attachEventHandler(m_secret.getDom(m_id+"_"+name+"_other"),"onblur",function(){m_resultOtherValue.row=__getOtherValue(g_optType.row);m_resultOtherValue.col=__getOtherValue(g_optType.col);if(m_func!=null){m_func(m_resultValues,m_resultOtherValue.row,m_resultOtherValue.col);}});}});(function(){var html="";m_secret.setNote(html);})();return that;};})();NUI.Widget.Input.TextInput=(function(){var g_dom=NUI.Util.DomService,g_evt=NUI.Util.EventService,g_sb=NUI.Util.StringService.StringBuilder,g_ht=NUI.Util.DataStructure.HashTable,g_math=NUI.Util.MathService,g_type=NUI.Widget.Input.TextInputType;function _isTypeLegal(vType){var isLegal=false;NUI.Util.ObjectService.searchObject(g_type,function(vName){isLegal=(NUI.Util.ObjectService.sameAs(g_type[vName],vType));return isLegal;});return isLegal;}var g_checker={};g_checker[g_type.STRING.value]=function(vValue,vMin,vMax){var _msg="";if(vValue==null){_msg="输入值不能为空";}else if(vValue.length<vMin){_msg="输入文字长度必须大于"+vMin;}else if(vValue.length>vMax){_msg="输入文字长度必须小于"+vMax;}return{value:vValue,msg:_msg};};g_checker[g_type.INT.value]=function(vValue,vMin,vMax){var intvalue=g_math.toInt(vValue),_msg="";if(isNaN(intvalue)){_msg="输入必须为整数";}else if(intvalue<vMin){_msg="输入整数必须大于"+vMin;}else if(intvalue>vMax){_msg="输入整数必须小于"+vMax;}return{value:intvalue,msg:_msg};};g_checker[g_type.FLOAT.value]=function(vValue,vMin,vMax){var fltvalue=g_math.toFloat(vValue),_msg="";if(isNaN(fltvalue)){_msg="输入必须为浮点数";}else if(fltvalue<vMin){_msg="输入浮点数必须大于"+vMin;}else if(fltvalue>vMax){_msg="输入浮点数必须小于"+vMax;}return{value:fltvalue,msg:_msg};};g_checker[g_type.EMAIL.value]=function(vValue,vMin,vMax){var _msg="";if(vValue==null){_msg="输入值不能为空";}else{var checkMail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;if(!checkMail.test(vValue)){_msg="邮箱地址不合法";}}return{value:vValue,msg:_msg};};return function(vType,vMin,vMax,vFunc,vAttributes){if(!_isTypeLegal(vType)){return null;}var m_type=vType,m_min=vMin,m_max=vMax,m_func=vFunc?vFunc:function(){},m_resultValue="",m_secret={},that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id;if(vAttributes!=null){if(vAttributes.initValue!=null){m_resultValue=vAttributes.initValue;}}var m_inputId=m_id+"_input",m_inputTmplt=(function(){if(m_type.id==g_type.STRING.id&&m_max>=500){return"<div style=\"text-align:center;\"><textarea id=\"{INPUT_ID}\" "+"style=\"width:80%; height:100px;\">"+m_resultValue+"</textarea></div>";}else{return"<input type=\"text\" id=\"{INPUT_ID}\" value=\""+m_resultValue+"\" />";}})(),m_innerHTML=(function(){var sb=new g_sb();sb.append(m_inputTmplt.supplant({INPUT_ID:m_inputId}),"<span id=\""+m_id+"_msg\" style=\"background:#FAD163;\"></span>");sb.append("<span class=\"note\">");if(m_type.id==g_type.EMAIL.id){sb.append("(邮箱地址必须合法)");}else{sb.append("(输入"+m_type.text+"在"+m_min+"到"+m_max+"之间)");}sb.append("</span>");return sb.toString();})();var _onblurEvent=function(){var ck=g_checker[m_type.value](this.value.trim(),m_min,m_max);m_secret.getDom(m_id+"_msg").innerHTML=ck.msg;this.value=ck.value;if(ck.msg==""){if(m_func==null){return;}m_func(ck.value);}};var m_node=(function(){var retval=g_dom.createNode("div",{id:m_id,style:{display:"inline"}}),innerHTML=m_innerHTML;g_dom.setInnerHTML(retval,innerHTML);var ipt=g_dom.getNode(m_inputId,{root:retval});if(ipt!=null){g_evt.attachEventHandler(ipt,"onblur",_onblurEvent);}return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;}});return that;};})();NUI.Widget.Input.RankBar=(function(){var g_type=NUI.Widget.Input.RankBarType,g_dom=NUI.Util.DomService,g_btn=NUI.Widget.Button.SpanButton,g_btnStatus=NUI.Widget.Button.ButtonStatus,g_imgInfo={index:0,width:24,height:24,xCount:3,yCount:15,image:"nui/input/rankbar.gif"};return function(vContent,vFunc,vAttributes){var m_html=vContent,m_type=g_type.star0,m_count=10,m_func=vFunc?vFunc:function(){},m_resultValue=0,m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.type!=null&&NUI.Util.ObjectService.hasValue(g_type,vAttributes.type)){m_type=vAttributes.type;}if(vAttributes.count>0){m_count=vAttributes.count;}if(vAttributes.initValue>0){m_resultValue=vAttributes.initValue;}}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id,m_contentDom=(function(){var retval=g_dom.createNode("div",{className:"content"});g_dom.setInnerHTML(retval,m_html);return retval;})(),m_iconDom=g_dom.createNode("div",{id:m_id+"_icons",className:"icons"}),m_icons=(function(){var retval=[];for(var i=0;i<m_count;i++){g_imgInfo.index=m_type;retval[i]=new g_btn(g_imgInfo,{title:i+1,onclick:(function(vIndex){return function(){_onclick(vIndex);};})(i),onmouseover:(function(vIndex){return function(){_onmouseover(vIndex);};})(i),onmouseout:_onmouseout});if(i<m_resultValue){retval[i].lockStatus(g_btnStatus.mousedown);}retval[i].appendTo(m_iconDom);}return retval;})(),m_tipDom=(function(){var retval=g_dom.createNode("span",{id:m_id+"_tip",className:"tip"});g_dom.setInnerHTML(retval,m_resultValue+"/"+m_count);return retval;})(),m_nodeDom=(function(){var retval=m_secret.node,body=g_dom.createNode("div",{className:"rankbar"}),iconCon=g_dom.createNode("div",{className:"iconCon"});g_dom.appendNode(body,m_contentDom);g_dom.appendNode(iconCon,m_iconDom);g_dom.appendNode(iconCon,m_tipDom);g_dom.appendNode(body,iconCon);g_dom.appendNode(retval,body);return retval;})();function _onclick(vIndex){m_resultValue=vIndex+1;__setIcon(vIndex);__setTip(m_resultValue);if(!m_func){return;}m_func(m_resultValue);}function _onmouseover(vIndex){__setIcon(vIndex);__setTip(vIndex+1);}function _onmouseout(){__setIcon(m_resultValue-1);__setTip(m_resultValue);}function __setIcon(vIndex){var bound1=m_resultValue,bound2=vIndex+1;if(bound1>bound2){var tmp=bound1;bound1=bound2;bound2=tmp;}for(var i1=0;i1<bound1;i1++){m_icons[i1].lockStatus(g_btnStatus.mousedown);}for(var i2=bound1;i2<bound2;i2++){m_icons[i2].lockStatus(g_btnStatus.mouseover);}for(var i3=bound2;i3<m_count;i3++){m_icons[i3].lockStatus(g_btnStatus.mouseout);}}function __setTip(vValue){g_dom.setInnerHTML(m_tipDom,vValue+"/"+m_count);}NUI.Util.ObjectService.annex(that,{nodeEntity:m_nodeDom,getLabelDom:function(){return m_contentDom;},resetEvent:function(vFunc){m_func=vFunc;}});return that;};})();NUI.Widget.Input.SortPanel=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder;return function(vOptHtmls,vFunc,vAttributes){var m_optHtmls=NUI.Util.ObjectService.clone(vOptHtmls),m_len=m_optHtmls.length,m_column=3,m_func=vFunc?vFunc:function(){},m_resultValue=(function(){var retval=[];for(var i=0;i<m_len;i++){retval[i]=-1;}return retval;})(),m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(vAttributes.column>0){m_column=vAttributes.column;}if(vAttributes.initValue!=null){m_resultValue=vAttributes.initValue;}}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id;function _getMenuId(vIndex){return m_id+"_menu_"+vIndex;}function _getCbxId(vIndex){return m_id+"_cbx_"+vIndex;}function _getOptId(vIndex){return m_id+"_opt_"+vIndex;}function _getTipId(vIndex){return m_id+"_tip_"+vIndex;}var m_currentRank=0,m_menus=(function(){var retval=g_dom.createNode("div",{id:m_id+"_menus",className:"menus",onclick:function(){var src=event.srcElement;if(g_dom.isButton(src)){var preNode=m_secret.getDom(_getMenuId(m_currentRank));if(preNode){g_dom.removeCssClass(preNode.parentNode,"selected");preNode.disabled=false;}m_currentRank=src.id.controlId();src.disabled=true;g_dom.addCssClass(src.parentNode,"selected");for(var i=0;i<m_len;i++){var cbx=m_secret.getDom(_getCbxId(i));if(!cbx){continue;}cbx.disabled=(m_resultValue[i]>=0&&m_resultValue[i]!=m_currentRank);}}}});var sb=new g_sb();for(var i=0;i<m_len;i++){sb.append("<div class=\"item\"><input type=\"button\" id=\"",_getMenuId(i),"\" value=\"第",(i+1),"名\" /></div>");}sb.append("<div class=\"clearup\"></div>");g_dom.setInnerHTML(retval,sb.toString());return retval;})(),m_options=(function(){var retval=g_dom.createNode("div",{id:m_id+"_content",className:"content",onclick:function(){var src=event.srcElement;if(g_dom.isCheckBox(src)){var checked=src.checked;for(var i=0;i<m_len;i++){if(m_resultValue[i]==m_currentRank){m_resultValue[i]=-1;g_dom.setInnerHTML(m_secret.getDom(_getTipId(i)),"");m_secret.getDom(_getCbxId(i)).checked=false;}}src.checked=checked;if(checked){var index=src.id.controlId();g_dom.setInnerHTML(m_secret.getDom(_getTipId(index)),"("+(m_currentRank+1)+")");m_resultValue[index]=m_currentRank;var next=m_currentRank+1;if(next>=m_len){next=0;}m_secret.getDom(_getMenuId(next)).click();}}if(m_func){m_func(m_resultValue);}}}),body=NUI.Widget.Panel.RoundConner({border:"#7089C1",background:"#BFCAE6"});var sb=new g_sb(),incrChar=NUI.Util.StringService.increaseChar;var rCount=Math.ceil(m_optHtmls.length/m_column);sb.append("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" valign=\"middle\">");for(var r=0;r<rCount;r++){sb.append("<tr>");for(var c=0;c<m_column;c++){var idx=r*m_column+c;html=m_optHtmls[idx];sb.append("<td class=\"cb\">");if(html!=null){sb.append("<input type=\"checkbox\" id=\""+_getCbxId(idx)+"\" ",(m_resultValue[idx]>=0)?"checked=\"true\" disabled=\"true\"":""," /></td><td><span class=\"optTag\">",incrChar("A",idx),".&nbsp;</span><div style=\"display:inline;\" id=\""+_getOptId(idx)+"\" >",html,"</div><span id=\""+_getTipId(idx)+"\" class=\"tip\">",(m_resultValue[idx]>=0)?"("+(m_resultValue[idx]+1)+")":"","</span>");}else{sb.append("</td><td>");}sb.append("</td>");}sb.append("</tr>");}sb.append("</table>");body.setInnerNode(sb.toString());body.appendTo(retval);return retval;})(),m_node=(function(){var retval=m_secret.node,body=g_dom.createNode("div",{id:m_id,className:"sortPanel"});g_dom.appendNode(retval,body);g_dom.appendNode(body,m_menus);g_dom.appendNode(body,m_options);g_dom.appendNode(body,g_dom.createNode("div",{className:"clearup"}));return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;},getOptDivDom:function(vIndex){return m_secret.getDom(_getOptId(vIndex));}});var menu1=m_secret.getChild(_getMenuId(0));if(menu1!=null){menu1.click();}return that;};})();NUI.Widget.Input.ConstBar=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_incrChar=NUI.Util.StringService.increaseChar,g_gmt=NUI.Util.WindowService.Geometry,g_cbType=NUI.Widget.Input.ConstBarType,g_argType=NUI.Widget.Input.ArrangeType,g_optTmplt="<div class=\"item\" style=\"{STYLE}\"><div class=\"tag\">{OPT_TAG}</div>"+"<div class=\"content\" id=\"{OPT_ID}\">{OPT_HTML}</div></div>",g_tagTmplt="<div id=\"{TAG_ID}\" class=\"tag\" style=\"left:{LEFT}%\">{TAG}<span id=\"{TAG_ID}_inner\">{VALUE}%</span></div>",g_borderTmplt="<div class=\"border\" style=\"background-position:-3px {BG_POSITION}px;\"></div>",g_staffTmplt="<div id=\"{STAFF_ID}\" class=\"staff\" style=\"background-position:0 {BG_POSITION}px;width:{WIDTH}px;\"></div>",g_ballTmplt="<div id=\"{BALL_ID}\" class=\"ball\" style=\"background-position:0 {BG_POSITION_01}px;\" "+"onmouseover=\"this.style.backgroundPosition='0 {BG_POSITION_02}px';\" "+"onmousedown=\"this.style.backgroundPosition='0 {BG_POSITION_03}px';\" "+"onmouseup=\"this.style.backgroundPosition='0 {BG_POSITION_02}px';\" "+"onmouseout=\"this.style.backgroundPosition='0 {BG_POSITION_01}px';\" "+"></div>";return function(vOptHtmls,vFunc,vAttributes){var m_optHtmls=NUI.Util.ObjectService.clone(vOptHtmls),m_len=m_optHtmls.length,m_type=0,m_arrange=NUI.Widget.Input.ArrangeType.horizontal,m_func=vFunc?vFunc:function(){},m_resultValue=(function(){if(m_len<=0){return[];}var retval=[],value=1/m_len;for(var i=0;i<m_len-1;i++){retval[i]=value;}retval[retval.length]=1-value*(m_len-1);return retval;})(),m_secret={};if(vAttributes){if(vAttributes.id!=null){m_secret.id=vAttributes.id;}if(NUI.Util.ObjectService.hasValue(g_cbType,vAttributes.type)){m_type=vAttributes.type;}if(NUI.Util.ObjectService.hasValue(g_argType,vAttributes.arrange)){m_arrange=vAttributes.arrange;}if(vAttributes.initValue!=null&&vAttributes.initValue.length==m_len){m_resultValue=vAttributes.initValue;}}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id,m_style=(m_arrange==g_argType.vertical)?"clear:both":"display:inline";function _getOptId(vIndex){return m_id+"_opt_"+vIndex;}function _getOptTag(vIndex){return g_incrChar("A",vIndex);}function _getTagId(vIndex){return m_id+"_tag_"+vIndex;}function _getBallId(vIndex){return m_id+"_ball_"+vIndex;}function _getStaffId(vIndex){return m_id+"_staff_"+vIndex;}function _getBgPosition(vIndex){var alt=vIndex-Math.floor(vIndex/2)*2;var base=(m_type+alt)*48;return{staff:-(base),ball_01:-(base+6),ball_02:-(base+16),ball_03:-(base+26),border:-(base+36)};}function _getTagLeft(vIndex){var adjust=10/m_totalWidth,left=0;for(var i=0;i<vIndex;i++){left+=m_resultValue[i]+adjust;}left+=m_resultValue[vIndex]/2;return left*100;}var m_totalWidth=500,m_widths=(function(){m_resultValue
var retval=[],len=m_len-1,sum=0;for(var i=0;i<len;i++){retval[i]=m_totalWidth*m_resultValue[i];sum+=retval[i];}retval[len]=m_totalWidth-sum;return retval;})(),m_options=(function(){var retval=g_dom.createNode("div",{id:m_id+"_optcon",className:"options"});var sb=new g_sb();for(var i=0;i<m_len;i++){sb.append(g_optTmplt.supplant({OPT_ID:_getOptId(i),OPT_TAG:_getOptTag(i),OPT_HTML:m_optHtmls[i],STYLE:m_style}));}g_dom.setInnerHTML(retval,sb.toString());return retval;})(),m_docEvent=null,m_docReset=true,m_bar=(function(){var retval=g_dom.createNode("div",{id:m_id+"_bar",className:"bar",onmousedown:function(){var src=event.srcElement,x0=event.clientX;if(src&&g_dom.isDiv(src)&&g_dom.hasCssClass(src,"ball")){var idx=src.id.controlId(),leftStaff=m_secret.getDom(_getStaffId(idx)),rightStaff=m_secret.getDom(_getStaffId(idx+1)),leftTag=m_secret.getDom(_getTagId(idx)),rightTag=m_secret.getDom(_getTagId(idx+1)),leftTagValue=m_secret.getDom(_getTagId(idx)+"_inner"),rightTagValue=m_secret.getDom(_getTagId(idx+1)+"_inner");if(leftStaff&&rightStaff){if(m_docReset){m_docEvent=document.onmousemove;m_docReset=false;}document.onmousemove=function(){var x1=event.clientX;var detaX=x1-x0;var w1=m_widths[idx]+detaX,w2=m_widths[idx+1]-detaX;if(w1<0||w2<0){return;}x0=x1;m_widths[idx]=w1;m_widths[idx+1]=w2;m_resultValue[idx]=w1/m_totalWidth;m_resultValue[idx+1]=w2/m_totalWidth;leftStaff.style.width=w1+"px";rightStaff.style.width=w2+"px";var left=0;for(var i=0;i<idx;i++){left+=m_resultValue[i];}leftTag.style.left=_getTagLeft(idx)+"%";rightTag.style.left=_getTagLeft(idx+1)+"%";g_dom.setInnerHTML(leftTagValue,Math.round(10000*m_resultValue[idx])/100+"%");g_dom.setInnerHTML(rightTagValue,Math.round(10000*m_resultValue[idx+1])/100+"%");};document.onmouseup=function(){if(m_func){m_func(m_resultValue);}if(!m_docReset){document.onmousemove=m_docEvent;m_docReset=true;}};}}}});var sb=new g_sb();var pos=_getBgPosition(0);sb.append("<div class=\"tags\" style=\"width:"+m_totalWidth+"px;\">");for(var i=0;i<m_len;i++){sb.append(g_tagTmplt.supplant({TAG_ID:_getTagId(i),TAG:_getOptTag(i),LEFT:_getTagLeft(i),VALUE:Math.round(10000*m_resultValue[i])/100}));}sb.append("</div>");sb.append(g_borderTmplt.supplant({BG_POSITION:pos.border}));var len=m_len-1;for(var i=0;i<len;i++){var pos=_getBgPosition(i);sb.append(g_staffTmplt.supplant({STAFF_ID:_getStaffId(i),BG_POSITION:pos.staff,WIDTH:m_widths[i]}),g_ballTmplt.supplant({BALL_ID:_getBallId(i),BG_POSITION_01:pos.ball_01,BG_POSITION_02:pos.ball_02,BG_POSITION_03:pos.ball_03}));}var pos=_getBgPosition(len);sb.append(g_staffTmplt.supplant({STAFF_ID:_getStaffId(len),BG_POSITION:pos.staff,WIDTH:m_widths[len]}),g_borderTmplt.supplant({BG_POSITION:pos.border}));g_dom.setInnerHTML(retval,sb.toString());return retval;})(),m_node=(function(){var retval=m_secret.node,body=g_dom.createNode("div",{className:"constBar"});g_dom.appendNode(body,m_options);g_dom.appendNode(body,m_bar);g_dom.appendNode(retval,body);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,resetEvent:function(vFunc){m_func=vFunc;},getOptDivDom:function(vIndex){return m_secret.getDom(_getOptId(vIndex));}});(function(){m_secret.setNote("(拖动圆点改变各个选项所占权重)");})();return that;};})();NUI.Widget.Input.Location=(function(){var g_dom=NUI.Util.DomService,g_ajax=NUI.Ajax,g_ht=NUI.Util.DataStructure.HashTable,g_sb=NUI.Util.StringService.StringBuilder,g_countriesCache=null,g_provincesCache=new g_ht(),g_citiesCache=new g_ht();function _getCountryList(vFunc){var m_func=vFunc?vFunc:function(){};if(g_countriesCache!=null){m_func(g_countriesCache);return;}g_ajax.call("GetCountryList",{args:[],func:{success:function(vCountries){if(g_countriesCache!=null){m_func(g_countriesCache);}else{if(vCountries!=null){g_countriesCache=vCountries;m_func(vCountries);}else{m_func([]);}}}}});}function _getProvinceList(vCountryId,vFunc){var m_func=vFunc?vFunc:function(){};if(vCountryId==-2){m_func([]);return;}if(g_provincesCache.exist(vCountryId)){m_func(g_provincesCache.getValue(vCountryId));return;}g_ajax.call("GetProvinceList",{args:[vCountryId],func:{success:function(vProvinces){if(g_provincesCache.exist(vCountryId)){m_func(g_provincesCache.getValue(vCountryId));}else{if(vProvinces!=null){g_provincesCache.setValue(vCountryId,vProvinces);m_func(vProvinces);}else{m_func([]);}}}}});}function _getCityList(vCountryId,vProvinceId,vFunc){var m_func=vFunc?vFunc:function(){};if(vCountryId==-2||vProvinceId==-2){m_func([]);return;}var key=vCountryId+"_"+vProvinceId;if(g_citiesCache.exist(key)){m_func(g_citiesCache.getValue(key));return;}g_ajax.call("GetCityList",{args:[vCountryId,vProvinceId],func:{success:function(vCities){if(g_citiesCache.exist(key)){m_func(g_citiesCache.getValue(key));}else{if(vCities!=null){g_citiesCache.setValue(key,vCities);m_func(vCities);}else{m_func([]);}}}}});}return function(vFunc,vAttributes){var m_secret={},m_func=vFunc?vFunc:function(){},m_attribute=vAttributes?vAttributes:{isMultipleCity:false},m_initValue=m_attribute.initValue?m_attribute.initValue:{country:-2,province:-2,city:-2};var m_country=null,m_province=null,m_city=null;function _setuplist(vNode,vArealist,vInitValue){if(!vNode||!vArealist){return;}g_dom.removeChildren(vNode);var count=vArealist.length;for(var i=0;i<count;i++){var area=vArealist[i];if(area==null){continue;}var opt=g_dom.createNode("option",{value:area.id});if(vInitValue==opt.value){g_dom.setAttributes(opt,{selected:"selected"});}g_dom.setInnerHTML(opt,area.caption);g_dom.appendNode(vNode,opt);}}function _setupCountryList(){if(!m_countrySelect){return;}m_secret.showMsg("正在获取国家信息...");_getCountryList(function(vArealist){m_secret.showMsg("");if(vArealist!=null){if(!m_attribute.isMultipleCity&&(vArealist.length==0||vArealist[0].id!=-2)){vArealist.addAt(0,{id:-2,caption:"--请选择--"});}if(vArealist.length==0){return;}m_country={id:vArealist[0].id,caption:vArealist[0].caption};if(!m_attribute.isMultipleCity){for(var i=0;i<vArealist.length;i++){if(vArealist[i].id==m_initValue.country){m_country={id:vArealist[i].id,caption:vArealist[i].caption};break;}}}_setuplist(m_countrySelect,vArealist,m_country.id);_setupProvinceList(m_country);}});}function _setupProvinceList(vCountry){if(!m_provinceSelect||!vCountry){return;}var vCountryId=vCountry.id;m_secret.showMsg("正在获取省份信息...");_getProvinceList(vCountryId,function(vArealist){m_secret.showMsg("");if(vArealist!=null){if(!m_attribute.isMultipleCity&&(vArealist.length==0||vArealist[0].id!=-2)){vArealist.addAt(0,{id:-2,caption:"--请选择--"});}if(vArealist.length==0){return;}m_province={id:vArealist[0].id,caption:vArealist[0].caption};if(!m_attribute.isMultipleCity){if(vCountryId==m_initValue.country){for(var i=0;i<vArealist.length;i++){if(vArealist[i].id==m_initValue.province){m_province={id:vArealist[i].id,caption:vArealist[i].caption};break;}}}}_setuplist(m_provinceSelect,vArealist,m_province.id);_setupCityList(m_country,m_province);}});}function _setupCityList(vCountry,vProvince){if(!m_citySelect||!vCountry||!vProvince){return;}var vCountryId=vCountry.id,vProvinceId=vProvince.id;m_secret.showMsg("正在获取城市信息...");_getCityList(vCountryId,vProvinceId,function(vArealist){m_secret.showMsg("");if(vArealist!=null){if(m_attribute.isMultipleCity){_setuplist(m_citySelect,vArealist,-2);}else{if(vArealist.length==0||vArealist[0].id!=-2){vArealist.addAt(0,{id:-2,caption:"--请选择--"});}m_city={id:vArealist[0].id,caption:vArealist[0].caption};if(vCountryId==m_initValue.country&&vProvinceId==m_initValue.province){for(var i=0;i<vArealist.length;i++){if(vArealist[i].id==m_initValue.city){m_city={id:vArealist[i].id,caption:vArealist[i].caption};break;}}}_setuplist(m_citySelect,vArealist,m_city.id);}}});}var that=NUI.Widget.Input.Base(m_secret),m_id=m_secret.id,m_citySelect=g_dom.createNode("select",{style:{width:"150px"},onchange:function(){var options=m_citySelect.options;for(var i=0;i<options.length;i++){var opt=options[i];if(opt.selected){m_city={id:opt.value,caption:opt.innerHTML};m_func(m_country,m_province,m_city);}}}}),m_provinceSelect=g_dom.createNode("select",{style:{width:"150px"},onchange:function(){var value=m_provinceSelect.value;if(value!=m_province){var caption=null;var provincelist=g_provincesCache.getValue(m_country.id);if(provincelist==null){return;}for(var i=0;i<provincelist.length;i++){if(provincelist[i].id==value){caption=provincelist[i].caption;break;}}if(caption==null){return;}m_province={id:value,caption:caption};_setupCityList(m_country,m_province);}}}),m_countrySelect=g_dom.createNode("select",{style:{width:"150px"},onchange:function(){var value=m_countrySelect.value;if(value!=m_country){var caption=null;var countrylist=g_countriesCache;if(countrylist==null){return;}for(var i=0;i<countrylist.length;i++){if(countrylist[i].id==value){caption=countrylist[i].caption;break;}}if(caption==null){return;}m_country={id:value,caption:caption};_setupProvinceList(m_country);}}}),m_nodeDom=(function(){var retval=m_secret.node
body=g_dom.createNode("div",{className:"location"});g_dom.appendNode(body,m_countrySelect);g_dom.appendNode(body,m_provinceSelect);g_dom.appendNode(body,m_citySelect);g_dom.appendNode(retval,body);return retval;})();if(m_attribute.isMultipleCity){g_dom.setAttributes(m_countrySelect,{size:"10"});g_dom.setAttributes(m_provinceSelect,{size:"10"});g_dom.setAttributes(m_citySelect,{size:"10",multiple:"multiple"});}_setupCountryList();NUI.Util.ObjectService.annex(that,{nodeEntity:m_nodeDom,resetEvent:function(vFunc){m_func=vFunc?vFunc:function(){};}});(function(){var html="(请在下面列表里选择地区)";m_secret.setNote(html);})();return that;};})();NUI.Debug=(function(){var m_dom=NUI.Util.DomService;var m_debugOn=true,msgBox=null;function _showException(vException){if(msgBox==null){msgBox=m_dom.createNode("div",{style:{position:"absolute",top:"0",left:"0",background:"#fff",fontSize:"12px",width:"300px",height:"100px",overflow:"auto",color:"#f00"}});m_dom.appendNode(document.body,msgBox);}m_dom.setInnerHTML(msgBox,msgBox.innerHTML+vException+"\r\n");}var that={setDebugOn:function(){m_debugOn=true;},setDebugOff:function(){m_debugOn=false;},showException:function(vException){if(m_debugOn){_showException(vException);}}};return that;})();NUI.Widget.Dropdown=function(vChild,vAttributes){var m_dom=NUI.Util.DomService,m_sb=NUI.Util.StringService.StringBuilder,m_width=vAttributes?(vAttributes.width?vAttributes.width:150):150,m_height=vAttributes?(vAttributes.height?vAttributes.height:100):100,m_top=vAttributes?(vAttributes.top?vAttributes.top:22):22,m_left=vAttributes?(vAttributes.left?vAttributes.left:-24):-24,m_secret={},m_mousedown=null,m_visiable=false;if(vAttributes&&vAttributes.id){m_secret.id=vAttributes.id;}var that=NUI.Widget.Base(m_secret);var m_attributes={id:m_secret.id,className:"dropdown"};NUI.Util.ObjectService.annex(that,{nodeEntity:(function(){var retval=m_dom.createNode("div",m_attributes),sb=new m_sb();sb.append("<div class=\"inner\" onmousedown=\"NUI.Util.EventService.cancelBubble()\" ","style=\"top:"+m_top+"px; left:"+m_left+"px; ","width:"+m_width+"px; height:"+m_height+"px;\"></div>");m_dom.setInnerHTML(retval,sb.toString());if(NUI.Lang.isObject(vChild)){m_dom.appendNode(retval.firstChild,vChild);}return retval;})(),show:function(vNode){var n=m_dom.getNode(vNode);if(!n){return;}that.appendBehind(n);that.nodeEntity.style.display="inline";m_visiable=true;m_mousedown=document.onmousedown;document.onmousedown=that.hide;},hide:function(){if(!m_visiable){return;}document.onmousedown=m_mousedown;m_mousedown=null;m_visiable=false;that.nodeEntity.style.display="none";}});return that;};NUI.Widget.Fog=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_gty=NUI.Util.WindowService.Geometry,g_htmlTmplt=(function(){var sb=new g_sb();sb.append("<div class=\"fog\">","<table cellpadding=\"0\" cellspacing=\"0\" class=\"fadeTable\" ><tr><td>","<div class=\"fadeDiv\" id=\"{ID}_fade\">","</div></td></tr></table>","</div>","<div class=\"fog\" id=\"{ID}_fog_2\">","<table id=\"{ID}_tb_2\" cellpadding=\"0\" cellspacing=\"0\" class=\"panelTable\"><tr>","<td valign=\"middle\" align=\"center\"><div id=\"{ID}_panel\">","</div></td></tr></table>","</div>");return sb.toString();})();return function(vSecret){vSecret=vSecret||{};var that=NUI.Widget.Base(vSecret);var m_id=vSecret.id,m_node=(function(){var retval=g_dom.createNode("div",{id:m_id,className:"hide"});g_dom.setInnerHTML(retval,g_htmlTmplt.supplant({ID:m_id}));return retval;})();function _adjustSize(){var docHeight=g_gty.getDocumentHeight(),docWidth=g_gty.getDocumentWidth();if(docHeight<g_gty.getViewportHeight()){docHeight=g_gty.getViewportHeight();}var fadeDiv=vSecret.getChild(m_id+"_fade");if(fadeDiv){fadeDiv.style.width=docWidth+"px";fadeDiv.style.height=docHeight+"px";}var topPadding=g_gty.getVerticalScroll();var fog2=vSecret.getChild(m_id+"_fog_2");if(fog2){fog2.style.top=topPadding+"px";}}NUI.Util.ObjectService.annex(vSecret,{setChild:function(vChild){if(vChild){var panelCon=vSecret.getChild(m_id+"_panel");g_dom.setChild(panelCon,vChild);}}});NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,show:function(){if(m_node.parentNode!=document.body){g_dom.appendNode(document.body,m_node);}_adjustSize();g_dom.show(m_node);var isIE6=(NUI.Util.EnvService.browser.ie&&NUI.Util.EnvService.browser.version<7);if(isIE6){setTimeout(function(){var fog2=vSecret.getChild(m_id+"_fog_2");var m_top=(g_gty.getViewportHeight()-fog2.offsetHeight)/2;fog2.style.marginTop=m_top+"px";},500);}},hide:function(){g_dom.hide(m_node);}});return that;};})();NUI.Widget.Alert=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_htmlTmplt=(function(){var sb=new g_sb();sb.append("<div class=\"panel\" style=\"width:300px;\">","<div class=\"header\">{TITLE}</div><div class=\"content\">","<div style=\"padding:5px;\">{MESSAGE}</div>","<div style=\"padding:5px;\"><input type=\"button\" value=\"&nbsp;{BTN_TEXT}&nbsp;\" /></div>","</div></div>");return sb.toString();})();return function(vMsg,vAttribute){var m_secret={},that=new NUI.Widget.Fog(m_secret),m_id=m_secret.id;var m_btnText="确认",m_title="提示消息";if(vAttribute){if(vAttribute.btnText){m_btnText=vAttribute.btnText;}if(vAttribute.title){m_title=vAttribute.title;}}var m_child=(function(){var retval=g_dom.createNode("div",{onclick:function(){var src=event.srcElement;if(g_dom.isButton(src)){that.hide();}}});g_dom.setInnerHTML(retval,g_htmlTmplt.supplant({MESSAGE:vMsg,TITLE:m_title,BTN_TEXT:m_btnText}));return retval;})();m_secret.setChild(m_child);that.show();return that;};})();NUI.Widget.Confirm=(function(){var g_dom=NUI.Util.DomService,g_htmlTmplt=(function(){var m_sb=new NUI.Util.StringService.StringBuilder();m_sb.append("<div class=\"panel\" style=\"{WIDTH_STYLE};line-height:20px;\">","<div class=\"header\">确认消息</div><div class=\"content\">","<div style=\"padding:5px;\">{MESSAGE}</div>","<div style=\"padding:5px;\"><input type=\"button\" id=\"{ID}_OK\" value=\"&nbsp;{BTN_OK_TEXT}&nbsp;\" />","&nbsp;&nbsp;<input type=\"button\" id=\"{ID}_CANCEL\" value=\"&nbsp;{BTN_CANCEL_TEXT}&nbsp;\" /></div>","</div></div>");return m_sb.toString();})();return function(vMsg,vFunc,vAttribute){var m_secret={},that=new NUI.Widget.Fog(m_secret),m_id=m_secret.id;var m_btnOkText="确认",m_btnCancelText="取消",m_width=300;if(vAttribute){m_btnOkText=vAttribute.btnOkText?vAttribute.btnOkText:m_btnOkText;m_btnCancelText=vAttribute.btnCancelText?vAttribute.btnCancelText:m_btnCancelText;m_width=(vAttribute.width&&vAttribute.width>0)?vAttribute.width:m_width;}var m_child=(function(){var retval=g_dom.createNode("div",{onclick:function(){var src=event.srcElement;if(g_dom.isButton(src)){if(vFunc){var cn=src.id.controlIdStr();switch(cn){case"OK":vFunc(true);break;case"CANCEL":vFunc(false);break;}}that.hide();}}});g_dom.setInnerHTML(retval,g_htmlTmplt.supplant({ID:m_id,MESSAGE:vMsg,BTN_OK_TEXT:m_btnOkText,BTN_CANCEL_TEXT:m_btnCancelText,WIDTH_STYLE:"width:"+m_width+"px"}));return retval;})();m_secret.setChild(m_child);that.show();return that;};})();NUI.Widget.Popup=(function(){var g_dom=NUI.Util.DomService,g_htmlTmplt=(function(){var m_sb=new NUI.Util.StringService.StringBuilder();m_sb.append("<div class=\"panel\" style=\"{WIDTH_STYLE};\">","<div class=\"header\"><div id=\"{ID}_BTN\" style=\"float:right\"></div>{TITLE}</div>","<div id=\"{ID}_CONTENT\" class=\"content\" ","style=\"{WIDTH_STYLE}; {HEIGHT_STYLE}; overflow:auto; text-align:left;\" >","</div></div>");return m_sb.toString();})();return function(vChild,vAttribute){var m_width=500,m_height=0,m_title="弹出窗口",m_canHide=true;if(vAttribute){m_width=vAttribute.width?vAttribute.width:m_width;m_height=vAttribute.height?vAttribute.height:m_height;m_title=vAttribute.title?vAttribute.title:m_title;m_canHide=(vAttribute.canHide!=null)?vAttribute.canHide:m_canHide;}var m_secret={},that=new NUI.Widget.Fog(m_secret),m_id=m_secret.id;var m_child=(function(){var retval=g_dom.createNode("div");g_dom.setInnerHTML(retval,g_htmlTmplt.supplant({ID:m_id,TITLE:m_title,HEIGHT_STYLE:(m_height>0)?"height:"+m_height+"px":"",WIDTH_STYLE:(m_width>0)?"width:"+m_width+"px":""}));if(m_canHide){var _btncon=g_dom.getNode(m_id+"_BTN",{root:retval}),_btn=new NUI.Widget.Button.SpanButton({index:0,width:15,height:15,image:"nui/button/smallbtn.gif"},{id:m_id+"closebtn",onclick:function(){that.hide();}});_btn.attachTo(_btncon);}var _contentcon=g_dom.getNode(m_id+"_CONTENT",{root:retval});if(vChild){g_dom.setChild(_contentcon,vChild);}return retval;})();m_secret.setChild(m_child);NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Widget.Waiting=(function(){var g_dom=NUI.Util.DomService;var g_window=null;var that={start:function(vMsg,vCon){if(vMsg==null){vMsg="请稍候...";}var html="<div style=\"padding:20px; text-align:center;\"><img style=\"vertical-align:middle;\" src=\""+NUI.Util.WindowService.Path.imagePath("utility/loading.gif")+"\" alt=\"loading\" />&nbsp;"+vMsg+"...</div>";var con=g_dom.getNode(vCon);if(con){g_dom.setInnerHTML(con,html);}else{if(g_window){g_window.destroy();}g_window=NUI.Widget.Popup(html,{title:"请稍候",width:250,canHide:false});g_window.show();}},end:function(){if(g_window){g_window.destroy();}},create:function(vMsg,vCon){if(vMsg==null){vMsg="请稍候...";}var html="<div><img style=\"vertical-align:middle;\" src=\""+NUI.Util.WindowService.Path.imagePath("utility/loading.gif")+"\" alt=\"loading\" />&nbsp;"+vMsg+"...</div>";var con=g_dom.getNode(vCon);var node=null;if(con!=null){var con_rect=NUI.Util.WindowService.getNodeRect(con);if(con_rect!=null){node=g_dom.createNode("div",{className:"waiting_outer"});g_dom.appendNode(con,node);var rect=NUI.Util.WindowService.getNodeRect(node);var inner_node=g_dom.createNode("div",{className:"waiting_inner"});g_dom.appendNode(node,inner_node);inner_node.style.height=(con_rect.height>0)?(con_rect.height+"px"):"auto";inner_node.style.width=(con_rect.width>0)?(con_rect.width+"px"):"auto";inner_node.style.top=(con_rect.top-rect.top)+"px";inner_node.style.left=(con_rect.left-rect.left)+"px";var msg_node=g_dom.createNode("div");g_dom.setInnerHTML(msg_node,html);g_dom.appendNode(inner_node,msg_node);msg_node.style.padding=(con_rect.height/2<20)?(Math.floor(con_rect.height/2)+"px"):"20px";}}return{destroy:function(){g_dom.destroyNode(node);}};}};return that;})();NUI.Widget.MediaPlayer=(function(){var g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_path=NUI.Util.WindowService.Path,g_htmlTmplt=(function(){var sb=new g_sb();sb.append("<div onclick=\"try{NUI.Util.EventService.cancelBubble();}catch(ex){}\" ","onmousedown=\"try{NUI.Util.EventService.cancelBubble();}catch(ex){}\" style=\"display:inline;\">","<object classid=\"clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6\" width=\"{WIDTH}\" height=\"{HEIGHT}\">","<param name=\"src\" value=\"{SRC}\" />","<param name=\"url\" value=\"{SRC}\" />","<param name=\"width\" value=\"{WIDTH}\" />","<param name=\"height\" value=\"{HEIGHT}\" />","<embed type=\"application/x-mplayer2\" src=\"{SRC}\" width=\"{WIDTH}\" height=\"{HEIGHT}\"></embed>","<param name=\"AutoStart\" value=\"0\">","</object>","</div>");return sb.toString();})(),g_type={VIDEO:"video",AUDIO:"audio",FLASH:"flash"};function _checkType(vType){var retval=false;NUI.Util.ObjectService.searchObject(g_type,function(vName){retval=(vType==g_type[vName]);return retval;});return retval;}return{VIDEO:g_type.VIDEO,AUDIO:g_type.AUDIO,FLASH:g_type.FLASH,render:function(vMedia,vAttributes){if(!vMedia){return"";}var m_src=vMedia.src,m_type=vMedia.type;if(!_checkType(m_type)){return"";}var m_width=360,m_height=(m_type==g_type.AUDIO)?45:270;if(vAttributes){m_width=(vAttribute.width>0)?vAttribute.width:m_width;m_height=(vAttribute.height>0)?vAttribute.height:m_height;}var retval="";if(m_type==g_type.FLASH){var p=new SWFObject(m_src,"myflashplayer",m_width+"px",m_height+"px","9","#FFFFFF");p.addVariable("width",m_width+"px");p.addVariable("height",m_height+"px");try{var con=g_dom.createNode("div");p.write(con);retval=con.innerHTML;}catch(ex){}}else{retval=g_htmlTmplt.supplant({SRC:m_src,WIDTH:m_width,HEIGHT:m_height});}return retval;}};})();NUI.Quill.Enum={inEnum:function(vEnum,vObj){if(vEnum==null||vObj==null){return false;}return NUI.Util.ObjectService.hasValue(vEnum,vObj);},QuestionType:{CHOICE:{id:1,value:"Choice",text:"选择题"},MATRIX:{id:2,value:"Matrix",text:"矩阵题"},INPUT:{id:3,value:"Input",text:"填充题"},RANK:{id:4,value:"Rank",text:"评分题"},SORT:{id:5,value:"Sort",text:"排序题"},CONSTSUM:{id:6,value:"ConstSum",text:"常量和"},LOCATION:{id:7,value:"Location",text:"地区题"},MATRIXINPUT:{id:8,value:"MatrixInput",text:"多填充"}},InputOptionType:{TEXT:1,INPUT:2},BranchType:{END_SURVEY:1,NEW_SURVEY:2}};NUI.Quill.Entity={Survey:function(){},Question:{},Answer:{}};NUI.Quill.Entity.Question={Base:function(){},Choice:function(){},Matrix:function(){},Input:function(){},Rank:function(){},Sort:function(){},ConstSum:function(){},Location:function(){},MatrixInput:function(){}};NUI.Quill.Entity.Question.Base=function(vSecret){var m_lang=NUI.Lang,m_secret=vSecret||{};if(!m_lang.isNumber(m_secret.id)){m_secret.id=-1;}if(!m_lang.isNumber(m_secret.type)){m_secret.type=-1;}if(!m_lang.isString(m_secret.caption)){m_secret.caption="标题";}return{id:m_secret.id,modified:true,type:m_secret.type,caption:m_secret.caption};};NUI.Quill.Entity.Question.Choice=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.CHOICE.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{optSet:{options:["选项1","选项2","选项3"],hasOtherOption:false,constrain:{min:1,max:1}},style:{column:1,isRandom:false}});return that;};})();NUI.Quill.Entity.Question.Matrix=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.MATRIX.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{rows:{options:["行1","行2","行3"],hasOtherOption:false,constrain:{min:1,max:1}},cols:{options:["列1","列2","列3"],hasOtherOption:false,constrain:{min:1,max:1}}});return that;};})();NUI.Quill.Entity.Question.Input=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.INPUT.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{texts:["文本"],inputs:[{type:NUI.Widget.Input.TextInputType.STRING.id,min:0,max:50}],optTypeMask:[NUI.Quill.Enum.InputOptionType.TEXT,NUI.Quill.Enum.InputOptionType.INPUT]});return that;};})();NUI.Quill.Entity.Question.Rank=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.RANK.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.RANK.id,options:[{value:"选项1",type:NUI.Widget.Input.RankBarType.apple3,count:10},{value:"选项2",type:NUI.Widget.Input.RankBarType.star1,count:10},{value:"选项3",type:NUI.Widget.Input.RankBarType.moon0,count:10}]});return that;};})();NUI.Quill.Entity.Question.Sort=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.SORT.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.SORT.id,options:["选项1","选项2","选项3"],style:{column:1}});return that;};})();NUI.Quill.Entity.Question.ConstSum=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.CONSTSUM.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{options:["选项1","选项2","选项3"],color:NUI.Widget.Input.ConstBarType.blue,arrange:NUI.Widget.Input.ArrangeType.horizontal});return that;};})();NUI.Quill.Entity.Question.Location=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.LOCATION.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{constrain:{min:1,max:1}});return that;};})();NUI.Quill.Entity.Question.MatrixInput=(function(){var g_ns=NUI.Quill.Entity.Question,g_enum=NUI.Quill.Enum;return function(vId){if(!NUI.Lang.isNumber(vId)){return null;}var m_secret={id:vId,type:g_enum.QuestionType.MATRIXINPUT.id},that=new g_ns.Base(m_secret);NUI.Util.ObjectService.annex(that,{rows:{options:["行1","行2","行3"],hasOtherOption:false},cols:{options:["列1","列2","列3"],hasOtherOption:false}});return that;};})();NUI.Quill.Entity.Survey=(function(){var g_ht=NUI.Util.DataStructure.HashTable;return function(){return{id:-1,caption:"双击此处编辑问卷标题",subcaption:"双击此处编辑子标题",description:"双击此处输入问卷说明文字",header:"欢迎参加问卷调查",footer:"谢谢您的参与",questionSet:new g_ht(),qIdList:[],pageTags:new g_ht(),portionTags:new g_ht(),jumper:new g_ht(),branch:new g_ht()};};})();NUI.Quill.Entity.Answer={Base:function(){},Choice:function(){},Matrix:function(){},Input:function(){},Rank:function(){},Sort:function(){},ConstSum:function(){},Location:function(){},MatrixInput:function(){}};NUI.Quill.Entity.Answer.Base=function(vSecret){var m_secret=vSecret||{},m_question=m_secret.question||new NUI.Quill.Entity.Question.Base();return{type:-1};};NUI.Quill.Entity.Answer.Choice=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.CHOICE.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.CHOICE.id,answers:(function(){var retval=[],len=m_question.optSet.options.length+(m_question.optSet.hasOtherOption?1:0);for(var i=0;i<len;i++){retval[i]=0;}return retval;})(),other:""});return that;};})();NUI.Quill.Entity.Answer.Matrix=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.MATRIX.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.MATRIX.id,answers:(function(){var retval=[],rowCount=m_question.rows.options.length+(m_question.rows.hasOtherOption?1:0),colCount=m_question.cols.options.length+(m_question.cols.hasOtherOption?1:0);for(var r=0;r<rowCount;r++){var row=[];for(var c=0;c<colCount;c++){row[c]=0;}retval[r]=row;}return retval;})(),rowOther:"",colOther:""});return that;};})();NUI.Quill.Entity.Answer.Input=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.INPUT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.INPUT.id,answers:(function(){var retval=[],count=m_question.inputs.length;for(var i=0;i<count;i++){retval[retval.length]="";}return retval;})()});return that;};})();NUI.Quill.Entity.Answer.Rank=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.RANK.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.RANK.id,answers:(function(){var retval=[],count=m_question.options.length;for(var i=0;i<count;i++){retval[retval.length]=0;}return retval;})()});return that;};})();NUI.Quill.Entity.Answer.Sort=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.SORT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.SORT.id,answers:(function(){var retval=[],count=m_question.options.length;for(var i=0;i<count;i++){retval[retval.length]=-1;}return retval;})()});return that;};})();NUI.Quill.Entity.Answer.ConstSum=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.CONSTSUM.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.CONSTSUM.id,answers:(function(){var retval=[],count=m_question.options.length,value=(count>0)?1/count:-1;for(var i=0;i<count;i++){retval[retval.length]=value;}return retval;})()});return that;};})();NUI.Quill.Entity.Answer.Location=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.LOCATION.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.LOCATION.id,answers:(function(){return[];})()});return that;};})();NUI.Quill.Entity.Answer.MatrixInput=(function(){var g_ns=NUI.Quill.Entity.Answer,g_enum=NUI.Quill.Enum;return function(vQuestion){if(vQuestion==null||!(g_enum.QuestionType.MATRIXINPUT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion},that=new g_ns.Base(m_secret),m_question=m_secret.question;NUI.Util.ObjectService.annex(that,{type:g_enum.QuestionType.MATRIXINPUT.id,answers:(function(){var retval=[],rowCount=m_question.rows.options.length+(m_question.rows.hasOtherOption?1:0),colCount=m_question.cols.options.length+(m_question.cols.hasOtherOption?1:0);for(var r=0;r<rowCount;r++){var row=[];for(var c=0;c<colCount;c++){row[c]="";}retval[r]=row;}return retval;})(),rowOther:"",colOther:""});return that;};})();NUI.Quill.Render={getSurveyRender:function(vSurvey){},Survey:function(vSurvey){},Question:{}};NUI.Quill.Render.getSurveyRender=function(vSurvey){if(vSurvey==null){return null;}return NUI.Quill.Render.Survey(vSurvey);};NUI.Quill.Render.Question={getQuestionRender:function(vQuestion,vAnswer,vAttribute){},Base:function(vSecret){},Choice:function(vQuestion,vAnswer,vAttribute){},Matrix:function(vQuestion,vAnswer){},Input:function(vQuestion,vAnswer){},Rank:function(vQuestion,vAnswer){},Sort:function(vQuestion,vAnswer){},ConstSum:function(vQuestion,vAnswer){},Location:function(vQuestion,vAnswer){},MatrixInput:function(vQuestion,vAnswer){}};NUI.Quill.Render.Question.getQuestionRender=function(vQuestion,vAnswer,vAttribute){if(vQuestion==null){return null;}var type=vQuestion.type,typeValue=null,qType=NUI.Quill.Enum.QuestionType;NUI.Util.ObjectService.searchObject(qType,function(vName){if(qType[vName].id==type){typeValue=qType[vName].value;return true;}return false;});if(typeValue==null){return null;}return NUI.Quill.Render.Question[typeValue](vQuestion,vAnswer,vAttribute);};NUI.Quill.Render.Question.Base=(function(){var g_dom=NUI.Util.DomService,g_entity=NUI.Quill.Entity.Question,g_widget=NUI.Widget;return function(vSecret){var secret=vSecret||{};if(!secret.question){secret.question=g_entity["Base"]();}var that=g_widget.Base(secret),m_question=secret.question,m_frame=(function(){var frame=g_dom.createNode("div",{className:"question"});return frame;})(),m_caption=(function(){var cap=g_dom.createNode("div",{className:"cap"});g_dom.setInnerHTML(cap,m_question.caption);return cap;})(),m_optCon=(function(){var opt=g_dom.createNode("div",{className:"opt"});return opt;})();g_dom.appendNode(m_frame,m_caption);g_dom.appendNode(m_frame,m_optCon);NUI.Util.ObjectService.annex(secret,{});NUI.Util.ObjectService.annex(that,{nodeEntity:m_frame,getFrameDom:function(){return m_frame;},getCaptionDom:function(){return m_caption;},getOptConDom:function(){return m_optCon;}});return that;};})();NUI.Quill.Render.Question.Choice=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer,vAttribute){if(vQuestion==null||vQuestion.type!=g_type.CHOICE.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var attrs={hasOther:m_question.optSet.hasOtherOption};NUI.Util.ObjectService.annex(attrs,m_question.optSet.constrain);NUI.Util.ObjectService.annex(attrs,m_question.style);if(vAnswer&&vAnswer.type==g_type.CHOICE.id){attrs.initIndexes=vAnswer.answers;attrs.initOtherValue=vAnswer.other;}if(vAttribute&&vAttribute.openRandom){attrs.random=m_question.style.isRandom;}return g_input.Options(m_question.optSet.options,null,attrs);})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{getOptionDom:function(vIndex){return m_options.getOptDivDom(vIndex);},setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.Matrix=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.MATRIX.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var rs=m_question.rows,cs=m_question.cols,attrs={rmin:cs.constrain.min,rmax:cs.constrain.max,cmin:rs.constrain.min,cmax:rs.constrain.max,rhasOther:rs.hasOtherOption,chasOther:cs.hasOtherOption};if(vAnswer&&vAnswer.type==g_type.MATRIX.id){attrs.initIndexes=vAnswer.answers;attrs.initRowOtherValue=vAnswer.rowOther;attrs.initColOtherValue=vAnswer.colOther;}return g_input.Matrix(rs.options,cs.options,null,attrs);})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{getRowOptionDom:function(vIndex){return m_options.getRoptDivDom(vIndex);},getColOptionDom:function(vIndex){return m_options.getCoptDivDom(vIndex);},setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.Input=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input,g_inputType=NUI.Widget.Input.TextInputType,g_optType=NUI.Quill.Enum.InputOptionType;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.INPUT.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_inputs=[],m_texts=[];(function(){var frame=that.getFrameDom(),retval=[],mask=m_question.optTypeMask,len=mask.length,texts=m_question.texts,tIdx=0,inputs=m_question.inputs,iIdx=0;for(var i=0;i<len;i++){var optDom=null;if(mask[i]==g_optType.TEXT){optDom=g_dom.createNode("div",{style:{display:"inline"}});g_dom.setInnerHTML(optDom,texts[tIdx]);g_dom.appendNode(frame,optDom);m_texts[tIdx]=optDom;tIdx++;}else if(mask[i]==g_optType.INPUT){var type=null,typeId=inputs[iIdx].type;NUI.Util.ObjectService.searchObject(g_inputType,function(vName){if(g_inputType[vName].id==typeId){type=g_inputType[vName];return true;}return false;});if(type==null){return;}var value=(function(){var retval="";if(vAnswer&&vAnswer.type==g_type.INPUT.id&&vAnswer.answers[iIdx]!=null){retval=vAnswer.answers[iIdx];}return retval;})();optDom=g_input.TextInput(type,inputs[iIdx].min,inputs[iIdx].max,null,{initValue:value});optDom.appendTo(frame);m_inputs[iIdx]=optDom;iIdx++;}}})();g_dom.hide(that.getCaptionDom());NUI.Util.ObjectService.annex(that,{getOptionDom:function(vType,vIndex){var mask=m_question.optTypeMask,retval=null;if(vType==g_optType.TEXT){retval=m_texts[vIndex];}else if(vType==g_optType.INPUT){retval=m_inputs[vIndex];}return retval;},setInputBlurEventHandler:function(vIndex,vFunc){if(!m_inputs.isIndexLegal(vIndex)){return;}m_inputs[vIndex].resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.Rank=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input,g_incrChar=NUI.Util.StringService.increaseChar,g_sb=NUI.Util.StringService.StringBuilder;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.RANK.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var optCon=that.getOptConDom(),retval=[],opts=m_question.options,len=opts.length,tagTmplt=(function(){var sb=new g_sb();sb.append("<span style=\"position:absolute; top:0px; left:-5px; text-align:center;","width:16px; height:16px; background:#ccc; color:#fff;\">{TEXT}</span>");return sb.toString();})();for(var i=0;i<len;i++){var opt=opts[i],optDom=null;var itemDom=g_dom.createNode("div",{style:{position:"relative",padding:"0 0 0 11px",margin:"5px"}});g_dom.appendNode(optCon,itemDom);g_dom.setInnerHTML(itemDom,tagTmplt.supplant({TEXT:g_incrChar("A",i)}));var value=(function(){var retval=0;if(vAnswer&&vAnswer.type==g_type.RANK.id&&vAnswer.answers[i]!=null){retval=vAnswer.answers[i];}return retval;})();optDom=g_input.RankBar(opt.value,null,{type:opt.type,count:opt.count,initValue:value});optDom.appendTo(itemDom);retval[retval.length]=optDom;}return retval;})();NUI.Util.ObjectService.annex(that,{getOptionDom:function(vIndex){if(!m_options.isIndexLegal(vIndex)){return null;}return m_options[vIndex].getLabelDom();},setOptEventHandler:function(vIndex,vFunc){if(!m_options.isIndexLegal(vIndex)){return;}m_options[vIndex].resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.Sort=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.SORT.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var value=null;if(vAnswer&&vAnswer.type==g_type.SORT.id){value=vAnswer.answers;}return g_input.SortPanel(m_question.options,null,{column:m_question.style.column,initValue:value});})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{getOptionDom:function(vIndex){return m_options.getOptDivDom(vIndex);},setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.ConstSum=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.CONSTSUM.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var value=null;if(vAnswer&&vAnswer.type==g_type.CONSTSUM.id){value=vAnswer.answers;}return g_input.ConstBar(m_question.options,null,{type:m_question.color,arrange:m_question.arrange,initValue:value});})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{getOptionDom:function(vIndex){return m_options.getOptDivDom(vIndex);},setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.Location=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.LOCATION.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var v=null;if(vAnswer&&vAnswer.answers&&vAnswer.answers.length>0){v=vAnswer.answers[0];}var locationInput=new g_input.Location(function(){},{initValue:v,isMultipleCity:(m_question.constrain.min!=1||m_question.constrain.max!=1)});return locationInput;})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Question.MatrixInput=(function(){var g_dom=NUI.Util.DomService,g_ns=NUI.Quill.Render.Question,g_type=NUI.Quill.Enum.QuestionType,g_input=NUI.Widget.Input;return function(vQuestion,vAnswer){if(vQuestion==null||vQuestion.type!=g_type.MATRIXINPUT.id){return null;}var secret={question:vQuestion};var that=new g_ns.Base(secret),m_question=secret.question,m_options=(function(){var rs=m_question.rows,cs=m_question.cols,attrs={rhasOther:rs.hasOtherOption,chasOther:cs.hasOtherOption};if(vAnswer&&vAnswer.type==g_type.MATRIXINPUT.id){attrs.initValues=vAnswer.answers;attrs.initRowOtherValue=vAnswer.rowOther;attrs.initColOtherValue=vAnswer.colOther;}return g_input.MatrixInput(rs.options,cs.options,null,attrs);})();m_options.appendTo(that.getOptConDom());NUI.Util.ObjectService.annex(that,{getRowOptionDom:function(vIndex){return m_options.getRoptDivDom(vIndex);},getColOptionDom:function(vIndex){return m_options.getCoptDivDom(vIndex);},setOptEventHandler:function(vFunc){m_options.resetEvent(vFunc);}});return that;};})();NUI.Quill.Render.Survey=(function(){var g_lang=NUI.Lang,g_dom=NUI.Util.DomService,g_sb=NUI.Util.StringService.StringBuilder,g_widget=NUI.Widget;return function(vSurvey){if(vSurvey==null){return null;}var survey=vSurvey,m_secret={},that=g_widget.Base(m_secret),m_id=m_secret.id;var m_node=(function(){var retval=g_dom.createNode("div");var sb=new g_sb();sb.append("<div id=\""+m_id+"\" class=\"survey\">","<div class=\"header\"><span id=\""+m_id+"_header\">"+survey.header+"</span></div>","<div class=\"caption\"><h1 id=\""+m_id+"_cap\">"+survey.caption+"</h1>","<h2 id=\""+m_id+"_subcap\" ",">"+survey.subcaption+"</h2></div>","<div id=\""+m_id+"_desc\" class=\"desc\">"+survey.description+"</div>","<div id=\""+m_id+"_content\" class=\"content\"></div>","<div class=\"footer\"><span id=\""+m_id+"_footer\">"+survey.footer+"</span></div>","</div>");g_dom.setInnerHTML(retval,sb.toString());return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,getCaption:function(){return m_secret.getChild(m_id+"_cap");},getSubCaption:function(){return m_secret.getChild(m_id+"_subcap");},getDesc:function(){return m_secret.getChild(m_id+"_desc");},getContent:function(){return m_secret.getChild(m_id+"_content");},getHeader:function(){return m_secret.getChild(m_id+"_header");},getFooter:function(){return m_secret.getChild(m_id+"_footer");}});return that;};})();NUI.Quill.Processor={getSurveyPrcs:function(vSurvey){},Survey:function(vSurvey){},Question:{},Answer:{}};NUI.Quill.Processor.Answer={getAnswerPrcs:function(vQuestion,vAnswer){},Base:function(vSecret){},Choice:function(vQuestion,vAnswer){},Matrix:function(vQuestion,vAnswer){},Input:function(vQuestion,vAnswer){},Rank:function(vQuestion,vAnswer){},Sort:function(vQuestion,vAnswer){},ConstSum:function(vQuestion,vAnswer){},MatrixInput:function(vQuestion,vAnswer){}};NUI.Quill.Processor.Answer.getAnswerPrcs=function(vQuestion,vAnswer){if(vQuestion==null){return null;}var type=vQuestion.type,typeValue=null,qType=NUI.Quill.Enum.QuestionType;NUI.Util.ObjectService.searchObject(qType,function(vName){if(qType[vName].id==type){typeValue=qType[vName].value;return true;}return false;});if(typeValue==null){return null;}return NUI.Quill.Processor.Answer[typeValue](vQuestion,vAnswer);};NUI.Quill.Processor.Answer.Base=(function(){var g_answer=NUI.Quill.Entity.Answer,g_question=NUI.Quill.Entity.Question,g_ns=NUI.Quill.Processor.Answer,g_lang=NUI.Lang,g_enum=NUI.Quill.Enum;return function(vSecret){var m_secret=vSecret||{};var m_question=m_secret.question||g_question["Base"](),m_answer=(function(){if(m_secret.answer&&m_secret.answer.type==m_secret.question.type){return m_secret.answer;}var type=m_secret.question.type,typeValue=null,qType=g_enum.QuestionType;NUI.Util.ObjectService.searchObject(qType,function(vName){if(qType[vName].id==type){typeValue=qType[vName].value;return true;}return false;});if(typeValue==null){return null;}return g_answer[typeValue](m_secret.question);})();NUI.Util.ObjectService.annex(m_secret,{question:m_question,answer:m_answer});var that={setAnswer:function(vAnswers){if(g_lang.isArray(vAnswers)){m_secret.answer.answers=NUI.Util.ObjectService.clone(vAnswers);return true;}return false;},updateAnswer:function(vAnswerIndex,vAnswer){if(!m_secret.answer.answers.isIndexLegal(vAnswerIndex)||vAnswer==null){return false;}m_secret.answer.answers[vAnswerIndex]=vAnswer;return true;},check:function(){return"";},save:function(vSurveyId,vFunc){NUI.Quill.Proxy.Answer.saveAnswer(vSurveyId,m_question.id,m_answer,function(vIsSuccess){vFunc(vIsSuccess);});},getAnswer:function(){if(m_answer==null){return null;}return NUI.Util.ObjectService.clone(m_answer);}};return that;};})();NUI.Quill.Processor.Answer.Choice=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.CHOICE.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{setOther:function(vOtherValue){if(vOtherValue!=null&&g_lang.isString(vOtherValue)){m_answer.other=vOtherValue;return true;}return false;},check:function(){if(m_answer.answers==null){return"答案不能为空";}var ans=m_answer.answers,optLen=m_question.optSet.options.length,ansLen=m_question.optSet.hasOtherOption?(optLen+1):optLen;if(ans.length!=ansLen){return"答案与选项无法对应";}var count=0;for(var i=0;i<ansLen;i++){if(ans[i]>0){count++;}}if(count<m_question.optSet.constrain.min){return"请至少选择"+m_question.optSet.constrain.min+"个选项";}if(count>m_question.optSet.constrain.max){return"请最多选择"+m_question.optSet.constrain.max+"个选项";}return"";}});return that;};})();NUI.Quill.Processor.Answer.Matrix=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.MATRIX.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{setRowOther:function(vOtherValue){if(vOtherValue!=null&&g_lang.isString(vOtherValue)){m_answer.rowOther=vOtherValue;return true;}return false;},setColOther:function(vOtherValue){if(vOtherValue!=null&&g_lang.isString(vOtherValue)){m_answer.colOther=vOtherValue;return true;}return false;},check:function(){if(m_answer.answers==null){return"答案不能为空";}var rowAns=m_answer.answers,rowOptLen=m_question.rows.options.length,colOptLen=m_question.cols.options.length,rowAnsLen=m_question.rows.hasOtherOption?(rowOptLen+1):rowOptLen,colAnsLen=m_question.cols.hasOtherOption?(colOptLen+1):colOptLen;if(rowAns.length!=rowAnsLen){return"答案行数与选项行数无法对应";}function _ckrow(vRowIndex){var colAns=rowAns[vRowIndex],prex="第"+(vRowIndex+1)+"行";if(colAns==null){return prex+"答案不能为空";}if(colAns.length!=colAnsLen){return prex+"答案列数与选项列数无法对应";}var count=0;for(var c=0;c<colAnsLen;c++){if(colAns[c]>0){count++;}}if(count<m_question.cols.constrain.min){return prex+"至少选择"+m_question.cols.constrain.min+"个选项";}if(count>m_question.cols.constrain.max){return prex+"最多选择"+m_question.cols.constrain.max+"个选项";}return"";}var r_count=(m_question.rows.hasOtherOption?(rowAnsLen-1):rowAnsLen);for(var r=0;r<r_count;r++){var ckmsg=_ckrow(r);if(ckmsg!=""){return ckmsg;}}function _ckcol(vColIndex){var prex="第"+(vColIndex+1)+"列",count=0;for(var r=0;r<rowAnsLen;r++){if(rowAns[r][vColIndex]>0){count++;}}if(count<m_question.rows.constrain.min){return prex+"至少选择"+m_question.rows.constrain.min+"个选项";}if(count>m_question.rows.constrain.max){return prex+"最多选择"+m_question.rows.constrain.max+"个选项";}return"";}var c_count=(m_question.cols.hasOtherOption?(colAnsLen-1):colAnsLen);for(var c=0;c<c_count;c++){var ckmsg=_ckcol(c);if(ckmsg!=""){return ckmsg;}}return"";}});return that;};})();NUI.Quill.Processor.Answer.Input=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.INPUT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{check:function(){if(m_answer.answers==null){return"答案不能为空";}var types=NUI.Widget.Input.TextInputType;var ans=m_answer.answers,count=ans.length,inputs=m_question.inputs;if(count!=inputs.length){return"答案个数和输入框个数不等";}for(var i=0;i<count;i++){if(inputs[i]==null){continue;}var prex="第"+(i+1)+"个输入框",min=inputs[i].min,max=inputs[i].max;switch(inputs[i].type){case types.STRING.id:if(ans[i]==null){return prex+"需要填写";}var value=ans[i].length;if(value<min){return prex+"输入字符串长度必须大于"+min;}else if(value>max){return prex+"输入字符串长度必须小于"+max;}break;case types.INT.id:var value=parseInt(ans[i],10);if(isNaN(value)){return prex+"必须输入整数";}else if(value<min){return prex+"输入整数必须大于"+min;}else if(value>max){return prex+"输入整数必须小于"+max;}break;case types.FLOAT.id:var value=parseFloat(ans[i]);if(isNaN(value)){return prex+"必须输入小数";}else if(value<min){return prex+"输入数值必须大于"+min;}else if(value>max){return prex+"输入数值必须小于"+max;}break;case types.EMAIL.id:if(ans[i]==null){return prex+"需要填写";}var value=ans[i];if(value==null){return"输入值不能为空";}else{var checkMail=/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;if(!checkMail.test(value)){return"邮箱地址不合法";}}break;}}return"";}});return that;};})();NUI.Quill.Processor.Answer.Rank=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.RANK.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{check:function(){if(m_answer.answers==null){return"答案不能为空";}var ans=m_answer.answers,count=ans.length,opts=m_question.options;if(count!=opts.length){return"答案个数和选项个数不等";}for(var i=0;i<count;i++){if(opts[i]==null){continue;}var prex="第"+(i+1)+"个选项";if(ans[i]<=0){return"请给"+prex+"评分";}if(ans[i]>opts[i].count){return prex+"评分超出最大值";}}return"";}});return that;};})();NUI.Quill.Processor.Answer.Sort=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.SORT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{check:function(){if(m_answer.answers==null){return"答案不能为空";}var ans=m_answer.answers,count=ans.length,opts=m_question.options;if(count!=opts.length){return"答案个数和选项个数不等";}for(var i=0;i<count;i++){var prex="第"+(i+1)+"个选项";if(ans[i]<0){return"请给"+prex+"排序";}}return"";}});return that;};})();NUI.Quill.Processor.Answer.ConstSum=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.CONSTSUM.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{check:function(){if(m_answer.answers==null){return"答案不能为空";}if(m_answer.answers.length!=m_question.options.length){return"答案个数和选项个数不等";}return"";}});return that;};})();NUI.Quill.Processor.Answer.Location=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.LOCATION.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{check:function(){if(m_answer.answers==null){return"答案不能为空";}var count=m_answer.answers.length;if(count<m_question.constrain.min){return"请至少选择"+m_question.constrain.min+"个地区";}if(count>m_question.constrain.max){return"请最多选择"+m_question.constrain.max+"个地区";}for(var i=0;i<count;i++){if(m_answer.answers[i]==null||m_answer.answers[i].country==-2||m_answer.answers[i].province==-2||m_answer.answers[i].city==-2){return"选择地区有误";}}return"";}});return that;};})();NUI.Quill.Processor.Answer.MatrixInput=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Answer,g_type=NUI.Quill.Enum.QuestionType;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_type.MATRIXINPUT.id==vQuestion.type)){return null;}var m_secret={question:vQuestion,answer:vAnswer};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_answer=m_secret.answer;NUI.Util.ObjectService.annex(that,{setRowOther:function(vOtherValue){if(vOtherValue!=null&&g_lang.isString(vOtherValue)){m_answer.rowOther=vOtherValue;return true;}return false;},setColOther:function(vOtherValue){if(vOtherValue!=null&&g_lang.isString(vOtherValue)){m_answer.colOther=vOtherValue;return true;}return false;},check:function(){if(m_answer.answers==null){return"答案不能为空";}var rowAns=m_answer.answers,rowOptLen=m_question.rows.options.length,colOptLen=m_question.cols.options.length,rowAnsLen=m_question.rows.hasOtherOption?(rowOptLen+1):rowOptLen,colAnsLen=m_question.cols.hasOtherOption?(colOptLen+1):colOptLen;if(rowAns.length!=rowAnsLen){return"答案行数与选项行数无法对应";}function _ckrow(vRowIndex){var colAns=rowAns[vRowIndex],prex="第"+(vRowIndex+1)+"行";if(colAns==null){return prex+"答案不能为空";}if(colAns.length!=colAnsLen){return prex+"答案列数与选项列数无法对应";}return"";}var r_count=(m_question.rows.hasOtherOption?(rowAnsLen-1):rowAnsLen);for(var r=0;r<r_count;r++){var ckmsg=_ckrow(r);if(ckmsg!=""){return ckmsg;}}function _ckcol(vColIndex){return"";}var c_count=(m_question.cols.hasOtherOption?(colAnsLen-1):colAnsLen);for(var c=0;c<c_count;c++){var ckmsg=_ckcol(c);if(ckmsg!=""){return ckmsg;}}return"";}});return that;};})();NUI.Quill.Processor.Question={getQuestionPrcs:function(vQuestion){},Base:function(vQuestion){},Choice:function(vQuestion){},Matrix:function(vQuestion){},Input:function(vQuestion){},Rank:function(vQuestion){},Sort:function(vQuestion){},ConstSum:function(vQuestion){},Location:function(vQuestion){},MatrixInput:function(vQuestion){}};NUI.Quill.Processor.Question.getQuestionPrcs=function(vQuestion){if(vQuestion==null){return null;}var type=vQuestion.type,typeValue=null,qType=NUI.Quill.Enum.QuestionType;NUI.Util.ObjectService.searchObject(qType,function(vName){if(qType[vName].id==type){typeValue=qType[vName].value;return true;}return false;});if(typeValue==null){return null;}return NUI.Quill.Processor.Question[typeValue](vQuestion);};NUI.Quill.Processor.Question.Base=(function(){var g_question=NUI.Quill.Entity.Question,g_ns=NUI.Quill.Processor.Question,g_lang=NUI.Lang;return function(vSecret){var secret=vSecret||{};if(!secret.entity){secret.entity=g_question["Base"]();}NUI.Util.ObjectService.annex(secret,{isModified:function(){return secret.entity.modified;},setModified:function(){secret.entity.modified=true;},resetModified:function(){secret.entity.modified=false;},itemLength:function(vItemList){if(!vItemList){return-1;}return vItemList.length;},addItem:function(vItemList,vIndex,vItem){if(!vItemList){return false;}var retval=vItemList.addAt(vIndex,vItem);if(retval){secret.setModified();}return retval;},removeItem:function(vItemList,vIndex){if(!vItemList){return false;}var retval=vItemList.removeAt(vIndex);if(retval){secret.setModified();}return retval;},updateItem:function(vItemList,vIndex,vItem){if(!vItemList){return false;}var retval=vItemList.update(vIndex,vItem);if(retval){secret.setModified();}return retval;},setOtherOption:function(vOptionSet,vHasOtherOption){if(vOptionSet&&vOptionSet.hasOtherOption!=vHasOtherOption){vOptionSet.hasOtherOption=vHasOtherOption;secret.setModified();}},setMin:function(vOptionSet,vMin){if(vOptionSet&&g_lang.isNumber(vMin)){var max=vOptionSet.hasOtherOption?(vOptionSet.options.length+1):vOptionSet.options.length;if(vMin>max){vMin=max;}if(vMin>vOptionSet.constrain.max){vMin=vOptionSet.constrain.max}if(vMin<=0){vMin=0;}if(vMin!=vOptionSet.constrain.min){vOptionSet.constrain.min=vMin;secret.setModified();}}return vMin;},setMax:function(vOptionSet,vMax){if(vOptionSet&&g_lang.isNumber(vMax)){var len=vOptionSet.options.length;if(vOptionSet.hasOtherOption){len+=1;}if(vMax>len){vMax=len;}if(vMax<vOptionSet.constrain.min){vMax=vOptionSet.constrain.min}if(vMax<=0){vMax=0;}if(vMax!=vOptionSet.constrain.max){vOptionSet.constrain.max=vMax;secret.setModified();}}return vMax;}});var that={updateCaption:function(vCaption){if(g_lang.isString(vCaption)){secret.setModified();secret.entity.caption=vCaption;return true;}return false;},save:function(vSurveyId,vFunc){if(!secret.isModified()){vFunc(true);}else{NUI.Quill.Proxy.Question.saveQuestion(vSurveyId,secret.entity,function(vIsSuccess){if(vIsSuccess){secret.resetModified();}vFunc(vIsSuccess);});}}};return that;};})();NUI.Quill.Processor.Question.Choice=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.CHOICE.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{optionLength:function(){return secret.itemLength(entity.optSet.options);},addOption:function(vIndex,vOption){return secret.addItem(entity.optSet.options,vIndex,vOption);},removeOption:function(vIndex){return secret.removeItem(entity.optSet.options,vIndex);},updateOption:function(vIndex,vOption){return secret.updateItem(entity.optSet.options,vIndex,vOption);},setOtherOption:function(vHasOtherOption){return secret.setOtherOption(entity.optSet,vHasOtherOption);},setMin:function(vMin){return secret.setMin(entity.optSet,vMin);},setMax:function(vMax){return secret.setMax(entity.optSet,vMax);},setColumn:function(vColumn){if(g_lang.isNumber(vColumn)&&entity.style.column!=vColumn){entity.style.column=vColumn;secret.setModified();}},setRandom:function(vIsRandom){if(g_lang.isBoolean(vIsRandom)&&entity.style.isRandom!=vIsRandom){entity.style.isRandom=vIsRandom;secret.setModified();}}});return that;};})();NUI.Quill.Processor.Question.Matrix=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.MATRIX.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{addRowOption:function(vIndex,vOption){return secret.addItem(entity.rows.options,vIndex,vOption);},removeRowOption:function(vIndex){return secret.removeItem(entity.rows.options,vIndex);},updateRowOption:function(vIndex,vOption){return secret.updateItem(entity.rows.options,vIndex,vOption);},addColOption:function(vIndex,vOption){return secret.addItem(entity.cols.options,vIndex,vOption);},removeColOption:function(vIndex){return secret.removeItem(entity.cols.options,vIndex);},updateColOption:function(vIndex,vOption){return secret.updateItem(entity.cols.options,vIndex,vOption);},setRowOtherOption:function(vHasOtherOption){return secret.setOtherOption(entity.rows,vHasOtherOption);},setColOtherOption:function(vHasOtherOption){return secret.setOtherOption(entity.cols,vHasOtherOption);},setRowMin:function(vMin){return secret.setMin(entity.rows,vMin);},setRowMax:function(vMax){return secret.setMax(entity.rows,vMax);},setColMin:function(vMin){return secret.setMin(entity.cols,vMin);},setColMax:function(vMax){return secret.setMax(entity.cols,vMax);}});return that;};})();NUI.Quill.Processor.Question.Input=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType,g_optType=NUI.Quill.Enum.InputOptionType;return function(vEntity){if(vEntity==null||!(g_type.INPUT.id==vEntity.type)){return null;}var secret={entity:vEntity};var m_type=NUI.Widget.Input.TextInputType,that=new g_ns.Base(secret),entity=secret.entity;function _getPosition(vType,vIndex){if(!NUI.Util.ObjectService.hasValue(g_optType,vType)){return-1;}var mask=secret.entity.optTypeMask,len=mask.length,count=-1,retval=0;for(;retval<len;retval++){if(mask[retval]==vType){count++;if(count==vIndex){break;}}}if(count!=vIndex){return-1;}else{return retval;}}function _isText(vMaskIndex){return(secret.entity.optTypeMask[vMaskIndex]==g_optType.TEXT);}function _isInput(vMaskIndex){return(secret.entity.optTypeMask[vMaskIndex]==g_optType.INPUT);}function _getItems(vType){var retval=null;switch(vType){case g_optType.TEXT:retval=secret.entity.texts;break;case g_optType.INPUT:retval=secret.entity.inputs;break;}return retval;}function _adjustOptions(){var mask=secret.entity.optTypeMask,texts=secret.entity.texts,inputs=secret.entity.inputs;var mIdx=0,tIdx=0,iIdx=0;while(mIdx<mask.length){if(_isText(mIdx)){var mNext=mIdx+1,tNext=tIdx+1;if(tNext<texts.length&&mNext<mask.length&&_isText(mNext)){texts[tIdx]+=texts[tNext];texts.removeAt(tNext);mask.removeAt(mNext);}else{mIdx++;tIdx++;}}else if(_isInput(mIdx)){mIdx++;iIdx++;}}}NUI.Util.ObjectService.annex(that,{optionLength:function(){var mask=secret.entity.optTypeMask;if(!mask){return-1;}return mask.length;},isText:function(vMaskIndex){return _isText(vMaskIndex);},isInput:function(vMaskIndex){return _isInput(vMaskIndex);},addOption:function(vType,vOption){if(!NUI.Util.ObjectService.hasValue(g_optType,vType)){return false;}var items=_getItems(vType);if(!items){return false;}items[items.length]=vOption;var mask=secret.entity.optTypeMask;mask[mask.length]=vType;_adjustOptions();secret.setModified();return true;},removeOption:function(vType,vIndex){var items=_getItems(vType),pos=_getPosition(vType,vIndex);if(!items||pos<0){return false;}items.removeAt(vIndex);secret.entity.optTypeMask.removeAt(pos);_adjustOptions();secret.setModified();return true;},updateOption:function(vType,vIndex,vNewOption){var items=_getItems(vType);if(!items){return false;}secret.setModified();return items.update(vIndex,vNewOption);},setMin:function(vIndex,vMin){var inputs=secret.entity.inputs;if(!inputs.isIndexLegal(vIndex)||!g_lang.isNumber(vMin)){return;}inputs[vIndex].min=vMin;secret.setModified();},setMax:function(vIndex,vMax){var inputs=secret.entity.inputs;if(!inputs.isIndexLegal(vIndex)||!g_lang.isNumber(vMax)){return;}inputs[vIndex].max=vMax;secret.setModified();},setType:function(vIndex,vInputTypeId){var inputs=secret.entity.inputs;if(!inputs.isIndexLegal(vIndex)){return;}var hasType=false;NUI.Util.ObjectService.searchObject(m_type,function(vName){hasType=(m_type[vName].id==vInputTypeId);return hasType;});if(!hasType){return;}inputs[vIndex].type=vInputTypeId;secret.setModified();}});return that;};})();NUI.Quill.Processor.Question.Rank=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.RANK.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{optionLength:function(){return secret.itemLength(entity.options);},addOption:function(vIndex,vOption){return secret.addItem(entity.options,vIndex,vOption);},removeOption:function(vIndex){return secret.removeItem(entity.options,vIndex);},updateOption:function(vIndex,vOption){return secret.updateItem(entity.options,vIndex,vOption);},updateOptionValue:function(vIndex,vValue){if(!g_lang.isString(vValue)){return false;}var opts=secret.entity.options;if(!opts||!opts.isIndexLegal(vIndex)){return false;}var opt=opts[vIndex];if(opt==null){return false;}opt.value=vValue;secret.setModified();return true;},updateOptionType:function(vIndex,vType){if(!NUI.Util.ObjectService.hasValue(NUI.Widget.Input.RankBarType,vType)){return false;}var opts=secret.entity.options;if(!opts||!opts.isIndexLegal(vIndex)){return false;}var opt=opts[vIndex];if(opt==null){return false;}opt.type=vType;secret.setModified();return true;},updateOptionCount:function(vIndex,vCount){if(!g_lang.isNumber(vCount)||!(vCount>0)){return false;}var opts=secret.entity.options;if(!opts||!opts.isIndexLegal(vIndex)){return false;}var opt=opts[vIndex];if(opt==null){return false;}opt.count=vCount;secret.setModified();return true;}});return that;};})();NUI.Quill.Processor.Question.Sort=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.SORT.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{optionLength:function(){return secret.itemLength(entity.options);},addOption:function(vIndex,vOption){return secret.addItem(entity.options,vIndex,vOption);},removeOption:function(vIndex){return secret.removeItem(entity.options,vIndex);},updateOption:function(vIndex,vOption){return secret.updateItem(entity.options,vIndex,vOption);},setColumn:function(vColumn){if(!g_lang.isNumber(vColumn)||vColumn<=0){return false;}secret.entity.style.column=vColumn;secret.setModified();return true;}});return that;};})();NUI.Quill.Processor.Question.ConstSum=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.CONSTSUM.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity,m_color=NUI.Widget.Input.ConstBarType,m_arrange=NUI.Widget.Input.ArrangeType;NUI.Util.ObjectService.annex(that,{optionLength:function(){return secret.itemLength(entity.options);},addOption:function(vIndex,vOption){return secret.addItem(entity.options,vIndex,vOption);},removeOption:function(vIndex){return secret.removeItem(entity.options,vIndex);},updateOption:function(vIndex,vOption){return secret.updateItem(entity.options,vIndex,vOption);},setColor:function(vColor){if(!NUI.Util.ObjectService.hasValue(m_color,vColor)){return false;}secret.entity.color=vColor;secret.setModified();return true;},setArrange:function(vArrange){if(!NUI.Util.ObjectService.hasValue(m_arrange,vArrange)){return false;}secret.entity.arrange=vArrange;secret.setModified();return true;}});return that;};})();NUI.Quill.Processor.Question.Location=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.LOCATION.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{setMin:function(vMin){if(g_lang.isNumber(vMin)){if(vMin<=1){vMin=1;}if(vMin>=entity.constrain.max){vMin=entity.constrain.max;}if(vMin!=entity.constrain.min){entity.constrain.min=vMin;secret.setModified();}}return vMin;},setMax:function(vMax){if(g_lang.isNumber(vMax)){if(vMax<=1){vMax=1;}if(vMax<=entity.constrain.min){vMax=entity.constrain.min;}if(vMax!=entity.constrain.max){entity.constrain.max=vMax;secret.setModified();}}return vMax;}});return that;};})();NUI.Quill.Processor.Question.MatrixInput=(function(){var g_lang=NUI.Lang,g_ns=NUI.Quill.Processor.Question,g_type=NUI.Quill.Enum.QuestionType;return function(vEntity){if(vEntity==null||!(g_type.MATRIXINPUT.id==vEntity.type)){return null;}var secret={entity:vEntity};var that=new g_ns.Base(secret),entity=secret.entity;NUI.Util.ObjectService.annex(that,{addRowOption:function(vIndex,vOption){return secret.addItem(entity.rows.options,vIndex,vOption);},removeRowOption:function(vIndex){return secret.removeItem(entity.rows.options,vIndex);},updateRowOption:function(vIndex,vOption){return secret.updateItem(entity.rows.options,vIndex,vOption);},addColOption:function(vIndex,vOption){return secret.addItem(entity.cols.options,vIndex,vOption);},removeColOption:function(vIndex){return secret.removeItem(entity.cols.options,vIndex);},updateColOption:function(vIndex,vOption){return secret.updateItem(entity.cols.options,vIndex,vOption);},setRowOtherOption:function(vHasOtherOption){return secret.setOtherOption(entity.rows,vHasOtherOption);},setColOtherOption:function(vHasOtherOption){return secret.setOtherOption(entity.cols,vHasOtherOption);}});return that;};})();NUI.Quill.Processor.getSurveyPrcs=function(vSurvey){return NUI.Quill.Processor.Survey(vSurvey);};NUI.Quill.Processor.Survey=(function(){var g_lang=NUI.Lang,g_enum=NUI.Quill.Enum,g_entity=NUI.Quill.Entity,g_ht=NUI.Util.DataStructure.HashTable;return function(vSurvey){if(vSurvey==null){return null;}var m_entity=vSurvey;function _refreshId(vNewId){if(!g_lang.isNumber(vNewId)||vNewId<=0){return false;}if(m_entity.id>0){return false;}m_entity.id=vNewId;return true;}function _updateStringVar(vVariable,vValue){if(!g_lang.isString(vValue)||vValue==null||!g_lang.isString(vVariable)){return false;}try{m_entity[vVariable]=vValue;return true;}catch(ex){return false;}}function _addPageTag(vQId){if(m_entity.qIdList[0]==vQId||!m_entity.qIdList.contain(vQId)){return;}m_entity.pageTags.setValue(vQId,true);}function _removePageTag(vQId){m_entity.pageTags.remove(vQId);}function _setPortionTag(vQId,vText){if(!m_entity.qIdList.contain(vQId)){return;}m_entity.portionTags.setValue(vQId,vText);}function _removePortionTag(vQId){m_entity.portionTags.remove(vQId);}function _addJumper(vQId,vOptionIndex,vTargetQId){var jp=m_entity.jumper;if(!jp.exist(vQId)){jp.setValue(vQId,new g_ht());}var optSet=jp.getValue(vQId);if(!optSet.exist(vOptionIndex)){optSet.setValue(vOptionIndex,new g_ht());}var idSet=optSet.getValue(vOptionIndex);idSet.setValue(vTargetQId,true);}function _removeJumper(vQId,vOptionIndex,vTargetQId){var jp=m_entity.jumper;if(!jp.exist(vQId)){return;}var optSet=jp.getValue(vQId);if(!optSet.exist(vOptionIndex)){return;}var idSet=optSet.getValue(vOptionIndex);idSet.remove(vTargetQId);if(idSet.count()==0){optSet.remove(vOptionIndex);if(optSet.count()==0){jp.remove(vQId);}}}function _removeQJumper(vQId){m_entity.jumper.remove(vQId);}function _isJumper(vQId){return m_entity.jumper.exist(vQId);}function _setBranch(vQId,vOptIdx,vBranchType,vValue){var br=m_entity.branch;if(!br.exist(vQId)){br.setValue(vQId,new g_ht());}var qBr=br.getValue(vQId);qBr.setValue(vOptIdx,{type:vBranchType,value:vValue});}function _removeBranch(vQId,vOptIdx){var br=m_entity.branch;if(!br.exist(vQId)){return;}var qBr=br.getValue(vQId);qBr.remove(vOptIdx);if(qBr.count()==0){br.remove(vQId);}}function _removeQBranch(vQId){m_entity.branch.remove(vQId);}function _isBranch(vQId){return m_entity.branch.exist(vQId);}function _isBranchByType(vQId,vOptIdx,vBranchType){var br=m_entity.branch;if(br){var qBr=br.getValue(vQId);if(qBr){var value=qBr.getValue(vOptIdx);return(value&&value.type==vBranchType);}}return false;}function __createQId(){var qIds=m_entity.qIdList;if(qIds==null||qIds.length==0){return 1;}var len=qIds.length,retval=0;for(var i=0;i<len;i++){if(qIds[i]>retval){retval=qIds[i];}}retval++;return retval;}function _addQuestion(vType,vPosition){var qIds=m_entity.qIdList;if(vPosition!=qIds.length&&!qIds.isIndexLegal(vPosition)){return-1;}var qId=__createQId(),qst=g_entity.Question[vType.value](qId);m_entity.questionSet.setValue(qId,qst);qIds.splice(vPosition,0,qId);return qId;}function _pasteQuestion(vQuestion,vPosition){var qId=__createQId(),qIds=m_entity.qIdList;if(vPosition!=qIds.length&&!qIds.isIndexLegal(vPosition)){return-1;}var pasteQst=NUI.Util.ObjectService.clone(vQuestion);pasteQst.id=qId;pasteQst.modified=true;m_entity.questionSet.setValue(qId,pasteQst);qIds.splice(vPosition,0,qId);return qId;}function _deleteQuestion(vQId){var qIdx=m_entity.qIdList.getIndex(vQId);if(qIdx<0){return;}var preIdx=qIdx-1,nextIdx=qIdx+1,len=m_entity.qIdList.length;if(m_entity.pageTags&&m_entity.pageTags.exist(vQId)){_removePageTag(vQId);if(nextIdx>0&&nextIdx<len){_addPageTag(m_entity.qIdList[nextIdx]);}}if(nextIdx==1){_removePageTag(m_entity.qIdList[nextIdx]);}if(m_entity.portionTags&&m_entity.portionTags.exist(vQId)){var text=m_entity.portionTags.getValue(vQId);_removePortionTag(vQId);if(nextIdx>0&&nextIdx<len){_setPortionTag(m_entity.qIdList[nextIdx],text);}}m_entity.qIdList.remove(vQId);_removeQJumper(vQId);_removeQBranch(vQId);m_entity.questionSet.remove(vQId);}function _moveQuestion(vQId,vStep){var qIds=m_entity.qIdList,len=qIds.length,oldPos=0;for(;oldPos<len;oldPos++){if(qIds[oldPos]==vQId){break;}}if(oldPos==len){return false;}var newPos=oldPos+vStep,newPageTagQId=qIds[oldPos+1];if(newPos<0){newPos=0;}else if(newPos>=len){newPos=len;}qIds.remove(vQId);qIds.splice(newPos,0,vQId);if(m_entity.pageTags.exist(vQId)){_removePageTag(vQId);if(newPageTagQId){_addPageTag(newPageTagQId);}}if(m_entity.pageTags.exist(qIds[0])){_removePageTag(qIds[0]);}return true;}function _getQuestion(vQId,vFunc){var retval=m_entity.questionSet.getValue(vQId);if(retval!=null){vFunc(retval);}else{NUI.Quill.Proxy.Question.getQuestion(m_entity.id,vQId,function(vQuestion){var q=m_entity.questionSet.getValue(vQId);if(vQuestion!=null){if(q==null){m_entity.questionSet.setValue(vQId,vQuestion);}else{vQuestion=q;}}vFunc(vQuestion);});}}var that={updateCaption:function(vCaption){return _updateStringVar("caption",vCaption);},updateSubcaption:function(vSubcap){return _updateStringVar("subcaption",vSubcap);},updateDescription:function(vDesc){return _updateStringVar("description",vDesc);},updateHeader:function(vHeader){return _updateStringVar("header",vHeader);},updateFooter:function(vFooter){return _updateStringVar("footer",vFooter);},addPageTag:function(vQId){_addPageTag(vQId);},removePageTag:function(vQId){_removePageTag(vQId);},setPortionTag:function(vQId,vText){if(!g_lang.isString(vText)||vText==null){return;}_setPortionTag(vQId,vText);},removePortionTag:function(vQId){_removePortionTag(vQId);},addJumper:function(vQId,vOptionIndex,vTargetQId){_addJumper(vQId,vOptionIndex,vTargetQId);},removeJumper:function(vQId,vOptionIndex,vTargetQId){_removeJumper(vQId,vOptionIndex,vTargetQId);},isJumper:function(vQId){return _isJumper(vQId);},setBranch:function(vQId,vOptIdx,vBranchType,vValue){if(!g_enum.inEnum(g_enum.BranchType,vBranchType)){return;}_setBranch(vQId,vOptIdx,vBranchType,vValue);},removeBranch:function(vQId,vOptIdx){_removeBranch(vQId,vOptIdx);},isBranch:function(vQId){return _isBranch(vQId);},isBranchByType:function(vQId,vOptIdx,vBranchType){return _isBranchByType(vQId,vOptIdx,vBranchType);},getQuestion:function(vQId,vFunc){var m_func=vFunc?vFunc:function(){};if(vQId==null||vQId<=0){m_func(null);return;}else{_getQuestion(vQId,vFunc);}},addQuestion:function(vType,vPosition){if(!g_enum.inEnum(NUI.Quill.Enum.QuestionType,vType)){return-1;}return _addQuestion(vType,vPosition);},deleteQuestion:function(vQId){_deleteQuestion(vQId);},pasteQuestion:function(vQuestion,vPosition){if(vQuestion==null){return null;}return _pasteQuestion(vQuestion,vPosition);},moveQuestion:function(vQId,vStep){return _moveQuestion(vQId,vStep);},getQstIdx:function(vQId){return m_entity.qIdList.getIndex(vQId);},create:function(vFunc){NUI.Quill.Proxy.Survey.createSurvey(m_entity,function(vSurveyId){if(vSurveyId>0){_refreshId(vSurveyId);vFunc(true);}else{vFunc(false);}});},save:function(vFunc){NUI.Quill.Proxy.Survey.saveSurvey(m_entity,function(vSurveyId){if(vSurveyId>0){_refreshId(vSurveyId);vFunc(true);}else{vFunc(false);}});},saveAs:function(vNewCaption,vFunc){if(m_entity.id<=0||vNewCaption==null||vNewCaption==""||vNewCaption==m_entity.caption){vFunc(-1);}else{NUI.Quill.Proxy.Survey.saveAsSurvey(m_entity.id,vNewCaption,function(vNewSurveyId){vFunc(vNewSurveyId);});}}};return that;};})();NUI.Quill.Proxy=(function(){var g_ajax=NUI.Ajax,g_enum=NUI.Quill.Enum,g_entity=NUI.Quill.Entity,g_prcs=NUI.Quill.Processor,g_ns=NUI.Quill.Proxy,g_ht=NUI.Util.DataStructure.HashTable;return{Survey:(function(){var m_parsers={toServer:function(vSurvey){if(vSurvey==null){return null;}var retval=NUI.Util.ObjectService.clone(vSurvey);NUI.Util.ObjectService.remove(retval,"questionSet");NUI.Util.ObjectService.remove(retval,"pageTags");retval.pageTags=vSurvey.pageTags.keys();NUI.Util.ObjectService.remove(retval,"portionTags");retval.portionTags=vSurvey.portionTags.elements("qstId","value");NUI.Util.ObjectService.remove(retval,"jumper");var elems=vSurvey.jumper.elements("qstId","jpOpts"),count=elems.length;for(var i=0;i<count;i++){var qJp=elems[i]["jpOpts"].elements("optIdx","targetQIds"),qcount=qJp.length;for(var k=0;k<qcount;k++){qJp[k]["targetQIds"]=qJp[k]["targetQIds"].keys();}elems[i]["jpOpts"]=qJp;}retval.jumper=elems;NUI.Util.ObjectService.remove(retval,"branch");var elems=vSurvey.branch.elements("qstId","brOpts"),count=elems.length;for(var i=0;i<count;i++){elems[i]["brOpts"]=elems[i]["brOpts"].elements("optIdx","value");}retval.branch=elems;return retval;},fromServer:function(vSId,vSurvey){if(vSurvey==null){return null;}var retval=new g_entity.Survey();retval.id=vSId;retval.caption=vSurvey.caption;retval.subcaption=vSurvey.subcaption;retval.description=vSurvey.description;retval.header=vSurvey.header;retval.footer=vSurvey.footer;retval.questionSet=new g_ht();retval.qIdList=vSurvey.qIdList;retval.pageTags=new g_ht();var pgtags=vSurvey.pageTags,pgCount=pgtags.length;for(var i=0;i<pgCount;i++){retval.pageTags.setValue(pgtags[i],true);}retval.portionTags=new g_ht();retval.portionTags.setValues(vSurvey.portionTags,"qstId","value");retval.jumper=new g_ht();retval.jumper.setValues(vSurvey.jumper,"qstId","jpOpts");retval.jumper.walkTable(function(vQId,vQValue){var qJp=new g_ht();qJp.setValues(vQValue,"optIdx","targetQIds");qJp.walkTable(function(vOptIdx,vTgtQIds){var optValue=new g_ht(),count=vTgtQIds.length;for(var i=0;i<count;i++){optValue.setValue(vTgtQIds[i],true);}qJp.setValue(vOptIdx,optValue);});retval.jumper.setValue(vQId,qJp);});retval.branch=new g_ht();retval.branch.setValues(vSurvey.branch,"qstId","brOpts");retval.branch.walkTable(function(vQId,vQValue){var qBr=new g_ht();qBr.setValues(vQValue,"optIdx","value");retval.branch.setValue(vQId,qBr);});return retval;}};return{createSurvey:function(vSurvey,vFunc){var surveyToBeCreated=m_parsers.toServer(vSurvey);if(surveyToBeCreated==null){vFunc(-1);return;}g_ajax.call("CreateSurvey",{args:[surveyToBeCreated],func:{success:function(vSurveyId){vFunc(vSurveyId);}}});},getSurvey:function(vSurveyId,vFunc){if(vSurveyId==null||vSurveyId<=0){vFunc(null);return;}g_ajax.call("GetSurvey",{args:[vSurveyId],func:{success:function(vSurvey){if(vSurvey!=null){vFunc(m_parsers.fromServer(vSurveyId,vSurvey));}else{vFunc(null);}}}});},deleteSurvey:function(vSurveyId,vFunc){},saveSurvey:function(vSurvey,vFunc){var surveyToBeSaved=m_parsers.toServer(vSurvey);if(surveyToBeSaved==null){vFunc(-1);return;}g_ajax.call("SaveSurvey",{args:[surveyToBeSaved],func:{success:function(vSurveyId){vFunc(vSurveyId);}}});},saveAsSurvey:function(vSurveyId,vNewCaption,vFunc){g_ajax.call("SurveySaveAs",{args:[vSurveyId,vNewCaption],func:{success:function(vNewSurveyId){vFunc(vNewSurveyId);}}});}};})(),Question:(function(){function _getParser(vQuestionType){if(vQuestionType==null){return null;}var typeValue=null;NUI.Util.ObjectService.searchObject(g_enum.QuestionType,function(vName){var type=g_enum.QuestionType[vName];if(type.id==vQuestionType){typeValue=type.value;return true;}return false;});if(typeValue==null){return null;}var parser={toServer:function(vQuestion){if(vQuestion==null){return null;}var retval=NUI.Util.ObjectService.clone(vQuestion);NUI.Util.ObjectService.remove(retval,"modified");return retval;},fromServer:function(vQId,vQuestion){if(vQuestion==null){return null;}var retval=new g_entity.Question[typeValue]();NUI.Util.ObjectService.annex(retval,vQuestion);retval.id=vQId;retval.modified=false;return retval;}};return parser;}return{getParser:_getParser,getQuestion:function(vSurveyId,vQuestionId,vFunc){if(vQuestionId==null||vQuestionId<=0){vFunc(null);return;}g_ajax.call("GetQuestion",{args:[vSurveyId,vQuestionId],func:{success:function(vQuestion){var returnedQuestion=null;if(vQuestion!=null){var parser=_getParser(vQuestion.type);if(parser!=null){returnedQuestion=parser.fromServer(vQuestionId,vQuestion);}}vFunc(returnedQuestion);}}});},getSpecialQuestion:function(vType,vFunc){if(vType==null){vFunc(null);return;}g_ajax.call("GetSpecialQuestion",{args:[vType],func:{success:function(vQuestion){var returnedQuestion=null;if(vQuestion!=null){var parser=_getParser(vQuestion.type);if(parser!=null){returnedQuestion=parser.fromServer(-vType,vQuestion);}}vFunc(returnedQuestion);}}});},getQuestionAnswerSet:function(vSurveyId,vQuestionId,vVolunteer,vFunc){if(vQuestionId==null||vQuestionId<=0||vVolunteer==null){vFunc(null);return;}g_ajax.call("GetQuestionAnswerSet",{args:[vSurveyId,vQuestionId,vVolunteer],func:{success:function(vQuestionAnswerSet){var Qsts=null;if(vQuestionAnswerSet!=null){var parser=_getParser(vQuestionAnswerSet.question.type),Qsts={question:parser.fromServer(vQuestionAnswerSet.id,vQuestionAnswerSet.question),answer:vQuestionAnswerSet.answer};}vFunc(Qsts);}}});},getOnePage:function(vSurveyId,vFunc){if(vSurveyId==null||vSurveyId<=0){vFunc([]);return;}g_ajax.call("GetOnePage",{args:[vSurveyId],func:{success:function(vQuestionAnswerSets){if(vQuestionAnswerSets==null){vFunc(null);return;}var Qsts=[];var count=vQuestionAnswerSets.length;for(var i=0;i<count;i++){var qaset=vQuestionAnswerSets[i];if(qaset==null||qaset.question==null){continue;}var parser=_getParser(qaset.question.type),item={question:parser.fromServer(qaset.id,qaset.question),answer:qaset.answer};Qsts[Qsts.length]=item;}vFunc(Qsts);}}});},getOnePageByIndex:function(vSurveyId,vPageIndex,vFunc){if(vSurveyId==null||vSurveyId<=0||vPageIndex==null||vPageIndex<0){vFunc([]);return;}g_ajax.call("GetOnePageByIndex",{args:[vSurveyId,vPageIndex],func:{success:function(vQuestionAnswerSets){if(vQuestionAnswerSets==null){vFunc(null);return;}var Qsts=[];var count=vQuestionAnswerSets.length;for(var i=0;i<count;i++){var qaset=vQuestionAnswerSets[i];if(qaset==null||qaset.question==null){continue;}var parser=_getParser(qaset.question.type),item={question:parser.fromServer(qaset.id,qaset.question),answer:qaset.answer};Qsts[Qsts.length]=item;}vFunc(Qsts);}}});},saveQuestion:function(vSurveyId,vQuestion,vFunc){if(vQuestion==null){vFunc(false);return;}var parser=_getParser(vQuestion.type);if(parser==null){vFunc(false);return;}var qstToSave=parser.toServer(vQuestion);if(qstToSave==null){vFunc(false);return;}g_ajax.call("SaveQuestion",{args:[vSurveyId,qstToSave],func:{success:function(vIsSuccess){if(!vIsSuccess){NUI.Widget.Alert("保存题目出错，请稍后再试");}vFunc(vIsSuccess);}}});}};})(),Answer:(function(){return{saveAnswer:function(vSurveyId,vQuestionId,vAnswer,vFunc){var m_fun=vFunc?vFunc:function(){};if(vSurveyId<=null||vQuestionId<=0||vAnswer==null){vFunc(false);return;}g_ajax.call("SaveAnswer",{args:[vSurveyId,vQuestionId,vAnswer],func:{success:function(vIsSuccess){m_fun(vIsSuccess);}}});}};})()};})();NUI.Quill.Filler={Survey:{},Question:{}};NUI.Quill.Filler.Question={getQuestionFiller:function(vQuestion,vAnswer){},Base:function(vSecret){},Choice:function(vQuestion,vAnswer){},Matrix:function(vQuestion,vAnswer){},Input:function(vQuestion,vAnswer){},Rank:function(vQuestion,vAnswer){},Sort:function(vQuestion,vAnswer){},ConstSum:function(vQuestion,vAnswer){},Location:function(vQuestion,vAnswer){},MatrixInput:function(vQuestion,vAnswer){}};NUI.Quill.Filler.Question.getQuestionFiller=function(vQuestion,vAnswer){if(vQuestion==null){return null;}var type=vQuestion.type,typeValue=null,qType=NUI.Quill.Enum.QuestionType;NUI.Util.ObjectService.searchObject(qType,function(vName){if(qType[vName].id==type){typeValue=qType[vName].value;return true;}return false;});if(typeValue==null){return null;}return NUI.Quill.Filler.Question[typeValue](vQuestion,vAnswer);};NUI.Quill.Filler.Question.Base=(function(){var g_widget=NUI.Widget,g_enum=NUI.Quill.Enum,g_entity=NUI.Quill.Entity,g_render=NUI.Quill.Render.Question,g_prcs=NUI.Quill.Processor.Answer,g_dom=NUI.Util.DomService;return function(vSecret){var m_secret=vSecret||{},m_question=m_secret.question||g_entity.Question["Base"]();NUI.Util.ObjectService.annex(m_secret,{question:m_question,render:g_render.getQuestionRender(m_question,m_secret.answer,m_secret.attribute),prcs:g_prcs.getAnswerPrcs(m_question,m_secret.answer)});var that=g_widget.Base(m_secret),m_id=m_secret.id;var m_node=(function(){var retval=g_dom.createNode("div");m_secret.render.attachTo(retval);return retval;})();NUI.Util.ObjectService.annex(that,{nodeEntity:m_node,check:function(){return m_secret.prcs.check();},save:function(vSurveyId,vFunc){m_secret.prcs.save(vSurveyId,vFunc);},getAnswer:function(){if(m_secret.prcs==null){return null;}return m_secret.prcs.getAnswer();}});return that;};})();NUI.Quill.Filler.Question.Choice=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.CHOICE.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion,attribute:{openRandom:true}};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.CHOICE.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);m_prcs.setOther(vAnswer.other);}m_render.setOptEventHandler(function(vOptIndexes,vOtherValue){m_prcs.setAnswer(vOptIndexes);m_prcs.setOther(vOtherValue);});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.Matrix=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.MATRIX.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.MATRIX.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);m_prcs.setRowOther(vAnswer.rowOther);m_prcs.setColOther(vAnswer.colOther);}m_render.setOptEventHandler(function(vOptIndexes,vRotherValue,vCotherValue){m_prcs.setAnswer(vOptIndexes);m_prcs.setRowOther(vRotherValue);m_prcs.setColOther(vCotherValue);});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.Input=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.INPUT.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.INPUT.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);}var m_inputs=m_question.inputs,len=m_inputs.length;for(var i=0;i<len;i++){m_render.setInputBlurEventHandler(i,(function(vIndex){return function(vValue){m_prcs.updateAnswer(vIndex,vValue);};})(i));}NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.Rank=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.RANK.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_question=m_secret.question,m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.RANK.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);}var m_options=m_question.options,len=m_options.length;for(var i=0;i<len;i++){m_render.setOptEventHandler(i,(function(vIndex){return function(vValue){m_prcs.updateAnswer(vIndex,vValue);};})(i));}NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.Sort=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.SORT.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.SORT.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);}m_render.setOptEventHandler(function(vOptIndexes,vOtherValue){m_prcs.setAnswer(vOptIndexes);});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.ConstSum=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.CONSTSUM.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.CONSTSUM.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);}m_render.setOptEventHandler(function(vResults){m_prcs.setAnswer(vResults);});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.Location=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.LOCATION.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.LOCATION.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);}m_render.setOptEventHandler(function(vCountry,vProvince,vCity){m_prcs.setAnswer([{country:vCountry.id,province:vProvince.id,city:vCity.id}]);});NUI.Util.ObjectService.annex(that,{});return that;};})();NUI.Quill.Filler.Question.MatrixInput=(function(){var g_enum=NUI.Quill.Enum,g_ns=NUI.Quill.Filler.Question;return function(vQuestion,vAnswer){if(vQuestion==null||!(g_enum.QuestionType.MATRIXINPUT.id==vQuestion.type)){return null;}var m_secret={answer:vAnswer,question:vQuestion};var that=new g_ns.Base(m_secret),m_render=m_secret.render,m_prcs=m_secret.prcs;if(vAnswer!=null&&g_enum.QuestionType.MATRIXINPUT.id==vAnswer.type){m_prcs.setAnswer(vAnswer.answers);m_prcs.setRowOther(vAnswer.rowOther);m_prcs.setColOther(vAnswer.colOther);}m_render.setOptEventHandler(function(vOptValues,vRotherValue,vCotherValue){m_prcs.setAnswer(vOptValues);m_prcs.setRowOther(vRotherValue);m_prcs.setColOther(vCotherValue);});NUI.Util.ObjectService.annex(that,{});return that;};})();