function populateManager(){this.getUrlVars=function(e){var d=[],c;var a=e.split("&");for(var b=0;b<a.length;b++){c=a[b].split("=");d.push(c[0]);d[c[0]]=c[1]}return d};this.GETVars=new Array();this.populateFields=function(a,b){for(i=0;i<a.length;i++){if(this.GETVars[a[i]]!=null){var c=unescape(this.GETVars[a[i]]);jQuery("#"+b+"_R1_"+a[i]).val((a[i]!="ORRMiddleName")?c:c.substring(0,1))}}};this.populateRows=function(f,m,d,e,k,b,l,g,p,h,c){if(typeof f!="undefined"){var o=f.split(",");var a=(typeof m!="undefined")?m.split(","):new Array(o.length);var n=(typeof d!="undefined")?d.split(","):new Array(o.length);for(var j=0;j<o.length;j++){if(o[j]!=""){rowId=e+"_R"+(j+1)+"_";if(jQuery("#"+rowId+k+":hidden").length>0){ShowTableRow()}jQuery("#"+rowId+k).val(unescape(o[j]));PopulateCountyDDL(rowId);jQuery("#"+rowId+b).val(unescape(a[j]).replace("'",""));if(jQuery("#"+rowId+l).val()==""){jQuery("#"+rowId+l).val(unescape(n[j]))}else{n[j]=jQuery("#"+rowId+l).val()}if(n[j]!=""){if(n[j]=="civil"){jQuery("#"+rowId+g).attr(p,h)}else{if(n[j]=="criminal"){jQuery("#"+rowId+g).attr(p,c)}else{if(n[j]=="all"){jQuery("#"+rowId+g).attr(p,h+c)}}}}ProcessItem(rowId)}}}DisplayOrderTotal()};this.makeTailStr=function(h,k,a){var g="";jQuery.each(h,function(){g+="&"+this+"="+jQuery("#"+k+"_R1_"+this).val();return g});var d="";var j="";var b="";var c="";var e;for(var f=0;f<5;f++){e=a+"_R"+(f+1)+"_";if(jQuery("#"+e+"ORRState").val()!=""){c=f<4?",":"";d+=jQuery("#"+e+"ORRState").val()+c;j+=jQuery("#"+e+"ORRCounty").val()+c;b+=jQuery("#"+e+"ORRSearchType").val()+c}}return g+((d!="")?"&states="+d:"")+((j!="")?"&counties="+j:"")+((b!="")?"&searchTypes="+b:"")}}function formLoader(b){var a=b;this.loadForm=function(){jQuery.get(a,function(c){var d=document.createElement("DIV");d.innerHTML=c;jQuery(".orrForm").append(d.getElementsByTagName("form")[0]);formState.onFormLoaded()})}}var formPopulate=new function(){var b=null;var c=new populateManager();var a;this.init=function(d){a=d;if(document.getElementById(a.linkId)!=null){a.nonEzUrl=document.getElementById(a.linkId).href;b=new formLoader(a.nonEzUrl);document.getElementById(a.linkId).href="javascript:void(0);";jQuery("#"+a.linkId).click(formPopulate.loadForm)}};this.queryStringPopulate=function(){c.GETVars=c.getUrlVars(window.location.href.slice(window.location.href.indexOf("?")+1));c.populateFields(a.fields,a.formName);c.populateRows(c.GETVars.states,c.GETVars.counties,c.GETVars.searchTypes,a.linkedFormName,a.stateCtrlName,a.countyCtrlName,a.typeCtrlName,a.rowInfoCtrlName,a.itemPriceAttrName,a.civilPrice,a.crimPrice)};this.loadForm=function(){c.GETVars=c.getUrlVars(c.makeTailStr(a.fields,a.formName,a.linkedFormName));jQuery("#"+a.formName).remove();formState.onLoadStarted();b.loadForm()};this.formPopulate=function(){a.formName=document.forms[0].id;c.populateFields(a.fields,a.formName);c.populateRows(c.GETVars.states,c.GETVars.counties,c.GETVars.searchTypes,a.linkedFormName,a.stateCtrlName,a.countyCtrlName,a.typeCtrlName,a.rowInfoCtrlName,a.itemPriceAttrName,a.civilPrice,a.crimPrice)}};var formState=new function(){this.onFormLoaded=function(){formPopulate.formPopulate();jQuery("#loadingDiv").remove()};this.onLoadStarted=function(){jQuery(".orrForm").append(jQuery("<div></div>").attr("style","text-align:center;").attr("id","loadingDiv"));jQuery("#loadingDiv").append(jQuery("<img />").attr("src","waf/images/loading.gif").attr("id","loading"))}};
