function ClearForm(){var b,c;c=0;for(b=document.getElementsByTagName("input").length;c<b;c++){var a;a=document.getElementsByTagName("input").item(c);if(a.type=="text")a.value=""}c=0;for(b=document.getElementsByTagName("select").length;c<b;c++)document.getElementsByTagName("select").item(c).selectedIndex=0}function noenter(){return!(window.event&&window.event.keyCode==13)}
function UpdateBalance(b,c,a,d,e,f,g,h,l){var k=new Boolean(!1),k=new Boolean(!1),j,m,n,r,p,o,q,b=document.getElementById(b).value,b=b.replace(/\$/g,""),b=b.replace(/,/g,""),b=Number(b),d=document.getElementById(d),a=document.getElementById(a);p=document.getElementById(g);o=document.getElementById(h);h=c.replace(/\$/g,"");h=h.replace(/,/g,"");m=a.value;m=m.replace(/\$/g,"");m=m.replace(/,/g,"");g="false";e!="False"&&(k=!0);m=Number(m);j=Number(h);h=e=0;l=document.getElementById(l);for(n=document.getElementsByTagName("span").length;h<
n;h++)if(q=document.getElementsByTagName("span").item(h),r=q.id,r.match(/lblErrorFlag/))q.style.display="none";o.innerHTML="&nbsp;";if(m)if(m<0){if(k==!0)p.style.display="",o.innerHTML="Payment must be a positive number.&nbsp;&nbsp;Click in the problem field above to re-enter the payment and clear this error message.";g="true";k=!1}else if(m>j){if(k==!0)p.style.display="",o.innerHTML="The payment entered exceeded the line item amount.&nbsp;&nbsp;Click in the problem field above to re-enter the payment and clear this error message.";
g="true";k=!1}else if(h=m.toFixed(2),m!=h){if(k==!0)p.style.display="",o.innerHTML="Please ensure that only two digits follow a decimal point when entering payments.&nbsp;&nbsp;Click in the problem field above to re-enter the payment and clear this error message.";g="true";k=!1}else m=h,k=!0;else{if(m!=0){if(k==!0)p.style.display="",o.innerHTML="Please enter payments using numeric characters.&nbsp;&nbsp;Click in the problem field above to re-enter the payment and clear this error message.";g="true"}k=
!1}if(k==!0){c=(j-m).toFixed(2);c=addCommas(String(c));d.innerHTML="$"+c;UpdateTotal(f);h=0;for(f=document.getElementsByTagName("input").length;h<f;h++)if(k=document.getElementsByTagName("input").item(h),c=k.id,c.match(/txtPayment/))c=k.value,c=c.replace(/\$/g,""),c=c.replace(/,/g,""),c=Number(c),e+=c;e=e.toFixed(2);intAmountLeft=b-e;intAmountLeft=intAmountLeft.toFixed(2);intAmountLeft<0?(intAmountLeft=Math.abs(intAmountLeft),strValidatedPayment=String(intAmountLeft),strValidatedPayment=addCommas(strValidatedPayment),
strValidatedPayment="<font color='aa0000;'>-$"+strValidatedPayment+"</font>"):(strValidatedPayment=String(intAmountLeft),strValidatedPayment=addCommas(strValidatedPayment),strValidatedPayment="$"+strValidatedPayment);strAmountLeft="Amount left to distribute: "+strValidatedPayment;l.innerHTML=strAmountLeft;g="false"}else d.innerHTML=c,a.value="$0.00",UpdateTotal(f);return g}
function ValidatePayment(b,c,a,d,e){var f,g=new Boolean(!1),h,l,k;f=document.getElementById(b);e=document.getElementById(e);b=f.value;b=b.replace(/\$/g,"");b=b.replace(/,/g,"");h=Number(b);d=d.replace(/\$/g,"");d=d.replace(/,/g,"");l=Number(d);k=b=d=0;c=document.getElementById(c);a!="False"&&(g=!0);a="false";if(h)if(h<0){if(g==!0)c.style.display="",c.innerHTML="Payment must be a positive number.";a="true"}else if(h>l){if(g==!0)c.style.display="",c.innerHTML="The payment entered must not exceed the total amount due.";
a="true"}else{if(d=h.toFixed(2),h!=d){if(g==!0)c.style.display="",c.innerHTML="Please ensure that only two digits follow a decimal point when entering payments.";a="true"}}else{if(h==0){if(g==!0)c.style.display="",c.innerHTML="Payment amount must be greater than zero."}else if(g==!0)c.style.display="",c.innerHTML="Please enter payments using numeric characters.";a="true"}if(a=="true")f.value="$0.00",e.innerHTML="&nbsp;";else{for(g=document.getElementsByTagName("input").length;k<g;k++)if(f=document.getElementsByTagName("input").item(k),
h=f.id,h.match(/txtPayment/))f=f.value,f=f.replace(/\$/g,""),f=f.replace(/,/g,""),f=Number(f),b+=f;b=b.toFixed(2);d=(d-b).toFixed(2);d<0?(d=Math.abs(d),d=addCommas(String(d)),d="<font color='aa0000;'>-$"+d+"</font>"):(d=addCommas(String(d)),d="$"+d);e.innerHTML="Amount left to distribute: "+d;c.style.display="none";c.innerHTML="&nbsp;"}return a}
function HandleSubmit(b,c,a,d){var e,f,g,h,a=document.getElementById(a).value,a=a.replace(/\$/g,""),a=a.replace(/,/g,""),a=Number(a),d=d.replace(/\$/g,"");d.replace(/,/g,"");g=d=0;for(f=document.getElementsByTagName("input").length;g<f;g++)if(e=document.getElementsByTagName("input").item(g),h=e.id,h.match(/txtPayment/))e=e.value,e=e.replace(/\$/g,""),e=e.replace(/,/g,""),e=Number(e),d+=e;d=d?d.toFixed(2):0;if(b=="false")a?a>0?a==d?(b=document.getElementById(c),document.FormName.Uinfo.disabled=!0,
document.FormName.Uinfo2.disabled=!0,b.submit()):(a=a.toFixed(2),b=addCommas(String(a)),b="$"+b,c=addCommas(String(d)),alert("Amount allocated ($"+c+") does not equal the payment amount ("+b+").")):alert("Please enter a payment."):alert("Please enter a payment.")}
function UpdateTotal(b){var c,a,d,e;d=e=0;b=document.getElementById(b);for(c=document.getElementsByTagName("span").length;d<c;d++){var f;f=document.getElementsByTagName("span").item(d);a=f.id;if(a.match(/lblBalField/))a=f.innerHTML,a=a.replace(/\$/g,""),a=a.replace(/,/g,""),a=Number(a),e+=a}e=e.toFixed(2);d=addCommas(String(e));b.innerHTML="$"+d}function addCommas(b){x=b.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";for(b=/(\d+)(\d{3})/;b.test(x1);)x1=x1.replace(b,"$1,$2");return x1+x2}
function IsNumeric(b,c){var a,d;if(a=Number(b))switch(c){case "integer":return d=Math.round(a),d==a?!0:!1;case "plusint":return d=Math.round(a),d==a?a>0?!0:!1:!1;default:return!0}else return!1}function LoadInMain(b,c,a,d){a=a.parent.Body;a.location=b;a.focus();c&&d.close()}function AmIAPopup(b){return b==window.top?!0:!1}function show(b){b=b.split("/");for(x=0;x<b.length;x++)if(b[x]!="")document.getElementById(b[x]).style.display=""}
function hide(b){b=b.split("/");for(x=0;x<b.length;x++)if(b[x]!="")document.getElementById(b[x]).style.display="none"}function clearInner(b){document.getElementById(b).innerHTML=""}function PopulateDDL(b,c){for(var a=0;a<b.length;a++){var d=document.getElementById(c),e=new Option(b[a],b[a],!1,!1);d.options[a]=e}}function PopulateDDL2(b,c,a){for(var d=0;d<b.length;d++){var e=document.getElementById(a),f=new Option(b[d],c[d],!1,!1);e.options[d]=f}}
function TextareaInsertText(b,c){var a=document.getElementById(b);if(document.selection)a.focus(),a=document.selection.createRange(),a.text=c;else if(a.selectionStart||a.selectionStart==0){var d=a.selectionEnd;a.value=a.value.substring(0,a.selectionStart)+c+a.value.substring(d,a.value.length)}else a.value+=c}function checkSection(b,c){var a=c.split("/");for(x=0;x<a.length;x++)if(a[x]!="")object=b.checked==!0?document.getElementById(a[x]).checked=!0:document.getElementById(a[x]).checked=!1}
function SetInputValue(b,c){document.getElementById(b).value=c;return!0}function UpdateFormPostAction(b,c){document.getElementById(b).action=c}function getHTML(b,c,a,d){d==null&&(d=!1);document.getElementById(c).innerHTML="<span style='font-size:12px;'><img src='/Images/indicator.gif'/> Loading...</span>";new Ajax.Updater(c,b,{method:"get",parameters:a,evalScripts:d})}function isDate(b){return!isNaN(new Date(b))}
function dateAdd(b,c,a){if(!isDate(a))return"invalid date: '"+a+"'";if(isNaN(c))return"invalid number: '"+c+"'";var d=0,d="",c=new Number(c),a=new Date(a);switch(b.toLowerCase()){case "yyyy":a.setFullYear(a.getFullYear()+c);break;case "q":a.setMonth(a.getMonth()+c*3);break;case "m":a.setMonth(a.getMonth()+c);break;case "d":d=a.toString();d=Date.parse(d)+c*864E5;d/=1E3;a=new Date(1970,0,1,0,0,d);break;case "wd":for(b=c<0?-1:1;c!=0;)a=a.getDay()==5?b==-1?dateAdd("w",b,a):dateAdd("w",b*3,a):a.getDay()==
1?b==-1?dateAdd("w",b*3,a):dateAdd("w",b,a):a.getDay()==6?b==-1?dateAdd("w",b,a):dateAdd("w",b*2,a):a.getDay()==0?b==-1?dateAdd("w",b*2,a):dateAdd("w",b,a):dateAdd("w",b,a),c-=b;break;case "y":case "w":a.setDate(a.getDate()+c);break;case "ww":a.setDate(a.getDate()+c*7);break;case "h":a.setHours(a.getHours()+c);break;case "n":a.setMinutes(a.getMinutes()+c);break;case "s":a.setSeconds(a.getSeconds()+c);break;case "ms":a.setMilliseconds(a.getMilliseconds()+c);break;default:return"invalid interval: '"+
b+"'"}return a}
function datePart(b,c){if(!isDate(c))return"invalid date: '"+c+"'";var a=new Date(c);switch(b.toLowerCase()){case "yyyy":return a.getFullYear();case "q":return parseInt(a.getMonth()/3)+1;case "m":return a.getMonth()+1;case "y":return dateDiff("y","1/1/"+a.getFullYear(),a);case "d":return a.getDate();case "w":return a.getDay();case "ww":return dateDiff("ww","1/1/"+a.getFullYear(),a);case "h":return a.getHours();case "n":return a.getMinutes();case "s":return a.getSeconds();case "ms":return a.getMilliseconds();default:return"invalid interval: '"+
b+"'"}}
function dateDiff(b,c,a){if(!isDate(c))return"invalid date: '"+c+"'";if(!isDate(a))return"invalid date: '"+a+"'";var d=new Date(c),e=new Date(a),a=e.valueOf()-d.valueOf(),c=e.getUTCFullYear()-d.getUTCFullYear(),d=e.getUTCMonth()-d.getUTCMonth()+(c!=0?c*12:0),e=parseInt(d/3),f=parseInt(a/1E3),g=parseInt(f/60),h=parseInt(g/60),l=parseInt(h/24),k=parseInt(l/7);switch(b.toLowerCase()){case "yyyy":return c;case "q":return e;case "m":return d;case "y":case "d":return l;case "w":return l;case "ww":return k;case "h":return h;
case "n":return g;case "s":return f;case "ms":return a;default:return"invalid interval: '"+b+"'"}}function copy_value(b,c){document.getElementById(c).value=b.value}
function calc_RemDate(b,c,a,d){var b=document.getElementById(b).value,e=document.getElementById(c).value;if(e.toLowerCase()=="t")var f=new Date,g=f.getMonth()+1,h=f.getDate(),f=f.getFullYear(),e=g+"/"+h+"/"+f;else if(e.substring(0,1)=="+")f=new Date,g=f.getMonth()+1,h=f.getDate(),f=f.getFullYear(),e=dateAdd("d",e.substring(1),g+"/"+h+"/"+f),g=e.getMonth()+1,h=e.getDate(),f=e.getFullYear(),e=g+"/"+h+"/"+f;else if(e.substring(0,1)=="-")return document.getElementById(d).innerHTML="<br><span class='ui-state-error'>Expiration Date is older than today</span>",
!1;if(e=="")document.getElementById(d).innerHTML="";else if(e=e.replace(/-/g,"/"),g=e.split("/"),h=g[g.length-1],e.toLowerCase()!="d/s"){if(h.length==2&&g.length==3)h="20"+h,e=g[0]+"/"+g[1]+"/"+h,document.getElementById(c).value=e;c=dateDiff("d",new Date,e);if(h.length==2||g.length<3)return document.getElementById(d).innerHTML="<br><span class='ui-state-error'>Invalid date; must be mm/dd/yyyy format</span>",!1;else if(h=g[0],g=g[1],h>12||h<1||g>31||g<1)return document.getElementById(d).innerHTML=
"<br><span class='ui-state-error'>Invalid date; must be mm/dd/yyyy format</span>",!1;else if(c<0){if(document.getElementById(a).value!=="")document.getElementById(a).value="",document.getElementById(d).innerHTML="<br><span class='ui-state-error'>Expiration Date is older than today</span>";return!1}else return b=dateAdd("d",-b,e),newRemDate=datePart("m",b)+"/"+datePart("d",b)+"/"+datePart("yyyy",b),document.getElementById(a).value=newRemDate,document.getElementById(d).innerHTML="",!0}else document.getElementById(d).innerHTML=
""}function create_reminder(b,c,a,d,e,f,g){document.getElementById(d).value=document.getElementById(a).value;if(calc_RemDate(e,d,f,g))document.getElementById(c).value="-1",b.innerHTML="<br>Reminder will be created when Update Info is clicked"}
function send_email(b,c,a,d,e,f){var b=document.getElementById(b).value,c=document.getElementById(c).value,a=document.getElementById(a).value,d=document.getElementById(d).value,e=document.getElementById(e).value,g=!0,h="";b==""?(g=!1,h="Please enter To address"):d==""&&(g=!1,h="Please enter To Subject");if(g){if(e=encodeURI(e),g=String.fromCharCode(34),d=d.gsub(g,"%22"),b="mailto:"+b+"?",c!=""&&(b=b+"cc="+c+"&"),a!=""&&(b=b+"bcc="+a+"&"),window.location.href=b+"subject="+d+"&body="+e,f)document.getElementById("btnSnedViaLocal").value=
"Send_EMail_via",setTimeout("document.forms[0].submit()",1E3)}else return document.getElementById("errMsg").innerHTML=h,!1}function reloadParent(){window.location.href=window.location.href}function GoToURL(b){window.location=b}function toggleView(b,c,a,d){c=document.getElementById(c);c.innerHTML==a?(show(b),c.innerHTML=d):(hide(b),c.innerHTML=a)}
function controlFlow(b,c,a){c=c.split(",");for(x=0;x<c.length;x++){class_Name=StripSpace(c[x]);var d=GetElementsByClassName(document,"input",class_Name),e=d.length;for(y=0;y<e;y++)if(b=="disable"){d[y].disabled=!0;if(a==!0)d[y].value="";if(d[y].type=="radio"&&d[y].checked==!0)d[y].checked=!1}else d[y].disabled=!1}}
function GetElementsByClassName(b,c,a){for(var b=c=="*"&&b.all?b.all:b.getElementsByTagName(c),c=[],a=a.replace(/\-/g,"\\-"),a=RegExp("(^|\\s)"+a+"(\\s|$)"),d,e=0;e<b.length;e++)d=b[e],a.test(d.className)&&c.push(d);return c}function StripSpace(b){return b=b.replace(/^\s*|\s*$/g,"")}
function toggleVisibility(b,c,a,d){var e=document.getElementById(c);e.innerHTML="<span style='font-size:12px; padding:5px;'>Loading...</span>";b.alt=="right arrow"?(b.src="/Images/arrow_down.png",b.alt="down arrow",b.title="click here to close this section",b="show="+c):(b.src="/Images/arrow_right.png",b.alt="right arrow",b.title="click here to open this section",b="hide="+c);new Ajax.Request("/4DCGI/Web_Menu/"+a+"/1010/"+d+"?"+b,{method:"get",onSuccess:function(a){e.innerHTML=a.responseText}})}
function Utl_SubmitForm(b,c,a){document.getElementById(a).value=c;document.forms[b].submit()}
function CreateNewI94(b,c){var a=b,b=b.substr(0,4)+"",d=b+"1",e;if(document.getElementsByTagName("input"))for(EachField in e=document.getElementsByTagName("input"),e){var f=e[EachField];if(f.name&&f.name.substr(0,4)==b)switch(f.type){case "hidden":if(f.name.substr(0,5)==a)document.getElementsByName(f.name)[0].value="-1";break;case "radio":f.checked=!1;break;default:if(f.name.substr(0,5)==d)document.getElementsByName(f.name)[0].value=""}document.getElementById(c.id).disabled=!0}}
function toggleAllCheckboxes(b){for(var c=document.getElementsByTagName("input"),a=0;a<c.length;a++)if(c[a].type=="checkbox"&&c[a].disabled==!1)c[a].checked=b.checked?!0:!1}
function addInputRows(b,c){var a,d,e,f;if(window[b+"counter"]>=window[b+"maxcounter"])return!1;if(window[b+"rows"]>=window[b+"maxrows"])return!1;var g=window[b+"counter"];window[b+"rows"]++;var h=document.getElementById(b).cloneNode(!0);h.id="";h.style.display="";d=h.getElementsByTagName("input");f=h.getElementsByTagName("select");var l=h.getElementsByTagName("textarea"),k=h.getElementsByTagName("div"),j=[],m=[],n=[];a=d.length;for(e=0;e<a;e++)j.push(d[e]);a=f.length;for(e=0;e<a;e++)j.push(f[e]);
a=l.length;for(e=0;e<a;e++)j.push(l[e]);for(e=0;e<j.length;e++){a=j[e].name;d=Left(a,5);l=a.substring(6);daTable="";for(f=0;f<l.length;f++)"0123456789".indexOf(l.charAt(f))!=-1?daTable+=l.charAt(f):f=l.length;if(d=="TABLE")m.push(d+"/"+daTable),n.push(window[b+"counter"]),a="s"+window[b+"counter"]+"/"+a,window[b+"counter"]++,m.push("FIELD/"+daTable),n.push(window[b+"counter"]),window[b+"counter"]++;else for(f=0;f<m.length;f++)if(m[f].toLowerCase()==(d+"/"+daTable).toLowerCase())a="s"+n[f]+"/"+a,f=
m.length;j[e].name=a;if(j[e].id!="")j[e].id=="bRemove"?j[e].id="s"+g:j[e].id+=window[b+"rows"];j[e].className=j[e].className.replace(/fv_hidden/gi,"fv")}for(e=0;e<k.length;e++)k[e].id+=window[b+"rows"];e=document.getElementById(c);e.parentNode.insertBefore(h,e)}function clearTableRowContents(b){document.getElementById(b);return!0}
function RemoveRow(b,c){document.getElementById(c+"_delete")&&(isIE()?document.getElementById(c+"_delete").value+=b.parentNode.parentNode.childNodes[0].childNodes[0].value+"|":document.getElementById(c+"_delete").value+=b.parentNode.parentNode.childNodes[1].childNodes[1].value+"|");b.parentNode.parentNode.parentNode.removeChild(b.parentNode.parentNode);window[c+"rows"]--}
function RestoreRows(b,c){var a=document.createElement("div");a.id="refreshing";a.title="Updating Info";a.innerHTML="Form is refreshing, thank you for your patience.";document.getElementsByTagName("body")[0].appendChild(a);$j("#refreshing").dialog();if(document.getElementById(c+"_delete"))document.getElementById(c+"_delete").value="";submitFormfromBtn(b,"Update Info")}
function calc_Amount(){var b=document.getElementById("Quantity_id").value,c=document.getElementById("Price_id").value;c.substring(0,1)=="$"&&(c=c.substring(1));c=deleteChar(c,",");b=Math.round(b*c*100)/100;document.getElementById("Amount_id").value=b}function Left(b,c){return c<=0?"":c>String(b).length?b:String(b).substring(0,c)}function Right(b,c){if(c<=0)return"";else if(c>String(b).length)return b;else{var a=String(b).length;return String(b).substring(a,a-c)}}
function KeyPressed(b){return window.event?window.event.keyCode:b?b.which:0}
function simpleRowAdd(b){var c,a,d=document.getElementById(b).tBodies[0],e=d.rows[1].cloneNode(!0);e.style.display="";var f=e.getElementsByTagName("input"),g=e.getElementsByTagName("select"),h=e.getElementsByTagName("textarea"),l=e.getElementsByTagName("div"),k=e.getElementsByTagName("span"),j=[];a=f.length;for(c=0;c<a;c++)j.push(f[c]);a=g.length;for(c=0;c<a;c++)j.push(g[c]);a=h.length;for(c=0;c<a;c++)j.push(h[c]);a=l.length;for(c=0;c<a;c++)j.push(l[c]);a=k.length;for(c=0;c<a;c++)j.push(k[c]);a=[];
f=[];for(c=0;c<j.length;c++)if(j[c].name=j[c].name+"_"+pad(d.rows.length-2,2),j[c].id!="")g=j[c].id,j[c].id=j[c].id+"_"+pad(d.rows.length-2,2),j[c].className=="autoComplete"&&(daRegex=RegExp("data\\.(.*?);[^;]*?"+g,"i"),h=document.body.innerHTML.match(daRegex),a.push(j[c].id),f.push(h[1])),j[c].className.indexOf("autocomplete")>0&&(a.push(j[c].id),g=$j("#"+g).autocomplete("option","source"),f.push(g));d.insertBefore(e,document.getElementById(b+"_baseline"));for(c=0;c<a.length;c++)$j("#"+a[c]).autocomplete({source:f[c]})}
function simpleRowDelete(b){var b=document.getElementById(b),c=b.rows.length,a="";if(c==4){for(i=0;i<b.rows[0].cells.length;i++)a=b.rows[c-2].cells[i].innerHTML,a=a.replace(/value=[\'"]?.*?[\'"\s]/gi,"value=''"),a=a.replace(/(selected|checked)(=[\"']?(selected|checked|true)[\"']?)?/gi,""),b.rows[c-2].cells[i].innerHTML=a;b.rows[c-2].style.display="none"}else c>4&&b.deleteRow(c-2)}
function submitFormfromBtn(b,c){var a=document.createElement("input");a.setAttribute("type","hidden");a.setAttribute("value",c);a.setAttribute("name","bUpdate");b.parentNode.appendChild(a);document.forms[0].submit()}function fireEvent(b,c){if(b&&document.getElementById(b)){var a=document.getElementById(b);if(document.createEventObject){var d=document.createEventObject();return a.fireEvent("on"+c,d)}else return d=document.createEvent("HTMLEvents"),d.initEvent(c,!0,!0),!a.dispatchEvent(d)}}
function CharactersRemaining(b,c,a){if(document.getElementById(b).value.length>a)document.getElementById(b).value=document.getElementById(b).value.substring(0,a);document.getElementById(c).innerHTML=a-document.getElementById(b).value.length}function isIE(){if(navigator.appName=="Microsoft Internet Explorer")return!0;return!1}
function ValidateHHMMSS(b){var c,a;c=document.getElementById(b).value.split(":");if(c.length!=3)return alert("Time format is HH:MM:SS. Valid range is 00:00:00 - 23:59:59."),!1;else{b=parseInt(c[0]);a=parseInt(c[1]);c=parseInt(c[2]);if(c<0||c>59)return alert("Time format is HH:MM:SS. Valid range is 00:00:00 - 23:59:59."),!1;if(a<0||a>59)return alert("Time format is HH:MM:SS. Valid range is 00:00:00 - 23:59:59."),!1;if(b<0||b>23)return alert("Time format is HH:MM:SS. Valid range is 00:00:00 - 23:59:59."),
!1}return!0}
function getSelectedValues(b){if(b&&(b=document.getElementsByName(b),b.length>0)){var c;if(b[0].type=="radio")for(c=0;c<b.length;c++){if(b[c].checked==!0)return b[c].value}else if(b[0].type=="checkbox"){var a=[];for(c=0;c<b.length;c++)b[c].checked==!0&&a.push(b[c].value);return a}else if(b[0].type=="select-one"){a="";for(c=0;c<b.length;c++)a+=b[c].options[b[c].selectedIndex].value;return a}else if(b[0].type=="select-multiple"){a=[];for(c=0;c<b[0].options.length;c++)b[0].options[c].selected==!0&&a.push(b[0].options[c].value);
return a}else if(b[0].type=="text"||b[0].type=="textarea"){a="";for(c=0;c<b.length;c++)a+=b[c].value;return a}}return""}
function setSelectedValues(b,c){if(b){var a=document.getElementsByName(b);if(a.length>0){var d;if(a[0].type=="radio")for(d=0;d<a.length;d++){if(a[d].value==c)a[d].checked=!0,d=a.length}else if(a[0].type=="checkbox")for(d=0;d<a.length;d++){if(a[d].value==c)a[d].checked=!0}else if(a[0].type=="select-one")for(d=0;d<a.length;d++)for(var e=0;e<a[d].options.length;e++){if(a[d].options[e].value==c)a[d].options[e].selected=!0,e=a[d].options.length}else if(a[0].type=="select-multiple")for(d=0;d<a[0].options.length;d++)for(e=
0;e<a[d].options.length;e++){if(a[d].options[e].value==c)a[d].options[e].selected=!0}else for(d=0;d<a.length;d++)a[d].value=c}}}if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,c){c==null?c=0:c<0&&(c=Math.max(0,this.length+c));for(var a=c,d=this.length;a<d;a++)if(this[a]===b)return a;return-1};
function getAllInputsFromElem(b,c){var a,d=b.getElementsByTagName("input"),e=b.getElementsByTagName("select"),f=b.getElementsByTagName("textarea"),g=[];for(a=0;a<d.length;a++)g.push(d[a]);for(a=0;a<e.length;a++)g.push(e[a]);for(a=0;a<f.length;a++)g.push(f[a]);c&&g.sort();return g}
function addTable(b,c,a){var d,e=document.getElementById(c),f=getAllInputsFromElem(e),g=[],e=document.getElementById(b),e=getAllInputsFromElem(e);if(e.length/f.length>a)alert("Maximum number of rows is "+a);else{for(var h=[],a=0;a<f.length;a++)d=f[a].name.split("/")[0].split("s")[1],IsNumeric(d)&&h.push(d),f[a].className.indexOf("autocomplete")>0&&g.push(f[a].id);h.sort();for(var f=Number(h[0]),l=Number(h[h.length-1])-f+1,h=[],a=0;a<e.length;a++)d=e[a].name.split("/")[0].split("s")[1],IsNumeric(d)&&
h.push(d);h.sort();d=Number(h[h.length-1])+1;e=document.createElement("div");document.body.appendChild(e);a=document.getElementById(c).cloneNode(!0);e.appendChild(a);tempHTML=e.innerHTML;for(a=l;a>=0;a--)l=RegExp("s"+(f+a),"ig"),tempHTML=tempHTML.replace(l,"s"+(d+a));tempHTML=tempHTML.replace(/(id=[\"']?.*?)([\"'\s])/gi,"$1"+d+"$2");tempHTML=tempHTML.replace(RegExp(c,"ig"),c+d);e.innerHTML=tempHTML;a=e.firstChild.cloneNode(!0);a.id=c+d;a.style.display="";document.getElementById(b).insertBefore(a,
document.getElementById(b).lastChild);if(tempHTML.indexOf("autoComplete")>0){c=tempHTML.match(/<div[^<]*?autoComplete.*?>/gi);for(a=0;a<c.length;a++)b=c[a].match(/=[\"']?(div.*?)[\"'\s]/i),l=RegExp("data\\.(.*?);[^;]*?"+b[1].replace(d,""),"i"),f=document.body.innerHTML.match(l),window["arrItems"+d+a]=data[f[1]],window["list"+d+a]=new Autocompleter.Local(b[1].replace("div","txt"),b[1],window["arrItems"+d+a],{fullSearch:!0})}if(tempHTML.indexOf("autocomplete")>0){c=tempHTML.match(/<input[^<]*?autocomplete.*?>/gi);
for(a=0;a<c.length;a++)b=c[a].match(/txt.*?\b/i),f=$j("#"+g[a]).autocomplete("option","source"),$j("#"+b[0]).autocomplete({source:f})}e.parentNode.removeChild(e)}}
function removeTable(b,c){document.getElementById(b+"_delete")&&document.getElementById("key_"+c)&&(document.getElementById(b+"_delete").value+=document.getElementById("key_"+c).value+"|");document.getElementById(b).removeChild(document.getElementById(c));for(var a=document.getElementById(b),d=getAllInputsFromElem(a,!0),a=[],e=0;e<d.length;e++)a.push(d[e].name.split("/")[0].split("s")[1]);a.sort();for(var e=Number(d[0].name.split("/")[0].split("s")[1]),d=Number(d[d.length-1].name.split("/")[0].split("s")[1]),
f=0;e<=d;e++)if(a.indexOf(e+"",f)>=0)f=a.indexOf(e+"");else{f+=1;for(var g=f;g<=a.length;g++)Number(a[g])>e&&(f=g);g=RegExp(a[f],"ig");a[f]=e+"";document.getElementById(b).innerHTML.replace(g,a[f])}}function radioButtonRevealElem(b,c){var a=getSelectedValues(b);document.getElementById(c).style.display=a=="1"?"":"none";window.enableValidation&&hideShowValidationClasses(c,a!="1")}
function createCookie(b,c,a){if(a){var d=new Date;d.setTime(d.getTime()+a*864E5);a="; expires="+d.toGMTString()}else a="";document.cookie=b+"="+c+a+"; path=/"}function readCookie(b){b+="=";for(var c=document.cookie.split(";"),a=0;a<c.length;a++){for(var d=c[a];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(b)==0)return d.substring(b.length,d.length)}return null}function eraseCookie(b){createCookie(b,"",-1)}
function isCookieEnabled(){document.cookie="test";cookieEnabled=document.cookie.indexOf("test")!=-1?!0:!1;eraseCookie("test");return cookieEnabled}function deleteChar(b,c){var a=b.split(c),b="",d;for(d=0;d<a.length;d++)b+=a[d];return b}function downloadIE(b){return $j.browser.msie?(location.href=b,!1):!0}function Get_4DWPG(){var b="4DWPG_",c=new Date;b+=pad(c.getMonth()+1,2);b+=pad(c.getDate(),2);b+=c.getFullYear();b+=c.valueOf();return b}
function pad(b,c){for(var a=b+"";a.length<c;)a="0"+a;return a}function simple_tooltip(b,c){$j(b).each(function(a){var b=$j(this).attr("title");$j("body").append("<div class='"+c+"' id='"+c+a+"'><p>"+b+"</p></div>");var e=$j("#"+c+a);$j(this).removeAttr("title").mouseover(function(){e.css("display","none").fadeIn(400)}).mousemove(function(a){e.css({left:a.pageX+15,top:a.pageY+15})}).mouseout(function(){e.fadeOut(400)})})}
function getScrollBarWidth(){var b=document.createElement("p");b.style.width="100%";b.style.height="200px";var c=document.createElement("div");c.style.position="absolute";c.style.top="0px";c.style.left="0px";c.style.visibility="hidden";c.style.width="200px";c.style.height="150px";c.style.overflow="hidden";c.appendChild(b);document.body.appendChild(c);var a=b.offsetWidth;c.style.overflow="scroll";b=b.offsetWidth;if(a==b)b=c.clientWidth;document.body.removeChild(c);return a-b}
function jQuerySanitize(b){if(b)return b.replace(/([#;&,.+*~':"!\^$\[\]()=>|\/`%<?@{}])/g,"\\$1")}
if(typeof jQuery!="undefined"){jQuery.expr[":"].regex=function(b,c,a){c=a[3].split(",");a=/^(data|css):/;a={method:c[0].match(a)?c[0].split(":")[0]:"attr",property:c.shift().replace(a,"")};return RegExp(c.join("").replace(/^\s+|\s+$/g,""),"ig").test(jQuery(b)[a.method](a.property))};var checkAllByClass=function(b,c,a,d){b.attr("checked")?(a!="uncheck-only"&&$j("."+c).attr("checked",!0),d&&$j("."+c).attr("disabled",!0)):(a!="check-only"&&$j("."+c).attr({checked:!1}),d&&$j("."+c).attr("disabled",!1))},
toggle_id=function(b){b=document.getElementById(b);$j(b).toggle("blind")};jQuery(document).ready(function(){$j(".collapse_head").click(function(){$j(this).next(".collapse_body").slideToggle(600)})});var CookieCollapseToggle=function(b){b=readCookie(b);if(b!=null)for(var c=b.split("|"),b=0;b<c.length;b++)toggle_id(c[b])},setCookieCollapse=function(b,c){var a,d,e;a="";for(e=0;e<c.length;e++)d=document.getElementById(c[e]),d.style.display=="none"&&(a=a+"|"+c[e]);createCookie(b,a,7)};edge_alert=function(b){$j("#edge_warning_msg").html(b);
window.scrollTo(0,0);$j("#edge_warning").fadeIn("slow").delay(6E3).fadeOut("slow")};jQuery(document).ready(function(){var b="Unknown OS";navigator.appVersion.indexOf("Win")!=-1?b="Windows":navigator.appVersion.indexOf("Mac")!=-1&&(b="MacOS");jQuery(document).keydown(function(c){if(daJSON_HTKObject.Enabled==!0&&c.ctrlKey==!0&b=="MacOS"|c.ctrlKey==!0&c.altKey==!0&b=="Windows"){var a=String.fromCharCode(c.keyCode).toLowerCase(),d=daJSON_HTKObject.Save.value;a==d.toLowerCase()&&(c.preventDefault(),$j('input[value="Update Info"]:first').click());
d=daJSON_HTKObject.Cancel.value;a==d.toLowerCase()&&(c.preventDefault(),$j('input[value="Cancel"]:first').click());if(top.frames.Body){var d=daJSON_HTKObject.Reports.value,e=daJSON_HTKObject.Reports.href;if(a==d.toLowerCase()&&(c.preventDefault(),daJSON_HTKObject.ReportPriv==!0))daJSON_HTKObject.newWindow?window.open(e,"MReports"):top.frames.Body.location.href=e;d=daJSON_HTKObject.Messages.value;e=daJSON_HTKObject.Messages.href;a==d.toLowerCase()&&(c.preventDefault(),window.open(e,"Messaging","width=920, height=707,  scrollbars=yes, resizable=no, toolbar=yes"));
d=daJSON_HTKObject.Reminders.value;e=daJSON_HTKObject.Reminders.href;if(a==d.toLowerCase())c.preventDefault(),top.frames.Body.location.href=e;d=daJSON_HTKObject.Dashboard.value;e=daJSON_HTKObject.Dashboard.href;a==d.toLowerCase()&&(c.preventDefault(),window.open(e,"Dashboard","width=1000, height=800,  scrollbars=yes, resizable=yes, toolbar=yes"));d=daJSON_HTKObject.Calendar.value;e=daJSON_HTKObject.Calendar.href;if(a==d.toLowerCase())c.preventDefault(),daJSON_HTKObject.newWindow?window.open(e,"Calendar"):
top.frames.Body.location.href=e;d=daJSON_HTKObject.FNIndividual.value;e=daJSON_HTKObject.FNIndividual.href;if(a==d.toLowerCase())c.preventDefault(),top.frames.Body.location.href=e;d=daJSON_HTKObject.CaseNotes.value;e=daJSON_HTKObject.CaseNotes.href;if(a==d.toLowerCase())c.preventDefault(),daJSON_HTKObject.newWindow?window.open(e,"CaseNote"):top.frames.Body.location.href=e;d=daJSON_HTKObject.AddressBook.value;e=daJSON_HTKObject.AddressBook.href;if(a==d.toLowerCase())c.preventDefault(),daJSON_HTKObject.newWindow?
window.open(e,"AddressBook"):top.frames.Body.location.href=e;d=daJSON_HTKObject.Company.value;e=daJSON_HTKObject.Company.href;if(a==d.toLowerCase())c.preventDefault(),top.frames.Body.location.href=e;d=daJSON_HTKObject.Billing.value;e=daJSON_HTKObject.Billing.href;if(a==d.toLowerCase()&&(c.preventDefault(),daJSON_HTKObject.BillingPriv==!0))top.frames.Body.location.href=e;d=daJSON_HTKObject.Template.value;e=daJSON_HTKObject.Template.href;a==d.toLowerCase()&&(c.preventDefault(),daJSON_HTKObject.TemplatePriv==
!0&&window.open(e,"editdocumenttemplate","width=1000, height=800,  scrollbars=yes, resizable=yes, toolbar=yes"));d=daJSON_HTKObject.Logout.value;e=daJSON_HTKObject.Logout.href;if(a==d.toLowerCase())c.preventDefault(),top.location.href=e;d=daJSON_HTKObject.Admin.value;e=daJSON_HTKObject.Admin.href;if(a==d.toLowerCase()&&(c.preventDefault(),daJSON_HTKObject.AdminPriv==!0))top.frames.Body.location.href=e}}})});$j(function(){function b(c){var c=$j(c),a=parseInt(c.attr("maxlength")),b=c.val().length;c.parent().find(".charsRemaining").size()==
0&&c.after("<br><span class='charsRemaining' style='color:red; padding:1em 1em;'></span>");b>=a?(c.val(c.val().substr(0,a)),c.parent().find(".charsRemaining").html("You have 0 characters remaining, data may be truncated")):c.parent().find(".charsRemaining").html("You have "+(a-b)+" characters remaining")}$j(".datepicker").datepicker({showOn:"button",buttonImage:"/Extras/jquery-ui/css/"+jQueryUI_Theme+"/Images/calpick.png",buttonImageOnly:!0,showAnim:"fadeIn",changeMonth:!0,changeYear:!0,constrainInput:!1,
onClose:function(){$j(this).focus()},beforeShow:function(c,a){a.dpDiv.css({bottom:"auto",top:"auto",right:"auto",left:"auto"});var b=$j(c).offset();offsetNum=$j(document).height()-$j(c).height()-b.top;offsetNum<200&&setTimeout(function(){a.dpDiv.css({bottom:"0px",top:"auto"})},0);offsetNum=$j(document).width()-$j(c).width()-b.left;offsetNum<250&&setTimeout(function(){a.dpDiv.css({right:"0px",left:"auto"})},0);$j(c).is(":disabled")&&setTimeout(function(){a.dpDiv.css({left:"-1000px",right:"auto"})},
0)}});(function(){$j(".datepicker").bind("dblclick",function(){var b;b=new Date;var a=b.getDate(),d=b.getMonth()+1;b=b.getFullYear();$j(this).val(d.toString()+"/"+a.toString()+"/"+b.toString());$j(this).trigger("change")});$j(".datepicker").bind("blur",function(){var b=jQuery(this),a=$j(this).val();if(a.toLowerCase()=="t")var d=new Date,e=d.getMonth()+1,f=d.getDate(),d=d.getFullYear(),a=e+"/"+f+"/"+d;else a.substring(0,1)=="+"?(d=new Date,e=d.getMonth()+1,f=d.getDate(),d=d.getFullYear(),a=dateAdd("d",
a.substring(1),e+"/"+f+"/"+d),e=a.getMonth()+1,f=a.getDate(),d=a.getFullYear(),a=e+"/"+f+"/"+d):a.substring(0,1)=="-"&&(d=new Date,e=d.getMonth()+1,f=d.getDate(),d=d.getFullYear(),a=dateAdd("d",-parseInt(a.substring(1)),e+"/"+f+"/"+d),e=a.getMonth()+1,f=a.getDate(),d=a.getFullYear(),a=e+"/"+f+"/"+d);if(a!=""&a!="00/00/00"&a.toLowerCase()!="d/s"){e=!isNaN(new Date(a));a=a.replace(/-/g,"/");f=a.split("/");d=f[f.length-1];d.length==2&&f.length==3&&(d="20"+d,a=f[0]+"/"+f[1]+"/"+d,$j(this).val(a));if(d.length<
4||f.length<3)e=!1;else if(d=f[0],f=f[1],d>12||d<1||f>31||f<1)e=!1;e==!1&&(a="Invalid Date Format: "+a+"&nbsp;&nbsp;&nbsp;&nbsp;Date Format: MM/DD/YYYY or D/S<p></p><p></p>",$j("#datePickerError").remove(),document.getElementById("datePickerError")==null&&$j(this).after("<span id='datePickerError' style='color:red; padding:1em 1em;'>"+a+"</span>"),jQuery("#datePickerError").dialog({modal:!1,autoOpen:!0,title:"Invalid Date",minWidth:450,position:"top",close:function(){jQuery(":input:eq("+(jQuery(":input").index(b)+
1)+")").focus()},buttons:{Ok:function(){jQuery(this).dialog("close")}}}),setTimeout(function(){jQuery(":input:eq("+(jQuery(":input").index(b)+1)+")").focus();$j("#datePickerError").dialog("destroy")},5E3))}})})();$j(".countries").not(".ui-autocomplete-input").autocomplete({source:["UNITED STATES OF AMERICA","AFGHANISTAN","ALBANIA","ALGERIA","ANDORRA","ANGOLA","ANGUILLA","ANTIGUA AND BARBUDA","ARGENTINA","ARMENIA","ARUBA","AUSTRALIA","AUSTRIA","AZERBAIJAN","BAHAMAS","BAHRAIN","BANGLADESH","BARBADOS",
"BELARUS","BELGIUM","BELIZE","BENIN","BERMUDA","BHUTAN","BOLIVIA","BOSNIA AND HERZEGOVINA","BOTSWANA","BRAZIL","BRITISH VIRGIN ISLANDS","BRUNEI","BULGARIA","BURKINA FASO","BURMA (MYANMAR)","BURUNDI","CAMBODIA","CAMEROON","CANADA","CAPE VERDE","CAYMAN ISLANDS","CENTRAL AFRICAN REPUBLIC","CHAD","CHILE","CHINA","COLOMBIA","COMOROS","CONGO (BRAZZAVILLE)","CONGO (KINSHASA)","COSTA RICA","COTE D'IVOIRE","CROATIA","CUBA","CYPRUS","CZECH REPUBLIC","CZECHOSLOVAKIA","DENMARK","DEPENDANT TERRITORY","DJIBOUTI",
"DOMINICA","DOMINICAN REPUBLIC","EAST TIMOR","ECUADOR","EGYPT","EL SALVADOR","EQUATORIAL GUINEA","ERITREA","ESTONIA","ETHIOPIA","FIJI","FINLAND","FRANCE","FRENCH POLYNESIA","GABON","GAMBIA","GEORGIA","GERMANY","GHANA","GIBRALTAR","GREECE","GREENLAND","GRENADA","GUATEMALA","GUINEA","GUINEA-BISSAU","GUYANA","HAITI","HOLY SEE","HONDURAS","HONG KONG","HUNGARY","ICELAND","INDIA","INDONESIA","IRAN","IRAQ","IRELAND","ISRAEL","ITALY","IVORY COAST","JAMAICA","JAPAN","JORDAN","KAZAKHSTAN","KENYA","KIRIBATI",
"KOSOVO","KUWAIT","KYRGYZSTAN","LAOS","LATVIA","LEBANON","LESOTHO","LIBERIA","LIBYA","LIECHTENSTEIN","LITHUANIA","LUXEMBOURG","MACAU (SAR)","MACEDONIA","MADAGASCAR","MALAWI","MALAYSIA","MALDIVES","MALI","MALTA","MARSHALL ISLANDS","MAURITANIA","MAURITIUS","MEXICO","MICRONESIA","MOLDOVA","MONACO","MONGOLIA","MONTSERRAT","MONTENEGRO","MOROCCO","MOZAMBIQUE","NAMIBIA","NAURU","NEPAL","NETHERLANDS","NETHERLANDS ANTILLES","NEW ZEALAND","NICARAGUA","NIGER","NIGERIA","NIUE","NORTH KOREA","NORWAY","OMAN","PAKISTAN",
"PALAU","PALESTINE","PALESTINIAN TERRITORIES","PANAMA","PAPUA NEW GUINEA","PARAGUAY","PERU","PHILIPPINES","PITCAIRN ISLANDS","POLAND","PORTUGAL","QATAR","REPUBLIC OF CONGO","ROMANIA","RUSSIA","RWANDA","SAINT KITTS AND NEVIS","SAINT LUCIA","SAINT VINCENT AND THE GRENADINES","SAMOA","SAN MARINO","SAO TOME AND PRINCIPE","SAUDI ARABIA","SENEGAL","SERBIA","SEYCHELLES","SIERRA LEONE","SINGAPORE","SLOVAKIA","SLOVENIA","SOLOMON ISLANDS","SOMALIA","SOUTH AFRICA","SOUTH KOREA","SOVIET UNION","SPAIN","SRI LANKA",
"ST HELENA","STATELESS","SUDAN","SURINAME","SWAZILAND","SWEDEN","SWITZERLAND","SYRIA","TAIWAN","TAJIKISTAN","TANZANIA","THAILAND","TIMOR-LESTE","TOGO","TONGA","TRINIDAD AND TOBAGO","TUNISIA","TURKEY","TURKMENISTAN","TURKS AND CAICOS ISLANDS","TUVALU","UGANDA","UKRAINE","UNITED ARAB EMIRATES","UNITED KINGDOM","URUGUAY","UZBEKISTAN","VANUATU","VENEZUELA","VIETNAM","WESTERN SAMOA","YEMEN","YUGOSLAVIA","ZAMBIA","ZIMBABWE"]});$j(".jq-button").not(".ui-button").button();$j(".jq-buttonset").buttonset();
$j(document).ready(function(){$j("textarea[maxlength]").keyup(function(){b($j(this))});$j("textarea[maxlength]").blur(function(){b($j(this))});$j("textarea[maxlength]").blur()})});$j(document).ready(function(){$j(".drop").hover(function(){$j(this).children(".dropdown").addClass("display")},function(){$j(this).children(".dropdown").delay(500).removeClass("display")});$j(".display").hover(function(){$j(this).addClass("display")},function(){$j(this).delay(500).removeClass("display")});$j(".select").hover(function(){$j(this).addClass("ui-state-hover")},
function(){$j(this).removeClass("ui-state-hover")})});$j(document).ready(function(){simple_tooltip(".tool","tooltip")});var jQueryBlbTable=function(b,c){var a=jQuery("#"+b).find("tr:eq(1)"),d,e='<tfoot><tr><td colspan="'+jQuery("#"+b).find("tr")[1].cells.length+'" style="text-align:center">&nbsp;';e+='<input type="button" class="jq-button" id="'+b+'_add" value="&nbsp;Add Row&nbsp;">';e+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";e+='<input type="button" class="jq-button" id="'+b+'_delete" value="Delete Row">';
e+="</td></tr></tfoot>";jQuery(e).insertBefore("#"+b+" tbody");jQuery("#"+b+"_add").click(function(){var a=jQuery("#"+b).find("tr:last").clone(!0,!0);jQuery(":input",a).val("").removeAttr("checked").removeAttr("selected").attr("name",function(a,b){var c=b.split("_"),d=parseInt(c.pop());c.push(d+1+"");return c.join("_")});a.appendTo("#"+b+" tbody")});jQuery("#"+b+"_delete").click(function(){jQuery("#"+b+" tr:last").remove()});if(c)for(var e=jQuery.parseJSON(c),f=e.records.length,g=0;g<f;g++)d=g==0?
a:a.clone(),jQuery.each(e.records[g],function(a,b){d.find(':input[name="'+jQuerySanitize(a)+'"]').each(function(a,c){switch(c.type||c.tagName){case "radio":this.checked=c.value!=""&&b.toString()==c.value;break;case "checkbox":for(var d=b.constructor==Array?b:[b],e=0;e<d.length;e++)c.checked|=c.value==d[e];break;case "select-multiple":d=b.constructor==Array?b:[b];for(e=0;e<c.options.length;e++)for(var f=0;f<d.length;f++)c.options[e].selected|=c.options[e].value==d[f];break;case "select":case "select-one":c.value=
b.toString()||b;break;default:b=b==null?"":b,c.value=b}jQuery(c).attr("name",function(a,b){if(g>0){var c=b.split("_"),d=parseInt(c.pop());c.push(d+g+"");return c.join("_")}})})}),g==0?a=d:jQuery(d).appendTo("#"+b+" tbody")}}function stripNonPhoneChars(b){b=document.getElementById(b);if(b!=null)b.value=b.value.replace(/[^\d\(\)\-\+\s]/g,"")}function stripNonNumeric(b){b=document.getElementById(b);if(b!=null)b.value=b.value.replace(/[^\d]/g,"")};

