//Compactado usando o site: http://www.focalizaisso.com.br/compactador-de-js-e-css/

function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
var inpstr="";var currlength=0;var startrun=true;var addedpart="";var currfocus="";function enterautofill(tbidstr){if(lastopen!=tbidstr+"DIV"){hidelastopen();}}
function filter(idstr,nextfieldid,optArray,e){if(optArray!=null){var tb=document.getElementById(idstr);var sel=document.getElementById(idstr+"SEL");var sellayer=document.getElementById(idstr+"DIV");var kcode;if(!e)var e=window.event;if(e.keyCode)kcode=e.keyCode;else if(e.which)kcode=e.which;if(kcode==13){sellayer.style.display="none";addedpart="";tb.selectionStart=0;tb.selectionEnd=0;if(nextfieldid!="ADDOSTATE"&&nextfieldid!="ADDDSTATE"&&nextfieldid!="LOADCITIES"){if(nextfieldid!=""&&kcode!=9){if(document.getElementById(nextfieldid)){document.getElementById(nextfieldid).focus();}}}else{if(nextfieldid=="LOADCITIES"){currfocus=idstr.substring(0,1);loadcities(tb.value);}
if(nextfieldid=="ADDOSTATE"){addstate("O");}
if(nextfieldid=="ADDDSTATE"){addstate("D");}}
return false;}
if(kcode==8){if(addedpart!=""){addedpart="";startrun=true;return;}}
if(kcode==38){if(sel.selectedIndex>0){sel.options[sel.selectedIndex-1].selected=true;tb.value=sel.options[sel.selectedIndex].text;}
sel.focus();return;}
if(kcode==40){sellayer.style.display="inline";lastopen=sellayer.id;if(sel.selectedIndex<sel.options.length-1){sel.options[sel.selectedIndex+1].selected=true;tb.value=sel.options[sel.selectedIndex].text;}
sel.focus();return;}
if((kcode>=55&&kcode<=90)||(kcode>=97&&kcode<=122)||kcode==8){if(startrun==true){var l,opt;var strFilter=tb.value.toLowerCase();if(strFilter.length>0){if(sellayer.style.display!="inline"){showlayer(idstr+"DIV");}
pos=strFilter.indexOf(addedpart.toLowerCase());if(pos!=-1){}}
var intLength=strFilter.length;var selOptions=sel.options;selOptions.length=0;var firstmatch=true;for(var i=0;i<optArray.length;i++){l=optArray[i].toLowerCase();if(l.indexOf(strFilter)==0){if(idstr!="OCIT"&&idstr!="DCIT"){opt=new Option(optArray[i],optArray[i]);selOptions.add(opt);}else{if(strFilter.length>0){opt=new Option(optArray[i],optArray[i]);selOptions.add(opt);}}
if(firstmatch==true&&intLength>0){if(opt!=null){opt.selected=true;}
tb.value=optArray[i];var s=new String();s=optArray[i];addedpart=s.substring(intLength,s.length);if(document.selection){var rNew=tb.createTextRange();rNew.moveStart("character",intLength);rNew.select();}else{tb.selectionStart=intLength;tb.selectionEnd=s.length;}
firstmatch=false;}}}
if(selOptions.length>1){sellayer.style.display="inline";}else{sellayer.style.display="none";}
startrun=false;}else{startrun=true;}}else{return false;}
return true;}else{}}
function fillselect(selid,optArray){sel=document.getElementById(selid);for(var i=0;i<optArray.length;i++){opt=new Option(optArray[i],optArray[i]);sel.options.add(opt);}}
var currCityArray;function loadcities(st){window.status="LOADING "+st;var head=document.getElementsByTagName("head").item(0);var scriptTag=document.getElementById("CityScript_"+st);if(!scriptTag){document.getElementById(currfocus+"CIT").disabled=true;document.getElementById(currfocus+"CIT").value="loading...";script=document.createElement("script");script.src="CityList.aspx?ST="+st;script.type="text/javascript";script.id="CityScript_"+st;head.appendChild(script);}else{loadedCities(st);}}
function checkforload(tbidstr){if(lastopen==tbidstr+"DIV"){hidelastopen();}
if(document.getElementById(tbidstr).value.length==2){var scriptTag=document.getElementById("CityScript_"+document.getElementById(tbidstr).value);if(!scriptTag){currfocus=tbidstr.substring(0,1);loadcities(document.getElementById(tbidstr).value);}}}
function loadedCities(st){currCityArray=eval("optCities_"+st);document.getElementById(currfocus+"CIT").disabled=false;document.getElementById(currfocus+"CIT").value="";document.getElementById(currfocus+"CIT").focus();}
var lastopen="";function showlayer(lid){if(lid!=lastopen){hidelastopen();if(document.getElementById(lid).style.display=="none"){if(lid.indexOf("O")==0){}
if(lid.indexOf("D")==0){}
if(lid.indexOf("eoptgr")==0){var eid=lid.charAt(lid.length-1,lid.length);switch(eid){case"5":document.getElementById("LTYP").style.visibility="hidden";document.getElementById("LLIM").style.visibility="hidden";break;case"1":case"2":case"6":case"7":if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="hidden";}
document.getElementById("AGE").style.visibility="hidden";document.getElementById("LLIM").style.visibility="hidden";if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="hidden";}
break;case"3":case"8":document.getElementById("AGE").style.visibility="hidden";if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="hidden";}
if(document.getElementById("PS")){document.getElementById("PS").style.visibility="hidden";}
if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="hidden";}
break;case"4":case"9":if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="hidden";}
if(document.getElementById("PS")){document.getElementById("PS").style.visibility="hidden";}
if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="hidden";}
break;}}
document.getElementById(lid).style.display="inline";lastopen=lid;}}else{hidelastopen();}}
function hidelastopen(){if(lastopen!="")
{document.getElementById(lastopen).style.display="none";if(lastopen.indexOf("O")==0){}
if(lastopen.indexOf("D")==0){}
if(lastopen.indexOf("eoptgr")==0){var eid=lastopen.charAt(lastopen.length-1,lastopen.length);switch(eid){case"5":document.getElementById("LTYP").style.visibility="visible";document.getElementById("LLIM").style.visibility="visible";break;case"1":case"2":case"6":case"7":if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="visible";}
document.getElementById("AGE").style.visibility="visible";document.getElementById("LLIM").style.visibility="visible";if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="visible";}
break;case"3":case"8":document.getElementById("AGE").style.visibility="visible";if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="visible";}
if(document.getElementById("PS")){document.getElementById("PS").style.visibility="visible";}
if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="visible";}
break;case"4":case"9":if(document.getElementById("WLIM")){document.getElementById("WLIM").style.visibility="visible";}
if(document.getElementById("PS")){document.getElementById("PS").style.visibility="visible";}
if(document.getElementById("SOPT")){document.getElementById("SOPT").style.visibility="visible";}
break;}}
lastopen="";}
else
{}}
function noenter(e){var kcode;if(!e)var e=window.event;if(e.keyCode)kcode=e.keyCode;else if(e.which)kcode=e.which;return!(e&&(kcode==13||kcode==9));}
function focuson(nextfieldid){if(nextfieldid!="undefined"&&nextfieldid!=""){document.getElmentById(nextfieldid).focus();}}
function sorton(sid){document.location.href=urlstr+"&SOPT="+sid;}
function addstate(osign){hidelastopen();var field=document.getElementById(osign+"STATEBOX");var hidd=document.getElementById(osign+"STATE");var sp=document.getElementById(osign+"STATELIST");if(field.value!=""){var newstr="";if(hidd.value!=""){newstr=hidd.value}
var fstr="";for(y=0;y<field.value.length;y++){if(field.value.charAt(y)!=" "){fstr+=field.value.charAt(y);}}
var splarr=fstr.split(",");var curarr=hidd.value.split(",");for(x=0;x<splarr.length;x++){if(splarr[x]!=""&&splarr[x].length==2){notin=false;for(y=0;y<curarr.length;y++){if(splarr[x].toUpperCase()==curarr[y].toUpperCase()){notin=true;}}
if(notin==false){foundstate=false;for(u=0;u<statesArray.length;u++){if(splarr[x].toUpperCase()==statesArray[u]){foundstate=true;break;}}
if(foundstate==true){if(newstr!=""){newstr+=","+splarr[x].toUpperCase();}else{newstr+=splarr[x].toUpperCase();}}}}}
hidd.value=newstr;var finstr=newstr;var curarr=finstr.split(",");if(curarr.length>14){finstr="<span title='"+newstr+"'>"+curarr.length+" states selected</span>";}
sp.innerHTML=finstr;field.value="";}}
function clearstates(osign){var hidd=document.getElementById(osign+"STATE");var tb=document.getElementById(osign+"STATEBOX");var sp=document.getElementById(osign+"STATELIST");if(hidd.value==""){hidd.value="";sp.innerHTML="None";tb.value="";}else{hidd.value="";sp.innerHTML="None";}}
var mapDialog=new Object;function choosestate(idstr,cmode){if(document.selection){if(document.getElementById(idstr+"STATE")!=null){var ststr=document.getElementById(idstr+"STATE").value;ststr=ststr.replace("ANYWHERE","");mapDialog.selectedstates=ststr;}
mapDialog.selectedcity="";if(cmode=="3"){result=showModalDialog("MapSelect.aspx?MODE="+cmode,mapDialog,"dialogHeight:490px;dialogWidth:780px;edge:sunken;help:no;status:no;")}else{result=showModalDialog("MapSelect.aspx?MODE="+cmode,mapDialog,"dialogHeight:490px;dialogWidth:650px;edge:sunken;help:no;status:no;")}
if(result==false)
return;else{if(mapDialog.selectedstates!=""){if(document.getElementById(idstr+"CITST")!=null){document.getElementById(idstr+"CITST").value=mapDialog.selectedstates;}else{if(document.getElementById(idstr+"STATELIST")!=null){var finstr=mapDialog.selectedstates;var curarr=finstr.split(",");if(curarr.length>14){finstr="<span title='"+mapDialog.selectedstates+"'>"+curarr.length+" states selected</span>";}
document.getElementById(idstr+"STATELIST").innerHTML=finstr;}
if(document.getElementById(idstr+"STATEBOX")){document.getElementById(idstr+"STATEBOX").value=mapDialog.selectedstates;}
document.getElementById(idstr+"STATE").value=mapDialog.selectedstates;}}else{if(document.getElementById(idstr+"STATELIST")!=null){document.getElementById(idstr+"STATELIST").innerHTML="None";}
document.getElementById(idstr+"STATE").value="";}}}else{if(document.getElementById(idstr+"STATE")!=null){calendar_window=window.open("MapSelect.aspx?MODE="+cmode+"&FID="+idstr+"&SELST="+document.getElementById(idstr+"STATE").value,"map_window","width=780,height=490");}else{calendar_window=window.open("MapSelect.aspx?MODE="+cmode+"&FID="+idstr+"&SELST=","map_window","width=650,height=490");}
calendar_window.focus();}}
function refreshstates(idstr){if(document.getElementById(idstr+"STATE")!=null){if(document.getElementById(idstr+"STATE").value!=""){if(document.getElementById(idstr+"STATELIST")!=null){var finstr=document.getElementById(idstr+"STATE").value;var curarr=finstr.split(",");if(curarr.length>14){finstr="<span title='"+mapDialog.selectedstates+"'>"+curarr.length+" states selected</span>";}
document.getElementById(idstr+"STATELIST").innerHTML=finstr;}
if(document.getElementById(idstr+"STATEBOX")){document.getElementById(idstr+"STATEBOX").value=document.getElementById(idstr+"STATE").value;}}}}
function selectegroup(id){if(document.getElementById('EOPTM'+id))
{if(document.getElementById('EOPTM'+id).checked==false)
{document.getElementById("showall").checked=false;}
var groupdiv=document.getElementById('eoptgroup'+id);if(groupdiv.childNodes&&groupdiv.childNodes.length>0){var iCount=groupdiv.childNodes.length;var iCountChk=0;for(i=0;i<iCount;i++){if(groupdiv.childNodes[i].type=="checkbox"){groupdiv.childNodes[i].checked=document.getElementById('EOPTM'+id).checked;}}}
checkifall();updateeoptcount(id);}}
function checkifall(){var allchecked=true;for(i=1;i<10;i++){if(document.getElementById("EOPTM"+i)){if(document.getElementById("EOPTM"+i).checked==false){allchecked=false;}}}
document.getElementById("showall").checked=allchecked;}
function updateeoptcount(id){if(document.getElementById('eoptgroup'+id)){var groupdiv=document.getElementById('eoptgroup'+id);var countdiv=document.getElementById('eoptcount'+id);var checkedcount=0;var allcount=0;if(groupdiv.childNodes&&groupdiv.childNodes.length>0){var iCount=groupdiv.childNodes.length;var iCountChk=0;for(i=0;i<iCount;i++){if(groupdiv.childNodes[i].type=="checkbox"){iCountChk++;if(groupdiv.childNodes[i].checked){checkedcount++;}
allcount++;}}
if(iCountChk>0){if(checkedcount>0){countdiv.innerHTML="("+checkedcount+"/"+allcount+") ";document.getElementById('EOPTM'+id).checked=true;}else{countdiv.innerHTML="";document.getElementById('EOPTM'+id).checked=false;}}}}}
function selectallegroups(chb){for(i=1;i<10;i++){if(document.getElementById('eoptcount'+i)){var checkedcount=0;var allcount=0;var countdiv=document.getElementById('eoptcount'+i);document.getElementById("EOPTM"+i).checked=chb.checked;var groupdiv=document.getElementById('eoptgroup'+i);if(groupdiv.childNodes&&groupdiv.childNodes.length>0){var iCount=groupdiv.childNodes.length;var iCountChk=0;for(u=0;u<iCount;u++){if(groupdiv.childNodes[u].type=="checkbox"){groupdiv.childNodes[u].checked=chb.checked;if(chb.checked){checkedcount++;}
allcount++;}}}
if(checkedcount>0){countdiv.innerHTML="("+checkedcount+"/"+allcount+") ";}else{countdiv.innerHTML="";}}}}
lastX=-1;lastY=-1;resultwidth=570;resultheight=270;rspeed=2;function initloaddetail(){setloaddetail();window.onresize=setloaddetail;adjustdetail();}
function setloaddetail(){resX=Math.round((document.body.offsetWidth-20)/2)-Math.round(resultwidth/2);resY=5;}
NS6=false;IE4=(document.all);if(!IE4){NS6=(document.getElementById);}
NS4=(document.layers);function adjustdetail(){if(document.getElementById("resultdetails")){if((NS4)||(NS6)){if(lastX==-1||rspeed==0)
{lastX=window.pageXOffset+resX;lastY=window.pageYOffset+resY;}
else
{var dx=Math.abs(window.pageXOffset+resX-lastX);var dy=Math.abs(window.pageYOffset+resY-lastY);var d=Math.sqrt(dx*dx+dy*dy);var c=Math.round(d/10);if(window.pageXOffset+resX>lastX){lastX=lastX+rspeed+c;}
if(window.pageXOffset+resX<lastX){lastX=lastX-rspeed-c;}
if(window.pageYOffset+resY>lastY){lastY=lastY+rspeed+c;}
if(window.pageYOffset+resY<lastY){lastY=lastY-rspeed-c;}}
if(NS4){document.layers["resultdetails"].pageX=lastX;document.layers["resultdetails"].pageY=lastY;}
if(NS6){document.getElementById("resultdetails").style.left=lastX;document.getElementById("resultdetails").style.top=lastY;}}
else if(IE4){if(lastX==-1||rspeed==0)
{lastX=document.body.scrollLeft+resX;lastY=document.body.scrollTop+resY;}
else
{var dx=Math.abs(document.body.scrollLeft+resX-lastX);var dy=Math.abs(document.body.scrollTop+resY-lastY);var d=Math.sqrt(dx*dx+dy*dy);var c=Math.round(d/10);if(document.body.scrollLeft+resX>lastX){lastX=lastX+rspeed+c;}
if(document.body.scrollLeft+resX<lastX){lastX=lastX-rspeed-c;}
if(document.body.scrollTop+resY>lastY){lastY=lastY+rspeed+c;}
if(document.body.scrollTop+resY<lastY){lastY=lastY-rspeed-c;}}
document.all["resultdetails"].style.posLeft=lastX;document.all["resultdetails"].style.posTop=lastY;}
setTimeout("adjustdetail()",40);}}
var currentloadid;var currentcompanyid;var currselclass="";var currrow=null;function selectrow(e,sid,r){var tagn=""
if(e.srcElement){tagn=e.srcElement.tagName.toString();}else{tagn=e.target.tagName;}
if(tagn=="TD"){chooserow(sid,r);}}
function chooserow(sid,r){var ldiv=document.getElementById("resultdetails");if(sid!=currentloadid){if(currselclass!=""){lrow.className=currselclass;}
if(r){if(r.className=="rover"){currselclass=currclass;}else{currselclass=r.className;}
lrow=r;r.className="r3"}
if(document.getElementById("searchpanel")){document.getElementById("searchpanel").style.display="none";}
if(document.getElementById("loadresult")){document.getElementById("loadresult").style.display="none";}
if(document.getElementById("truckresult")){document.getElementById("truckresult").style.display="none";}
document.getElementById("loadmail").style.display="none";document.getElementById("sendingmaillabel").style.display="none";document.getElementById("companyresult").style.display="none";document.getElementById("otherinfo").style.display="none";document.getElementById("notesresult").style.display="none";document.getElementById("accessdenied").style.display="none";if(document.getElementById("factorcredit")){document.getElementById("factorcredit").style.display="none";}
document.getElementById("loadlabel").style.display="inline";if(ldiv.visibility!="visible"){if(document.getElementById("smode")){document.getElementById("smode").style.display="none";}
ldiv.style.visibility="visible";}
currentloadid=sid;loadresult(sid);}else{r.className=currselclass;hidedetail();}}
function selectnextrow(){if(lrow.nextSibling){currclass=lrow.nextSibling.className;var idstr=lrow.nextSibling.id;idstr=idstr.substring(1,idstr.length);chooserow(idstr,lrow.nextSibling);}}
function selectpreviousrow(){if(lrow.previousSibling){currclass=lrow.previousSibling.className;var idstr=lrow.previousSibling.id;idstr=idstr.substring(1,idstr.length);chooserow(idstr,lrow.previousSibling);}}
function settabsback(){if(document.getElementById("loadresult")){document.getElementById("loadresult").style.display="none";document.getElementById("loadlink").className="";}
if(document.getElementById("truckresult")){document.getElementById("truckresult").style.display="none";document.getElementById("trucklink").className="";}
document.getElementById("companylink").className="";if(document.getElementById("otherlink")){document.getElementById("otherinfo").style.display="none";document.getElementById("otherlink").className="";}
if(document.getElementById("factorcredit")){document.getElementById("factorcredit").style.display="none";document.getElementById("factorlink").className="";}
if(document.getElementById("noteslink")){document.getElementById("noteslink").className="";}
if(document.getElementById("telltablink")){document.getElementById("telltablink").className="";}
if(document.getElementById("inquirytablink")){document.getElementById("inquirytablink").className="";}
document.getElementById("loadmail").style.display="none";document.getElementById("sendingmaillabel").style.display="none";document.getElementById("companyresult").style.display="none";document.getElementById("notesresult").style.display="none";document.getElementById("accessdenied").style.display="none";}
function showotherinfo(){settabsback();document.getElementById("otherlink").className="activetab";document.getElementById("otherinfo").style.display="inline";}
function showfactorinfo(){settabsback();document.getElementById("factorlink").className="activetab";document.getElementById("factorcredit").style.display="inline";}
function shownotesform(){settabsback();document.getElementById("noteslink").className="activetab";document.getElementById("notesresult").style.display="inline";}
function showNA(){settabsback();document.getElementById("accessdenied").style.display="inline";}
function showrow(sid){settabsback();if(document.getElementById("favsearchdd")){document.getElementById("favsearchdd").style.display="none";}
if(document.getElementById("flagdd")){document.getElementById("flagdd").style.display="none";}
if(document.getElementById("UpperMenu:AutoRefresh")){document.getElementById("UpperMenu:AutoRefresh").style.display="none";}
document.getElementById("loadlabel").style.display="none";if(document.getElementById("loadresult")){document.getElementById("loadlink").className="activetab";document.getElementById("loadresult").style.display="inline";}
if(document.getElementById("truckresult")){document.getElementById("trucklink").className="activetab";document.getElementById("truckresult").style.display="inline";}}
function selectcompany(selid){settabsback()
sid=selid+"";var ldiv=document.getElementById("resultdetails");if(document.getElementById("searchpanel")){document.getElementById("searchpanel").style.display="none";}
document.getElementById("companylink").className="activetab";document.getElementById("companyresult").style.display="none";document.getElementById("loadlabel").style.display="inline";if(ldiv.visibility!="visible"){if(document.getElementById("smode")){document.getElementById("smode").style.display="none";}
ldiv.style.visibility="visible";}
currentcompanyid=sid;loadcompanyresult(sid);}
function showpreviousload(){if(currentloadid!=""){var tid=currentloadid;currentloadid="";currentcompanyid=0;chooserow(tid,lrow);}else{hidedetail();}}
function loadcompanyresult(lid){var head=document.getElementsByTagName("head").item(0);var scriptTag=document.getElementById("CompanyScript_"+lid);if(scriptTag){head.removeChild(scriptTag);}
script=document.createElement("script");script.src="SingleCompany.aspx?CID="+lid;script.type="text/javascript";script.id="CompanyScript_"+lid;head.appendChild(script);}
function showcompany(){document.getElementById("loadlabel").style.display="none";if(document.getElementById("loadresult")){document.getElementById("loadresult").style.display="none";}
if(document.getElementById("truckresult")){document.getElementById("truckresult").style.display="none";}
document.getElementById("companyresult").style.display="inline";}
function showinquirymailform(){cmailmode="inq";settabsback();document.getElementById("inquirytablink").className="activetab";document.getElementById("maildesc2").style.display="none";document.getElementById("maildesc1").style.display="inline";document.getElementById("loadmail").style.display="inline";document.getElementById("sendingmaillabel").style.display="none";document.getElementById("emailrecfield").style.display="none";document.getElementById("emailnotes").value="";document.getElementById("emailname").focus();}
function showtellafriendmailform(){cmailmode="tf";settabsback();document.getElementById("telltablink").className="activetab";document.getElementById("maildesc1").style.display="none";document.getElementById("maildesc2").style.display="inline";document.getElementById("loadmail").style.display="inline";document.getElementById("sendingmaillabel").style.display="none";document.getElementById("emailrecfield").style.display="inline";document.getElementById("emailnotes").value="";document.getElementById("emailrec").focus();}
function hidemailform(){document.getElementById("companyresult").style.display="none";document.getElementById("loadmail").style.display="none";document.getElementById("sendingmaillabel").style.display="none";if(document.getElementById("loadresult")){document.getElementById("loadresult").style.display="inline";}
if(document.getElementById("truckresult")){document.getElementById("truckresult").style.display="inline";}}
function savecompanynotes(){var st=document.getElementById("cnotes").value;while(st.indexOf('\r')!=-1){st=st.replace("\r","|");}
var head=document.getElementsByTagName("head").item(0);var scriptTag=document.getElementById("SNOTE");if(scriptTag){head.removeChild(scriptTag);}
script=document.createElement("script");script.src="SaveCompanyNotes.aspx?CID="+currentcompanyid+"&CN="+st;script.type="text/javascript";script.id="SNOTE";head.appendChild(script);}
function clearcompanynotes(){document.getElementById("cnotes").value=" ";}
var currclass="";function overrow(r){if(r.className!="r3"){currclass=r.className;r.className="rover";}}
function outrow(r){if(r.className!="r3"){r.className=currclass;}}
var lrow=null;function hidedetail(){if(lrow){lrow.className=currselclass;}
currentloadid="";currentcompanyid=0;if(document.getElementById("favsearchdd")){document.getElementById("favsearchdd").style.display="inline";}
if(document.getElementById("flagdd")){document.getElementById("flagdd").style.display="inline";}
if(document.getElementById("UpperMenu:AutoRefresh")){document.getElementById("UpperMenu:AutoRefresh").style.display="inline";}
document.getElementById("quickmenu").style.display="inline";var ldivc=document.getElementById("resultdetails");ldivc.style.visibility="hidden";if(document.getElementById("smode")){document.getElementById("smode").style.display="inline";}}
function setfield(fname,fvalue){if(document.getElementById(fname)){document.getElementById(fname).innerHTML=fvalue;}else{alert(fname);}}
function switchpanel(){var doit=false;if(!window.event){doit=true;}else{if(window.event.srcElement.tagName!="A"){doit=true;}}
if(doit){if(document.getElementById("equipdetails")){document.getElementById("equipdetails").style.display="none";}
if(document.getElementById("searchpanel").style.display=="none"){hidedetail();document.getElementById("searchpanel").style.display="inline";}else{document.getElementById("searchpanel").style.display="none";}}}
var currinp="";function showstateinp(typeid){document.getElementById(typeid+"selmode").style.display="none";document.getElementById(typeid+"stateseldiv").style.display="inline";}
function showcityinp(typeid){document.getElementById(typeid+"selmode").style.display="none";document.getElementById(typeid+"citysel").style.display="inline";}
function showselinp(typeid,ctype){document.getElementById(typeid+"citysel").style.display="none";document.getElementById(typeid+"stateseldiv").style.display="none";document.getElementById(typeid+"selmode").style.display="inline";}
function choosedate(){if(document.selection){if(document.getElementById("SDATE")){mapDialog.SelectedDate=document.getElementById("SDATE").value;}else{mapDialog.SelectedDate=document.getElementById("PDATE").value;}
result=showModalDialog("ChooseDateFS.aspx",mapDialog,"dialogHeight:280px;dialogWidth:230px;edge:sunken;help:no;status:no;")
if(result==false)
return;else{if(document.getElementById("SDATE")){document.getElementById("SDATE").value=mapDialog.SelectedDate;}else{document.getElementById("PDATE").value=mapDialog.SelectedDate;}}}else{calendar_window=window.open("ChooseDateFS.aspx","calendar_window","width=230,height=280");calendar_window.focus();}}
function checksubmit(){if(document.getElementById("OSTATEBOX")!=null){addstate("O");}
if(document.getElementById("DSTATEBOX")!=null){addstate("D");}
var isok=true;if(document.getElementById("OSTATE")!=null){if(document.getElementById("OSTATE").value.length==0){alert("ERROR : Please use State abbreviations only. (Ex. FL,GA,...)");if(document.getElementById("OSTATEBOX")!=null){document.getElementById("OSTATEBOX").focus();}else{document.getElementById("OSTATE").focus();}
return false;}}
if(document.getElementById("DSTATE")!=null){if(document.getElementById("DSTATE").value.length==0){alert("ERROR : Please use State abbreviations only. (Ex. FL,GA,...)");if(document.getElementById("DSTATEBOX")!=null){document.getElementById("DSTATEBOX").focus();}else{document.getElementById("DSTATE").focus();}
return false;}}
if(document.getElementById("OCITST")!=null){if(document.getElementById("OCITST").value.length==0){alert("Please enter the state of the origin city!");document.getElementById("OCITST").focus();return false;}}
if(document.getElementById("OCIT")!=null){if(document.getElementById("OCIT").value.length==0){alert("Please enter the origin city!");document.getElementById("OCIT").focus();return false;}}
if(document.getElementById("OCITR")!=null){if(document.getElementById("OCITR").value.length==0||isNaN(document.getElementById("OCITR").value)==true){alert("Please enter radius in miles from the origin city!");document.getElementById("OCITR").focus();return false;}else{if(document.getElementById("OCITR").value<30||document.getElementById("OCITR").value>500){alert("Please enter a radius in miles higher than 30 and lower than 500 miles !");document.getElementById("OCITR").focus();return false;}}}
if(document.getElementById("DCITST")!=null){if(document.getElementById("DCITST").value.length==0){alert("Please enter the state of the destination city!");document.getElementById("DCITST").focus();return false;}}
if(document.getElementById("DCIT")!=null){if(document.getElementById("DCIT").value.length==0){alert("Please enter the destination city!");document.getElementById("DCIT").focus();return false;}}
if(document.getElementById("DCITR")!=null){if(document.getElementById("DCITR").value.length==0||isNaN(document.getElementById("DCITR").value)==true){alert("Please enter radius in miles from the destination city!");document.getElementById("DCITR").focus();return false;}else{if(document.getElementById("DCITR").value<30||document.getElementById("DCITR").value>500){alert("Please enter a radius in miles higher than 30 and lower than 500 miles !");document.getElementById("DCITR").focus();return false;}}}
if(document.getElementById("EOPTM1").checked==false&&document.getElementById("EOPTM2").checked==false&&document.getElementById("EOPTM3").checked==false&&document.getElementById("EOPTM4").checked==false&&document.getElementById("EOPTM5").checked==false&&document.getElementById("EOPTM7").checked==false&&document.getElementById("EOPTM8").checked==false&&document.getElementById("EOPTM9").checked==false){alert("Please select at least one equipment type !");return false;}
if(document.getElementById("SDATE")){if(document.getElementById("SDATE").value.length>0){if(isValidDate(document.getElementById("SDATE").value)==false){alert("Please enter a valid date in the format MM/DD/YY !");document.getElementById("SDATE").focus();return false;}}}else{if(document.getElementById("PDATE")){if(document.getElementById("PDATE").value.length>0){if(isValidDate(document.getElementById("PDATE").value)==false){alert("Please enter a valid date in the format MM/DD/YY !");document.getElementById("PDATE").focus();return false;}}}}
if(document.getElementById("LENGTH")!=null){if(document.getElementById("LENGTH").value!=""){if(isNaN(document.getElementById("LENGTH").value)==true){alert("Please enter a number for the Length limitation !");document.getElementById("LENGTH").focus();return false;}else{if(document.getElementById("LENGTH").value<1||document.getElementById("LENGTH").value>100){alert("The length limitation needs to be between 1 and 99 !");document.getElementById("LENGTH").focus();return false;}}}}
if(document.getElementById("WEIGHT")!=null){if(document.getElementById("WEIGHT").value!=""){var val=document.getElementById("WEIGHT").value;val=val.replace(",","");if(isNaN(val)==true){alert("Please enter a number for the Weight limitation !");document.getElementById("WEIGHT").focus();return false;}else{if(val<1||val>99999){alert("The Weight limitation needs to be between 1 and 99,999 !");document.getElementById("WEIGHT").focus();return false;}}}}
return isok;}
function isValidDate(dateStr){if(dateStr==""){return true;}else{var datePat=/^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;var matchArray=dateStr.match(datePat);if(matchArray==null){return false;}
month=matchArray[1];day=matchArray[3];year=matchArray[4];if(month<1||month>12){return false;}
if(day<1||day>31){return false;}
if((month==4||month==6||month==9||month==11)&&day==31){return false;}
if(month==2){var isleap=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap)){return false;}}
return true;}}
var testresults;function checkemail(str){var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(filter.test(str))
testresults=true;else{testresults=false;}
return(testresults);}
function openlegend(pag){legendwin=window.open(pag,"legend_window","width=500,height=550,left=10,top=10,menubar=no,toolbar=no,scrollbars=yes,resizable=no");}
function openpopuplessons(){var popurl="/online/lessons/";winpops=window.open(popurl,"","width=825,height=675,scrollbars,");}
function openCRpopup(){legendwin=window.open("/online/resources/credit_popup.asp","creditwindow","width=500,height=550,left=10,top=10,menubar=no,toolbar=no,scrollbars=yes,resizable=no");}
function toggleAll(itemname,state)
{tmp=document.getElementsByTagName("div");for(i=0;i<tmp.length;i++)
{if(tmp[i].className==itemname)tmp[i].style.display=state;}}
function toggle(idname)
{document.getElementById(idname).style.display=(document.getElementById(idname).style.display=="none")?"block":"none";}
var sall=false;function select_deselectAll(chkVal,idVal)
{var frm=document.forms[0];for(i=0;i<frm.length;i++)
{if(frm.elements[i].id.indexOf("CLID_")!=-1){if(sall==false)
{frm.elements[i].checked=true;}
else
{frm.elements[i].checked=false;}
checkRow(frm.elements[i]);}}
sall=!sall;}
function checkRow(chkb){if(chkb.checked){chkb.parentNode.parentNode.style.backgroundColor="#EEA81C";}else{chkb.parentNode.parentNode.style.backgroundColor="";}}
function changeflag(im,lid,fid){if(fid==undefined){fid=-1;}
var urlstr=im.src;urlstr=urlstr.replace("http://62.178.155.213/truckloads/","");urlstr=urlstr.replace("http://www.123loadboard.com/","");if(urlstr.indexOf("0")>-1&&fid==-1){fid=1;}
if(urlstr.indexOf("1")>-1&&fid==-1){fid=2;}
if(urlstr.indexOf("2")>-1&&fid==-1){fid=3;}
if(urlstr.indexOf("3")>-1&&fid==-1){fid=4;}
if(urlstr.indexOf("4")>-1&&fid==-1){fid=5;}
if(urlstr.indexOf("5")>-1&&fid==-1){fid=0;}
im.src="../assets/images/search/flag"+fid+".gif";var cname;if(stype=="Loads"){cname="flagstr";}else{cname="flagtstr";}
var fstr=readCookie(cname);if(fstr==null){fstr=lid+"-"+fid;createCookie(cname,fstr,10);}else{var alr=false;var ca=fstr.split('|');var sp;var fnstr="";for(var i=0;i<ca.length;i++)
{if(ca[i].length>0){sp=ca[i].split("-");if(sp[0]==lid){alr=true;sp[1]=fid;if(fid!=0){fnstr+=sp[0]+"-"+sp[1]+"|";}}else{fnstr+=sp[0]+"-"+sp[1]+"|";}}}
if(alr==false){fnstr+=lid+"-"+fid+"|";}
createCookie(cname,fnstr,10);}}
function setflags(){var frm=document.forms[0];var chc=0;for(i=0;i<frm.length;i++)
{if(frm.elements[i].id.indexOf("CLID_")!=-1){if(frm.elements[i].checked==true)
{var lid=frm.elements[i].id;lid=lid.replace("CLID_","");changeflag(document.getElementById("CFLID_"+lid),lid,document.getElementById("flagdd").value);chc+=1;}}}
document.getElementById("flagdd").value="";if(chc==0){alert("You need to select at least one row with the checkboxes to change their flags.");}}
function clearflags(){var cname;if(stype=="Loads"){cname="flagstr";}else{cname="flagtstr";}
eraseCookie(cname);for(var i=0;i<document.images.length;i++)
{if(document.images[i].src.indexOf("flag")>-1){document.images[i].src="../assets/images/search/flag0.gif";}}}
function createCookie(name,value,days)
{if(days)
{var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}
else var expires="";document.cookie=name+"="+value+expires+"; path=/";}
function readCookie(name)
{var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++)
{var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;}
function eraseCookie(name)
{createCookie(name,"",-1);}
function toggleresultdisplay(){if(document.getElementById("resultlist")){if(document.getElementById("resultlist").style.overflow==""){document.getElementById("resultlist").style.overflow="auto";document.getElementById("resultlist").style.height="320px";createCookie("resultdisplay","bars",100);}else{document.getElementById("resultlist").style.overflow="";document.getElementById("resultlist").style.height="";eraseCookie("resultdisplay");}}}
var redirectid;function setautoredirect(timeo,tid){redirectid=tid;setTimeout("doredirect()",timeo);}
function doredirect(){document.location.href=redstr+"&REF="+redirectid;}