function handleError(h,f,c){var a="/core/pages/logJavascriptError.nl?NS_VER=2009.2.0";var b;if(typeof window.errorObj!="undefined"&&window.errorObj!=null){h="NLAPI Error "+window.errorObj.code+": "+window.errorObj.detail;}window.errorObj=null;b="mesg="+escape(h)+"&";b=b+"winHref="+escape(window.location.href)+"&";b=b+"line="+escape(c)+"&";b=b+"isinited="+escape(window.isinited)+"&";try{b=b+"stcktrc="+escape(stacktrace());}catch(g){}if(window.parent!=window){b=b+"&parHref="+escape(window.parent.location.href);}if(f!=window.location.href){b=b+"&errDocUrl="+escape(f);}var d=new ActiveXObject("Microsoft.XMLHTTP");d.Open("POST",a,true);d.SetRequestHeader("Content-Type","application/x-www-form-urlencoded");d.Send(b);return false;}window.onerror=handleError;function debugAlert(a){}function debugStartTimer(){}function debugGetTime(){}function encode(a){return escape(a).replace(/\+/g,"%2B");}function alphafirst(b){var a=new RegExp("([A-Za-z].*)");return(a.exec(b)!=null&&RegExp.$1==b);}function stacktrace(){var c="stacktrace: ";for(var b=arguments.callee.caller;b!=null;b=b.caller){c+=getFuncName(b);c+=getFuncArgs(b)+"\n\n";if(b.caller==b){break;}}return c;}function getFuncArgs(b){s="arguments: {";for(i=0;i<b.arguments.length;i++){if(typeof b.arguments[i]=="undefined"){s+="'undefined'";}else{if(b.arguments[i]==null){s+="null";}else{if(typeof b.arguments[i]=="string"){s+="'"+b.arguments[i].toString()+"'";}else{s+=b.arguments[i].toString();}}}if(i<b.arguments.length-1){s+=",";}}s+="}";return s;}function getFuncName(b){var a=b.toString();if(a.indexOf("anonymous")>=0){if(a.length>100){return a.substr(0,100)+"\n";}else{return a+"\n";}}else{a=a.match(/function[^{]*/)[0];}if((a==null)||(a.length==0)){return"anonymous \n";}return a;}function scrollDiv(){if(document.getElementById("div__label")){document.getElementById("div__label").scrollLeft=document.getElementById("div__body").scrollLeft;}}function getDocumentClientHeight(){return document.body.clientHeight;}function getDocumentClientWidth(){return document.body.clientWidth;}function getDocumentHeight(){if(window.innerHeight){return window.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight&&document.documentElement.clientHeight!=0){return document.documentElement.clientHeight;}else{return document.body.clientHeight;}}}function getDocumentWidth(){if(window.innerWidth){return window.innerWidth;}else{if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth;}else{return document.body.clientWidth;}}}var ieDiffWidth=0;var ieDiffHeight=0;function initOuter(){var a,e,b,f,d,g;var j=800;var c=600;if(document.all){b=document.body.offsetWidth;f=document.body.offsetHeight;window.resizeTo(j,c);d=document.body.offsetWidth-b;g=document.body.offsetHeight-f;a=j-d;e=c-g;ieDiffWidth=a-b;ieDiffHeight=e-f;window.resizeTo(a,e);}}function outerWd(){if(document.all){if(ieDiffHeight==0){initOuter();}return document.body.offsetWidth+ieDiffWidth;}else{return window.outerWidth;}}function outerHt(){if(document.all){if(ieDiffHeight==0){initOuter();}return document.body.offsetHeight+ieDiffHeight;}else{return window.outerHeight;}}function onBeforePrint(){var a=document.getElementById("div__label");if(a!=null){a.style.width=null;a.style.height=null;}a=document.getElementById("div__body");if(a!=null){a.style.width=null;a.style.height=null;}document.body.scroll="auto";}function onAfterPrint(){if(document.getElementById("resetdivwascalled")!=null){resetDivSizes();}}window.onbeforeprint=onBeforePrint;window.onafterprint=onAfterPrint;function resetDivSizes(){if(document.getElementById("resetdivwascalled")==null){var f=document.createElement("input");f.type="hidden";f.value="T";f.id="resetdivwascalled";document.body.appendChild(f);}var n=document.getElementById("div__header");var t=document.getElementById("div__title");var r=document.getElementById("div__banner");var c=document.getElementById("div__prelabel");var e=document.getElementById("div__label");var p=document.getElementById("div__body");var d=document.getElementById("div__nav");var h=document.getElementById("div__footer");if(p==null){return;}document.body.style.overflowY="hidden";var q=getDocumentHeight()-10;q-=getHeight(n)+getHeight(h)+getHeight(t)+getHeight(r)+getHeight(c)+getHeight(e)+4;p.style.height=(q>0?q:0)+"px";p.clientWidth;var a=getDocumentWidth();var k=document.getElementById("_rptdata");if(d!=null){p.style.height=(q-p.offsetTop>0?q-p.offsetTop:0);var g=document.getElementById("div__nav_tree");if(g){g.style.height=(q-g.offsetTop>0?q-g.offsetTop:0);}a-=isIE?d.offsetWidth:d.scrollWidth;var m=d.parentNode;var j=0;while(m!=null){if(m.getAttribute("cellspacing")){j=m.getAttribute("cellspacing");break;}m=m.parentNode;}a-=4*j;}p.style.width=Math.max(a,0);q=getDocumentHeight()-10;q-=getHeight(n)+getHeight(h)+getHeight(t)+getHeight(r)+getHeight(c)+getHeight(e)+4;p.style.height=(q>0?q:0)+"px";if(d!=null){p.style.height=(q-p.offsetTop>0?q-p.offsetTop:0);var g=document.getElementById("div__nav_tree");if(g){g.style.height=(q-g.offsetTop>0?q-g.offsetTop:0);}}if(e!=null){e.style.width=p.clientWidth;e.style.left=-document.getElementById("div__body").scrollLeft;}for(var o=0;o==0||document.getElementById("div__labcol"+o)!=null;o++){var b=document.getElementById("div__labcol"+o);var l=document.getElementById("div__lab"+o);if(l!=null){if(isIE||l.tagName=="TD"){l.style.width=b.offsetWidth;if(b.offsetWidth>(l.offsetWidth-b.offsetWidth)){l.style.width=b.offsetWidth-(l.offsetWidth-b.offsetWidth);}}else{l.offsetParent.style.width=b.offsetWidth;}}}makeVisible(e);makeVisible(p);makeVisible(h);hideInvisibleRows();}function hideInvisibleRows(){var d=document.getElementById("squeezeBox");if(d==null){return;}var a=d.getElementsByTagName("tr");var c=0;for(var b=0;b<a.length;b++){if(a[b].className=="labelRow"&&isValEmpty(a[b].getAttribute("squeezeBox"))){c+=a[b].offsetHeight+1;a[b].setAttribute("squeezeBox","T");}}if(c>0){d.style.overflow="hidden";d.style.height=d.offsetHeight-c+(isIE?0:28);}}function resizePopupWindow(){var c=document.getElementById("div__body");if(c==null){return;}var e=getDocumentWidth()-10;var d=getMaxContentWidth(c.getElementsByTagName("span"));var b=getMaxContentWidth(c.getElementsByTagName("div"));var a=Math.max(c.scrollWidth,Math.max(d,b));if(a>e){window.resizeBy(a-e,0);}}function getMaxContentWidth(a){var b=0;for(i=0;i<a.length;i++){if(a[i].scrollWidth>b){b=a[i].scrollWidth;}}return b;}function getHeight(a){if(a==null){return 0;}else{return a.offsetHeight?a.offsetHeight:0;}}function makeVisible(a){if(a!=null){a.style.visibility="visible";}}function display(b,a){if(b!=null){b.style.display=a?"":"none";}}function visible(b,a){if(b!=null){b.style.visibility=a?"inherit":"hidden";}}function endsWith(b,a){return b!=null&&a!=null&&b.length>=a.length&&b.substr(b.length-a.length)==a;}function format_message(d){var b=format_message.arguments.length;var f=1;if(d.length>=3&&d.substring(0,3)=="@@@"){var c=d.substring(3).split(/\s*\|\|\s*/);var a=0;if(b>=2){a=format_message.arguments[1];if(typeof(a)=="boolean"){a=a?0:1;}else{if(typeof(a)=="string"){a=parseInt(a);}}if(typeof(a)!="number"){a=0;}}if(a>=c.length){a=0;}d=c[a];f=2;}else{if(d.length>=2&&d.substring(0,2)=="@@"){return"?";}}var e=format_message.arguments;if(b==(f+1)&&format_message.arguments[f].constructor==Array){e=format_message.arguments[f];f=0;b=e.length;}return d.replace(/{(?:(\d+)|:)[^}]*}/g,function(g,j){var h=j?(parseInt(j)-1+f):b;return(h<b)?e[h]:"";});}function checkzipcode(b,d){var a=b.value;var c=d?6:5;if(!onlydigits(b)||a.length!=c){if(d){alert("Please enter a valid "+c+" digit Postal Code.");}else{alert("Please enter a valid "+c+" digit Zip Code.");}return false;}return true;}function splitIntoRows(a){return a!=null?(a.length>0?a.split(String.fromCharCode(2)):new Array()):null;}function splitIntoCells(a){return a!=null?(typeof(a)=="string"?a.split(String.fromCharCode(1)):a):null;}function isempty(a,b){var c=a.value;return isValEmpty(c,b);}function checknotempty(a,b){if(!checkvalnotempty(a.value,"please enter a value for {1}".replace("{1}",b))){try{a.focus();a.select();}catch(c){}return false;}return true;}function amount_string(c){var a=Math.floor((c-Math.floor(c))*100+0.5);var b=(a<10)?"0"+a.toString():a.toString();var d=dollars_string(Math.floor(c));return d.charAt(0).toUpperCase()+d.substr(1)+"and "+b+"/100";}function format_rate(l,b){var j;if(isNaN(parseFloat(l))){j="";}else{var f=get_precision();if(f>1||b){var m=(l<0);if(m){l=-l;}var h=Math.floor(l);var k=Math.floor((l-h)*(b?10:100)+0.5);if(l==h+k/(b?10:100)){if(k==(b?10:100)){h++;k=0;}var g=b?k.toString():((k<10)?"0"+k.toString():k.toString());j=(m?"-":"")+h.toString()+"."+g+(b?"%":"");}else{j=(m?"-":"")+l+(b?"%":"");}}else{if(f==1){var m=(l<0);if(m){l=-l;}var g=l.toString();var e=g.indexOf(".");if(e==-1){g=g.toString()+".0";}else{if(e==0){g="0."+g.toString();}else{if(e==g.length-1){g=g.toString()+"0";}}}j=(m?"-":"")+g;}else{if(f==0){var m=(l<0);if(m){l=-l;}var g=l.toString();var e=g.indexOf(".");if(e==0){g="0."+g.toString();}else{if(e==g.length-1){g=g.substring(0,g.length-2);}}j=(m?"-":"")+g;}}}}return j;}function get_precision(){var c=getFormElementViaFormName("main_form","currencyprecision");var a=2;if(c!=null){var b=parseFloat(c.value);if(!isNaN(b)){a=b;}}return a;}function round_currency(e,d,f){var c=d;if(c==null){c=get_precision();}var a=Math.abs(e);a=Math.floor((a*100000)+0.5)/100000+0.000001;factor=Math.pow(10,c);if(f==null||f=="OFF"){a=Math.floor((a*factor)+0.5)/factor;}else{if(f=="UP"){a=Math.round(Math.ceil(Math.abs(e)*factor))/factor;}else{if(f=="DOWN"){a=Math.round(Math.floor(Math.abs(e)*factor))/factor;}}}a=a*(e>=0?1:-1);if(a==0){return 0;}return a;}function round_float(b){return round_float_to_n_places(b,8);}function round_float_to_n_places(d,f){var c=Math.abs(d);c=c+1e-14;var e=Math.pow(10,f);c=Math.floor((c*e)+0.5)/e;c=c*(d>=0?1:-1);if(c==0){return 0;}return c;}function pad_to_atleast_two_decimal_places(b){var c;if(b==null){c="";}else{c=b.toString();var d=c.indexOf(".");if(d==-1){c=c+".00";}else{if(d==c.length-1){c=c+"00";}else{if(d==c.length-2){c=c+"0";}}}if(d==0){c="0"+c;}}return c;}function pad_decimal_places(b,d){var c;if(b==null){c="";}else{c=b.toString();var e=c.indexOf(".");if(d==0){if(b==0){c=0;}else{if(e>-1){c=c.substring(0,e);}}}else{if(d==1){if(e==-1){c=c+".0";}else{if(e==c.length-1){c=c+"0";}else{if(e==0){c="0"+c;}}}}else{if(e==-1){c=c+".00";}else{if(e==c.length-1){c=c+"00";}else{if(e==c.length-2){c=c+"0";}}}if(e==0){c="0"+c;}}}}return c;}function format_currency(d,c){var f=getFormElementViaFormName("main_form","currencyprecision");var e=2;if(f!=null){e=parseFloat(f.value);if(isNaN(e)){e=2;}}var b;if(isNaN(d)){return"";}else{if(!(c==true)){b=round_currency(d,e);}else{b=d;}}b=pad_decimal_places(b,e);return b;}function format_currency2(c){if(isNaN(c)){return"";}var b=round_float(c);var a=get_precision();if(a==2){b=pad_to_atleast_two_decimal_places(b);}return b;}function format_percent(a){return a+(a==Math.floor(a)?".0%":"%");}function parseCJKNumbers(e){var f=e.value;if(f==null){return null;}var c=/[\uff01-\uff5e]/g;var b=[];var a,d=0;c.lastIndex=0;while((a=c.exec(f))!=null){if(a.index>d){b.push(f.substring(d,a.index));}d=c.lastIndex;b.push(String.fromCharCode(a[0].charCodeAt(0)-65248));}if(d==0){return f;}if(d<f.length){b.push(f.substring(d));}return b.join("");}function validate_textfield_maxlen(g,b,f,c){if(g.value==null||g.value.length==0){window.isvalid=true;return true;}var d=true,e=null;if(c){var a=g.value.length;if(a>b){if(f){alert("You have exceeded the "+b+" character limit for this field. Please shorten your entry by "+(a-b)+" characters.");}e=b;}}else{var h=analyzeUTF8(g.value,b);if(h){if(f){alert("You have exceeded the length limit for this field. Please shorten your entry by "+h+" characters.");}e=UTF8toUTF16index(g.value,b);}}if(e){window.focusedTextArea=g;setTimeout("setSelectionRange(window.focusedTextArea, "+e+", "+g.value.length+");",0);d=false;}window.isvalid=d;return d;}function truncateStringInUnicode(f,c){var h=0;var d=128;var b=2048;var e="";for(var a=0;a<f.length;a++){var g=f.charCodeAt(a);if(g<d){h+=1;}else{if(g>=d&&g<b){h+=2;}else{if(g>=b){h+=3;}}}if(h<c){e=e+f.charAt(a);}}return e;}function UTF8toUTF16index(f,b){var a=0;var e=128;var d=2048;for(var c=0;c<f.length;++c){var g=f.charCodeAt(c);if(g<e){a+=1;}else{if(g<d){a+=2;}else{a+=3;}}if(a>b){return c;}}return 0;}function analyzeUTF8(k,f){var j=0,d=[null,0,0,0];for(var g=0;g<k.length;++g){var b=k.charCodeAt(g);var e=(b<128)?1:(b<2048?2:3);j+=e;d[e]+=1;}var c=j-f;var h=0;for(var g=1;c>0&&g<=3;++g){var a=Math.min(Math.floor((c+g-1)/g),d[g]);h+=a;c-=a*g;}return h;}function validate_field(field,type,doalert,autoplace,minval,maxval,mandatory,separator){window.isvalid=false;type=type.toLowerCase();if(field.value==null||field.value.length==0){if(mandatory){if(doalert){alert("Field must contain a value.");}selectAndFocusField(field);window.isvalid=false;return false;}else{window.isvalid=true;return true;}}if((type!="text"&&type!="identifier"&&type!="identifieranycase"&&type!="address"&&type!="visiblepassword")&&("en"=="ja"||"en"=="ko"||"en"=="zh")){field.value=parseCJKNumbers(field);}var validflag=true;if(type=="url"){var val=trim(field.value.toLowerCase());if(!(val.indexOf("/")==0||val.indexOf("http://")==0||val.indexOf("https://")==0||val.indexOf("ftp://")==0||val.indexOf("file://")==0)){if(val.indexOf("://")!=-1){if(doalert){alert("Invalid url. Url must start with http://, https://, ftp://, or file://");}validflag=false;}else{field.value="http://"+trim(field.value);}}if(val.indexOf(" ")>0||val.indexOf("\t")>0){if(doalert){alert("Invalid url. Spaces are not allowed in the URL");}validflag=false;}}else{if(type=="currency"||type=="currency2"||type=="poscurrency"){var val=field.value.replace(/$/g,"");val=val.replace(/\ /g,"");val=val.replace(/,/g,"");val=val.toLowerCase();if(val.charAt(0)=="="){val=val.substr(1);}if(val.substr(1).search(/[\+\-\*\/]/g)!=-1){var c=val.charAt(0);if(val.charAt(0)>="a"&&val.charAt(0)<="z"){value="error";}else{try{val=eval(val);}catch(e){val="error";}autoplace=false;}}numval=parseFloat(val);if(type=="currency2"){if(isNaN(maxval)||maxval==null){maxval=100000000;}if(isNaN(numval)||Math.abs(numval)>=maxval){if(doalert){var regex=new RegExp("(-?[0-9]+)([0-9]{3})");var preDecimal=(maxval-1).toString();while(regex.test(preDecimal)){preDecimal=preDecimal.replace(regex,"$1,$2");}alert("Invalid currency value. Values must be numbers up to "+preDecimal+".99");}validflag=false;}}else{if(isNaN(numval)||Math.abs(numval)>=(maxval==100000000000?100000000000:10000000000)){if(doalert){alert(maxval==100000000000?"Invalid currency value. Values must be numbers up to 99,999,999,999.99":"Invalid currency value. Values must be numbers up to 9,999,999,999.99");}validflag=false;}}if((type=="poscurrency"||minval==0)&&numval<0){if(doalert){alert("Invalid currency value. Value can not be negative.");}validflag=false;}if(validflag){if(autoplace&&val.indexOf(".")==-1){numval/=100;}if(type=="currency"||type=="poscurrency"){field.value=format_currency(numval);}else{field.value=format_currency2(numval);}}}else{if(type=="date"){var dt=NLDate_parseString(field.value,doalert);if(dt==null){validflag=false;}else{validflag=true;field.value=getdatestring(dt);}}else{if(type=="mmyydate"){var month;var day=0;var year;var fmterr="MMYY, MMYYYY, "+((window.dateformat=="DD/MM/YYYY"||window.dateformat=="DD.MM.YYYY"||window.dateformat=="DD-MM-YYYY")?"DD/MM/YY, DD/MM/YYYY":"MM/DD/YY, MM/DD/YYYY");if(window.dateformat=="DD-Mon-YYYY"&&field.value.indexOf("/")==-1&&!onlydigits(field.value)){var ms="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";var val=field.value;if(val.indexOf("-")!=-1){var c=val.split("-");month=getMonthIndex(c[0]);year=parseInt(c[1],10);}else{var l=val.length,str;str=val.substr(0,3);if("en_GB".substring(0,2)=="en"){if(ms.indexOf(str.toUpperCase())>=0){month=(ms.indexOf(str.toUpperCase())+3)/3;}}else{month=getMonthIndex(str);}str=val.substr(3);year=parseInt(str,10);}fmterr="Mon-YY, Mon-YYYY, MonYY or MonYYYY";}else{if(field.value.indexOf("/")==-1){var l=field.value.length;month=parseInt(field.value.substr(0,2-l%2),10);year=parseInt(field.value.substr(2-l%2),10);}else{var comps=field.value.split("/");var bIsDayFirst=(window.dateformat=="DD/MM/YYYY"||window.dateformat=="DD-MM-YYYY"||window.dateformat=="DD.MM.YYYY");if(comps[2]==null){month=parseInt(comps[0],10);year=parseInt(comps[1],10);}else{day=parseInt(comps[bIsDayFirst?0:1],10);month=parseInt(comps[bIsDayFirst?1:0],10);year=parseInt(comps[2],10);}}}if(month>=1&&month<=12&&((year>=0&&year<100)||(year>1900&&year<2100))){if(year<50){year+=2000;}else{if(year<100){year+=1900;}}if(day==0||day>31){if(month==2){if(year%400==0||(year%4==0&&year%100!=0)){day=29;}else{day=28;}}else{if(month==4||month==6||month==9||month==11){day=30;}else{day=31;}}}var dDate=validateDate(new Date(year,month-1,day),doalert);if(dDate){field.value=getmmyydatestring(dDate,NLDate_short_months);validflag=true;}else{validflag=false;}}else{if(doalert){alert("Invalid date value (must be "+fmterr+")");}validflag=false;}}else{if(type=="ccexpdate"||type=="ccvalidfrom"){validflag=true;var m=0,y=0;if(field.value.indexOf("/")!=-1){var dToday=new Date();var Y=dToday.getFullYear();var M=dToday.getMonth()+1;if(Y<=999){Y+=1900;}var c=field.value.split("/");if(onlydigits(c[0])){m=parseInt(c[0],10);}if(onlydigits(c[1])){y=parseInt(c[1],10);}if(m<1){m=1;}else{if(m>12){m=12;}}if(y<100){y+=((y>=70)?1900:2000);}if(type=="ccexpdate"&&(y<Y||(y==Y&&m<M))||type=="ccvalidfrom"&&(y>Y||(y==Y&&m>M))){if(doalert){alert("Notice: The credit card appears to be incorrect");}}field.value=(m<10?"0":"")+m+"/"+y;}else{if(doalert){if(type=="ccexpdate"){alert("Please enter an expiration date in MM/YYYY format");}else{alert("Please enter a Valid From / Start Date in MM/YYYY format");}}validflag=false;}}else{if(type=="ccnumber"){validflag=(field.value.length>4&&field.value.substring(0,field.value.length-4).replace(new RegExp("\\*","g"),"").length==0&&field.value.substring(field.value.length-4).replace(new RegExp("\\*","g"),"").length==4)||checkccnumber(field);}else{if(type=="rate"){var numval;var minclip=-10000000000;var maxclip=10000000000;var val=field.value;val=val.replace(/,/g,"");var pctidx=val.lastIndexOf("%");if(pctidx!=-1){val=val.substr(0,pctidx);}numval=parseFloat(val);if(isNaN(numval)){if(doalert){alert("Invalid number or percentage");}validflag=false;}else{if(numval>=maxclip){if(doalert){alert("Number exceeds maximum value");}validflag=false;}else{if(numval<=minclip){if(doalert){alert("Number is less than minimum value");}validflag=false;}else{if(autoplace&&pctidx==-1&&val.indexOf(".")==-1){numval/=100;}field.value=format_rate(numval,pctidx!=-1);validflag=true;}}}}else{if(type=="integer"||type=="posinteger"||type=="float"||type=="posfloat"||type=="percent"){var numval;var custrange=false;if((minval!=null||maxval!=null)||type=="percent"){custrange=true;}var minclip=minval==null?(type=="percent"?0:-Math.pow(2,32)):minval;var maxclip=maxval==null?(type=="percent"?100:Math.pow(2,64)):maxval;var val=field.value;val=val.replace(/,/g,"");val=val.replace(/%/g,"");if(type=="integer"){numval=parseInt(val,10);}else{if(type=="posinteger"){numval=parseInt(val,10);minclip=0;}else{if(type=="posfloat"||type=="float"){numval=val.indexOf(".")==-1?parseFloat(val):round_float(parseFloat(val));if(type=="posfloat"){minclip=0;}}else{numval=parseFloat(val);}}}if(isNaN(numval)||(custrange&&(numval>maxclip||numval<minclip))||(!custrange&&(numval>=maxclip||numval<=minclip))){if(doalert){if(type=="percent"){alert("Invalid percentage (must be between "+minclip+" and "+maxclip+")");}else{if(custrange==true){if(minval==null){alert("Invalid number (must be at most "+maxclip+")");}else{if(maxval==null){alert("Invalid number (must be at least "+minclip+")");}else{alert("Invalid number (must be between "+minclip+" and "+maxclip+")");}}}else{if(type=="posinteger"||type=="posfloat"){alert("Invalid number (must be positive)");}else{if(type=="integer"||type=="float"){if(isNaN(numval)){alert("You may only enter numbers into this field");}else{alert("Illegal number: "+numval);}}else{alert("Invalid number (must be greater than -4.29B");}}}}}validflag=false;}else{if(type=="percent"){field.value=format_percent(numval);}else{field.value=numval;}validflag=true;}}else{if(type=="address"){var err="";if(field.value.length>999){err="Address too long (truncated at 1000 characters)";newval=field.value.substr(0,999);}if(err!=""){if(doalert){alert(err);}field.value=newval;}}else{if(type=="function"){if(field.value.indexOf("(")>0){field.value=field.value.substr(0,field.value.indexOf("("));}var val=field.value;var re=/^[0-9A-Za-z_]+(\.[0-9A-Za-z_]+)*$/;if(!re.test(val)){if(doalert){alert("The Function field must be a valid JavaScript function identifier");}validflag=false;}}else{if(type=="time"||type=="timetrack"){var hours;var minutes;var re=/([0-9][0-9]?)?(:[0-9][0-9]+)?/;var result=re.exec(field.value);if(result==null||result.index>0||result[0].length!=field.value.length){timeval=parseFloat(field.value);if(isNaN(timeval)){hours=-1;}else{hours=Math.floor(timeval);minutes=Math.floor((timeval-hours)*60+0.5);}}else{if(RegExp.$1.length>0){hours=parseInt(RegExp.$1,10);}else{hours=0;}if(typeof(RegExp.$2)!="undefined"&&RegExp.$2.length>0){minutes=parseInt(RegExp.$2.substr(1),10);if(minutes>=60){var hours_delta=Math.floor(minutes/60);minutes-=(hours_delta*60);hours+=hours_delta;}}else{minutes=0;}}if(hours>=0&&minutes>=0&&minutes<60){field.value=hours+":"+(minutes<10?"0":"")+minutes;validflag=true;}else{if(doalert){alert("Invalid time value (must be hh:mm)");}validflag=false;}}else{if(type=="timeofday"){var fldvalue=field.value;fldvalue=hhmmtotimestring(fldvalue);var time=stringtotime(null,fldvalue);validflag=!isNaN(time);if(validflag){field.value=gettimestring(time,window.datetime_am_string,window.datetime_pm_string);}else{if(doalert){alert("Invalid time value");}}}else{if(type=="visiblepassword"){validflag=checkpassword(field.value,field.value,doalert);}else{if(type=="email"){validflag=checkemail(field.value,true,doalert);}else{if(type=="emails"){var bademails=new Array();var validcount=0;if(!separator){separator=/[,;]/;}var emails=field.value.split(separator);for(var j=0;j<emails.length;j++){var semail=trim(emails[j]);if(semail){if(checkemailvalue(semail,false)){validcount+=1;}else{bademails.push(emails[j]);}}}if(bademails.length>0){validflag=false;if(doalert){alert("Invalid email(s) found: "+bademails.join("; "));}}else{if(validcount<1){validflag=false;if(doalert){alert('No valid emails found in "'+field.value+'"');}}}}else{if(type=="printerOffset"){var maxclip=2;var minclip=-2;var val=field.value;val=val.replace(/,/g,"");numval=parseFloat(val);if(isNaN(numval)||numval>=maxclip||numval<=minclip){if(doalert){if(numval>=maxclip){alert("Invalid number (must be lower than "+maxclip+").");}else{if(numval<=minclip){alert("Invalid number (must be greater than "+minclip+").");}else{alert("Illegal number: "+numval);}}}validflag=false;}else{validflag=true;}}else{if(type=="metricPrinterOffset"){var maxclip=50;var minclip=-50;var val=field.value;val=val.replace(/,/g,"");numval=parseFloat(val);if(isNaN(numval)||numval>=maxclip||numval<=minclip){if(doalert){if(numval>=maxclip){alert("Invalid number (must be lower than "+maxclip+").");}else{if(numval<=minclip){alert("Invalid number (must be greater than "+minclip+").");}else{alert("Illegal number: "+numval);}}}validflag=false;}else{validflag=true;}}else{if(type=="phone"||type=="fullphone"){var val=field.value;if(val.length!=0&&val.length<7){if(doalert){alert("Phone number should have seven digits or more.");}validflag=false;}if(validflag&&type=="fullphone"){if(val.length!=0&&val.length<10){if(doalert){alert("Please include the area code for phone number: "+val);}validflag=false;}}if(autoplace&&validflag){var extidx=val.search(/[A-Za-z]/);var ext="";if(extidx>=0){ext=" "+val.substring(extidx);val=val.substring(0,extidx);}var re=/^[0-9()-.\s]+$/;if(re.test(val)){var digits=val.replace(/[()-.\s]/g,"");var phoneformat=window.phoneformat.replace(new RegExp("[360]","g"),String.fromCharCode(3));if(digits.length==7){field.value=phoneformat.replace(phoneformat.substring(0,phoneformat.indexOf("4")),"").replace("45"+String.fromCharCode(3),digits.substring(0,3)).replace("789"+String.fromCharCode(3),digits.substring(3))+ext;}else{if(digits.length==10){field.value=phoneformat.replace("12"+String.fromCharCode(3),digits.substring(0,3)).replace("45"+String.fromCharCode(3),digits.substring(3,6)).replace("789"+String.fromCharCode(3),digits.substring(6))+ext;}else{if(digits.length==11&&digits.substring(0,1)=="1"){field.value="1 "+phoneformat.replace("12"+String.fromCharCode(3),digits.substring(1,4)).replace("45"+String.fromCharCode(3),digits.substring(4,7)).replace("789"+String.fromCharCode(3),digits.substring(7))+ext;}}}}}}else{if(type=="color"){var val=field.value;if(val.substring(0,1)=="#"){val=val.substring(1);}var re=/^[0-9ABCDEFabcdef]{6,}$/;if(val.length>6||!re.test(val)){if(doalert){alert("Color value must be 6 hexadecimal digits of the form: #RRGGBB.  Example: #FF0000 for red.");}validflag=false;}else{field.value="#"+val;}}else{if(type=="identifier"||type=="identifieranycase"){var val=field.value;var re=/^[0-9A-Za-z_]+$/;if(!re.test(val)){if(doalert){alert('Identifiers can contain only digits, alphabetic characters, or "_" with no spaces');}validflag=false;}else{field.value=type=="identifier"?val.toLowerCase():val;}}else{if(type=="furigana"){var val=field.value;var re=/^[\u0020\u3000\u30A0-\u30FF\uFF61-\uFF9F]+$/;if(!re.test(val)){if(doalert){alert("A non-katakana character has been entered.");}validflag=false;}}}}}}}}}}}}}}}}}}}}}}if(mandatory==true){if(field.value.length==0){if(doalert){alert("Field must contain a value.");}validflag=false;}}if(!validflag){selectAndFocusField(field);}window.isvalid=validflag;return validflag;}function selectAndFocusField(a){if(isIE){a.focus();a.select();}else{setTimeout("document.getElementById('"+a.id+"').focus();document.getElementById('"+a.id+"').select();",0);}}function validatePeriodRange(a,b){if(getSelectIndex(b)<getSelectIndex(a)){alert("Please enter a valid date range. The From date must precede the To date.");return false;}return true;}function setSelectionRange(b,c,d){if(b.setSelectionRange){b.focus();b.setSelectionRange(c,d);}else{if(b.createTextRange){var a=b.createTextRange();a.collapse(true);a.moveEnd("character",d);a.moveStart("character",c);a.select();}}}var NLDate_months=new Array("January","February","March","April","May","June","July","August","September","October","November","December");if(13>12){NLDate_months.push("");}var NLDate_short_months=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");if(13>12){NLDate_short_months.push("");}function nlGetFullYear(a){if(window.navigator!=null&&window.navigator.appName=="Netscape"){if(a.getFullYear=="undefined"){return a.getYear();}}return a.getFullYear();}function nlSetFullYear(b,a){if(window.navigator!=null&&window.navigator.appName=="Netscape"){if(b.setFullYear=="undefined"){b.setYear(a);}}b.setFullYear(a);}var year_char_cn="年";var month_char_cn="月";var day_char_cn="日";var weekday=new Array(7);weekday[0]="Sunday";weekday[1]="Monday";weekday[2]="Tuesday";weekday[3]="Wednesday";weekday[4]="Thursday";weekday[5]="Friday";weekday[6]="Saturday";function getdatestring(c,b){var a;if(typeof(b)!="undefined"){a=b;}else{if(typeof(window.dateformat)!="undefined"){a=window.dateformat;}else{a="MM/DD/YYYY";}}a=a.replace("YYYY",nlGetFullYear(c));a=a.replace("MM",(c.getMonth()+1));a=a.replace("DD",c.getDate());a=a.replace(/month/i,NLDate_months[c.getMonth()]);a=a.replace(/mon/i,NLDate_short_months[c.getMonth()]);if(a.indexOf("EEYY")==0){a=a.replace("EEYY",get_japanese_imperial_era(c)+get_japanese_imperial_year(c));}else{if(a.indexOf("EYY")==0){a=a.replace("EYY",get_short_japanese_imperial_era(c)+get_japanese_imperial_year(c));}}return a;}var heisei_start_date=new Date(1989,0,8);var shouwa_start_date=new Date(1926,11,25);var taishou_start_date=new Date(1912,6,30);var meiji_start_date=new Date(1867,1,3);function get_japanese_imperial_era(a){if(a>=heisei_start_date){return"平成";}else{if(a>=shouwa_start_date){return"昭和";}else{if(a>=taishou_start_date){return"大正";}else{return"明治";}}}}function get_short_japanese_imperial_era(a){if(a>=heisei_start_date){return"H";}else{if(a>=shouwa_start_date){return"S";}else{if(a>=taishou_start_date){return"D";}else{return"M";}}}}function get_japanese_imperial_year(a){if(a>=heisei_start_date){return nlGetFullYear(a)-1988;}else{if(a>=shouwa_start_date){return nlGetFullYear(a)-1925;}else{if(a>=taishou_start_date){return nlGetFullYear(a)-1911;}else{return nlGetFullYear(a)-1867;}}}}function get_gregorian_year(b,a){if(a=="平成"||a=="H"){return b+1988;}else{if(a=="昭和"||a=="S"){return b+1925;}else{if(a=="大正"||a=="D"){return b+1911;}else{return b+1867;}}}}function getdefaultformatdatestring(a){return(a.getMonth()+1)+"/"+a.getDate()+"/"+nlGetFullYear(a);}function gettimestring(f,d,e){var a=f.getHours();if(typeof(d)=="undefined"){d=window.datetime_am_string;e=window.datetime_pm_string;}var b=a<12?d:e;if(window.timeformat.indexOf("HH24")<0){a=a%12;if(a==0){a=12;}}var c=f.getMinutes()<10?"0"+f.getMinutes():f.getMinutes();var g=window.timeformat;g=g.replace("24","");g=g.replace("fmHH",a);g=g.replace("fmMI",c);if(window.timeformat.indexOf("HH24")<0){g=g.replace("am",b);}return g;}function getdatetimestring(a){return getdatestring(a)+" "+gettimestring(a);}function getmmyydatestring(b,a){if(window.dateformat=="DD-Mon-YYYY"){return a[b.getMonth()]+"-"+nlGetFullYear(b);}else{if(window.dateformat=="DD.MM.YYYY"){return(b.getMonth()+1)+"."+nlGetFullYear(b);}else{if(window.dateformat=="DD/MM/YYYY"){return(b.getMonth()+1)+"/"+nlGetFullYear(b);}else{if(window.dateformat=="YYYY/MM/DD"){return(b.getMonth()+1)+"/"+nlGetFullYear(b);}else{return(b.getMonth()+1)+"/"+nlGetFullYear(b);}}}}}function stringtodate(b,o,g){var l;var v,p,f;var c,q,h,m;var r=b;if(o==null){if(typeof(window.dateformat)!="undefined"){o=window.dateformat;}else{o="MM/DD/YYYY";}}var n=b.length;var k;var a=4;var u=g?null:new Date();if(r.length>0){if(o=="MM/DD/YYYY"){l=r.split("/");if(l.length!=3){return u;}v=parseInt(l[0])-1;p=parseInt(l[1]);f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD/MM/YYYY"){l=r.split("/");if(l.length!=3){return u;}p=parseInt(l[0]);v=parseInt(l[1])-1;f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD-Mon-YYYY"){l=r.split("-");if(l.length!=3){return u;}p=parseInt(l[0]);v=getMonthIndex(l[1])-1;f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD.MM.YYYY"){l=r.split(".");if(l.length!=3){return u;}p=parseInt(l[0]);v=parseInt(l[1])-1;f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD-MONTH-YYYY"){l=r.split("-");if(l.length!=3){return u;}p=parseInt(l[0]);v=arrayIndexOf(NLDate_months,l[1],true);f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="YYYY/MM/DD"){l=r.split("/");if(l.length!=3){return u;}k=l[2].split(" ")[0];p=parseInt(k);v=parseInt(l[1])-1;f=parseInt(l[0]);n=l[1].length+k.length+a+2;}else{if(o=="YYYY-MM-DD"){l=r.split("-");if(l.length!=3){return u;}k=l[2].split(" ")[0];p=parseInt(k);v=parseInt(l[1])-1;f=parseInt(l[0]);n=l[1].length+k.length+a+2;}else{if(o=="EEYY年MM月DD日"){c=r.indexOf(year_char_cn);q=r.indexOf(month_char_cn);h=r.indexOf(day_char_cn);if(c<0||q<0||h<0){return u;}p=parseInt(r.substring(q+1,h));v=parseInt(r.substring(c+1,q))-1;m=r.substring(0,2);f=get_gregorian_year(parseInt(r.substring(2,c)),m);n=h+1;}else{if(o=="YYYY年MM月DD日"){c=r.indexOf(year_char_cn);q=r.indexOf(month_char_cn);h=r.indexOf(day_char_cn);if(c<0||q<0||h<0){return u;}p=parseInt(r.substring(q+1,h));v=parseInt(r.substring(c+1,q))-1;f=parseInt(r.substring(0,c));n=h+1;}else{if(o=="EYY.MM.DD"){l=r.split(".");if(l.length!=3){return u;}k=l[2].split(" ")[0];p=parseInt(k,10);v=parseInt(l[1])-1;m=l[0].substring(0,1);f=get_gregorian_year(parseInt(l[0].substring(1,l[0].length)),m);n=l[0].length+l[1].length+k.length+2;}else{if(o=="DD. MON YYYY"){l=r.split(" ");if(l.length!=3){return u;}p=parseInt(l[0].substring(0,l[0].length-1));v=arrayIndexOf(NLDate_short_months,l[1]);f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD de MONTH de YYYY"){l=r.split(" de ");if(l.length!=3){return u;}p=parseInt(l[0]);v=getMonthIndex(l[1])-1;f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+8;}else{if(o=="YYYY년 MM월 DD일"){l=r.split(" ");if(l.length!=3){return u;}p=parseInt(l[2].substring(0,l[2].length-1));v=parseInt(l[1].substring(0,l[1].length-1))-1;f=parseInt(l[0].substring(0,l[0].length-1));n=a+l[1].length+l[2].length+5;}else{if(o=="DD MONTH YYYY"){l=r.split(" ");if(l.length!=3){return u;}p=parseInt(l[0]);v=arrayIndexOf(NLDate_months,l[1],true);f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}else{if(o=="DD MONTH, YYYY"){l=r.split(" ");if(l.length!=3){return u;}p=parseInt(l[0]);v=arrayIndexOf(NLDate_months,l[1].substring(0,l[1].length-1),true);f=parseInt(l[2].substring(0,a));n=l[0].length+l[1].length+a+2;}}}}}}}}}}}}}}}}if(!isvalidyearmonthday(f,v,p)){return u;}var e;var j=b.substring(n);if(j!=null&&j.length>0){e=stringtotime(b.substring(0,n),j);}else{e=new Date(f,v,p);}if(f<50){nlSetFullYear(e,f+2000);}else{if(f<100){nlSetFullYear(e,f+1900);}}return e;}function isvalidyearmonthday(b,c,a){if(isNaN(b)||b<0||isNaN(c)||c<0||c>11||isNaN(a)||a<1||a>31){return false;}else{return true;}}function stringtotime(c,b){var l=c!=null?stringtodate(c):new Date();if(b!=null&&new String(b).length!=0&&new String(b).search(/\S/)>=0){var j,d,g,k;var h;var f;format=window.timeformat.replace(/fm/g,"");if(format=="HH:MI am"||format=="HH-MI am"||format=="HH24:MI"||format=="HH24-MI"){var a=/^\s*(\d+)[-:](\d+)\s*(.*)/.exec(b);if(!a){return NaN;}j=parseInt(a[1],10);d=parseInt(a[2],10);if(format.substring(6)=="am"){k=(a[3]==window.datetime_pm_string);if(!k&&j==12){j=0;}else{if(k&&j<12){j+=12;}}}}else{if(format=="amHH時MI分"||format=="amHH点MI分"||format=="amHH시MI분"){h=b.indexOf("時");if(h<0){h=b.indexOf("点");}if(h<0){h=b.indexOf("시");}var e=0;k=false;if(b.indexOf(window.datetime_am_string)==0){e=window.datetime_am_string.length;}else{if(b.indexOf(window.datetime_pm_string)==0){e=window.datetime_pm_string.length;k=true;}}j=parseInt(b.substring(e,h));if(!k&&j==12){j=0;}else{if(k&&j<12){j+=12;}}d=parseInt(b.substring(h+1,b.length-1));}else{if(format=="HH24時MI分"||format=="HH24点MI分"||format=="HH24시MI분"){h=b.indexOf("時");if(h<0){h=b.indexOf("点");}if(h<0){h=b.indexOf("시");}j=parseInt(b.substring(0,h));d=parseInt(b.substring(h+1,b.length-1));}}}if(isNaN(j)||isNaN(d)||j>=24||j<0||d>=60||d<0){return NaN;}l.setHours(j,d,0,0);}return l;}function hhmmtotime(a){return stringtotime(null,hhmmtotimestring(a));}function hhmmtotimestring(j){var g=j;var f,b;if(window.datetime_am_string.charAt(0)==window.datetime_pm_string.charAt(0)){re=new RegExp("^[0-9]{1,4}("+window.datetime_am_string+"|"+window.datetime_pm_string+")*$","i");}else{re=new RegExp("^[0-9]{1,4}(["+window.datetime_am_string.charAt(0)+"|"+window.datetime_pm_string.charAt(0)+"]?)$","i");}if(re.test(g)){var c="";if(RegExp.$1){if(window.datetime_am_string.charAt(0)==window.datetime_pm_string.charAt(0)){c=RegExp.$1.toLowerCase()==window.datetime_pm_string?window.datetime_pm_string:window.datetime_am_string;}else{c=RegExp.$1.toLowerCase().charAt(0)==window.datetime_pm_string.charAt(0)?window.datetime_pm_string:window.datetime_am_string;}}if(g.length<3||(g.length==3&&RegExp.$1)){var d=RegExp.$1?g.substring(0,g.length-1):g;f=parseInt(d,10)==0?12:(parseInt(d,10)>12?parseInt(d,10)%12:d);b=0;var h=RegExp.$1?c:(parseInt(g,10)>11?window.datetime_pm_string:window.datetime_am_string);}else{if(g.length==3||(g.length==4&&RegExp.$1)){var d=g.substring(0,1)=="0"?"12":g.substring(0,1);f=parseInt(d,10);var e=RegExp.$1?g.substring(1,3):g.substring(1);b=parseInt(e,10);var h=RegExp.$1?c:window.datetime_am_string;}else{var d=g.substring(0,2);f=parseInt(d,10)==0?12:(parseInt(d,10)>12?parseInt(d,10)%12:d);var e=RegExp.$1?g.substring(2,4):g.substring(2);b=parseInt(e,10);var h=parseInt(g.substring(0,2),10)>11?window.datetime_pm_string:window.datetime_am_string;h=RegExp.$1?c:h;}}if(h==window.datetime_am_string&&f==12){f=0;}else{if(h==window.datetime_pm_string&&f!=12){f=parseInt(f)+12;}}var a=new Date();a.setHours(f,b,0,0);g=gettimestring(a,window.datetime_am_string,window.datetime_pm_string);}return g;}function adddays(c,a){var b=new Date(c.getTime()+86400*a*1000);if(b.getHours()!=c.getHours()){if((c.getHours()>0&&b.getHours()<c.getHours())||(c.getHours()==0&&b.getHours()==23)){b.setTime(b.getTime()+3600*1000);}else{b.setTime(b.getTime()-3600*1000);}}c.setTime(b.getTime());return c;}function daysBetween(b,a){return get_julian_date(a)-get_julian_date(b);}function monthsBetween(b,a){return 12*(a.getFullYear()-b.getFullYear())+(a.getMonth()-b.getMonth());}function isDOWIM(b,a){return(a>=1&&a==(1+Math.floor((b.getDate()-1)/7)))||((a==-1||a==5)&&daysBetween(b,addmonths(new Date(b.getFullYear(),b.getMonth(),1),1))<=7);}function isLeapYear(a){return(a%4==0)&&((a%100!=0)||(a%400==0));}MONTH_LENGTH=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]];function getMonthLength(a,b){return MONTH_LENGTH[isLeapYear(a)?1:0][b];}function setDateComponents(d,e,c,a){var b=new Date(d);if(typeof(a)!="boolean"){a=false;}addmonths(b,e);setDate(b,c,a);return b;}function addmonths(f,a){if(a!=0){var b=nlGetFullYear(f);var e=f.getDate();var c=f.getMonth()+a;if(c<0){c+=1;b=b+Math.ceil(c/12)-1;nlSetFullYear(f,b);c=11+(c%12);}else{if(c>11){b=b+Math.floor(c/12);nlSetFullYear(f,b);c%=12;}}eom=getMonthLength(b,c);if(e>eom){f.setDate(eom);}f.setMonth(c);}return f;}function addhours(e,c,a){var b=new Date(e.getTime()+3600*c*1000);e.setTime(b.getTime());if(a){e.setMinutes(0);e.setSeconds(0);e.setMilliseconds(0);}return e;}function setDate(e,b,a){if(a){var c=getMonthLength(nlGetFullYear(e),e.getMonth());b=Math.min(c,b);}e.setDate(b);}m_j_d=[[0,31,59,90,120,151,181,212,243,273,304,334],[0,31,60,91,121,152,182,213,244,274,305,335]];function getMonthJulian(a,b){return m_j_d[isLeapYear(a)?1:0][b];}var j_d=new Array();j_d[1970]=0;j_d[1971]=365;j_d[1972]=730;j_d[1973]=1096;j_d[1974]=1461;j_d[1975]=1826;j_d[1976]=2191;j_d[1977]=2557;j_d[1978]=2922;j_d[1979]=3287;j_d[1980]=3652;j_d[1981]=4018;j_d[1982]=4383;j_d[1983]=4748;j_d[1984]=5113;j_d[1985]=5479;j_d[1986]=5844;j_d[1987]=6209;j_d[1988]=6574;j_d[1989]=6940;j_d[1990]=7305;j_d[1991]=7670;j_d[1992]=8035;j_d[1993]=8401;j_d[1994]=8766;j_d[1995]=9131;j_d[1996]=9496;j_d[1997]=9862;j_d[1998]=10227;j_d[1999]=10592;j_d[2000]=10957;j_d[2001]=11323;j_d[2002]=11688;j_d[2003]=12053;j_d[2004]=12418;j_d[2005]=12784;j_d[2006]=13149;j_d[2007]=13514;j_d[2008]=13879;j_d[2009]=14245;j_d[2010]=14610;j_d[2011]=14975;j_d[2012]=15340;j_d[2013]=15706;j_d[2014]=16071;j_d[2015]=16436;j_d[2016]=16801;j_d[2017]=17167;j_d[2018]=17532;j_d[2019]=17897;j_d[2020]=18262;j_d[2021]=18628;j_d[2022]=18993;j_d[2023]=19358;j_d[2024]=19723;j_d[2025]=20089;j_d[2026]=20454;j_d[2027]=20819;j_d[2028]=21184;j_d[2029]=21550;j_d[2030]=21915;function get_julian_date(a){return j_d[a.getFullYear()]+getMonthJulian(a.getFullYear(),a.getMonth())+a.getDate()-1;}function getMonthIndex(b){var a=-1;b=b.toUpperCase();for(var d=0;d<NLDate_short_months.length;d++){if(NLDate_short_months[d].toUpperCase()==b){a=d+1;break;}}if(a!=-1){return a;}for(var d=0;d<NLDate_months.length;d++){if(NLDate_months[d].toUpperCase()==b){a=d+1;break;}}if(a!=-1){return a;}else{var c="JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";a=(c.indexOf(b)+3)/3;}return a;}function createTDWindow(b){var a=screen.width*(0.35);var d=screen.height*(0.3);if(a<150||d<150){a=150;d=150;}var e=screen.width-(a+20);var c=screen.height-(d+60);window.open(b,"test","scrollbars=yes,width="+a+",height="+d+",left="+e+",top="+c);}function DoFieldFocus(c){if(c==null){return;}var a;for(a=0;a<c.elements.length;a++){var b=c.elements[a];if(b.type=="text"||b.type=="select-one"||b.type=="checkbox"){b.focus();return;}}}function clearMultiSelect(a){if(isNLMultiDropDown(a)){getMultiDropdown(a).removeAll();}else{if(a.type=="select-multiple"){for(i=a.length-1;i>=0;i--){a.options[i].selected=false;}}else{a.value="";if(a.form.elements[a.name+"_display"]!=null){a.form.elements[a.name+"_display"].value="";}}}}function getnamevaluelisttext(h,g,b){if(h.length==0){return"";}var f=h.split(String.fromCharCode(4));var a="";for(var e=0;e<f.length;e++){var c=f[e].split(String.fromCharCode(3));var d=c.length==5?c[4]:c[3];if(d.length>0||b==true){if(!isValEmpty(a)){a+=g;}a+=c[2]+": "+d;}}return a;}function getnamevaluelistdata(f){if(f.length==0){return"";}var e=f.split(String.fromCharCode(4));var a="";for(var d=0;d<e.length;d++){if(d>0){a+=String.fromCharCode(4);}var c=e[d].split(String.fromCharCode(3));var b=c.length>3?c[3]:"";a+=c[0]+String.fromCharCode(3)+b;}return a;}function getnamevaluelistvalue(b,c){if(b.length==0){return null;}var e=b.split(String.fromCharCode(4));for(var d=0;d<e.length;d++){var a=e[d].split(String.fromCharCode(3));if(a[0].toLowerCase()==c.toLowerCase()){return a[3];}}return null;}function getnamevaluelistdisplayvalue(b,c){if(b.length==0){return null;}var e=b.split(String.fromCharCode(4));for(var d=0;d<e.length;d++){var a=e[d].split(String.fromCharCode(3));if(a[0].toLowerCase()==c.toLowerCase()){return a.length==5?a[4]:a[3];}}return null;}function setnamevaluelistvalue(b,c,e){if(b.length==0){return"";}var f=b.split(String.fromCharCode(4));for(var d=0;d<f.length;d++){var a=f[d].split(String.fromCharCode(3));if(a[0].toLowerCase()==c.toLowerCase()){a[3]=e;f[d]=a.join(String.fromCharCode(3));break;}}return f.join(String.fromCharCode(4));}function syncnamevaluelist(b){var a=b.form.elements[b.name+"_display"];a.value=getnamevaluelisttext(b.value,"\n",true);if(a.onchange){a.onchange();}}function NLNameValueList_onKeyPress(a,c,e){var d=getEventKeypress(a);if(d==32){var b=document.getElementById(c+"_helper_"+e);if(b&&b.click){b.click();}}return true;}function synclist(e,f,d){if(e.className=="nldropdown"){var b=getDropdown(e);if(b!=null){var a=b.getIndexForValue(f);b.setIndex(a,true);if(d){b.setDefaultIndex(a);}}}else{if(e.type=="select-one"){for(var c=0;c<e.length;c++){if(e.options[c].value==f){e.selectedIndex=c;if(d){e.options[c].defaultSelected=true;}break;}}}else{e.value=f;}}}function syncpopup(f,h,c,e){var d;if(f.className=="nldropdown"){var b=getDropdown(f);var a=b.getIndexForValue(h);b.setIndex(a,true);if(e){b.setDefaultIndex(a);}}else{if(isNLMultiDropDown(f)){var b=getMultiDropdown(f);b.setValues(h);}else{if(f.type=="select-one"||f.type=="select-multiple"){for(d=0;d<f.length;d++){if(f.options[d].value==h){f.selectedIndex=d;if(e){f.options[d].defaultSelected=true;}break;}}}else{if(isPopupSelect(f)){f.value=h;if(e){f.defaultValue=h;}var g=f.form.elements[f.name+"_display"];if(h.length>0||(c!=null&&c.length>0)){g.value=c;g.style.color="000000";if(e){g.defaultValue=c;}}else{g.value=g.type=="text"?_popup_help:_mult_popup_help;g.style.color="999999";}}else{f.value=h;if(e){f.defaultValue=h;}}}}}}function syncmultiselectlist(h,b,g,c){clearMultiSelect(h);if(typeof b!="string"&&!isArray(b)){b=""+b;}if(isNLMultiDropDown(h)){if(typeof b!="string"){b=b.join(String.fromCharCode(5));}var k=getMultiDropdown(h);k.setValues(b,c);}else{if(h.type!="select-multiple"){h.form.elements[h.name].value=b;g=emptyIfNull(g);var a=g.indexOf(String.fromCharCode(5))!=-1?String.fromCharCode(5):"\n";var d=h.form.elements[h.name+"_labels"];if(d!=null){d.value=isValEmpty(b)?"":g.split(a).join(String.fromCharCode(5));}var l=h.form.elements[h.name+"_display"];if(l!=null){l.value=g?g.split(a).join("\n"):_mult_popup_help;}}else{if(typeof b=="string"){b=b.split(String.fromCharCode(5));}for(var f=0;f<b.length;f++){for(var e=0;e<h.length;e++){if(h.options[e].value==b[f]){h.options[e].selected=true;}}}}}}function syncradio(a,e,c){var b;var d;for(b=0;b<a.length;b++){d=a[b].value==e;a[b].checked=d;if(c){a[b].defaultChecked=d;}}}function getlisttext(c,d,a){if(c.className=="nldropdown"){return getDropdown(c).getTextForValue(d);}if(c.type!="select-one"&&!a){return"";}for(var b=0;b<c.length;b++){if(c.options[b].value==d){return c.options[b].text;}}return"";}function getmultiselectlisttext(d,e){if(isNLMultiDropDown(d)){return getMultiDropdown(d).getSelectedTextFromValues(e,"<br>");}else{if(d.type!="select-multiple"){return"";}else{var a=e.split(String.fromCharCode(5));var b="";for(var c=0;c<a.length;c++){if(c>0){b+="<br>";}b+=getlisttext(d,a[c],true);}return b;}}}function getradiotext(a,c){var b;for(b=0;b<a.length;b++){if(a[b].value==c){return a[b].textValue;}}return"";}function getRadioValue(a){var c="";if(typeof a.length=="undefined"){a=a.ownerDocument.getElementsByName(a.name);}for(var b=0;b<a.length;b++){if(a[b].checked==true){c=a[b].value;break;}}return c;}function getSelectedRadio(a){var c=null;if(typeof a.length=="undefined"){a=a.ownerDocument.getElementsByName(a.name);}for(var b=0;b<a.length&&c==null;b++){c=a[b].checked?a[b]:null;}return c;}function getSelectValue(b){var a;if(b.type!=null&&b.type=="select-one"){a=(b.options.length==0||b.selectedIndex==-1||b.selectedIndex>=b.options.length)?"":b.options[b.selectedIndex].value;}else{if(isMultiSelect(b)){a=getMultiSelectValues(b);}else{if(b.className=="nldropdown"){a=getDropdown(b).getValue();}else{if(isNLMultiDropDown(b)){a=getMultiDropdown(b).getSelectedValues();}else{a=b.value;}}}}return a;}function getSelectValueArray(c){var a;if(c.type=="select-one"||c.type=="select-multiple"){a=new Array(c.length);for(var b=0;b<c.length;b++){a[b]=c.options[b].value;}}else{if(c.className=="nldropdown"){a=getDropdown(c).valueArray;}else{if(isNLMultiDropDown(c)){a=getMultiDropdown(c).valueArray;}}}return a;}function getIndexForValue(c,d){var a=-1;if(c.type=="select-one"||c.type=="select-multiple"){for(var b=0;b<c.length;b++){if(c.options[b].value==d){a=b;break;}}}else{if(c.className=="nldropdown"){a=getDropdown(c).getIndexForValue(d);}else{if(isNLMultiDropDown(c)){a=getMultiDropdown(c).getIndexForValue(d);}}}if(typeof(a)=="undefined"){a=-1;}return a;}function getSelectTextForValue(c,d){var a=getSelectValueArray(c);var b;for(b=0;b<a.length;b++){if(a[b]==d){return getSelectTextAtIndex(c,b);}}return null;}function getSelectTextArray(c){var a;if(c.type=="select-one"||c.type=="select-multiple"){a=new Array(c.length);for(var b=0;b<c.length;b++){a[b]=c.options[b].text;}}else{if(c.className=="nldropdown"){a=getDropdown(c).textArray;}else{if(isNLMultiDropDown(c)){a=getMultiDropdown(c).textArray;}}}return a;}function getSelectText(a,b){var c=getSelectValue(a);if(a.type=="select-one"){return(a.options.length==0||a.selectedIndex==-1||a.selectedIndex>=a.options.length)?null:a.options[a.selectedIndex].text;}else{if(a.className=="nldropdown"){return getDropdown(a).getText();}else{if(isMultiSelect(a)||isPopupMultiSelect(a)){return getMultiSelectText(a,null,b);}else{if(isPopupSelect(a)){return isValEmpty(c)?"":getFormElement(a.form,a.name+"_display").value.replace(/\s$/,"");}else{if(isDisplayOnlySelect(a)){return getInlineTextValue(document.getElementById(a.name+"_displayval"));}else{return a.text;}}}}}}function setSelectValue(c,d){if(window.virtualBrowser){c.value=d;}else{if(c.className=="nldropdown"){var h=getDropdown(c);var g=h.getIndexForValue(d);if(g==null){return false;}h.setIndex(g,true);if(h.isOpen){h.setCurrentCellInMenu(h.divArray[g]);}}else{if(isNLMultiDropDown(c)){var h=getMultiDropdown(c);var g=h.getIndexForValue(d);if(g==null){return false;}h.setIndex(g);}else{if(c.type=="select-one"){var b=c.options;for(var f=0;f<b.length;f++){if(b[f].value==d){c.selectedIndex=f;return true;}}return false;}else{if(c.type=="select-multiple"){var a=c.options;var j=false;for(var f=0;f<a.length;f++){a[f].selected=a[f].value==d;j=j||a[f].value==d;}return j;}else{c.value=d;if(d.length==0&&isPopupSelect(c)){var e=c.form.elements[c.name+"_display"];e.value=e.type=="text"?_popup_help:_mult_popup_help;e.style.color="999999";}}}}}}return true;}function addMultiSelectValue(c,d,b){if(isNLMultiDropDown(c)){var h=getMultiDropdown(c);var f=h.getIndexForValue(d);h.addIndex(f);}else{if(c.type=="select-multiple"){var a=c.options;for(var e=0;e<a.length;e++){if(a[e].value==d){a[e].selected=true;}}}else{var g=c.value.split(String.fromCharCode(5));for(var e=0;e<g.length;e++){if(g[e]==d){return;}}c.form.elements[c.name+"_display"].style.color="000000";if(g.length==0||g[0].length==0){c.value=d;c.form.elements[c.name+"_display"].value=b;c.form.elements[c.name+"_labels"].value=b;}else{c.value+=String.fromCharCode(5)+d;c.form.elements[c.name+"_labels"].value+=String.fromCharCode(5)+b;var j=c.form.elements[c.name+"_display"].value.split(/\n|\r/);if(j.length==g.length){c.form.elements[c.name+"_display"].value+="\n"+b;}else{j[g.length]=b;c.form.elements[c.name+"_display"].value=j.join("\n");}}}}}function getCurrentMultiSelectUserInputValue(b){var a=getSelectedTextRange(b)[0];var e=b.value.substr(0,a);var d=Math.max(e.lastIndexOf("\n"),e.lastIndexOf("\r"))+1;var c=b.value.substr(a).search(/\n|\r/);c=c==-1?b.value.length:a+c;userEnteredValue=b.value.substring(d,c);return userEnteredValue;}function getSelectValueForText(d,a){var b=getSelectTextArray(d);var c;for(c=0;c<b.length;c++){if(b[c]==a){return getSelectValueAtIndex(d,c);}}return null;}function deleteAllSelectOptions(a,b){if(a.className=="nldropdown"){getDropdown(a,b).deleteAllOptions();}else{if(isNLMultiDropDown(a)){getMultiDropdown(a,b).deleteAllOptions();}else{if(a.type=="select-one"||a.type=="select-multiple"){a.options.length=0;}else{if(a.form.elements[a.name+"_display"]!=null){a.form.elements[a.name+"_display"].value="";a.value="";}}}}}function deleteOneSelectOption(e,d,c){if(e.className=="nldropdown"){getDropdown(e).deleteOneOption(d,c);}else{if(isNLMultiDropDown(e)){getMultiDropdown(e).deleteOneOption(d);}else{if(e.type=="select-one"||e.type=="select-multiple"){var b=e.options;for(var a=0;a<b.length;a++){if(b[a].value==d){b[a]=null;}}}else{if(e.form.elements[e.name+"_display"]!=null){e.form.elements[e.name+"_display"].value="";e.value="";}}}}}function getSelectIndex(a,b){if(a.className=="nldropdown"){return getDropdown(a,b).getIndex();}else{return a.selectedIndex;}}function setSelectIndex(a,b){if(a.className=="nldropdown"){return getDropdown(a).setIndex(b,true);}else{if(isNLMultiDropDown(a)){return getMultiDropdown(a).setIndex(b);}else{a.selectedIndex=b;}}}function setMultiSelectValues(a,b){syncmultiselectlist(a,b);}function getMultiSelectValues(b,c){var d=null;if(isMultiSelect(b)){if(isNLMultiDropDown(b)){d=getMultiDropdown(b).getSelectedValues();}else{d="";for(var a=0;a<b.length;a++){if(b.options[a].selected){d+=((d==""?"":String.fromCharCode(5))+b.options[a].value);}}}}else{d=b.value;}return c?(isValEmpty(d)?[]:d.split(String.fromCharCode(5))):d;}function getMultiSelectText(c,a,d){var g="";var f=d?String.fromCharCode(5):", ";if(isMultiSelect(c)){f=a?"\n":f;if(isNLMultiDropDown(c)){g=getMultiDropdown(c).getSelectedText(f);}else{var b,e=0;for(b=0;b<c.length;b++){if(c.options[b].selected){g+=((e++==0?"":(f))+c.options[b].text);}}}}else{if(isPopupMultiSelect(c)){g=getFormElement(c.form,c.name+"_labels").value;if(g!=null&&f!=String.fromCharCode(5)){g=g.replace(new RegExp(String.fromCharCode(5),"g"),f);}}else{g=c.text;}}return d?(isValEmpty(g)?[]:g.split(f)):g;}function updateMultiSelectValue(e,d,h,g,a){e.value=h;a.value=g;var b=g.split(String.fromCharCode(5));var c="",f=0;for(i=0;i<b.length;i++){c+=((f==0?"":"\n")+b[i]);f++;}d.value=c;}function addSelectOption(f,b,k,g,c,d,h){if(b.className=="nldropdown"){var j=getDropdown(b,d);j.addOption(k,g,h);if(c!==false){var h=j.getIndexForValue(g);j.setIndex(h,true);}}else{if(isNLMultiDropDown(b)){var j=getMultiDropdown(b,d);j.addOption(k,g,c,h);}else{var a=f.createElement("OPTION");a.text=k;a.value=g;if(isIE){if(typeof(h)=="undefined"){h=b.length;}b.add(a,h);}else{var e=null;if(typeof(h)!="undefined"&&h>=0&&h<b.length){e=b.options[h];}b.add(a,e);}if(c!==false){a.selected=true;if(isIE){b.selectedIndex=h;}}}}}function setSelectOptionText(e,d,g,f){if(e.className=="nldropdown"){var a=getDropdown(e,f);a.setOptionText(d,g);}else{if(e.type=="select-one"||e.type=="select-multiple"){var c=e.options;for(var b=0;b<c.length;b++){if(c[b].value==d){c[b].text=g;}}}}}function getCascadedStyle(b,d,c){if(b.currentStyle){return b.currentStyle[d];}else{if(window.getComputedStyle){if(b.nodeType!=1){return null;}var a=window.getComputedStyle(b,"");return a.getPropertyValue(c);}}return null;}function isFocusable(a){if(a==null||(typeof a.type=="undefined"&&!isNLDropDownSpan(a))||a.type=="hidden"||a.disabled||a.type=="button"){return false;}return elementIsFocusable(a);}function elementIsFocusable(b){while(b!=null){var a=getCascadedStyle(b,"visibility","visibility");var c=getCascadedStyle(b,"display","display");if(c=="none"||a=="hidden"||a=="hide"){return false;}b=b.parentNode;}return true;}function NLIsButton(a){if(a){if(a.tagName=="BUTTON"||(a.tagName=="INPUT"&&(a.type=="submit"||a.type=="button"||a.type=="reset"))){return true;}}return false;}function NLDisableButton(a,b){a.disabled=b;if(a.className.indexOf("nlbutton")>=0||a.className.indexOf("bgbutton")>=0||a.className.indexOf("nlinlineeditbutton")>=0){a.className=a.className.split("Disabled")[0]+(b?"Disabled":"");}}function isDisplayOnlySelect(a){return a!=null&&a.type=="hidden"&&document.getElementById(a.name+"_displayval")!=null;}function isPopupSelect(a){return a!=null&&a.type=="hidden"&&getFormElement(a.form,a.name+"_display")!=null&&getFormElement(a.form,a.name+"_display").type=="text";}function isPopupMultiSelect(a){return a!=null&&a.type=="hidden"&&getFormElement(a.form,a.name+"_display")!=null&&getFormElement(a.form,a.name+"_display").type=="textarea"&&getFormElement(a.form,a.name+"_labels")!=null;}function NLPopupSelect_setExactMatchQuery(c,a){c.setAttribute("exactMatchQuery",a?"T":"F");}function NLPopupSelect_getExactMatchQuery(a){return a.getAttribute("exactMatchQuery")=="T";}function isSelect(a){return a!=null&&(a.type=="select-one"||isNLDropDown(a));}function isNLDropDown(a){return a!=null&&a.className=="nldropdown";}function isNLDropDownSpan(a){return a!=null&&a.tagName=="SPAN"&&window.getDropdown!=null&&getDropdown(a)!=null;}function isMultiSelect(a){return a!=null&&(isNLMultiDropDown(a)||a.multiple||a.type=="select-multiple");}function isNLMultiDropDown(a){return a!=null&&a.getAttribute&&!isValEmpty(a.getAttribute("nlmultidropdown"));}function isRichTextEditor(a){return a!=null&&window.getHtmlEditor!=null&&getHtmlEditor(a.name)!=null;}function resetlist(b){if(b!=null){if(b.type=="select-one"||b.type=="select-multiple"){var a;for(a=0;a<b.length;a++){if(b.options[a].defaultSelected){b.selectedIndex=a;return;}}b.selectedIndex=0;}else{if(b.className=="nldropdown"){getDropdown(b).resetDropDown();}else{if(isNLMultiDropDown(b)){getMultiDropdown(b).resetDropDown();}else{b.value=b.defaultValue;b.form.elements[b.name+"_display"].value=b.form.elements[b.name+"_display"].defaultValue;}}}}}function setFieldFocus(a){if(isSelect(a)||isMultiSelect(a)||isPopupSelect(a)||isPopupMultiSelect(a)){setSelectFocus(a);}else{if(window.getHtmlEditor!=null&&window.getHtmlEditor(a.name)!=null){window.getHtmlEditor(a.name).setFocus();}else{if(isFocusable(a)){a.focus();}}}}function setSelectFocus(a,b){if(a!=null){if(a.type=="select-one"||a.type=="select-multiple"){if(isFocusable(a)){a.focus();}}else{if(a.className=="nldropdown"){if(isFocusable(getDropdown(a,b).getContainer())){getDropdown(a,b).setFocus();}}else{if(isNLMultiDropDown(a)){if(isFocusable(getMultiDropdown(a,b).getContainer())){getMultiDropdown(a,b).setFocus();}}else{if(isFocusable(a.form.elements[a.name+"_display"])){a.form.elements[a.name+"_display"].focus();}}}}}}function restoreSelectToOriginalValue(b,c){if(b!=null){if(b.type=="select-one"||b.type=="select-multiple"){var a=b.getAttribute("valuewhenrendered");if(a!=null&&a.length>0){setSelectValue(b,a);}}else{if(b.className=="nldropdown"){getDropdown(b,c).restoreToOriginalValue();}}}}function disableSelect(b,c,g){if(b!=null){var j=g!=null?g.document:b.document!=null?b.document:window.document;if(b.type=="select-one"||b.type=="select-multiple"){b.disabled=c;}else{if(b.className=="nldropdown"){getDropdown(b,g).setDisabled(c);}else{if(isNLMultiDropDown(b)){getMultiDropdown(b,g).setDisabled(c);}else{var d=b.form.elements[b.name+"_display"];if(d!=null){d.disabled=c;}var f=j.getElementById(b.name+"_popup_list");if(f!=null){f.style.visibility=c?"hidden":"inherit";}var e=j.getElementById(b.name+"_popup_search");if(e!=null){e.style.visibility=c?"hidden":"inherit";}var a=j.getElementById(b.name+"_popup_all");if(a!=null){a.style.visibility=c?"hidden":"inherit";}}}}var k=isNS4x?null:j.getElementById(b.name+"_popup_new");if(k!=null){k.style.visibility=c?"hidden":"inherit";}var h=isNS4x?null:j.getElementById(b.name+"_popup_link");if(h!=null){h.style.visibility=c?"hidden":"inherit";}}}function getSelectValueAtIndex(b,a){if(b!=null){if(b.type=="select-one"||b.type=="select-multiple"){if((b.options!=null)&&(b.options.length>a)){return b.options[a].value;}else{return null;}}else{if(b.className=="nldropdown"){return getDropdown(b).getValueAtIndex(a);}else{if(isNLMultiDropDown(b)){return getMultiDropdown(b).getValue(a);}}}}}function getSelectTextAtIndex(b,a){if(b!=null){if(b.type=="select-one"||b.type=="select-multiple"){if((b.options!=null)&&(b.options.length>a)){return b.options[a].text;}else{return null;}}else{if(b.className=="nldropdown"){return getDropdown(b).getTextAtIndex(a);}else{if(isNLMultiDropDown(b)){return getMultiDropdown(b).getText(a);}}}}}function setRequired(a,b){if(a.className=="nldropdown"){getDropdown(a).setRequired(b);}else{if(isNLMultiDropDown(a)){getMultiDropdown(a).setRequired(b);}else{if(window.getHtmlEditor!=null&&getHtmlEditor(a.name)!=null&&getHtmlEditor(a.name).setMandatory){getHtmlEditor(a.name).setMandatory(b);}else{if(a.form!=null&&a.form.elements[a.name+"_display"]!=null){a.form.elements[a.name+"_display"].className="input"+(b?"req":"");}else{a.className="input"+(b?"req":"");}}}}}function setDefaultOrNotRequired(a,b){setRequired(a,b?hasAttribute(a,128):false);}function hasAttribute(b,a){if(b.className=="nldropdown"){return getDropdown(b).hasAttribute(a);}else{if(isNLMultiDropDown(b)){return getMultiDropdown(b).hasAttribute(a);}else{if(window.getHtmlEditor!=null&&getHtmlEditor(b.name)!=null){return getHtmlEditor(b.name).hasAttribute(a);}else{return(b.getAttribute("flags")&a)!=0;}}}}function getRequired(a){if(a.className=="nldropdown"){return getDropdown(a).getRequired();}else{if(isNLMultiDropDown(a)){return getMultiDropdown(a).getRequired();}else{if(window.getHtmlEditor!=null&&getHtmlEditor(a.name)){return getHtmlEditor(a.name).getMandatory();}else{if(a.form!=null&&a.form.elements[a.name+"_display"]!=null){return a.form.elements[a.name+"_display"].className=="inputreq";}else{return a.className=="inputreq"||a.className=="inputrtreq";}}}}}function disableField(c,e){if(c==null){return;}if(!isSelect(c)&&c.length>1){for(var b=0;b<c.length;b++){if(c[b].type=="radio"){disableField(c[b],e);}}}else{if(isSelect(c)||isPopupSelect(c)||isMultiSelect(c)||isPopupMultiSelect(c)){disableSelect(c,e);}else{if(window.getHtmlEditor!=null&&getHtmlEditor(c.name)!=null){getHtmlEditor(c.name).setDisabled(e);}else{if(NLIsButton(c)){NLDisableButton(c,e);}else{c.disabled=e;var a=(c.document)?c.document:document;var d=a.getElementById(c.name+"_helper_calendar");if(d!=null){d.style.visibility=e?"hidden":"inherit";}}}}}}function getFieldDisabled(b){if(b==null){return;}if(!isSelect(b)&&b.length>1){for(var a=0;a<b.length;a++){if(b[a].type=="radio"){return b[a].disabled;}}}else{if(isSelect(b)||isPopupSelect(b)||isMultiSelect(b)){if(b.type=="select-one"||b.type=="select-multiple"){return b.disabled;}else{if(isNLDropDown(b)){return getDropdown(b,window).disabled;}else{if(isNLMultiDropDown(b)){return getMultiDropdown(b,window).disabled;}else{if(isPopupSelect(b)){return getFormElement(b.form,b.name+"_display").disabled;}}}}}else{if(window.getHtmlEditor!=null&&getHtmlEditor(b.name)!=null){return getHtmlEditor(b.name).disabled;}else{return b.disabled;}}}return false;}function isDisplayOnlyField(a){if(a==null){return;}if(isDisplayOnlySelect(a)){return true;}else{if(a.type=="hidden"&&document.getElementById(a.name+"_val")!=null){return true;}}return false;}function setOptionsFromMachineField(machine_name,field_name,selectObject,alternate_label,test_field,test_value){deleteAllSelectOptions(selectObject,window);var doc=window.document;var mch=eval(machine_name+"_machine");addSelectOption(doc,selectObject,"","",true,window);var bNewOptions=false;for(var i=1;i<=getLineCount(machine_name);i++){if(mch.getMachineIndex()==i||(test_field!=null&&getEncodedValue(machine_name,i,test_field)!=test_value)){continue;}bNewOptions=true;addSelectOption(doc,selectObject,getEncodedValue(machine_name,i,alternate_label!=null?alternate_label:field_name+"_display"),getEncodedValue(machine_name,i,field_name),false,window);}return bNewOptions;}function getSyncFunctionName(fldname,machine){var syncFuncName="Sync"+fldname;if(machine!=null){var machSyncFunc=syncFuncName+machine;if(eval("window."+machSyncFunc)!=null){return machSyncFunc;}}return syncFuncName;}function safeSetDocumentLocation(a){try{document.location=a;}catch(b){}}function addParamToURL(a,d,c,b){if(a==null){return null;}if(a.length&&a.charAt(a.length-1)=="#"){a=a.substring(0,a.length-1);}if(isValEmpty(d)){return a;}if(b==true){a=removeParamFromURL(a,d);}return addNextParamPrefixToURL(a)+d+"="+emptyIfNull(c);}function addNextParamPrefixToURL(a){return a+(a.indexOf("?")==-1?"?":"&");}function removeParamFromURL(b,e){var a="&";var d=b.indexOf("&"+e+"=");if(d==-1){d=b.indexOf("?"+e+"=");a="?";}if(d!=-1){var c=b.indexOf("&",d+1);return b.substring(0,d)+(c>0?(a=="?"?"?"+b.substr(c+1):b.substr(c)):"");}return b;}function formEncodeURLParams(c){var b="";for(var a in c){b+=(isValEmpty(b)?"":"&")+escape(a)+"="+escape(emptyIfNull(c[a]));}return b;}function previewMedia(d,c,a){if(c){d=d.substr(d.lastIndexOf("/")+1);}var b="/core/media/previewmedia.nl?id="+d;preview(b,"prevmedia");}function previewTemplate(c,a){var b="/app/crm/common/merge/previewtemplate.nl?id="+c;if(!isValEmpty(a)){b=addParamToURL(b,"entity",a);}preview(b,"previewtemplate");}function siteMedia(d,c,a){if(c){d=d.substr(d.lastIndexOf("/")+1);}var b="/app/site/media/sitemedia.nl?id="+d;preview(b,"sitemedia");}function preview(b,c){var a="location=no,width=600,height=500,menubar=yes,scrollbars=yes,resizable=yes";var d=window.open(b,c,a);d.focus();}function getCookieVal(b){var a=document.cookie.indexOf(";",b);if(a==-1){a=document.cookie.length;}return unescape(document.cookie.substring(b,a));}function GetCookie(d){var b=d+"=";var f=b.length;var a=document.cookie.length;var e=0;while(e<a){var c=e+f;if(document.cookie.substring(e,c)==b){var g=getCookieVal(c);if(d=="JSESSIONID"&&g!=null&&g.indexOf(".")!=-1){g=g.substring(0,g.indexOf("."));}return g;}e=document.cookie.indexOf(" ",e)+1;if(e==0){break;}}return null;}function getStickyTag(d){var c=GetCookie("stickytags");if(c!=null){var a=c.indexOf(","+d+":")+1;if(a>=1){var f=c.indexOf(",",a);if(f<0){f=c.length;}return unescape(c.substring(a+d.length+1,f));}}return null;}function addStickyTagToUrl(b,a){return b+(b.indexOf("?")>=0?"&t=":"?t=")+getStickyTag(a);}function redirectToStickyPage(c,a,b){var f=addStickyTagToUrl(c,a);try{if(typeof(b)=="number"){parent.frames[b].document.location=f;}else{if(b){parent.document.location=f;}else{document.location=f;}}}catch(d){}}var SelectKeyPressMaxKeyPause=2000;function SelectKeyPressHandler(b,a){keyString=String.fromCharCode(getEventKeypress(b)).toUpperCase();if(!(keyString>=" "&&keyString<="_")){SelectKeyPressTypedString="";return true;}if(SelectKeyPressTimeoutID!=null){window.clearTimeout(SelectKeyPressTimeoutID);}SelectKeyPressTimeoutID=window.setTimeout("SelectKeyPressTimeout()",SelectKeyPressMaxKeyPause);SelectKeyPressTypedString+=keyString;if(a){if(SelectKeyPressTypedString.length==1){option=SelectKeyPressLookupFirst(b,SelectKeyPressTypedString);}else{option=SelectKeyPressLookupNext(b,SelectKeyPressTypedString);}}else{option=SelectKeyPressLookupLinear(b,SelectKeyPressTypedString);}setEventPreventDefault(b);if(option!=-1){getEventTarget(b).selectedIndex=option;getEventTarget(b).onchange();}return false;}var SelectKeyPressTypedString="";SelectKeyPressTimeoutID=null;function SelectKeyPressTimeout(){SelectKeyPressTypedString="";SelectKeyPressTimeoutID=null;}function SelectKeyPressLookupFirst(b,a){select=getEventTarget(b);options=select.options;low=0;high=options.length;while(high-low>1){i=Math.floor((high+low)/2);if(a.charAt(0)<=options(i).text.charAt(0).toUpperCase()){high=i;}else{low=i;}}while(high>0&&a.charAt(0)==options(high-1).text.charAt(0).toUpperCase()){--high;}if(high<options.length&&a.charAt(0)==options(high).text.charAt(0).toUpperCase()){return high;}else{return -1;}}function SelectKeyPressLookupNext(b,a){select=getEventTarget(b);options=select.options;selIndex=select.selectedIndex;while(selIndex<options.length-1&&options(selIndex).text.toUpperCase()<a){++selIndex;}if(selIndex<options.length-1&&options(selIndex).text.substr(0,a.length).toUpperCase()==a){return selIndex;}else{return -1;}}function SelectKeyPressLookupLinear(b,a){select=getEventTarget(b);options=select.options;for(i=0;i<options.length;++i){if(options(i).text.substr(0,a.length).toUpperCase()==a){return i;}}return -1;}function disableFilter(b,a,d,c){if(getRadioValue(b)==a){d.disabled=true;if(c){c.disabled=true;}}else{d.disabled=false;if(c){c.disabled=false;}}}function NLDate_parseString(k,v){var g=0;var n=0;var u=0;var f=k;var w="";var q="";var t,r,b;var j=null;if(!window.dateformat){window.dateformat="MM/DD/YYYY";}if(k==""){return new Date();}else{if(window.dateformat=="MM/DD/YYYY"){if(f.indexOf("/")!=-1){var p=f.split("/");if(onlydigits(p[0])){g=parseInt(p[0],10);}if(onlydigits(p[1])){n=parseInt(p[1],10);}if(n>1970){q=u=n;n=1;}else{if(onlydigits(p[2])){u=parseInt(p[2],10);}q=p[2];}}else{var h=f.length,o;o=f.substr(0,2-h%2);if(onlydigits(o)){g=parseInt(o,10);}o=f.substr(2-h%2,2);if(onlydigits(o)){n=parseInt(o,10);}o=f.substr(4-h%2);if(onlydigits(o)){u=parseInt(o,10);}q=o;}}else{if(window.dateformat=="DD/MM/YYYY"){if(f.indexOf("/")!=-1){var p=f.split("/");if(onlydigits(p[0])){n=parseInt(p[0],10);}if(onlydigits(p[1])){g=parseInt(p[1],10);}if(onlydigits(p[2])){u=parseInt(p[2],10);}q=p[2];}else{var h=f.length,o;o=f.substr(0,2-h%2);if(onlydigits(o)){n=parseInt(o,10);}o=f.substr(2-h%2,2);if(onlydigits(o)){g=parseInt(o,10);}o=f.substr(4-h%2);if(onlydigits(o)){u=parseInt(o,10);}q=o;}}else{if(window.dateformat=="YYYY/MM/DD"){if(f.indexOf("/")!=-1){var p=f.split("/");if(onlydigits(p[0])){u=parseInt(p[0],10);}if(onlydigits(p[1])){g=parseInt(p[1],10);}if(onlydigits(p[2])){n=parseInt(p[2],10);}q=p[0];}else{var h=f.length,o;o=f.substr(0,2-h%2);if(onlydigits(o)){u=parseInt(o,10);}o=f.substr(2-h%2,2);if(onlydigits(o)){g=parseInt(o,10);}o=f.substr(4-h%2);if(onlydigits(o)){n=parseInt(o,10);}q=o;}}else{if(window.dateformat=="DD.MM.YYYY"){if(f.indexOf(".")!=-1){var p=f.split(".");if(onlydigits(p[0])){n=parseInt(p[0],10);}if(onlydigits(p[1])){g=parseInt(p[1],10);}if(onlydigits(p[2])){u=parseInt(p[2],10);}q=p[2];}else{var h=f.length,o;o=f.substr(0,2-h%2);if(onlydigits(o)){n=parseInt(o,10);}o=f.substr(2-h%2,2);if(onlydigits(o)){g=parseInt(o,10);}o=f.substr(4-h%2);if(onlydigits(o)){u=parseInt(o,10);}q=parseInt(o,10);}}else{if(window.dateformat=="DD-Mon-YYYY"){if(f.indexOf("-")!=-1){var p=f.split("-");if(onlydigits(p[0])){n=parseInt(p[0],10);}g=getMonthIndex(p[1]);if(onlydigits(p[2])){u=parseInt(p[2],10);}q=p[2];}else{var h=f.length,o;o=f.substr(0,1+h%2);if(onlydigits(o)){n=parseInt(o,10);}o=f.substr(1+h%2,3);g=getMonthIndex(o);o=f.substr(4+h%2);if(onlydigits(o)){u=parseInt(o,10);}q=o;}}else{if(window.dateformat=="DD-MONTH-YYYY"){var e=f.split("-");if(onlydigits(e[0])){n=parseInt(e[0]);}g=arrayIndexOf(NLDate_months,e[1],true)+1;if(onlydigits(e[2])){u=parseInt(e[2]);q=u;}}else{if(window.dateformat=="YYYY-MM-DD"){var e=f.split("-");if(onlydigits(e[2])){n=parseInt(e[2]);}if(onlydigits(e[1])){g=parseInt(e[1]);}if(onlydigits(e[0])){u=parseInt(e[0]);q=u;}}else{if(window.dateformat=="EEYY年MM月DD日"){t=f.indexOf(year_char_cn);r=f.indexOf(month_char_cn);b=f.indexOf(day_char_cn);if(onlydigits(f.substring(r+1,b))){n=parseInt(f.substring(r+1,b));}if(onlydigits(f.substring(t+1,r))){g=parseInt(f.substring(t+1,r));}var a=f.substring(0,2);if(onlydigits(f.substring(2,t))){u=get_gregorian_year(parseInt(f.substring(2,t)),a);q=u;}}else{if(window.dateformat=="YYYY年MM月DD日"){t=f.indexOf(year_char_cn);r=f.indexOf(month_char_cn);b=f.indexOf(day_char_cn);if(onlydigits(f.substring(r+1,b))){n=parseInt(f.substring(r+1,b));}if(onlydigits(f.substring(t+1,r))){g=parseInt(f.substring(t+1,r));}if(onlydigits(f.substring(0,t))){u=parseInt(f.substring(0,t));q=u;}}else{if(window.dateformat=="EYY.MM.DD"){e=f.split(".");if(onlydigits(e[2])){n=parseInt(e[2]);}if(onlydigits(e[1])){g=parseInt(e[1]);}var a=e[0].substring(0,1);if(onlydigits(e[0].substring(1,e[0].length))){u=get_gregorian_year(parseInt(e[0].substring(1,e[0].length)),a);q=u;}}else{if(window.dateformat=="DD. Mon YYYY"){e=f.split(" ");if(onlydigits(e[0].substring(0,e[0].length-1))){n=parseInt(e[0].substring(0,e[0].length-1));}g=getMonthIndex(e[1]);if(onlydigits(e[2])){u=parseInt(e[2]);q=u;}}else{if(window.dateformat=="DD de MONTH de YYYY"){e=f.split(" de ");if(onlydigits(e[0])){n=parseInt(e[0]);}g=arrayIndexOf(NLDate_months,e[1])+1;if(onlydigits(e[2])){u=parseInt(e[2]);q=u;}}else{if(window.dateformat=="YYYY년 MM월 DD일"){e=f.split(" ");if(onlydigits(e[2].substring(0,e[2].length-1))){n=parseInt(e[2].substring(0,e[2].length-1));}if(onlydigits(e[1].substring(0,e[1].length-1))){g=parseInt(e[1].substring(0,e[1].length-1))-1;}if(onlydigits(e[0].substring(0,e[0].length-1))){u=parseInt(e[0].substring(0,e[0].length-1));q=u;}}else{if(window.dateformat=="DD MONTH YYYY"){e=f.split(" ");if(onlydigits(e[0])){n=parseInt(e[0]);}g=arrayIndexOf(NLDate_months,e[1],true)+1;if(onlydigits(e[2])){u=parseInt(e[2]);q=u;}}else{if(window.dateformat=="DD MONTH, YYYY"){e=f.split(" ");if(onlydigits(e[0])){n=parseInt(e[0]);}g=arrayIndexOf(NLDate_months,e[1].substring(0,e[1].length-1),true)+1;if(onlydigits(e[2])){u=parseInt(e[2]);q=u;}}}}}}}}}}}}}}}}}if(g==0||n==0){if(v){if(w==""){w=window.dateformat;}alert("Invalid date value (must be "+window.dateformat+")");}}else{if(u==0&&!onlydigits(q)){u=(new Date()).getFullYear();}if(g<1){g=1;}else{if(g>12){g=12;}}if(n<1){n=1;}else{if(n>31){n=31;}}if(u<100){u+=((u>=70)?1900:2000);}if(u<1000){u*=10;}if(u>9999){u=(new Date()).getFullYear();}q=u;j=validateDate(new Date(u,g-1,n),v);}return j;}function validateDate(a,b){if(a.getTime()<-11636672400000){a=null;if(b){alert("Invalid date value (must be on or after "+getdatestring(new Date(-11636672400000))+")");}}return a;}var NLDate_pnDaysInMonths=new Array(31,28,31,30,31,30,31,31,30,31,30,31);function NLDate_getLastDayOfMonth(b){var a=b.getMonth();var d=NLDate_pnDaysInMonths[a];if(a==1){var c=b.getYear();if((c%400==0)||((c%4==0)&&(c%100!=0))){d++;}}return d;}function setDisabledState(a,c){elem=document.getElementById(a);if(typeof elem.disabled!="undefined"){elem.disabled=!c;return;}var b=document.getElementById(a).getElementsByTagName("INPUT");for(var d=0;d<b.length;d++){if(b[d].name.indexOf("_send")==-1){b[d].disabled=!c;}}var b=document.getElementById(a).getElementsByTagName("A");for(var d=0;d<b.length;d++){if(!c&&!b[d].disabled){b[d].enabledonclick=b[d].onclick;b[d].onclick=new Function("return false;");}else{if(c&&b[d].enabledonclick!=null&&b[d].disabled){b[d].onclick=b[d].enabledonclick;}}b[d].disabled=!c;}}var NLAlertContext_CREDIT_CARD_NUMBERS_MUST_CONTAIN_BETWEEN_13_AND_20_DIGITS="Credit card numbers must contain between 13 and 20 digits.";var NLAlertContext_CREDIT_CARD_NUMBERS_MUST_CONTAIN_ONLY_DIGITS="Credit card numbers must contain only digits.";var NLAlertContext_EMAIL_ADDRESSES_MUST_MATCH="Email addresses must match.";var NLAlertContext_NETSUITE_DOES_NOT_ACCEPT_EMAIL_ADDRESSES_WITH_QUOTATION_MARKS_COMMAS_COLONS_SPACES_OR_GREATER_THAN_OR_LESS_THAN_SIGNS="NetSuite does not accept email addresses with quotation marks, commas, colons, spaces, or greater than or less than signs.";var NLAlertContext_PASSWORDS_DONT_MATCHN="Passwords don't match.\n";var NLAlertContext_PASSWORDS_CANNOT_BE_EMPTYN="Passwords cannot be empty.\n";var NLAlertContext_PASSWORDS_MUST_BE_AT_LEAST_1_CHARACTERS_LONGN="Passwords must be at least {1} characters long.\n";var NLAlertContext_PASSWORDS_MUST_CONTAIN_AT_LEAST_ONE_LETTER_AZN="Passwords must contain at least one letter (A-Z).\n";var NLAlertContext_PASSWORDS_MUST_CONTAIN_AT_LEAST_ONE_NUMBER_OR_SPECIAL_CHARACTERN="Passwords must contain at least one number or special character.\n";var NLAlertContext_PASSWORDS_MAY_CONTAIN_ONLY_LETTERS_NUMBERS_AND_SPECIAL_CHARACTERSN="Passwords may contain only letters, numbers, and special characters.\n";var NLAlertContext_OLD_AND_NEW_PASSWORDS_ARE_TOO_SIMILAR="Old and new passwords are too similar.";var NLAlertContext_PASSWORD_MUST_NOT_BE_THE_SAME_AS_THE_EMAIL_ADDRESS="Password must not be the same as the email address";var NLAlertContext_CREDIT_CARD_NUMBER_IS_NOT_VALID__PLEASE_CHECK_THAT_ALL_DIGITS_WERE_ENTERED_CORRECTLY="Credit card number is not valid.  Please check that all digits were entered correctly.";var NLAlertContext_NETSUITE_DOES_NOT_ACCEPT_EMAIL_ADDRESSES_WITH_QUOTATION_MARKS_COMMAS_COLONS_SPACES_OR_GREATER_THAN_OR_LESS_THAN_SIGNS="NetSuite does not accept email addresses with quotation marks, commas, colons, spaces, or greater than or less than signs.";var NLAlertContext_PLEASE_ENTER_A_VALID_EMAIL_ADDRESS="Please enter a valid email address.";var NLValidationUtil_SIMPLE_EMAIL_PATTERN=/^(?!\.)[-a-z0-9!#$%&'*+\/=?^_`{|}~.]*[-a-z0-9!#$%&'*+\/=?^_`{|}~]@(?:(?!-)[-a-z0-9]*[a-z0-9]\.)+(?:ac|ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|info|int|io|iq|ir|is|it|je|jm|jo|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mobi|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)$/i;var NLAlertContext_THE_SPECFIED_ROUTING_NUMBER_FAILED_VALIDATION_FOR_ABA_ROUTING_NUMBERS="The specfied routing number failed validation for ABA Routing Numbers.";var NLAlertContext_ABA_ROUTING_NUMBERS_MUST_BE_NINE_CHARACTERS="ABA Routing Numbers must be nine characters.";function isValEmpty(a){if(a==null){return true;}a=new String(a);return(a.length==0)||!/\S/.test(a);}function isHTMLValEmpty(a){if(isValEmpty(a)){return true;}a=a.replace(/&nbsp;|<(?!NL)[^>]*>/gi,"");return !/\S/.test(a);}function nvl(b,a){return b==null?a:b;}function emptyIfNull(a){return a==null?"":a;}function nullIfEmpty(a){return isValEmpty(a)?null:a;}function trim(a){return a.replace(/^\s+/,"").replace(/\s+$/,"");}function onlydigitsandchars(b){var a=new RegExp("([A-Za-z0-9]+)");return(a.exec(b)!=null&&RegExp.$1==b);}function onlydigits(b){var a=new RegExp("([0-9]+)");return(a.exec(b)!=null&&RegExp.$1==b);}function isemptyorzero(d){var b=d;var a=isValEmpty(b);var c=b==0;return(a||c);}function isNewRecord(){var a=typeof nlapiGetField!=undefined&&nlapiGetField("id")!=null?nlapiGetFieldValue("id"):typeof document!=undefined&&document.forms.main_form.elements.id!=null?document.forms.main_form.elements.id:"";return isValEmpty(a)||a==-1;}function isExistingRecord(){return !isNewRecord();}function getEditFlag(){return isExistingRecord();}function checkMandatoryFields(e,d,k,h){var l="";for(var c=0;c<e.length;c++){if(e[c]==null){continue;}var a=k!=null?k[c]:e[c].value;if((new String(a)).indexOf(String.fromCharCode(3))!=-1){var g=a.split(String.fromCharCode(4));for(var b=0;b<g.length;b++){var f=g[b].split(String.fromCharCode(3));if(f[1]=="T"&&f[3].length==0){l+=(l.length?", ":"")+f[2];}}continue;}if(k!=null){if((h!=null&&!nlapiGetLineItemMandatory(h,e[c]))||(h==null&&!nlapiGetFieldMandatory(e[c]))){continue;}if(isValEmpty(a)){l+=(l.length?", ":"")+d[c];}}else{if(!getRequired(e[c])){continue;}if(isSelect(e[c])){a=getSelectValue(e[c]);if(isValEmpty(a)){l+=(l.length?", ":"")+d[c];}}else{if(window.getHtmlEditor!=null&&getHtmlEditor(e[c].name)!=null){if(isValEmpty(e[c].value.replace("<DIV></DIV>",""))){l+=(l.length?", ":"")+d[c];}}else{if(isempty(e[c])){l+=(l.length?", ":"")+d[c];}}}}}return l;}function checkUniqueFields(a,b,c){if(b==null||b.length==0){return null;}for(var h=1;h<=nlapiGetLineItemCount(a)+1;h++){if(h==nlapiGetCurrentLineItemIndex(a)){continue;}var n=true,e=true;for(var g=0;g<b.length;g++){var m=b[g];if(!isValEmpty(getEncodedValue(a,h,m))){n=false;}if(getEncodedValue(a,h,m)!=nlapiGetCurrentLineItemValue(a,b[g])){e=false;break;}}if(n||!e){continue;}var l=new Array();for(var d=0;d<b.length;d++){l.push(c[d]);}return l;}return null;}function checkccnumber(fld){var cardnum=typeof(fld)!="string"?fld.value:nlapiGetFieldValue(fld);if(cardnum.length>0){cardnum=cardnum.replace(/ /gi,"");}if(cardnum.length>0){cardnum=cardnum.replace(/-/gi,"");}if(cardnum.length<13||cardnum.length>20){alert(NLAlertContext_CREDIT_CARD_NUMBERS_MUST_CONTAIN_BETWEEN_13_AND_20_DIGITS);return false;}if(!onlydigits(cardnum)){alert(NLAlertContext_CREDIT_CARD_NUMBERS_MUST_CONTAIN_ONLY_DIGITS);return false;}var no_digit=cardnum.length;var oddoeven=no_digit&1;var sum=0;for(var count=0;count<no_digit;count++){var digit=parseInt(cardnum.charAt(count),10);if(!((count&1)^oddoeven)){digit*=2;if(digit>9){digit-=9;}}sum+=digit;}if(sum%10!=0){alert(NLAlertContext_CREDIT_CARD_NUMBER_IS_NOT_VALID__PLEASE_CHECK_THAT_ALL_DIGITS_WERE_ENTERED_CORRECTLY);return false;}eval(typeof(fld)!="string"?"fld.value = cardnum":"nlapiSetFieldValue(fld, cardnum, false)");return true;}function setPreferredFields(b,e,d,a){if(getEncodedValue(b,a,e)=="T"){for(var c=1;c<=getLineCount(b)+1;c++){if(c!=a&&getEncodedValue(b,c,e)=="T"){if(d==null||getEncodedValue(b,a,d)==getEncodedValue(b,c,d)){setEncodedValue(b,c,e,"F");}}}}return true;}function escapeJSONChar(b){if(b=='"'||b=="\\"){return"\\"+b;}else{if(b=="\b"){return"\\b";}else{if(b=="\f"){return"\\f";}else{if(b=="\n"){return"\\n";}else{if(b=="\r"){return"\\r";}else{if(b=="\t"){return"\\t";}}}}}}var a=b.charCodeAt(0).toString(16);if(a.length==1){return"\\u000"+a;}else{if(a.length==2){return"\\u00"+a;}else{if(a.length==3){return"\\u0"+a;}else{return"\\u"+a;}}}}function escapeJSONString(b){var d=b.split("");for(var a=0;a<d.length;a++){var e=d[a];if(e=='"'||e=="\\"||e.charCodeAt(0)<32||e.charCodeAt(0)>=128){d[a]=escapeJSONChar(d[a]);}}return'"'+d.join("")+'"';}toJSON=function toJSON(c){if(c==null){return"null";}else{if(c.constructor==String||c.constructor.name=="String"){return escapeJSONString(c);}else{if(c.constructor==Number||c.constructor.name=="Number"){return c.toString();}else{if(c.constructor==Boolean||c.constructor.name=="Boolean"){return c.toString();}else{if(c.constructor==Date||c.constructor.name=="Date"){return'{javaClass: "java.util.Date", time: '+c.valueOf()+"}";}else{if(c.constructor==Array||c.constructor.name=="Array"){var a=[];for(var b=0;b<c.length;b++){a.push(toJSON(c[b]));}return"["+a.join(", ")+"]";}else{var a=[];for(attr in c){if(c[attr]==null){a.push('"'+attr+'": null');}else{if(typeof c[attr]=="function"){}else{a.push(escapeJSONString(attr)+": "+toJSON(c[attr]));}}}return"{"+a.join(", ")+"}";}}}}}}};function getQtyRate(f,g,d){var b=f.split(String.fromCharCode(5));var c;var a=0;var e;for(c=0;c<b.length;c+=2){if(g>=parseFloat(b[c])&&(c+2>=b.length||g<parseFloat(b[c+2]))){if(d&&g>0){a+=(g-parseFloat(b[c]))*parseFloat(b[c+1]);e=a/g;}else{e=b[c+1];}break;}else{if(d&&g>0){a+=(parseFloat(b[c+2])-parseFloat(b[c]))*parseFloat(b[c+1]);}}}return e;}function parseFloatOrZero(b){var a=parseFloat(b);return isNaN(a)?0:a;}function isValidUSZipCode(b){var a=/^\d{5}([\-]\d{4})?$/;return(a.test(b));}function checkemail(b,a,c){b=trim(b);return checkemail2(b,b,a,c);}function checkemail2(a,e,b,d){var c=a;if(c!=e){alert(NLAlertContext_EMAIL_ADDRESSES_MUST_MATCH);return false;}if(b&&c.length==0){return true;}return checkemailvalue(c,d);}function checkemailvalue(a,b){b=true;if(/\s|[,":<>]/.test(a)){if(b){alert(NLAlertContext_PLEASE_ENTER_A_VALID_EMAIL_ADDRESS+" "+NLAlertContext_NETSUITE_DOES_NOT_ACCEPT_EMAIL_ADDRESSES_WITH_QUOTATION_MARKS_COMMAS_COLONS_SPACES_OR_GREATER_THAN_OR_LESS_THAN_SIGNS);}return false;}if(!NLValidationUtil_SIMPLE_EMAIL_PATTERN.test(a)){if(b){alert(a+" "+NLAlertContext_PLEASE_ENTER_A_VALID_EMAIL_ADDRESS);}return false;}return true;}function checkemailprefix(a){return/^[^@]+@[^@]*$/.test(a)&&!/\s|[,":<>]|[.][.]/.test(a);}function checkvalnotempty(b,a){if(isValEmpty(b)){if(a){alert(a);}return false;}return true;}function checkpassword(h,f,c,b,g,d,e){var j=(b==true||b==null);var a=getpassworderror(h,f,j,g,d,e);if(a!=null){if(c){alert(a);}return false;}else{return true;}}function getpassworderror(k,h,b,j,e,f){var m=(b==true||b==null);var a=k;if(e==null){e=6;}msg="";if(k!=h){msg+=NLAlertContext_PASSWORDS_DONT_MATCHN;}else{if(!m){if(a.length==0){msg=NLAlertContext_PASSWORDS_CANNOT_BE_EMPTYN;}}else{if(a.length<e){msg+=NLAlertContext_PASSWORDS_MUST_BE_AT_LEAST_1_CHARACTERS_LONGN.replace("{1}",String(e));}if(!/[A-Za-z]/.test(a)){msg+=NLAlertContext_PASSWORDS_MUST_CONTAIN_AT_LEAST_ONE_LETTER_AZN;}if(!/[0-9!@#$%^&*.:;~'`*",_|= \<\>\/\\\+\?\-\(\)\[\]\{\}]/.test(a)){msg+=NLAlertContext_PASSWORDS_MUST_CONTAIN_AT_LEAST_ONE_NUMBER_OR_SPECIAL_CHARACTERN;}if(!/^[A-Za-z0-9!@#$%^&*.:;~'`*",_|= \<\>\/\\\+\?\-\(\)\[\]\{\}]+$/.test(a)){msg+=NLAlertContext_PASSWORDS_MAY_CONTAIN_ONLY_LETTERS_NUMBERS_AND_SPECIAL_CHARACTERSN;}}}if(msg.length==0&&j!=null){var l=j;var n=0;for(var d=0;d<a.length;d++){var g=a.charAt(d);if(l.indexOf(g)==-1){n++;}}if(n<2){msg=NLAlertContext_OLD_AND_NEW_PASSWORDS_ARE_TOO_SIMILAR;}}if(msg.length==0&&f!=null){if(f==k){msg=NLAlertContext_PASSWORD_MUST_NOT_BE_THE_SAME_AS_THE_EMAIL_ADDRESS;}}if(msg.length>0){return msg;}else{return null;}}function validate_AbaRoutingNumber(f){if(f==null||f.length==0){window.isvalid=true;return true;}var c=9;var b=true;var d="";if(f.length!=c){d=NLAlertContext_ABA_ROUTING_NUMBERS_MUST_BE_NINE_CHARACTERS;b=false;}var a=f;var e=0;for(i=0;i<a.length;i+=3){e+=parseInt(a.charAt(i),10)*3+parseInt(a.charAt(i+1),10)*7+parseInt(a.charAt(i+2),10);}if(e!=0&&e%10==0){b=true;}else{d=NLAlertContext_THE_SPECFIED_ROUTING_NUMBER_FAILED_VALIDATION_FOR_ABA_ROUTING_NUMBERS+"("+f+")";b=false;}if(d!=""){alert(d);}window.isvalid=b;return b;}function stringContainsCJKChar(d){if(d==null&&d.length==0){return false;}var c=false;for(var b=0;b<d.length;b++){var a=d.charCodeAt(b);if((a>=12352&&a<=40959)||(a>=44032&&a<=55215)){c=true;break;}}return c;}function nlOpenWindow(c,e,b,a,d,f){if(window.doPageLogging){logStartOfRequest("popup");}if(isValEmpty(b)){return window.open(c,e);}else{if(isNaN(parseInt(b))){return window.open(c,e,b);}else{if(isIE){return window.open(c,e,"scrollbars="+(f?"yes":"no")+",width="+Math.min(screen.availWidth,b)+",height="+Math.min(screen.availHeight-40,a)+",left="+Math.min(screen.availWidth-b,getObjectLeft(d))+",top="+Math.min((screen.availHeight-40)-a,getObjectTop(d))+",resizable=yes");}else{return window.open(c,e,"scrollbars="+(f?"yes":"no")+",width="+b+",height="+a+",resizable=yes");}}}}function getObjectLeft(a){var b=0;while(a!=null&&a!=document.body){b+=a.offsetLeft;a=a.offsetParent;}return b+(isIE?window.screenLeft:window.screenX+window.outerWidth-window.innerWidth);}function getObjectTop(a){var b=0;while(a!=null&&a!=document.body){b+=a.offsetTop;a=a.offsetParent;}if(isIE){return b+window.screenTop;}var c=0;if(typeof window.statusbar!="undefined"&&window.statusbar!=null&&window.statusbar.visible){c=20;}return b+window.screenY+window.outerHeight-window.innerHeight-c;}function setFieldVisibility(b,a){var c=document.getElementById(b);visible(c,a);}function setLabelVisibility(b,a){var c=document.getElementById(b+"_lbl");visible(c,a);}function setFieldAndLabelVisibility(b,a){setLabelVisibility(b,a);setFieldVisibility(b,a);}function showField(b,a){var c=document.getElementById(b);display(c,a);if(c!=null&&c.parentNode.nodeName=="TD"&&c.parentNode.style.height=="22px"){display(c.parentNode,a);}}function showLabel(b,a){var c=document.getElementById(b+"_lbl");display(c,a);}function showHelperText(b,a){var c=document.getElementById(b+"_hlp");display(c,a);}function setLabel(b,a){var c=document.getElementById(b+"_lbl");if(c==null){return;}c.innerHTML=a;}function getLabel(a){var b=document.getElementById(a+"_lbl");if(b==null){return null;}else{if(b.getElementsByTagName("a")!=null&&b.getElementsByTagName("a").length==1){return b.getElementsByTagName("a").item(0).innerHTML;}else{return b.innerHTML;}}}function showFieldAndLabel(b,a){showLabel(b,a);showField(b,a);}function hideTab(d,a){var b=a?"none":"";var c=document.getElementById(d+"upperlt");if(c!=null){c.style.display=b;}c=document.getElementById(d+"uppermiddot");if(c!=null){c.style.display=b;}c=document.getElementById(d+"uppermid");if(c!=null){c.style.display=b;}c=document.getElementById(d+"upperrt");if(c!=null){c.style.display=b;}var c=document.getElementById(d+"lt");if(c!=null){c.style.display=b;}c=document.getElementById(d+"lnkdot");if(c!=null){c.style.display=b;}c=document.getElementById(d+"lnk");if(c!=null){c.style.display=b;}c=document.getElementById(d+"rt");if(c!=null){c.style.display=b;}c=document.getElementById(d+"_layer");if(c!=null){c.style.display=b;}c=document.getElementById(d+"_umh");if(c!=null){c.style.display=b;}}function setFormValue(c,d,f,a,b){if(c==null){return;}if(c.type=="checkbox"){c.checked=d=="T";}else{if(c.type=="radio"||(c.length>0&&c[0].type=="radio")){syncradio(c,d);}else{if(c.type=="select-one"){synclist(c,d);}else{if(c.className=="nldropdown"){getDropdown(c).setValue(d,true);}else{if(isMultiSelect(c)){syncmultiselectlist(c,d,null,true);}else{if(window.getHtmlEditor!=null&&getHtmlEditor(c.name)!=null){return getHtmlEditor(c.name).setValue(d,true);}else{if(c.nodeName=="INPUT"||c.nodeName=="TEXTAREA"||window.virtualBrowser){var e=d!=null&&d.join!=null&&(isPopupMultiSelect(c)||isArray(d))?d.join(String.fromCharCode(5)):d;if(isPopupSelect(c)){syncpopup(c,e,f);}else{if(isPopupMultiSelect(c)){syncmultiselectlist(c,e,f,true);}else{c.value=e;if(isDisplayOnlySelect(c)){document.getElementById(c.name+"_displayval").innerHTML=f!=null?f.replace(new RegExp(String.fromCharCode(5),"g"),"<BR>"):"";}}}}else{c.innerHTML=d;}}}}}}}if(a){try{if(b){setSlavingAsync(false);}fireProperOnChange(c);}finally{setSlavingAsync(true);}}}function getFormValue(a,b){if(a==null){return null;}if(a.type=="checkbox"){return a.checked?"T":"F";}else{if(a.type=="radio"||(a.length>0&&a[0].type=="radio")){return getRadioValue(a);}else{if(a.type=="select-one"||a.className=="nldropdown"){return getSelectValue(a);}else{if(isMultiSelect(a)){return getMultiSelectValues(a,b);}else{if(isRichTextEditor(a)){return getHtmlEditor(a.name).getValue();}else{return b&&a.value!=null&&isPopupMultiSelect(a)?a.value.split(String.fromCharCode(5)):a.value;}}}}}}function getParameter(d,c){if(typeof c=="undefined"||c==null){c=document;}var a=new RegExp(".*[?&]"+d+"=([^&]*)");var b=a.exec(c.location.href.toString());return b!=null&&b.length>0?b[1]:null;}function getBooleanParameter(a){return getParameter(a)=="T";}function getParameterValuesArray(){var c=document.location.href.toString();if(c.indexOf("?")<0){return null;}var e=c.substring(c.indexOf("?")+1).split("&");var b=new Array();for(var d=0;d<e.length;d++){var f=e[d].split("=");b[b.length]=f[0];b[b.length]=f.length>0?f[1]:null;}return b;}function getFormElement(d,c){var a=null;if(d!=null){if(c=="language"||(!isIE&&(c=="item"||c=="cash"))){for(var b=0;b<d.elements.length;b++){if(d.elements[b].name==c){a=d.elements[b];}}}else{a=d.elements[c];}}return a;}function getFormElementViaFormName(b,a){return getFormElement(document.forms[b],a);}var isIE=document.all?true:false;var isNS=document.addEventListener?true:false;var isNS4x=document.layers?true:false;var NODE_TD="TD";var NODE_TR="TR";var NODE_TEXT="#text";var NODE_TABLE="TABLE";function findGlobalPosX(c,a){var b=0;if(document.getElementById||document.all){while(c.offsetParent){b+=c.offsetLeft;c=c.offsetParent;}if(c.document!=null&&c.document.parentWindow!=null&&c.document.parentWindow.frameElement){b+=findGlobalPosX(c.document.parentWindow.frameElement);}}else{if(document.layers){b+=c.y;}}return b;}function findGlobalPosY(b){var a=0;if(document.getElementById||document.all){while(b.offsetParent){a+=b.offsetTop;b=b.offsetParent;}if(b.document!=null&&b.document.parentWindow!=null&&b.document.parentWindow.frameElement){a+=findGlobalPosY(b.document.parentWindow.frameElement);}}else{if(document.layers){a+=b.y;}}return a;}function findAbsolutePosX(a){var b=0;if(document.getElementById||document.all){while(a.offsetParent){b+=a.offsetLeft;if(a.offsetParent!=document.body){b-=a.offsetParent.scrollLeft;}a=a.offsetParent;}}else{if(document.layers){b+=a.x;}}return b;}function findAbsolutePosY(b){var a=0;if(document.getElementById||document.all){while(b.offsetParent){a+=b.offsetTop;if(b.offsetParent!=document.body){a-=b.offsetParent.scrollTop;}b=b.offsetParent;}}else{if(document.layers){a+=b.y;}}return a;}function findPosX(a){var b=0;if(document.getElementById||document.all){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent;}}else{if(document.layers){b+=a.x;}}return b;}function findPosY(b){var a=0;if(document.getElementById||document.all){while(b.offsetParent){a+=b.offsetTop;b=b.offsetParent;}}else{if(document.layers){a+=b.y;}}return a;}function getParentElementByTag(a,b){if(!a){return null;}var c=b;while(c!=null){if(c.tagName.toLowerCase()==a.toLowerCase()){return c;}if(c==c.parentNode){break;}c=c.parentNode;}return null;}function contains(a,b){var c=b;while(c!=null){if(c==a){return true;}c=c.parentNode;}return false;}function fireProperOnChange(a,b){if(a!=null){if(b==null){b=window;}if(a.getAttribute("onChangeFunc")){b.localEval(a.getAttribute("onChangeFunc").replace(/this/g,"document.forms."+a.form.name+"."+a.name));}else{if((a.type=="checkbox"||a.type=="radio")&&a.onclick){a.onclick();}else{if(a.onchange){a.onchange();}}}}}function getInlineTextValue(a){if(isIE){return a.innerText?a.innerText:a.innerHTML;}else{while(a!=null){if(a.nodeName=="#text"){return a.nodeValue;}a=a.firstChild;}return"";}}function setInlineTextValue(a,b){if(a==null){return;}a.innerHTML=b;}function findUp(b,a){while((b!=null)&&(b.nodeName!=a)){b=b.parentNode;}return b;}function getEvent(a){return(typeof(a)!="undefined"&&a)?a:((typeof(event)!="undefined"&&event)?event:null);}function getEventKeypress(a){a=getEvent(a);return(a)?a.keyCode:null;}function getEventAltKey(a){a=getEvent(a);return(a)?a.altKey:false;}function getEventMacCommandKey(a){return false;}function getEventCtrlKey(a){a=getEvent(a);return(a)?a.ctrlKey:false;}function getEventShiftKey(a){a=getEvent(a);return(a)?a.shiftKey:false;}function getEventTarget(a){a=getEvent(a);if(a){if(a.srcElement){return a.srcElement;}if(a.target){return a.target;}}return null;}function getEventTargetType(a){a=getEventTarget(a);return(a)?a.type:null;}function setEventPreventDefault(a){a=getEvent(a);if(a){if(a.preventDefault){a.preventDefault();}else{a.returnValue=false;}}}function setEventCancelBubble(a){a=getEvent(a);if(a){if(a.stopPropagation){a.stopPropagation();}else{a.cancelBubble=true;}}}function restoreHtmlEditors(c){if(window.htmleditors!=null){var a=document.forms.main_form!=null&&document.forms.main_form.elements.nlapiVF!=null?document.forms.main_form.elements.nlapiVF.value:null;try{if(a!=null){document.forms.main_form.elements.nlapiVF.value="";}for(i in window.htmleditors){var b=getHtmlEditor(String(i));if(c==null||b.hddn.form==c){b.setValue(b.hddn.value,true);}}}finally{if(a!=null){document.forms.main_form.elements.nlapiVF.value=a;}}}}function nlFieldHelp(m,b,j,g){var a="/core/help/fieldhelp.nl?fld="+j+"&perm="+b;if(window.isOLC){a="/offline/pages/core/help/offlinefieldhelp.html?field="+j+"&recordType="+b.toLowerCase();}var e="fieldhelp";var c=350;var l=150;if(g!=null){var d=Math.min(screen.availWidth-c,getObjectLeft(g));var k=Math.min((screen.availHeight-40)-l,getObjectTop(g)+g.offsetHeight);}var h=window[e];if(typeof h=="undefined"||h==null||h.closed){h=window.open(a,e,"scrollbars="+(isIE?"no":"yes")+",width="+Math.min(screen.availWidth,c)+",height=50,left="+d+",top="+k+",resizable=yes");}else{h.location=a;h.moveTo(d,k);}h.focus();window[e]=h;return false;}function dumpObj(a){for(var c in a){var b=c+": "+a[c];document.body.appendChild(document.createTextNode(b));document.body.appendChild(document.createElement("BR"));}if(a.style){document.body.appendChild(document.createTextNode("STYLE:"));document.body.appendChild(document.createElement("BR"));dumpObj(a.style);}}function NLAlert(b,a){alert(b);}function arrayIndexOf(d,c,b){for(var a=0;d!=null&&a<d.length;a++){if(c==d[a]||(b&&c!=null&&d[a]!=null&&c.toLowerCase()==d[a].toLowerCase())){return a;}}return -1;}function arrayContains(b,a){return arrayIndexOf(b,a)>=0;}function arrayAdd(b,a){if(!arrayContains(b,a)){b.push(a);}}function arrayRemove(d,c){var b=new Array();for(var a=0;a<d.length;a++){if(c!=d[a]){b.push(d[a]);}}return b;}function getArrayIntersection(e,c){var d=new Array();for(var b=0;b<e.length;b++){for(var a=0;a<c.length;a++){if(e[b]==c[a]){d[d.length]=e[b];c[a]=null;break;}}}return d;}function isArray(a){if(typeof a=="undefined"||a==null){return false;}if(a.constructor!=null){return a.constructor.toString().substring(0,a.constructor.toString().indexOf("{")).indexOf("Array")!=-1;}if(typeof a!="string"&&a.length>0){return true;}}function nlInsertCanvas(a){}function nlSyncCanvas(a){}function nlRemoveCanvas(a){}function getCanvasId(a){return a.id+"_canvas";}function findClassUp(b,a){while((b!=null)&&(b.className!=a&&b.classAlias!=a)){b=b.parentNode;}return b;}function getScrollLeftOffset(a){var b=0;var c;if(a!=null&&(c=findClassUp(a,"scrollarea"))!=null){b=c.scrollLeft;}else{if((c=document.getElementById("div__body"))!=null){b=c.scrollLeft;}}return b;}function getScrollTopOffset(a){var b=0;var c;if(a!=null&&(c=findClassUp(a,"scrollarea"))!=null){b=c.scrollTop;}else{if((c=document.getElementById("div__body"))!=null){b=c.scrollTop;}}return b;}function removeAllChildren(a){while(a.childNodes[0]){a.removeChild(a.childNodes[0]);}}function StringBuffer(){this.buffer=[];}StringBuffer.prototype.append=function(a){this.buffer.push(a);return this;};StringBuffer.prototype.toString=function(){return this.buffer.join("");};function setObjectOpacity(a,c){var b=c.style;b.opacity=(a/100);b.MozOpacity=(a/100);b.filter="alpha(opacity="+a+")";}function fadeObjectOpacity(e,c,b,a){var d=Math.round(a/100);var f=0;if(c>b){for(i=c;i>=b;i--){setTimeout(function(){setObjectOpacity(i,e);},(f*d));f++;}}else{if(c<b){for(i=c;i<=b;i++){setTimeout(function(){setObjectOpacity(i,e);},(f*d));f++;}}}}function tellafriend(e,c,d,h,f,a,g){var b=escape(c)+",%0d%0a%0d%0a";b+=escape(d)+escape(location.hostname)+".%0d%0a%0d%0a";b+=escape(h)+escape(document.title)+".%0d%0a";b+=escape(f)+escape(g)+"%0d%0a";b+=escape(a)+escape(location.href)+"%0d%0a";location.href="mailto:?subject="+escape(e)+"&body="+b;}function isLeftButtonDown(c){var a=false;var b=getEvent(c);if(isIE&&b.button==1||(!isIE&&b.button==0)){a=true;}return a;}function isRightButtonDown(c){var a=false;var b=getEvent(c);if(b.button==2){a=true;}return a;}function getSelectedTextRange(d){var c;var b;if(document.all){var e=document.selection.createRange();var a=e.duplicate();a.moveToElementText(d);a.setEndPoint("EndToEnd",e);c=a.text.length-e.text.length;b=c+e.text.length;}else{c=d.selectionStart;b=d.selectionEnd;}var a=new Array();a[0]=c;a[1]=b;return a;}function insertTextAtCursor(c,e){c.focus();if(document.all){var d=document.selection.createRange();d.text=e;d.scrollIntoView(true);}else{var b=c.selectionStart;var a=c.selectionEnd;c.value=c.value.substring(0,b)+e+c.value.substring(a);c.selectionEnd=c.selectionStart+e.length;c.selectionStart=c.selectionEnd;}}function setWindowChanged(b,a){if(b==null){b=window;}b.ischanged=a;}function escapeHTML(b){var c=document.createElement("div");var a=document.createTextNode(b);c.appendChild(a);return c.innerHTML;}function escapeHTMLAttr(a){var a=escapeHTML(a);return a.replace(/"/g,"&quot;").replace(/'/g,"&#39;");}function getRuntimeStyle(b,a){var c=null;if(typeof b=="string"){b=document.getElementById(b);}if(b==null){return c;}if(b.currentStyle){a=camelize(a);c=b.currentStyle[a];}else{if(window.getComputedStyle){c=document.defaultView.getComputedStyle(b,null).getPropertyValue(a);}}return c;}function camelize(e){var d=e.split("-");var a=d.length;if(a==1){return d[0];}var c=e.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<a;b++){c+=d[b].charAt(0).toUpperCase()+d[b].substring(1);}return c;}function eval_js(sScript){sScript=sScript.replace(/^\s*<!--[\s\S]*?-->\s*$/gm,"");return eval(sScript);}var slave_machines=new Array();function process_slaving_result(c){var e=c.getBody();var g=e.split("<machine");for(var f=1;f<g.length;f++){var a=g[f].indexOf("name='")+6;var d=g[f].substring(a,g[f].indexOf("'>",a));slave_machines[d]=g[f].substring(g[f].indexOf("'>")+2,g[f].lastIndexOf("</machine>"));}var b=g[0];eval_js(b);slave_machines=new Array();}var process_slaving_result_original=process_slaving_result;var performSlavingAsync=true;function setSlavingAsync(a){performSlavingAsync=a;}function getSlavingAsync(){return performSlavingAsync;}function loadSlavingResults(a){nlXMLRequestURL(a,null,null,process_slaving_result,getSlavingAsync());}function execute_js(a,b){eval_js(a.getBody());if(b){b();}}function loadXMLJSDoc(a,b){nlXMLRequestURL(a,null,null,function(c){execute_js(c,b);},true);}function nlXMLRequestURL(b,c,g,a,e){var f=new NLXMLHttpRequest();if(a instanceof Function){f.setResponseHandler(a);}var d=f.requestURL(b,c,g,e);return d;}function NLXMLHttpRequest(a){this.requestPending=false;this.callbackFunc=null;this.ignoreResponseErrors=a;if(window.XMLHttpRequest){this.xmlrequest=new XMLHttpRequest();}else{try{this.xmlrequest=new ActiveXObject("Msxml2.XMLHTTP.4.0");}catch(b){this.xmlrequest=isOffline()?null:new ActiveXObject("Msxml2.XMLHTTP");}}}NLXMLHttpRequest.prototype.setResponseHandler=function(a){this.callbackFunc=typeof a=="function"?a:null;};NLXMLHttpRequest.prototype.requestURL=function(b,c,e,d){if(this.requestPending){return;}this.requestPending=true;var g=c!=null?"POST":"GET";this.xmlrequest.open(g,b,(d!=null?d:false));for(var f in e){this.xmlrequest.setRequestHeader(f,e[f]);}this.xmlrequest.setRequestHeader("NSXMLHttpRequest","NSXMLHttpRequest");if(g=="POST"){if(c instanceof String||typeof c=="string"||nsInstanceofDocument(c)){this.xmlrequest.setRequestHeader("Content-Type","text/xml; charset=UTF-8");}else{c=formEncodeURLParams(c);this.xmlrequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");}}var a=null;if(d){this.xmlrequest.onreadystatechange=this.handleResponse.bindAsEventListener(this);this.xmlrequest.send(c);}else{this.xmlrequest.send(c);a=this.handleResponse();}return a;};NLXMLHttpRequest.prototype.handleResponse=function(){var d=null;if(this.xmlrequest.readyState==4){var l=this.xmlrequest.status;var c=this.xmlrequest.responseText;var a=new Array();var e=this.xmlrequest.getAllResponseHeaders();e=e.replace(/^\s+/,"").replace(/\s+$/,"").split("\n");for(var f=0;f<e.length;f++){var h=e[f].split(":");var g=h[0];var j=a[g];if(j==null){j=new Array();a[g]=j;}j[j.length]=h[1];}var k=null;if(c.indexOf("<onlineError>")>=0){var b=nsStringToXML(c);k=new NLXMLResponseError(nsSelectValue(b,"/onlineError/code"),nsSelectValue(b,"/onlineError/detail"),nsSelectValue(b,"/onlineError/id"));}else{if(l!=200&&l!=206){k=new NLXMLResponseError("SERVER_RESPONSE_ERROR",c);}}try{if(k!=null&&this.callbackFunc==null&&!this.ignoreResponseErrors){throw k;}d=new NLXMLResponse(l,c,a,k);if(this.callbackFunc!=null){this.callbackFunc(d);}}finally{this.requestPending=false;}}return d;};function NLXMLResponse(c,d,b,a){this.code=c;this.body=d;this.headers=b;this.error=a;this.getCode=function(){return this.code;};this.getBody=function(){return this.body;};this.getError=function(){return this.error;};this.getHeaders=function(){return this.headers;};}function NLXMLResponseError(c,a,b){this.id=b;this.code=c;this.details=a;this.getId=function(){return this.id;};this.getCode=function(){return this.code;};this.getDetails=function(){return this.details;};}function nsServerCall(f,e,d,a,c){var b=new NLJsonRpcClient(f);return b.sendRequest(e,d,a,c);}NLJsonRpcClient=function(a){if(a.indexOf("?")>0){a=a+"&jrr=T";}else{a=a+"?jrr=T";}this.serverURL=a;this.responseCallbackMap={};};NLJsonRpcClient.requestId=0;NLJsonRpcClient.prototype={sendRequest:function(j,g,k,b){b=b||"GET";var f={id:NLJsonRpcClient.requestId++,method:"remoteObject."+j,params:g||[]};if(k!=null){this.responseCallbackMap[f.id]=k;}var e=new NLXMLHttpRequest();if(k!=null){e.setResponseHandler(this.handleResponseAsync.bindAsEventListener(this));}var a=this.serverURL;var c=null;if("GET"==b){a+="&jrid="+f.id;a+="&jrmethod="+f.method;if(f.params.length>0){a+="&jrparams="+encode(toJSON(f.params));}}if("POST"==b||("GET"==b&&a.length>2083)){a=this.serverURL;c=toJSON(f);}var d=e.requestURL(a,c,null,k!=null?true:false);if(k==null){var h=this.getJsonRpcResponse(d);if(h.error){throw new NLXMLResponseError(h.error.code,h.error.trace,h.error.msg);}d=h.result;}return d;},getJsonRpcResponse:function(nlXMLResponseObj){var jsonRpcResp=nlXMLResponseObj.getBody();if(jsonRpcResp!=null){jsonRpcResp=jsonRpcResp.replace(/^\s*<!--[\s\S]*?-->\s*$/gm,"");}eval("jsonRpcResp = "+jsonRpcResp+";");return jsonRpcResp;},handleResponseAsync:function(a){var b=this.getJsonRpcResponse(a);var c=this.responseCallbackMap[b.id];this.responseCallbackMap[b.id]=null;c(b.result,b.error);}};Function.prototype.bind=function(b){var a=this;return function(){a.apply(b,arguments);};};Function.prototype.bindAsEventListener=function(b){var a=this;return function(c){a.call(b,c||window.event);};};function isOffline(){return window.isOLC!=null;}function clone(c){if(typeof(c)!="object"){return c;}if(c==null){return c;}var a=new Object();for(var b in c){a[b]=clone(c[b]);}return a;}