var SIMPLE_CALLOUT_DIV="simpleCalloutDiv";var j$=jQuery.noConflict();var currentElementSimpleCallout;var timeAfterClose=0;var mousePosSimpleCallout={posX:0,posY:0};var closeTimeoutSimpleCallout;var timeForShow=2000;function simpleCalloutMouseOut(a){if(currentElementSimpleCallout){closeSimpleCallOutDiv();currentElementSimpleCallout=null}}function simpleCalloutMouseMove(a){a=a||window.event;if(a.pageX||a.pageY){mousePosSimpleCallout.posX=a.pageX;mousePosSimpleCallout.posY=a.pageY}if(a.clientX||a.clientY){mousePosSimpleCallout.posX=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;mousePosSimpleCallout.posY=a.clientY+document.body.scrollTop+document.documentElement.scrollTop}}function simpleCalloutMouseOverByObject(d,c,b){d=d||window.event;timeForShow=b;var a=document.getElementById("div"+c.id);if(a!=null){simpleCalloutMouseOver(d,"",a.innerHTML)}a=null}function simpleCalloutMouseOver(g,h,j,f){g=g||window.event;if(f){timeForShow=f}var c=new Date().getTime();if((c-timeAfterClose)<200){return}var b=j$("#"+SIMPLE_CALLOUT_DIV);var d=(g.target||g.srcElement);if(b!=null&&b.is(":visible")&&currentElementSimpleCallout==d){return}currentElementSimpleCallout=d;var a=(h==null?"":h);var i=(j==null?"":j);if(b==null||b.length==0){initPipingCalloutDialog()}showSimpleCallout(a,i);c=b=d=a=i=null}function showSimpleCallout(b,a){showCalloutTimeout(b,a)}function setSimpleCalloutData(b,a){j$("#calloutHeaderSpan").html(b);j$("#calloutTextDiv").html(a)}function showCalloutTimeout(b,a){setTimeout(function(){showCalloutNearCursor(b,a)},500)}function showCalloutNearCursor(d,a){setSimpleCalloutData(d,a);var c=mousePosSimpleCallout.posX+"px";var b=(mousePosSimpleCallout.posY+20)+"px";j$("#"+SIMPLE_CALLOUT_DIV).css({top:b,left:c}).show();closeSimpleCallOutDivTimeOut();c=b=null}function initPipingCalloutDialog(){appendPipingCalloutDiv()}function appendPipingCalloutDiv(){j$("body").append('<div style="border: 1px gray solid; display: none; z-index: 900; position: absolute; min-height:0;" id="'+SIMPLE_CALLOUT_DIV+'" class="flora ui-dialog-content calloutMainDiv"><table cellpadding="3" cellspacing="0" bgcolor="white" ><tbody><tr class="calloutHeaderTr"><td align="left"><span id="calloutHeaderSpan" style="padding-left:3px;"></span></td><td align="right"><a id="pipingCalloutCloseElement" onclick="closeSimpleCallOutDiv();" class="pipingCalloutCloseA">X</a></td></tr><tr><td colspan="2"><div id="calloutTextDiv" class="calloutTextDiv"></div></td></tr></tbody></table></div>')}function closeSimpleCallOutDiv(){timeAfterClose=new Date().getTime();j$("#"+SIMPLE_CALLOUT_DIV).hide()}function closeSimpleCallOutDivTimeOut(){if(closeTimeoutSimpleCallout!=null){clearTimeout(closeTimeoutSimpleCallout)}closeTimeoutSimpleCallout=setTimeout(function(){closeSimpleCallOutDiv()},timeForShow)};
String.prototype.trim=function(){return this.leftTrim().rightTrim()};String.prototype.leftTrim=function(){return this.replace(/^\s*(.*)/,"$1")};String.prototype.rightTrim=function(){return this.replace(/^(.*\S)(\s*)$/,"$1")};function StringBuffer(){this.buffer=[]}StringBuffer.prototype.append=function append(a){this.buffer.push(a);return this};StringBuffer.prototype.toString=function toString(){return this.buffer.join("")};
var version=0;if(navigator.appVersion.indexOf("MSIE")!=-1){temp=navigator.appVersion.split("MSIE");version=parseFloat(temp[1])}var is_IE=false;if(version>=5.5){is_IE=true}function isPressedEnter(a){try{if(is_IE){a=window.event;try{if(a!="undefined"&&a.keyCode!="undefined"&&a.keyCode==13){return true}}catch(b){alert(b)}}else{event=a;if(event!=null&&event!="undefined"&&event.keyCode!="undefined"&&event.keyCode==13){return true}}}catch(b){alert(b)}return false}function isPressedTab(a){try{if(is_IE){a=window.event;try{if(a!="undefined"&&a.keyCode!="undefined"&&a.keyCode==9){return true}}catch(b){alert(b)}}else{event=a;if(event!=null&&event!="undefined"&&event.keyCode!="undefined"&&event.keyCode==9){return true}}}catch(b){alert(b)}return false};
function MM_HideLayer(b,c){var d=document.getElementById(b);if(d!=null){var a=(c)?"hidden":"visible";d.style.visibility=a}}function MM_preloadImages(){var g=document;if(g.images){if(!g.MM_p){g.MM_p=new Array()}var f,c=g.MM_p.length,b=MM_preloadImages.arguments;for(f=0;f<b.length;f++){if(b[f].indexOf("#")!=0){try{g.MM_p[c]=new Image();g.MM_p[c++].src=b[f]}catch(e){}}}}}function MM_swapImgRestore(){var d,b,c=document.MM_sr;for(d=0;c&&d<c.length&&(b=c[d])&&b.oSrc;d++){b.src=b.oSrc}}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&document.getElementById){a=document.getElementById(f)}return a}function MM_swapImage(){var e,d=0,b,c=MM_swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2]}}};
var result_ROW_LOGIC=true;var isOnlyValidate_ROW_LOGIC=true;var errors_ROW_LOGIC="";var rowLogicRegExp=new RegExp("Q(\\d+)(?:.A(\\?|\\d+|\\*))?(?:.C(\\d+))?((<>|==)[^\\s]+)?");var parser_ROW_LOGIC={isVoted_ROW_LOGIC:function(f){var c=rowLogicRegExp.exec(f);var a=c[1];var d=c[2];var e=c[3];var b=c[4];if(a==""||isNaN(a)){a=null}if(d==""||isNaN(d)){d=null}if(e==""||isNaN(e)){e=null}if(e!=null&&d!=null&&e.length>0){e=parseInt(e)-1}return validateRequiredElement(a,d,e,b)},validateBySurveyStructure_ROW_LOGIC:function(f){var c=rowLogicRegExp.exec(f);var a=c[1];var d=c[2];var e=c[3];var b=c[4];if(a==""||isNaN(a)){a=null}if(d==""||isNaN(d)){d=null}if(e==""||isNaN(e)){e=null}return validateRequiredElementBySurveyStructure(a,d,e,b)}};function getErrors_ROW_LOGIC(){return errors_ROW_LOGIC}function checkExpression_ROW_LOGIC(a){if(isOnlyValidate_ROW_LOGIC){return parser_ROW_LOGIC.validateBySurveyStructure_ROW_LOGIC(a)}else{return parser_ROW_LOGIC.isVoted_ROW_LOGIC(a)}}function saveResult_ROW_LOGIC(a){result_ROW_LOGIC=a}function parseExpressionLogic_ROW_LOGIC(e,a){isOnlyValidate_ROW_LOGIC=a;result_ROW_LOGIC=true;var c=new Array();var b=new Array();var d=0;if((d=__ROW_LOGICparse(e,c,b))>0){result_ROW_LOGIC=false;for(i=0;i<d;i++){errors_ROW_LOGIC+='Parse error near "'+e.substr(c[i])+'", expecting "'+b[i].join()+'"\n'}}return result_ROW_LOGIC}var ROW_LOGIC_dbg_withparsetree=false;var ROW_LOGIC_dbg_withtrace=false;var ROW_LOGIC_dbg_withstepbystep=false;function __ROW_LOGICdbg_print(a){alert(a)}function __ROW_LOGICdbg_wait(){}function __ROW_LOGIClex(d){var c=0;var a=-1;var b=0;var f=0;var e=d.offset+1;do{e--;c=0;a=-2;f=e;if(d.src.length<=f){return 12}do{switch(c){case 0:if((d.src.charCodeAt(e)>=9&&d.src.charCodeAt(e)<=10)||d.src.charCodeAt(e)==13||d.src.charCodeAt(e)==32){c=1}else{if(d.src.charCodeAt(e)==33){c=2}else{if(d.src.charCodeAt(e)==40){c=3}else{if(d.src.charCodeAt(e)==41){c=4}else{if(d.src.charCodeAt(e)==38){c=9}else{if(d.src.charCodeAt(e)==65||d.src.charCodeAt(e)==97){c=11}else{if(d.src.charCodeAt(e)==78||d.src.charCodeAt(e)==110){c=12}else{if(d.src.charCodeAt(e)==79||d.src.charCodeAt(e)==111){c=13}else{if(d.src.charCodeAt(e)==81||d.src.charCodeAt(e)==113){c=14}else{if(d.src.charCodeAt(e)==124){c=15}else{c=-1}}}}}}}}}}break;case 1:c=-1;a=1;b=e;break;case 2:c=-1;a=8;b=e;break;case 3:c=-1;a=2;b=e;break;case 4:c=-1;a=3;b=e;break;case 5:c=-1;a=7;b=e;break;case 6:c=-1;a=6;b=e;break;case 7:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=7}else{if(d.src.charCodeAt(e)==46){c=18}else{if(d.src.charCodeAt(e)==60){c=19}else{if(d.src.charCodeAt(e)==61){c=20}else{c=-1}}}}a=5;b=e;break;case 8:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=31)||(d.src.charCodeAt(e)>=33&&d.src.charCodeAt(e)<=254)){c=8}else{c=-1}a=4;b=e;break;case 9:if(d.src.charCodeAt(e)==38){c=5}else{c=-1}break;case 10:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=10}else{if(d.src.charCodeAt(e)==60){c=19}else{if(d.src.charCodeAt(e)==61){c=20}else{c=-1}}}a=5;b=e;break;case 11:if(d.src.charCodeAt(e)==78||d.src.charCodeAt(e)==110){c=16}else{c=-1}break;case 12:if(d.src.charCodeAt(e)==79||d.src.charCodeAt(e)==111){c=17}else{c=-1}break;case 13:if(d.src.charCodeAt(e)==82||d.src.charCodeAt(e)==114){c=6}else{c=-1}break;case 14:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=7}else{c=-1}break;case 15:if(d.src.charCodeAt(e)==124){c=6}else{c=-1}break;case 16:if(d.src.charCodeAt(e)==68||d.src.charCodeAt(e)==100){c=5}else{c=-1}break;case 17:if(d.src.charCodeAt(e)==84||d.src.charCodeAt(e)==116){c=2}else{c=-1}break;case 18:if(d.src.charCodeAt(e)==67||d.src.charCodeAt(e)==99){c=21}else{if(d.src.charCodeAt(e)==65||d.src.charCodeAt(e)==97){c=25}else{c=-1}}break;case 19:if(d.src.charCodeAt(e)==62){c=22}else{c=-1}break;case 20:if(d.src.charCodeAt(e)==61){c=22}else{c=-1}break;case 21:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=10}else{c=-1}break;case 22:if((d.src.charCodeAt(e)>=0&&d.src.charCodeAt(e)<=31)||(d.src.charCodeAt(e)>=33&&d.src.charCodeAt(e)<=254)){c=8}else{c=-1}break;case 23:if(d.src.charCodeAt(e)==67||d.src.charCodeAt(e)==99){c=21}else{c=-1}break;case 24:if(d.src.charCodeAt(e)==60){c=19}else{if(d.src.charCodeAt(e)==61){c=20}else{if(d.src.charCodeAt(e)==46){c=23}else{if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=24}else{c=-1}}}}a=5;b=e;break;case 25:if((d.src.charCodeAt(e)>=48&&d.src.charCodeAt(e)<=57)){c=24}else{c=-1}break}e++}while(c>-1)}while(1>-1&&a==1);if(a>-1){d.att=d.src.substr(f,b-f);d.offset=b}else{d.att=new String();a=-1}return a}function __ROW_LOGICparse(a,v,w){var c=new Array();var r=new Array();var k=0;var u;var l;var m;var y;var n=new Function("","var offset; var src; var att;");var s=new n();var b=new Function("","var sym; var att; var child;");var j=new Array();var e=new Array();var d=null;var q=new Array(new Array(0,1),new Array(10,1),new Array(9,3),new Array(9,3),new Array(9,2),new Array(9,3),new Array(9,1),new Array(11,1),new Array(11,1));var g=new Array(new Array(8,3,2,4,4,6,5,7),new Array(12,0),new Array(7,8,6,9,12,-1),new Array(8,3,2,4,4,6,5,7),new Array(8,3,2,4,4,6,5,7),new Array(12,-6,6,-6,7,-6,3,-6),new Array(12,-7,6,-7,7,-7,3,-7),new Array(12,-8,6,-8,7,-8,3,-8),new Array(8,3,2,4,4,6,5,7),new Array(8,3,2,4,4,6,5,7),new Array(7,-4,6,-4,12,-4,3,-4),new Array(7,8,6,9,3,14),new Array(7,8,6,-3,12,-3,3,-3),new Array(7,8,6,-2,12,-2,3,-2),new Array(12,-5,6,-5,7,-5,3,-5));var o=new Array(new Array(10,1,9,2,11,5),new Array(),new Array(),new Array(9,10,11,5),new Array(9,11,11,5),new Array(),new Array(),new Array(),new Array(9,12,11,5),new Array(9,13,11,5),new Array(),new Array(),new Array(),new Array(),new Array());var t=new Array("p'","^","(",")","EXPRESSION_TEXT","EXPRESSION","OR","AND","NOT","expr","p","expr_complex","$");s.offset=0;s.src=a;s.att=new String();if(!v){v=new Array()}if(!w){w=new Array()}c.push(0);r.push(0);m=__ROW_LOGIClex(s);while(true){u=16;for(var p=0;p<g[c[c.length-1]].length;p+=2){if(g[c[c.length-1]][p]==m){u=g[c[c.length-1]][p+1];break}}if(ROW_LOGIC_dbg_withtrace&&c.length>0){__ROW_LOGICdbg_print("\nState "+c[c.length-1]+"\n\tLookahead: "+t[m]+' ("'+s.att+'")\n\tAction: '+u+'\n\tSource: "'+s.src.substr(s.offset,30)+((s.offset+30<s.src.length)?"...":"")+'"\n\tStack: '+c.join()+"\n\tValue stack: "+r.join()+"\n");if(ROW_LOGIC_dbg_withstepbystep){__ROW_LOGICdbg_wait()}}if(u==16){if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("Error detected: There is no reduce or shift on the symbol "+t[m])}k++;v.push(s.offset-s.att.length);w.push(new Array());for(var p=0;p<g[c[c.length-1]].length;p+=2){w[w.length-1].push(t[g[c[c.length-1]][p]])}var f=new Array();var x=new Array();for(var p=0;p<c.length;p++){f[p]=c[p];x[p]=r[p]}while(u==16&&m!=12){if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tError recovery\nCurrent lookahead: "+t[m]+" ("+s.att+")\nAction: "+u+"\n\n")}if(m==-1){s.offset++}while(u==16&&c.length>0){c.pop();r.pop();if(c.length==0){break}u=16;for(var p=0;p<g[c[c.length-1]].length;p+=2){if(g[c[c.length-1]][p]==m){u=g[c[c.length-1]][p+1];break}}}if(u!=16){break}for(var p=0;p<f.length;p++){c.push(f[p]);r.push(x[p])}m=__ROW_LOGIClex(s)}if(u==16){if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tError recovery failed, terminating parse process...")}break}if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tError recovery succeeded, continuing")}}if(u>0){if(ROW_LOGIC_dbg_withparsetree){var h=new b();h.sym=t[m];h.att=s.att;h.child=new Array();e.push(j.length);j.push(h)}if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("Shifting symbol: "+t[m]+" ("+s.att+")")}c.push(u);r.push(s.att);m=__ROW_LOGIClex(s);if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tNew lookahead symbol: "+t[m]+" ("+s.att+")")}}else{u*=-1;if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("Reducing by producution: "+u)}y=void (0);if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tPerforming semantic action...")}switch(u){case 0:y=r[r.length-1];break;case 1:saveResult_ROW_LOGIC(r[r.length-1]);break;case 2:y=r[r.length-3]||r[r.length-1];break;case 3:y=r[r.length-3]&&r[r.length-1];break;case 4:y=(isOnlyValidate_ROW_LOGIC?r[r.length-1]:!r[r.length-1]);break;case 5:y=r[r.length-2];break;case 6:y=checkExpression_ROW_LOGIC(r[r.length-1]);break;case 7:y=r[r.length-1];break;case 8:y=r[r.length-1];break}if(ROW_LOGIC_dbg_withparsetree){d=new Array()}if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tPopping "+q[u][1]+" off the stack...")}for(var p=0;p<q[u][1];p++){if(ROW_LOGIC_dbg_withparsetree){d.push(e.pop())}c.pop();r.pop()}l=-1;for(var p=0;p<o[c[c.length-1]].length;p+=2){if(o[c[c.length-1]][p]==q[u][0]){l=o[c[c.length-1]][p+1];break}}if(ROW_LOGIC_dbg_withparsetree){var h=new b();h.sym=t[q[u][0]];h.att=new String();h.child=d.reverse();e.push(j.length);j.push(h)}if(u==0){break}if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\tPushing non-terminal "+t[q[u][0]])}c.push(l);r.push(y)}}if(ROW_LOGIC_dbg_withtrace){__ROW_LOGICdbg_print("\nParse complete.")}if(ROW_LOGIC_dbg_withparsetree){if(k==0){__ROW_LOGICdbg_print("\n\n--- Parse tree ---");__ROW_LOGICdbg_parsetree(0,j,e)}else{__ROW_LOGICdbg_print("\n\nParse tree cannot be viewed. There where parse errors.")}}return k}function __ROW_LOGICdbg_parsetree(b,c,a){var f=new String();for(var e=0;e<a.length;e++){f="";for(var d=b;d>0;d--){f+="\t"}f+=c[a[e]].sym;if(c[a[e]].att!=""){f+=" >"+c[a[e]].att+"<"}__ROW_LOGICdbg_print(f);if(c[a[e]].child.length>0){__ROW_LOGICdbg_parsetree(b+1,c,c[a[e]].child)}}};
BigNumber=function(e,c,b){var d=this,a;if(e instanceof BigNumber){for(a in {precision:0,roundType:0,_s:0,_f:0}){d[a]=e[a]}d._d=e._d.slice();return}d.precision=isNaN(c=Math.abs(c))?BigNumber.defaultPrecision:c;d.roundType=isNaN(b=Math.abs(b))?BigNumber.defaultRoundType:b;d._s=(e+="").charAt(0)=="-";d._f=((e=e.replace(/[^\d.]/g,"").split(".",2))[0]=e[0].replace(/^0+/,"")||"0").length;for(a=(e=d._d=(e.join("")||"0").split("")).length;a;e[--a]=+e[a]){}d.round()};with({$:BigNumber,o:BigNumber.prototype}){$.ROUND_HALF_EVEN=($.ROUND_HALF_DOWN=($.ROUND_HALF_UP=($.ROUND_FLOOR=($.ROUND_CEIL=($.ROUND_DOWN=($.ROUND_UP=0)+1)+1)+1)+1)+1)+1;$.defaultPrecision=5;$.defaultRoundType=$.ROUND_HALF_UP;o.add=function(f){if(this._s!=(f=new BigNumber(f))._s){var m=this.abs();var h=f.abs();if(m.compare(h)+1){var k=m.subtract(h);return k.setSing(this._s)}else{var k=h.subtract(m);return k.setSing(f._s)}}var e=new BigNumber(this),p=e._d,l=f._d,g=e._f,d=f._f,f=Math.max(g,d),j,c;g!=d&&((d=g-d)>0?e._zeroes(l,d,1):e._zeroes(p,-d,1));j=(g=p.length)==(d=l.length)?p.length:((d=g-d)>0?e._zeroes(l,d):e._zeroes(p,-d)).length;for(c=0;j;c=(p[--j]=p[j]+l[j]+c)/10>>>0,p[j]%=10){}return c&&++f&&p.unshift(c),e._f=f,e.round()};o.subtract=function(g){if(this._s!=(g=new BigNumber(g))._s){return g._s^=1,this.add(g)}var e=new BigNumber(this),p=e.abs().compare(g.abs())+1,r=p?e:g,q=p?g:e,h=r._f,f=q._f,m=h,l,k;r=r._d,q=q._d,h!=f&&((f=h-f)>0?e._zeroes(q,f,1):e._zeroes(r,-f,1));for(l=(h=r.length)==(f=q.length)?r.length:((f=h-f)>0?e._zeroes(q,f):e._zeroes(r,-f)).length;l;){if(r[--l]<q[l]){for(k=l;k&&!r[--k];r[k]=9){}--r[k],r[l]+=10}q[l]=r[l]-q[l]}return p||(e._s=g._s),e._f=m,e._d=q,e.round()};o.multiply=function(f){var d=new BigNumber(this),c=d._d.length>=(f=new BigNumber(f))._d.length,m=(c?d:f)._d,l=(c?f:d)._d,g=m.length,e=l.length,p=new BigNumber,k,h,q;for(k=e;k;c&&q.unshift(c),p.set(p.add(new BigNumber(q.join(""))))){for(q=(new Array(e- --k)).join("0").split(""),c=0,h=g;h;c+=m[--h]*l[k],q.unshift(c%10),c=(c/10)>>>0){}}return d._f=((c=g+e-d._f-f._f)>=(h=(d._d=p._d).length)?this._zeroes(d._d,c-h+1,1).length:h)-c,d.round()};o.divide=function(k){if((k=new BigNumber(k))=="0"){throw new Error("Division by 0")}else{if(this=="0"){return new BigNumber}}var g=new BigNumber(this),z=g._d,x=k._d,m=z.length-g._f,h=x.length-k._f,d=new BigNumber,t=0,q,A,p,u=1,w=0,v=0;d._s=g._s!=k._s,d.precision=Math.max(g.precision,k.precision),d._f=+d._d.pop(),m!=h&&g._zeroes(m>h?x:z,Math.abs(m-h));k._f=x.length,x=k,x._s=false,x=x.round();for(k=new BigNumber;z[0]=="0";z.shift()){}out:do{for(p=w=0,k=="0"&&(k._d=[],k._f=0);t<z.length&&k.compare(x)==-1;++t){(p=t+1==z.length,(!u&&++w>1||(v=p&&k=="0"&&z[t]=="0")))&&(d._f==d._d.length&&++d._f,d._d.push(0));(z[t]=="0"&&k=="0")||(k._d.push(z[t]),++k._f);if(v){break out}if((p&&k.compare(x)==-1&&(d._f==d._d.length&&++d._f,1))||(p=0)){while(d._d.push(0),k._d.push(0),++k._f,k.compare(x)==-1){}}}if(u=0,k.compare(x)==-1&&!(p=0)){while(p?d._d.push(0):p=1,k._d.push(0),++k._f,k.compare(x)==-1){}}for(A=new BigNumber,q=0;k.compare(y=A.add(x))+1&&++q;A.set(y)){}k.set(k.subtract(A)),!p&&d._f==d._d.length&&++d._f,d._d.push(q)}while((t<z.length||k!="0")&&(d._d.length-d._f)<=d.precision);return d.round()};o.mod=function(a){return this.subtract(this.divide(a).intPart().multiply(a))};o.pow=function(c){var b=new BigNumber(this),a;if((c=(new BigNumber(c)).intPart())==0){return b.set(1)}for(a=Math.abs(c);--a;b.set(b.multiply(this))){}return c<0?b.set((new BigNumber(1)).divide(b)):b};o.set=function(a){return this.constructor(a),this};o.compare=function(k){var e=this,j=this._f,c=new BigNumber(k),h=c._f,g=[-1,1],f,d;if(e._s!=c._s){return e._s?-1:1}if(j!=h){return g[(j>h)^e._s]}for(j=(e=e._d).length,h=(c=c._d).length,f=-1,d=Math.min(j,h);++f<d;){if(e[f]!=c[f]){return g[(e[f]>c[f])^e._s]}}return j!=h?g[(j>h)^e._s]:0};o.negate=function(){var a=new BigNumber(this);return a._s^=1,a};o.abs=function(){var a=new BigNumber(this);return a._s=0,a};o.setSing=function(a){var b=new BigNumber(this);return b._s=a,b};o.intPart=function(){return new BigNumber((this._s?"-":"")+(this._d.slice(0,this._f).join("")||"0"))};o.valueOf=o.toString=function(){var a=this;return(a._s?"-":"")+(a._d.slice(0,a._f).join("")||"0")+(a._f!=a._d.length?"."+a._d.slice(a._f).join(""):"")};o._zeroes=function(d,a,b){var c=["push","unshift"][b||0];for(++a;--a;d[c](0)){}return d};o.round=function(){if("_rounding" in this){return this}var f=BigNumber,e=this.roundType,c=this._d,h,g,i,a;for(this._rounding=true;this._f>1&&!c[0];--this._f,c.shift()){}for(h=this._f,g=this.precision+h,i=c[g];c.length>h&&!c[c.length-1];c.pop()){}a=(this._s?"-":"")+(g-h?"0."+this._zeroes([],g-h-1).join(""):"")+1;if(c.length>g){i&&(e==f.DOWN?false:e==f.UP?true:e==f.CEIL?!this._s:e==f.FLOOR?this._s:e==f.HALF_UP?i>=5:e==f.HALF_DOWN?i>5:e==f.HALF_EVEN?i>=5&&c[g-1]&1:false)&&this.add(a);c.splice(g,c.length-g)}return delete this._rounding,this}};
var isValidClickSubmit=false;var isValidClickBackNext=false;var isValidInverseSelectGoTo=false;var isValidClickGo=false;var questionForms=[];var showBeforeAlert=true;var blurObj=null;var timeOutForAlerts=new Date().getMilliseconds();var noScrollBrowser=false;var scrollToQuestion=null;var debug=false;var _current_form=null;var validationErrorHighliteElements=[];var validationError3dAllRows=[];var validationErrorElement=null;var validationErrorAlert=null;var isPreviewMode=false;var selTN="SELECT";var inpTN="INPUT";var j$=jQuery.noConflict();j$.fn.switchClass1=function(b,a){j$(this).removeClass(b).addClass(a)};function scrollToSomeQuestion(){var a=scrollToQuestion;if(a==null||a.length==0){return}if(a.charAt(0)=="#"){a=a.substring(1)}var b=document.getElementById(a);if(b==null){return}window.location.hash=a}function disableShowBeforeAlert(){showBeforeAlert=false}function getShowBeforeAlert(){return showBeforeAlert}function fillForms(){if(document.theForm==null||(questionForms!=null&&questionForms.length>0)){return}var g=document.forms;var f=g.length;for(var b=0;b<f;b++){var a=g[b];for(var c=0;c<a.length;c++){var e=a[c];var h=findQID(e.name);if(h<=0){continue}var d=questionForms[h];if(d==null||d.length==0){d=[];questionForms[h]=d}d[d.length]=e}}}function findForm(b){if(questionForms.length==0){fillForms()}var c=0;var d="Question";if(b.indexOf(d)==0){c=parseInt(b.substring(d.length))}isNaN(c)&&alert("findForm("+b+"),\n index==isNaN <= "+b.substring(d.length));var a=questionForms[c];return(a==null||a.length==0)?[]:a}function openLink(b){if(b!=null&&b.length>0){var a="new"+(Math.round(Math.random()*1000000));OpenWindow=window.open(b,a,"");OpenWindow.focus()}}function removeLeadingZeroes(c){c=""+c;c=j$.trim(c);var b=(c.indexOf("-")==0);while(c.indexOf("-")==0){c=c.substring(1)}if(c!=null&&c.length>0){if(c.search("^0+$")==0){return"0"}var a=c.replace(/^(0+)(.*)$/,"$2");if(a==null||a.length==0){return"0"}if(a.indexOf(".")==0){a="0"+a}if(b){a="-"+a}if(a==0){a="0"}return a}return(b)?"0":""}function transform(c){var a=0;var b="";if(c!=null&&c.length>0){while(a<c.length){if(c.charCodeAt(a)==39){b+="&#39;"}else{if(c.charCodeAt(a)==38){b+="&#38;"}else{b+=c.charAt(a)}}a++}}return b}function findQID(a){if(a==null||a.length==0){return"0"}var c=a.replace(/(R|other|total)(\d+)(_\d+(_\d+)?)?/,"$2");var b=parseInt(c);if(isNaN(b)){return 0}return b}function findAID(a){if(a==null||a.length==0){return 0}var c=a.replace(/[a-z]+\d+(_(\d+)(_\d+)?)?/i,"$2");var b=parseInt(c);if(isNaN(b)){return 0}return b}function processRadio(b,d){var c=j$(b);if(c.is(":radio")){if(d&&c.data("tallinn")){c.removeAttr("checked");c.data("tallinn",false);var e=getTextForRadio(b);if(e){e.value=""}}else{j$('input[name="'+c.attr("name")+'"]',j$(b.form)).data("tallinn",false);c.data("tallinn",true)}}}function moveRadio(c,b,h,j,a,e){if(b!=null&&h!=null){var f=0;var g=findForm(c);while(f<g.length){var d=g[f];if(e!=null&&d.form.name!=e.form.name){f++;continue}if(d!=null&&d.name!=null&&d.name.indexOf(b)==0&&d.value==h&&(e==null||d.form.name==e.form.name)){if(!a&&d.checked){if(debug){alert("moveRadio=checked.false")}d.checked=false}else{if(debug){alert("moveRadio=checked.true")}d.checked=true}if(j){if(debug){alert("moveRadio=checked.true")}d.checked=true}processRadio(d,!j)}f++}}}var formQuestions=[];function fillFormQuestions(){if(formQuestions.theForm!=null){return}var d=document.forms;var b=[];fillFormQuestionsArrayByForm(d[0],b);formQuestions[d[0].name]=b;for(var a=1;a<d.length;a++){var c=[];fillFormQuestionsArrayByForm(d[a],c);formQuestions[d[a].name]=c}}function fillFormQuestionsArrayByForm(d,f){var b=d.elements;for(var c=0;c<b.length;c++){var e=findQID(b[c].name);if(!isNaN(e)&&e>0){var a=f[e];if(a==null){a=[]}a.push(b[c]);f[e]=a}}}function findQuestionElementsOnForm(d,c){fillFormQuestions();var b;if(c==null){b="theForm"}else{b=c.name}var a=formQuestions[b];if(a==null){return[]}else{if(a[d]==null){return[]}return a[d]}}function validateOtherState(c,b){var h=findQuestionElementsOnForm(c,_current_form);var j=0;var e;var a=[];for(var g=0;g<h.length;g++){var d=h[g];var k;if(d.name.indexOf("other"+c)==0){k=findAID(d.name);if(isNaN(k)||k<=0){continue}j=k;e=d}else{k=d.value;a[k]=d}}if(e!=null&&e.value.length==0){var f=a[j];if(f!=null&&f.checked){beforeSubmitErrorAlert(b,e,c);return false}}return true}function validateDependent3DMatrix(f,c,j,n,m){if(j){if(!validateRequiredGeneral(f,c,m)){return false}}var k=0;var o=findQuestionElementsOnForm(f,_current_form);var l=new Object();var h=false;for(k=o.length-1;k>=0;k-=1){var e=o[k];if(e==null){break}var g=e.name;if(g==null){break}var a=g.toUpperCase();var q=e.tagName;var d=q!=null&&(q.toUpperCase().indexOf(inpTN)>=0&&(a.indexOf("CHECK")>=0||a.indexOf("RADIO")>=0)&&e.checked||q.toUpperCase().indexOf(selTN)>=0&&e.selectedIndex>0||a.indexOf("OTHER")>=0&&a.indexOf("CHECK")<0&&a.indexOf("RADIO")<0&&e.value!=null&&e.value.length>0);var b=getAnswer(g);if(l[b]==null){l[b]=d}else{if(d){l[b]=d}}if(d){h=true}}if(!h&&!j){return true}for(var p in l){if(!l[p]){pleaseAnswerAllRowsErrorAlert(m,c,e,f);return false}}return true}function addElementForHighlite3dMatrixAllRows(b,a){var c=findElementForHiglite(b,a);if(c!=null){validationError3dAllRows.push(c)}}function getAnswer(a){return a.replace(/other\d+_(\d+)(_.*)?/i,"$1")}function checkMandatoryAnswersNormal(e,b,d){var a=false;for(var c=0;c<b.length;c++){a|=!checkMandatoryAnswered(e,b[c])}a&&reactionOnMandatoryAnswerError(e,d);return a}function checkMandatoryAnswers360Internal(e,g,b,d){var a=false;for(var c=0;c<b.length;c++){var f=true;e.each(function(){f&=checkMandatoryAnswered(g,b[c],j$(this))});a|=!f}a&&reactionOnMandatoryAnswerError(g,d);return a}function checkMandatoryAnswers360(c,d,a,b){return isQuestionInGeneralSection(d)?checkMandatoryAnswers360Internal(j$("[name='theForm']"),d,a,b):checkMandatoryAnswers360Internal(c,d,a,b)}function checkMandatoryAnswers(d,a,c){var b=j$("tr.trWithRespInputs");return b.length?checkMandatoryAnswers360(b,d,a,c):checkMandatoryAnswersNormal(d,a,c)}function checkMandatoryAnswered(e,c,a){var b=a?j$("[name*='"+e+"_"+c+"']",a):j$("[name*='"+e+"_"+c+"']");if(!b.length){return true}var d=false;b.each(function(){var i=j$(this);var g=this.tagName.toUpperCase();if(g==selTN){d|=(j$.trim(i.val()).length>0)}else{var h=i.attr("type");if(h){h=h.toLowerCase()}if(h=="radio"||h=="checkbox"){d|=(i.is(":checked"))}else{d|=(j$.trim(i.val()).length>0)}}});var f=a?j$("[id^='AnswerElementTd"+e+"_"+c+"']",a):j$("#AnswerElementTd"+e+"_"+c);return markupMandatoryAnswer(f,d)}function markupMandatoryAnswer(a,b){if(b){a.switchClass1("MandatoryAnswerError","MandatoryAnswerNormal")}else{a.switchClass1("MandatoryAnswerNormal","MandatoryAnswerError")}return b}function checkMustAnswerAllFields3D(e,a,c){var b=j$("tr[id^='trForm']");if(b.length){var d=true;b.each(function(){d&=checkAnsweredAllFields3DFull(e,a)});if(!d){reactionOnErrorMustAnswerAllFields3D(e,c);return true}}else{if(!checkAnsweredAllFields3DFull(e,a)){reactionOnErrorMustAnswerAllFields3D(e,c);return true}}return false}function checkAnsweredAllFields3DFull(d,a){var c=true;for(var b=0;b<a.length;b++){c&=checkAnsweredAllFields3D(j$("[name*='"+d+"_"+a[b]+"']"))}return c}function checkAnsweredAllFields3D(b){var d=true;var e=false;var c=false;var a=[];b.each(function(){var i=j$(this);var h=j$(this.parentNode);var f=this.tagName.toUpperCase();if(f==selTN){d&=markupMustAnswerAllFields3D(h,(j$.trim(i.val()).length>0))}else{var g=i.attr("type");if(g){g=g.toLowerCase()}if(g=="radio"){c=true;a.push(h);e|=i.is(":checked")}else{d&=markupMustAnswerAllFields3D(h,(j$.trim(i.val()).length>0))}}});if(c){d&=markupMustAnswerAllFields3DPickOne(a,e)}return d}function markupMustAnswerAllFields3DPickOne(b,a){j$.each(b,function(){markupMustAnswerAllFields3D(this,a)});return a}function markupMustAnswerAllFields3D(b,a){if(a){b.switchClass1("MustAnswerAllFields3DError","MustAnswerAllFields3DNormal")}else{b.switchClass1("MustAnswerAllFields3DNormal","MustAnswerAllFields3DError")}return a}function validateRequiredGeneral(c,b,e,a){if(!isQuestionExistInForm(c,_current_form)){return true}var d=a!=null&&a.length>0;if(!d&&validateRequiredGeneralSilent(c)){return true}else{if(d){if(validateRequiredConditional(a)){if(validateRequiredGeneralSilent(c)){return true}}else{return true}}}reactionOnError(c,b);return false}function addElementForHighlite(b,a){var c=findElementForHiglite(b,a);if(c!=null){validationErrorHighliteElements.push(c)}}function isQuestionExistInForm(b,a){return findQuestionElementsOnForm(b,_current_form).length>0}function findElementForHiglite(e,d){var f=e.name.substr(7);if(f==null||isNaN(f)){return null}var c=[];c.push("tdAnswersCellForm"+f+"Id"+d);c.push("questionMainTableId"+d+"_Form"+f);c.push("QuestionAnswersTableId"+d+"_Form"+f);for(var b=0;b<c.length;b++){var a=document.getElementById(c[b]);if(a!=null){return a}}}function validateRequiredConditional(a){return parseExpressionLogic_ROW_LOGIC(a,false)}function validateRequiredGeneralSilent(d){var e=findQuestionElementsOnForm(d,_current_form);var b=e.length;while(b>=0){b-=1;var c=e[b];if(c==null){break}var a=c.name;if(a==null){break}if(a.indexOf("R"+d)==0){focus_obj=c;if(c.value!=0&&c.checked){return true}if(c.selectedIndex>0){return true}for(ii=1;c.options!=null&&ii<c.options.length;ii++){if(c.options[ii].selected){return true}}if(c.tagName!=null&&c.tagName.toUpperCase().indexOf(selTN)>=0&&parseInt(c.value,10)>0){return true}}else{if(a.indexOf("other"+d)==0){if(a.search(/radio|check/)>=0){if(c.checked){return true}}else{if(c.value!=null&&c.value.length>0){if(c.className!="inputPickOneComment"){return true}}if(c.tagName!=null&&c.tagName.toUpperCase().indexOf(selTN)>=0&&c.selectedIndex>0){return true}}}}}return false}function validateRequiredElement(b,j,k,d){b=parseInt(b);j=parseInt(j);k=parseInt(k);if(isNaN(b)){b=null}if(isNaN(j)){j=null}if(isNaN(k)){k=null}if(d==""){d=null}var h=findQuestionElementsOnForm(b,_current_form);if(_current_form!=null&&h!=null&&h.length==0){h=findQuestionElementsOnForm(b,null)}for(var f=0;f<h.length;f++){var c=h[f];if(c==null){continue}var e=c.name;if(e==null){break}if(j!=null&&e.indexOf("total"+b)==0&&c.id.substring(("inputtextother"+b).length+1).indexOf(j)>=0){return c.value!=null&&c.value.length>0&&(d==null||validateTextResult(d,c.value))}else{if(e.indexOf("R"+b)==0&&d==null){focus_obj=c;if(c.tagName!=null&&c.tagName.toUpperCase().indexOf(selTN)>=0){if(c.multiple==true){var a=c.options;for(var l=1;l<a.length;l++){var g=a[l];if(g.selected&&(g.value==j||j==null)){return true}}}else{if(c.value==j||(j==null&&c.selectedIndex>0)){return true}}}if(c.value==j||(j==null&&e.substring(("R"+b).length+1).length==0)){if(c.checked||(c.tagName.toUpperCase()==inpTN&&c.type=="hidden")){return true}}if(e.substring(("R"+b).length+1)==j||(j==null&&e.substring(("R"+b).length+1).length>0)){if(k!=null&&((j!=null&&(parseInt(c.value)-1)==k)||(j==null&&(parseInt(c.value)-1)==getIndexByColumnId(k)))){if(c.checked||(c.tagName.toUpperCase()==inpTN&&c.type=="hidden")){return true}}else{if(k==null&&(c.checked||(c.tagName.toUpperCase()==inpTN&&c.type=="hidden"))){return true}}}}else{if(e.indexOf("other"+b)==0){if(e.search(/radio|check/)>=0){if(j==null||e.substring(("other"+b).length+1).indexOf(j)>=0){if((k!=null&&((j!=null&&c.value==k)||(j==null&&c.value==getIndexByColumnId(k))))||k==null){if(c.checked||(c.tagName.toUpperCase()==inpTN&&c.type=="hidden")){return true}}}}else{if((k!=null&&e.substring(("other"+b).length+1)==(j+"_"+k))||(k!=null&&j==null&&e.substring(("other"+b).length+1).indexOf("_"+getIndexByColumnId(k))>=0)||(k==null&&e.substring(("other"+b).length+1).indexOf(j)>=0)||(k==null&&j==null)){if(c.tagName!=null&&c.tagName.toUpperCase().indexOf(selTN)>=0){if(c.selectedIndex>0){return true}}else{if(((c.value!=null&&c.value.length>0)||(c.tagName.toUpperCase()==inpTN&&c.type=="hidden"))&&(d==null||validateTextResult(d,c.value))){return true}}}}}}}}return false}function validateTextResult(d,b){var c=d.substring(2,d.length);var a=getResultForMatches(c,b);if(d.indexOf("==")==0){return a}if(d.indexOf("<>")==0||d.indexOf("!=")==0){return !a}return false}function getResultForMatches(d,a){var b=d.toUpperCase();if(b.indexOf("LIKE")==0){return a.trim().indexOf(d.replace("LIKE",""))>=0}else{if(b.indexOf("RMATCHES")==0){var c=a.trim().match(d.replace("RMATCHES",""));return c!=null&&c[0]==a}else{if(b.indexOf("RLIKE")==0){return a.trim().search(d.replace("RLIKE",""))>=0}}}return d==a.trim()}function checkPreferredCompareMatrix(c,a,f,j,l,h,d){if(_current_form!=null&&validationErrorElement!=null){return true}if(f){if(!validateRequiredGeneral(c,a,h,d)){return false}}var e=0;var m=findQuestionElementsOnForm(c,_current_form);for(var g=0;g<m.length;g++){var b=m[g];if(b==null||b.name==null){continue}if(b.name.indexOf("R"+c+"_")>=0){if(b.checked){e++}}}if(e==l||e==0){return true}pleaseAnswerErrorAlert(a,c);return false}function checkCheckboxes(e,a,f,i,j,k,b,h,d){if(_current_form!=null&&validationErrorElement!=null){return true}if(b>0){var l=j$("input:checkbox[name='R"+e+"']:checked",_current_form);var c=l.filter(function(){return j$(this).hasClass("exclusive")});if(c.length>0&&l.length>1){alertExclusive(a);scrollToQuestion="#Q"+e;window.setTimeout(scrollToSomeQuestion,250);return false}}if(i&&validateRequiredGeneralSilent(e)){removeFromPreferredArrays(e)}if(f){if(!validateRequiredGeneral(e,a,h,d)){return false}}if(k==0&&j<=1){return true}var g=getCountCheckedCheckboxes(e,_current_form);if((g<=k||k==0)&&(g==0||g>=j)){return true}alertMinMaxReq(e,a,j,k,_current_form);return false}function getCountCheckedCheckboxes(f,c){var e=0;var g=findQuestionElementsOnForm(f,c);for(var b=0;b<g.length;b++){var d=g[b];if(d==null){continue}var a=d.name;if(a==null){continue}if(a.indexOf("R"+f)==0){if(d.value!=0&&d.checked){e++}}}return e}function getCountCheckedInListbox(b,k){var g=0;var h=findQuestionElementsOnForm(b,k);for(var f=0;f<h.length;f++){var c=h[f];if(c==null){continue}var d=c.name;if(d==null){continue}if(d.indexOf("R"+b)==0){var a=c.options;for(var e=1;e<a.length;e++){if(a[e].selected){g++}}}}return g}function checkListbox(c,a,e,h,i,j,g,d){if(_current_form!=null&&validationErrorElement!=null){return true}var k=j$("[id^='AnswerOption"+c+"']:selected",_current_form);var b=k.filter(function(){return j$(this).hasClass("exclusive")});if(b.length>0&&k.length>1){alertExclusive(a);scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250);return false}if(e){if(!validateRequiredGeneral(c,a,g,d)){return false}}if(j==0&&i<=1){return true}var f=getCountCheckedInListbox(c,_current_form);if((f<=j||j==0)&&(f==0||f>=i)){return true}alertMinMaxReq(c,a,i,j,_current_form);return false}function fillArray(e){var a=[];var d=1;for(var b=0;b<e.length;b++){var c=e[b];if(c!=null&&c.name!=null&&c.name.indexOf("other")==0&&(e[b].type.toUpperCase())!="HIDDEN"){a[d]=c;d++}}a[0]=0;return a}function getTotalElement(d,b){for(var a=0;a<d.length;a++){var c=d[a];if(c!=null&&c.name!=null&&c.name.indexOf("total")==0){if(b==null||b.name==c.form.name){return d[a]}}}return null}function checkvalue(a,c,g,f,h,e,b){var d=subStringInteger(a.value,g,f,h,e,b);if(d.length==0||isNaN(parseInt(d,10))){if(c){a.focus()}return false}return true}function fixFormat(n,m,r,h,q,b){n=""+removeLeadingZeroes(n);var c=false;if(n.charAt(0)=="0"){var l="";var c=false;var f=0;var a=q.charAt(0);while(f<n.length){if(c){l+=n.charAt(f)}else{if(n.charAt(f)!="0"||n.charAt(f+1)==a){c=true;l+=n.charAt(f)}}f++}n=l}var d=n.indexOf(q);if(d<0){var f=0;if(h>=0){n+=q}while(f<h){n+="0";f++}}else{var f=0;var g=n.length-d;while(g+f<=h){n+="0";f++}}var p=n.indexOf("-")>=0;var f=n.indexOf(q)-1;var l="";var e=0;while(f>=0){if(e==3&&p&&f>0||e==3&&!p){l+=b;e=0}e++;l+=n.charAt(f);f-=1}var k=n.indexOf(q);var o=n.substring(k+1,k+1+h);n="";f=l.length-1;while(f>=0){n+=l.charAt(f);f-=1}if(n.length==0){n="0"}if(h>0){n+=q+o}var s=n;if(m.length>0){s=m+" "+n}if(r.length>0){s+=" "+r}return s}function intvalue(f,b,j,e,i,c,h,a){if(f!=null&&f!=window&&j.form.name!=f.form.name){return 0}var g=subStringInteger(j.value,e,i,c,h,a);if(!b&&j==f&&j.value!=null&&j.value.length>0){j.value=fixFormat(g,e,i,c,h,a)}var d=parseFloat(g);if(isNaN(d)){g=0}if(!b&&j.value!=null&&j.value.length>0){j.value=fixFormat(g,e,i,c,h,a)}return g}function removeDecimal(d,f,e){var c=d;var b=d.indexOf(e);if(b>0){var a=b+f+((f>0)?1:0);c=d.substring(0,a)}return c}function appendZeroes(b,d,c){var a=b.indexOf(c);while(a>0&&b.length-a<=d){b+="0"}return b}function removePreffix(b,c){if(c.length>0){var a=b.indexOf(c);if(a>=0){b=b.substring(a+c.length,b.length)}}return b}function removeSuffix(a,b){if(a==null||a.length==0){return a}if(a.indexOf(b)>0){return a.substring(0,a.indexOf(b))}return a}function removeNaNs(c,d,a){var b=new RegExp("[^-0-9"+d.charAt(0)+"]+","gi");return c.replace(b,"")}function extractNumbers(c,d){var b=0;var a="";while(b<c.length){if(c.charAt(b)==d.charAt(0)||c.charAt(b)=="-"&&b==0||!isNaN(parseInt(c.charAt(b),10))){a+=c.charAt(b)}b++}return a}function normalizeNumber(c,f,e){if(c.length==0){c="0"}var d=c.indexOf(e);if(d==0){c="0"+c;d++}if(d>=0){var b=c.substring(0,d);var a=c.substring(d+1);if(a.length>f){a=a.substring(0,f)}while(a.length<f){a+="0"}c=b+e+a}else{if(f>0){c+=e}while(f>0){c+="0";f--}}return c}function removeSpaces(a){return a.replace(/\s+/g,"")}function subStringAsInteger(c,f,e,g,d,a){var b=removeSpaces(c);c=removeSuffix(b,e);c=appendZeroes(c,g,d);c=removeDecimal(c,g,d);c=removePreffix(c,f);c=removeLeadingZeroes(c);return c}function subStringInteger(b,e,d,f,c,a){b=subStringAsInteger(b,e,d,f,c,a);if(b==null||b.length==0){return""}b=removeNaNs(b,c,a);b=extractNumbers(b,c);b=normalizeNumber(b,f,c);return b}function checkSum1(k,c,i,f,d,n,q,h,t,b,m,e,s){if(_current_form!=null&&validationErrorElement!=null){return true}var l=(k==null||k==window)?_current_form:k.form;var j=findQuestionElementsOnForm(d,l);if(j.length==0){return true}var p=fillArray(j);var g=getTotalElement(j,l);if(isNaN(p.length)){return true}var o=1;var r=1;while(r<p.length){var a=p[r];if(a!=null){if(a.value==""){o++}}r++}if(o==p.length){g.value="";return true}return checkSum(k,c,i,f,d,n,q,h,t,b,m,e,s)}function onunloadSaving(c,a){if(document.theForm==null){return false}var b=false;for(var d=0;d<document.theForm.elements.length;d++){var e=document.theForm.elements[d];if(e.value!=null||e.selectedIndex>0){if(e.value!=null&&e.name.indexOf("other")>=0&&e.value.length>0){b=true;break}}if(e.name.indexOf("other")>=0){continue}if(e.value!=null&&e.checked){b=true;break}else{if(e.selectedIndex>0){b=true;break}}}return false}function removeFromPreferredArrays(c){if(c<=0){return}var b=0;while(b<prefAnsweredQue.length){var a=prefAnsweredQue[b];if(a==c&&a>0){prefAnsweredQueBackup[b]=a;prefAnsweredQueTextsBackup[b]=prefAnsweredQueTexts[b];prefAnsweredQue[b]=0;prefAnsweredQueTexts[b]=""}b++}}function addToPreferredArrays(b){if(b<=0){return}var a=0;while(a<prefAnsweredQue.length){if(prefAnsweredQueBackup[a]==b){prefAnsweredQue[a]=prefAnsweredQueBackup[a];prefAnsweredQueTexts[a]=prefAnsweredQueTextsBackup[a];prefAnsweredQueBackup[a]=0;prefAnsweredQueTextsBackup[a]=""}a++}}var err_flg=false;function subStringIntegerWithAlert(b,f,d,h,c,a,e,g){b=subStringAsInteger(b,f,d,h,c,a);if(b==null||b.length==0){return""}b=removeNaNs(b,c,a);b=extractNumbers(b,c);b=normalizeNumber(b,h,c);return b}function intvalueWithAlert(g,c,k,f,j,d,i,a,b){var h=subStringIntegerWithAlert(k.value,f,j,d,i,a,b,false);if(!c&&k==g&&k.value!=null&&k.value.length>0){k.value=fixFormat(h,f,j,d,i,a)}var e=parseFloat(h);if(isNaN(e)){h=0}if(!c&&k.value!=null&&k.value.length>0){k.value=fixFormat(h,f,j,d,i,a)}return h}function subStringIntegerWithErrorCode(d,g,f,h,e,b,a){d=subStringAsInteger(d,g,f,h,e,b);if(d==null||d.length==0){return""}var c=new RegExp("[^-0-9"+e.charAt(0)+b.charAt(0)+"]+","gi");err_flg=c.test(d);d=removeNaNs(d,e,b);d=extractNumbers(d,e);d=normalizeNumber(d,h,e);return d}function intvalueWithErrorCode(g,b,k,f,j,d,i,a,c){var h=subStringIntegerWithErrorCode(k.value,f,j,d,i,a,c);if(!b&&k==g&&k.value!=null&&k.value.length>0){k.value=fixFormat(h,f,j,d,i,a)}var e=parseFloat(h);if(isNaN(e)){h=0}if(!b&&k.value!=null&&k.value.length>0){k.value=fixFormat(h,f,j,d,i,a)}return h}function setFocusByTimeOut(){var b=new Date();var a=b.getMilliseconds();if(blurObj!=null){if(Math.abs(a-timeOutForAlerts)>100&&blurObj.style.display!="none"){blurObj.focus()}blurObj=null}timeOutForAlerts=a}function getIndexByColumnId(e){var c=document.getElementById("ALL_COLUMNS");if(c==null){return -1}var a=c.value;var d=a.indexOf(","+e+"=");var b=(","+e+"=").length;if(d<0){d=a.indexOf(e+"=");b=(e+"=").length}if(d<0){return -1}var f=a.substring(d+b);var g=f.indexOf(",");if(g<0){return f}else{return f.substring(0,g)}}function selectTextInTextBox(c){if(c==null){return}var d=c.value.length;if(document.selection){try{var a=document.selection.createRange();if(c.type=="text"){a.moveStart("character",0);a.moveEnd("character",d);a.select()}}catch(b){}}else{if(c.selectionStart||c.selectionStart=="0"){c.setSelectionRange(0,d)}}}function alertExclusive(a){if(a.length>150){a=a.substr(0,150)+"..."}alert(exclusiveAlert.replace(/\{0\}/,a))}function checkSum(o,c,l,h,d,t,u,k,B,b,s,e,A){var p=false,w=1,D=new BigNumber(0),j=0,C=null,r=(o==null||o==window)?_current_form:o.form,m=findQuestionElementsOnForm(d,r);if(m.length==0){return true}var x=fillArray(m),z=getTotalElement(m,r);if(isNaN(x.length)){return true}if(t==null){t=-Number.MAX_VALUE}if(u==null){u=Number.MAX_VALUE}var g=1;while(w<x.length){var a=x[w];if(checkvalue(a,false,B,b,s,e,A)){j++}else{C=a}if(a.value==""){g++}w++}w=1;if(z!=null&&g==x.length){z.value="";return true}while(w<x.length){if(z!=null&&o!=null&&o!=window){if(z.form.name==o.form.name){var v=intvalue(o,c,x[w],B,b,s,e,A);D=D.add(new BigNumber(v))}}else{if(z!=null){var v=intvalue(o,c,x[w],B,b,s,e,A);D=D.add(new BigNumber(v))}}w++}var y=new String(D);if(z!=null){z.value=D}if(j==0){if(!k){p=true;return p}}if(D!=t&&t==u){if(j+2>=x.length&&C!=null){var q=new BigNumber(t).subtract(D);if(q.compare(0)>0){C.value=fixFormat(q,B,b,s,e,A);p=true;y=t;if(z!=null){z.value=fixFormat(y,B,b,s,e,A)}}else{if(!c){C.value=fixFormat(0,B,b,s,e,A)}p=false;if(z!=null){z.value=fixFormat(y,B,b,s,e,A)}}return p}else{if(k){w=1;while(w<x.length){if(!checkvalue(x[w],l,B,b,s,e,A)){break}w++}}}}else{p=true}if(z!=null){z.value=fixFormat(y,B,b,s,e,A)}if(t<u&&D>=t&&D<=u){p=true;return p}if(C==null&&!isNaN(x.length)&&x.length>1){C=x[x.length-1]}var f=null;if(t<=u&&D<t){p=false;f=inTheQue+'"'+h+'" \n\n ';f+=summLess.replace("{0}",t)}else{if(t<=u&&D>u){p=false;f=inTheQue+'"'+h+'" \n\n ';f+=summExceeds.replace("{0}",u)}}if(!p&&f!=null&&l){if(_current_form==null){alert(f);scrollToQuestion="#Q"+d;window.setTimeout(scrollToSomeQuestion,250);C.focus()}else{validationErrorAlert=f;validationErrorElement=findElementForHiglite(_current_form,d)}}return p}function beforeSubmitErrorAlert(a,c,b){var d="    "+beforeSubmitMsg+a;if(_current_form==null){alert(d);c.focus();scrollToQuestion="#Q"+b;window.setTimeout(scrollToSomeQuestion,250)}else{validationErrorAlert=d;validationErrorElement=findElementForHiglite(_current_form,b)}}function pleaseAnswerAllRowsErrorAlert(e,b,d,c){if(_current_form==null){var a=pleaseAnswerAllRowsMsg.replace(/(.*):\s*$/,"$1");alert("    "+a+(e?":\n"+b:""));d.focus();scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250)}else{addElementForHighlite3dMatrixAllRows(_current_form,c)}}function reactionOnError(c,b){if(_current_form==null){var a=pleaseAnswerMsg.replace(/(.*):\s*$/,"$1");alert("    "+a+":\n"+b);scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250)}else{addElementForHighlite(_current_form,c)}}function reactionOnMandatoryAnswerError(e,d){if(_current_form==null){var c=pleaseRespondToTheFollowingItems.replace(/(.*):\s*$/,"$1");var g="    ";var f=g+c+":\n";var a=d.length;for(var b=0;b<a;b++){f+=g+d[b]+",\n"}a&&(f=f.substring(0,f.length-2));alert(f);scrollToQuestion="#Q"+e;window.setTimeout(scrollToSomeQuestion,250)}else{addElementForHighlite(_current_form,e)}}function pleaseAnswerErrorAlert(b,c){var a=pleaseAnswerMsg.replace(/(.*):\s*$/,"$1");var d="    "+a+":\n"+b;if(_current_form==null){alert(d);scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250)}else{validationErrorAlert=d;validationErrorElement=findElementForHiglite(_current_form,c)}}function reactionOnErrorMustAnswerAllFields3D(c,b){if(_current_form==null){var a=pleaseAnswerAllMatrixFieldsMsg.replace(/(.*):\s*$/,"$1");alert("    "+a+":\n"+b);scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250)}else{addElementForHighlite(_current_form,c)}}function showPreferredAlert(){var b=0;var a=0;var d=""+notAnsweredButPreferredMsg;while(b<prefAnsweredQue.length){var c=prefAnsweredQue[b];if(c>0&&document.getElementById("QuestionAnswersTableId"+c)&&!validateRequiredGeneralSilent(c)){d+=" - "+prefAnsweredQueTexts[b]+"\n";if(a==0){scrollToQuestion="#Q"+c}a++}b++}d+=isItOkMsg;if(a==0){return true}if(confirm(d)>0){return true}window.setTimeout(scrollToSomeQuestion,250);return false}function alertMinMaxReq(c,a,f,d,b){var e="";if(f<=1){e="   "+mayCheckFullMsg.replace(/\{0\}/,d).replace(/\{1\}/,a)}else{if(d==0){e="   "+chooseAtLeastFullMsg.replace(/\{0\}/,f).replace(/\{1\}/,a)}else{if(f==d){e="   "+exactlyFullMsg.replace(/\{0\}/,f).replace(/\{1\}/,a)}else{e="   "+checkFromFullMsg.replace(/\{0\}/,f).replace(/\{1\}/,d).replace(/\{2\}/,a)}}}if(b==null){alert(e);validationErrorAlert=e;scrollToQuestion="#Q"+c;window.setTimeout(scrollToSomeQuestion,250)}else{validationErrorAlert=e;validationErrorElement=findElementForHiglite(b,c)}}function checkRankGrid(f,a,h,k,b,l,p){if(_current_form!=null&&validationErrorElement!=null){return true}if(!isQuestionExistInForm(f,_current_form)){return true}if(k){return true}var q;if(b==l){q="   "+pleaseAnswerAllRowsMsg+a}else{q="   "+atLeastMsg+" ";if(b!=1){q+=b+" "+rowsMsg}else{q+=oneRowMsg}q+=" "+inQueMsg+a}if(h||k){if(!validateRequiredGeneralSilent(f)){if(_current_form==null){alert(q);scrollToQuestion="#Q"+f;window.setTimeout(scrollToSomeQuestion,250)}else{validationErrorAlert=q;validationErrorElement=findElementForHiglite(_current_form,f)}return false}}var m=findQuestionElementsOnForm(f,_current_form);var g=0;var o=[];var n=false;var j=-1;while((j+1)<m.length&&m[j+1]!=null&&m[j+1].name!=null){j++;var e=m[j];if(e.name.indexOf("R"+f+"_")>=0){if(e.checked){g++;if(p&&!n){var d=e.value;if(o[d]==1){n=true}else{o[d]=1}}}}}if(!n){if(g>=b){return true}if(g==0){return true}}var c="";if(n){c=""+inTheQueMsg+'"'+a+'" \n\n ';c+=youCanChooseMsg}else{c=q}if(_current_form==null){alert(c);scrollToQuestion="#Q"+f;window.setTimeout(scrollToSomeQuestion,250)}else{validationErrorAlert=c;validationErrorElement=findElementForHiglite(_current_form,f)}return false}function isQuestionInGeneralSection(a){return j$("#generalSection").find("#questionMainTableId"+a).length>0}var stopFormEnter=function(a){a=a||window.event;if(a&&(a.target&&"input"==a.target.tagName.toLowerCase()||a.srcElement&&"input"==a.srcElement.tagName.toLowerCase())){return !((a.keyCode||a.which)==13)}else{return true}};function getRadioForText(a){return document.getElementById("RC"+a.id.substring(14))}function getTextForRadio(a){return document.getElementById("inputtextother"+a.id.substring(2))}function log(c,b,a){j$.ajax({url:"/servlet/voting/AjaxLoggerServlet",data:{level:c,msg:b,params:a()}})};

