﻿StringBuilder=function(){this.str=new Array()};StringBuilder.prototype={append:function(x){this.str.push(x)},toString:function(){return this.str.join('')},clear:function(){this.str.length=0}};var xv={loaded:false,oObj:new Object(),oCls:'',filter:function(id){var obj=new Object();for(var i=0;obj=data.leftSide[i];++i){if(obj.id==id)break};if(obj){var str=new StringBuilder();xv.term.options.length=0;for(var i=0,o=new Object();o=obj.data[i];++i){xv.term.options.add(new Option(o.name,o.id));if(i<1)id=o.id};this.show(id)}else this.err('State '+id)},show:function(id){var obj=new Object();for(var i=0;obj=data.rightSide[i];++i){if(obj.id==id)break};if(obj){var str=new StringBuilder();for(var i=0;id=obj.data[i];++i)str.append('<tr class="'+(i&1?'termAlt':'term')+'"><td><div class="lenderNumber">'+(i+1)+'</div></td><td><div class="lenderName">'+id+'</div></td></tr>');this.output.innerHTML='<table border="0" cellpadding="0" cellspacing="0">'+str.toString()+'</table>';str.clear()}else this.err('Term '+id)},err:function(x){alert('No matching '+x+' ID found.\r\nPlease contact LoanSifter to correct this problem.\r\nThank you.')},init:function(){if(!xv.loaded){xv.state=document.getElementById('ddlState');xv.term=document.getElementById('ddlTerm');xv.output=document.getElementById('output');xv.state.onchange=function(){xv.filter(this.options[this.selectedIndex].value)};xv.term.onchange=function(){xv.show(this.options[this.selectedIndex].value)};xv.loaded=true};xv.state.options.length=0;xv.term.options.length=0;for(var i=0,obj=new Object();obj=data.state[i];++i)xv.state.options.add(new Option(obj.name,obj.id));if(xv.state.options.length>0){xv.state.selectedIndex=2;xv.filter(xv.state.options[2].value)}}};function loadJS(url){var e=document.createElement("script");e.setAttribute("type","text/javascript");e.setAttribute("src",url);document.getElementsByTagName("head")[0].appendChild(e)};window.onload=function(){CallServer('');window.setInterval("CallServer('')",600000)};function CallBack(arg){if(arg!='-1')loadJS(arg)}