  $(document).ready(function(){
    //alert(document.ads.countyno.value);
    // Set body styling according to county
    try {
      if (document.ads.countyno.value=="MN" || document.ads.countyno.value=="11" ) {
        document.getElementById("body").style.top="0";
        document.getElementById("body").style.left="0";
        document.getElementById("body").style.margin="0";
        document.getElementById("body").style.padding="0";
        document.getElementById("body").style.fontFamily="Verdana, Helvetica, 'sans-serif'";
      }
      else if (document.ads.countyno.value=="CC" || document.ads.countyno.value=="13" ) {
        document.getElementById("body").style.fontFamily="Arial, Helvetica, 'sans-serif'";
        document.getElementById("body").style.backgroundImage="url(/docs/CCBackground.gif)";
        document.getElementById("body").style.backgroundRepeat="repeat-x";
        document.getElementById("body").style.verticalAlign="top";
      }
      else if (document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ) {
		if ( document.ads.embedded.value!=1 ) {
			document.getElementById("body").style.fontFamily="Arial, Helvetica, 'sans-serif'";
			document.getElementById("body").style.backgroundImage="url(/docs/LABackground.bmp)";
			document.getElementById("body").style.backgroundRepeat="repeat-x";
			document.getElementById("body").style.verticalAlign="top";
		}
      }
      else {
        document.getElementById("body").style.fontFamily="Arial, Helvetica, 'sans-serif'";
      }
      switch(document.ads.countyno.value) {
        case 'EL':
        case '04':
          document.getElementById("body").style.backgroundColor="#141414";
          break;
        case 'EU':
        case '06':
          document.getElementById("body").style.backgroundColor="#FFFFEF";
          break;
        case 'HU':
        case '07':
          document.getElementById("body").style.backgroundColor="#ADAF5C";
          break;
        case 'LA':
        case '08':
		  if ( document.ads.embedded.value!=1 ) {
            document.getElementById("body").style.backgroundColor="#263713";
		  }
		  else {
		    document.getElementById("body").style.backgroundColor="white";
		  }
          break;
        case 'LI':
        case '09':
          document.getElementById("body").style.backgroundColor="#F3ECD9";
          break;
        case 'LY':
        case '10':
          document.getElementById("body").style.backgroundColor="#5A9694";
          break;
        case 'MN':
        case '11':
          document.getElementById("body").style.backgroundColor="#F4F3C7";
          break;
        case 'NY':
        case '12':
          document.getElementById("body").style.backgroundColor="#E9E0DB";
          break;
        case 'CC':
        case '13':
          document.getElementById("body").style.backgroundColor="#688FB2";
          break;
        case 'PE':
        case '14':
          document.getElementById("body").style.backgroundColor="white";
          break;
        case 'ST':
        case '15':
          document.getElementById("body").style.backgroundColor="#9C6563";
          break;
        default:
          document.getElementById("body").style.backgroundColor="white";
      }
    }
    catch(err) {}
    // Display white dot banner on Lander recorder search, regular banner on other pages
    // Display special banner arrangement for Mineral
    try {
      if ((document.ads.countyno.value=="LA" || document.ads.countyno.value=="08") && (document.ads.embedded.value==1)) {
        document.getElementById('adsbanner').innerHTML="<div class='labelc'><img src='/docs/LA_BannerDot.gif'></div>";
      }
      else if (document.ads.countyno.value=="MN" || document.ads.countyno.value=="11" ) {
        document.getElementById('adsbanner').innerHTML="<div class='banner'><div class='banner2'><img src='/docs/logo.png' /></div></div>";
      }
      else {
        document.getElementById('adsbanner').innerHTML="<div class='labelc'><img src='/docs/" + document.ads.banner.value + "'></div>";
      }
    }
    catch(err) {}
    // For Lander and Mineral, put Close Window button instead of Assessor Home button
    try {
      if (document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ||
          document.ads.countyno.value=="MN" || document.ads.countyno.value=="11" ) {
        document.getElementById('assessorhome').innerHTML="<input type=button value='Close Window' onClick='javascript:window.close();'>";
      }
      else {
        document.getElementById('assessorhome').innerHTML="<input type='button' name='CGIOption' value='Assessor Home' onClick='javascript:window.open(\"" + document.ads.home.value + "\",\"_self\");'>";
      }
    }
    catch(err) {}
    // For Lander and Mineral, put Close Window button instead of Treasurer Home button
    try {
      if (document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ||
          document.ads.countyno.value=="MN" || document.ads.countyno.value=="11" ) {
        document.getElementById('treasurerhome').innerHTML="<input type=button value='Close Window' onClick='javascript:window.close();'>";
      }
      else {
        document.getElementById('treasurerhome').innerHTML="<input type='button' name='CGIOption' value='Treasurer Home' onClick='javascript:window.open(\"" + document.ads.home.value + "\",\"_self\");'>";
      }
    }
    catch(err) {}
    // For Lander, put Close Window button instead of Recorder Home button, no button on search page
    // For Mineral, put Close Window button instead of Recorder Home button
    try {
      if (document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ) {
		if ( document.ads.embedded.value==0 ) {
		  document.getElementById('recorderhome').innerHTML="<input type=button value='Close Window' onClick='javascript:window.close();'>";
		}
      }
      else if (document.ads.countyno.value=="MN" || document.ads.countyno.value=="11" ) {
        document.getElementById('recorderhome').innerHTML="<input type=button value='Close Window' onClick='javascript:window.close();'>";
      }
      else {
        document.getElementById('recorderhome').innerHTML="<input type='button' name='CGIOption' value='Recorder Home' onClick='javascript:window.open(\"" + document.ads.home.value + "\",\"_self\");'>";
      }
    }
    catch(err) {}
    // In aswmenu, give access to plats for Nye or Lyon
    try {
      if (document.ads.countyno.value=="NY" || document.ads.countyno.value=="12") {
        document.getElementById('aswmenuplats').innerHTML="<input type='button' name='CGIOption' value='Assessor Plats' onClick='javascript:window.open(\"/cgi-bin/asw104\");'>";
      }
      if (document.ads.countyno.value=="LY" || document.ads.countyno.value=="10") {
        document.getElementById('aswmenuplats').innerHTML="<input type='button' name='CGIOption' value='Assessor Plats' onClick='javascript:window.open(\"/cgi-bin/aswbkpg\");'>";
      }
    }
    catch(err) {}
    // In asw100, choose Elko or other counties parcel boxes
    try {
      if (document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ) {
        document.getElementById('asw100parcels').innerHTML="<input type='text' name='srchpar1' size='11' maxlength='9' value='" + document.ads.srchpar1.value + "' onBlur='this.value=this.value.toUpperCase()'> - <input type='text' name='srchpar2' size='11' maxlength='9' value='" + document.ads.srchpar2.value + "' onBlur='this.value=this.value.toUpperCase()'>&nbsp;9 characters, no dashes";
      }
      else {
        document.getElementById('asw100parcels').innerHTML="<input type='text' name='srchpar1' size='11' maxlength='8' value='" + document.ads.srchpar1.value + "' onBlur='this.value=this.value.toUpperCase()'> - <input type='text' name='srchpar2' size='11' maxlength='8' value='" + document.ads.srchpar2.value + "' onBlur='this.value=this.value.toUpperCase()'>&nbsp;8-digit #(s), no dashes";
      }
    }
    catch(err) {}
    // In asw100, show tooltip on name box for County
    try {
      if (document.ads.countyno.value=="XX" || document.ads.countyno.value=="99" ) {
        document.getElementById('asw100name').innerHTML="<input type='text' name='srchname' size='30' maxlength='30' onMouseover='ddrivetip(\"Placing a % before the search name will give more results.\", 300)'; onMouseout='hideddrivetip()' value='" + document.ads.srchname.value + "'>";
      }
      else {
        document.getElementById('asw100name').innerHTML="<input type='text' name='srchname' size='30' maxlength='30' value='" + document.ads.srchname.value + "'>";
      }
    }
    catch(err) {}
    // In asw100, fill zone dropdown for Nye County
    try {
      if (document.ads.countyno.value=="NY" || document.ads.countyno.value=="12" ) {
        var zcode = new Array();
        zcode[0] = "All";
        zcode[1] = "RH-9.5";
        zcode[2] = "RH-4.5";
        zcode[3] = "RE-2";
        zcode[4] = "RE-1";
        zcode[5] = "SE";
        zcode[6] = "VR-20";
        zcode[7] = "VR-10";
        zcode[8] = "VR-8";
        zcode[9] = "MF";
        zcode[10] = "MH";
        zcode[11] = "NC";
        zcode[12] = "GC";
        zcode[13] = "CM";
        zcode[14] = "TC";
        zcode[15] = "CC";
        zcode[16] = "M";
        zcode[17] = "VC";
        zcode[18] = "BO";
        zcode[19] = "MU";
        zcode[20] = "LI";
        zcode[21] = "HI";
        zcode[22] = "OS";
        zcode[23] = "BR";
        zcode[24] = "OU";
        zcode[25] = "HF";
        zcode[26] = "R";
        zcode[27] = "CF";
        var ztext = new Array();
        ztext[0] = "All";
        ztext[1] = "RH-9.5 - RURAL HOMESTEAD RESIDENTIAL";
        ztext[2] = "RH-4.5 - RURAL HOMESTEAD RESIDENTIAL";
        ztext[3] = "RE-2 - RURAL ESTATES RESIDENTIAL";
        ztext[4] = "RE-1 - RURAL ESTATES RESIDENTIAL";
        ztext[5] = "SE - SUBURBAN ESTATES RESIDENTIAL";
        ztext[6] = "VR-20 - VILLAGE RESIDENTIAL";
        ztext[7] = "VR-10 - VILLAGE RESIDENTIAL";
        ztext[8] = "VR-8 - VILLAGE RESIDENTIAL";
        ztext[9] = "MF - MULTIFAMILY RESIDENTIAL";
        ztext[10] = "MH - MOBILE HOME PARK";
        ztext[11] = "NC - NEIGHBORHOOD COMMERCIAL";
        ztext[12] = "GC - GENERAL COMMERCIAL";
        ztext[13] = "CM - COMMERCIAL MANUFACTURING";
        ztext[14] = "TC - TOWN CENTER";
        ztext[15] = "CC - CALVADA COMMERCIAL";
        ztext[16] = "M - MEDICAL/MEDICAL SUPPORT";
        ztext[17] = "VC - VISITOR COMMERCIAL";
        ztext[18] = "BO - BUSINESS OPPORTUNITY OVERLAY";
        ztext[19] = "MU - MIXED USE";
        ztext[20] = "LI - LIGHT INDUSTRIAL";
        ztext[21] = "HI - HEAVY INDUSTRIAL";
        ztext[22] = "OS - OPEN SPACE, PARKS AND RECREATION";
        ztext[23] = "BR - BROTHEL";
        ztext[24] = "OU - OPEN USE DISTRICT";
        ztext[25] = "HF - HIGHWAY FRONTAGE DISTRICT";
        ztext[26] = "R - RESERVE";
        ztext[27] = "CF - COMMUNITY FACILITIES";
        var zoptions = "<select name='srchzone'>";
        for (i=0;i<ztext.length;i++) {
          zoptions = zoptions + "<option value=\"" + zcode[i] + "\" ";
          if (document.ads.srchzone.value == zcode[i])
            {
            zoptions = zoptions + "selected";
            }
          zoptions = zoptions + ">" + ztext[i] + "</option>";
        }
        zoptions = zoptions + "</select>";
        document.getElementById('zonejs').innerHTML=zoptions;
        //alert(zoptions);
      }
    }
    catch(err) {}
    // In asw100d, display button link to secured tax inquiry (regular or pay or none) based on county
    try {
      if (document.ads.countyno.value=="CH" || document.ads.countyno.value=="01" ||
          document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ||
          document.ads.countyno.value=="HU" || document.ads.countyno.value=="07" ||
          document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ||
          document.ads.countyno.value=="CC" || document.ads.countyno.value=="13" ) {
        document.getElementById('securedtaxinquiry').innerHTML="<input type='button' name='CGIOption' value='Secured Tax Inquiry' onClick='javascript:window.open(\"/cgi-bin/tcw100p?CGIOption=Detail&Parcel=" + document.ads.detlparno.value + "\");'>";
      }
      else if (document.ads.countyno.value=="PE" || document.ads.countyno.value=="14" ) {
        document.getElementById('securedtaxinquiry').innerHTML="<input type='button' value='Secured Tax Inquiry' disabled='disabled'>";
      }
      else {
        document.getElementById('securedtaxinquiry').innerHTML="<input type='button' name='CGIOption' value='Secured Tax Inquiry' onClick='javascript:window.open(\"/cgi-bin/tcw100?CGIOption=Detail&Parcel=" + document.ads.detlparno.value + "\");'>";
      }
    }
    catch(err) {}
    // In asw200d, display button link to unsecured tax inquiry (regular or pay or none) based on county
    try {
      if (document.ads.countyno.value=="CH" || document.ads.countyno.value=="01" ||
          document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ||
          document.ads.countyno.value=="HU" || document.ads.countyno.value=="07" ||
          document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ||
          document.ads.countyno.value=="CC" || document.ads.countyno.value=="13" ) {
        document.getElementById('unsecuredtaxinquiry').innerHTML="<input type='button' name='CGIOption' value='Unsecured Tax Inquiry' onClick='javascript:window.open(\"/cgi-bin/ppw5100p?CGIOption=Detail&Account=" + document.ads.detlactno.value + "\",\"_blank\");'>";
      }
      else if (document.ads.countyno.value=="PE" || document.ads.countyno.value=="14" ) {
        document.getElementById('unsecuredtaxinquiry').innerHTML="<input type='button' value='Unsecured Tax Inquiry' disabled='disabled'>";
      }
      else {
        document.getElementById('unsecuredtaxinquiry').innerHTML="<input type='button' name='CGIOption' value='Unsecured Tax Inquiry' onClick='javascript:window.open(\"/cgi-bin/ppw5100?CGIOption=Detail&Account=" + document.ads.detlactno.value + "\",\"_blank\");'>";
      }
    }
    catch(err) {}
    // In asw100d, display button for assessor maps based on county
    try {
      if (document.ads.countyno.value=="CH" || document.ads.countyno.value=="01" ||
          document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ||
          document.ads.countyno.value=="LY" || document.ads.countyno.value=="10" ||
          document.ads.countyno.value=="NY" || document.ads.countyno.value=="12" ) {
        $("#elassessormaps").hide();
        $("#peassessormaps").hide();
        $("#noassessormaps").hide();
      }
      else if (document.ads.countyno.value=="EL" || document.ads.countyno.value=="04") {
        $("#chlalynyassessormaps").hide();
        $("#peassessormaps").hide();
        $("#noassessormaps").hide();
      }
      else if (document.ads.countyno.value=="PE" || document.ads.countyno.value=="14") {
        $("#elassessormaps").hide();
        $("#chlalynyassessormaps").hide();
        $("#noassessormaps").hide();
      }
      else {
        $("#elassessormaps").hide();
        $("#peassessormaps").hide();
        $("#chlalynyassessormaps").hide();
      }
    }
    catch(err) {}
    // In asw100d and asw300d, display button for ag land in Lander
    try {
      if (document.ads.countyno.value!="LA" && document.ads.countyno.value!="08") {
        $("#agland").hide();
      }
    }
    catch(err) {}
    // In asw100d and asw300d, display button for sketches based on county
    try {
      if (document.ads.countyno.value!="LA" && document.ads.countyno.value!="08" &&
          document.ads.countyno.value!="NY" && document.ads.countyno.value!="12" ) {
        $("#isketches").hide();
        $("#asw300ddivider").hide();
      }
    }
    catch(err) {}
    // In asw100d and asw300d, display button for photos in Lander
    try {
      if (document.ads.countyno.value!="LA" && document.ads.countyno.value!="08" ) {
        $("#iphotos").hide();
      }
    }
    catch(err) {}
    // In asw100d, display button for recorder search or home page or none based on county
    try {
      if (document.ads.countyno.value=="HU" || document.ads.countyno.value=="07" ) {
        document.getElementById('recorderlink').innerHTML="<input type='button' name='CGIOption' value='Recorder Website' onClick='javascript:window.open(\"http://hcnv.us/recorder/recorder.htm\");'>";
      }
      else if (document.ads.countyno.value=="LA" || document.ads.countyno.value=="08" ) {
        document.getElementById('recorderlink').innerHTML="<input type='button' name='CGIOption' value='Recorder Website' onClick='javascript:window.open(\"http://www.landercountynv.org/recorder-office\");'>";
      }
      else if (document.ads.countyno.value=="NY" || document.ads.countyno.value=="12" ) {
        document.getElementById('recorderlink').innerHTML="<input type='button' name='CGIOption' value='Recorder Website' onClick='javascript:window.open(\"http://www.tylerworksasp.com/nyecounty/web/splash.jsp\");'>";
      }
      else if (document.ads.countyno.value=="PE" || document.ads.countyno.value=="14" ) {
        document.getElementById('recorderlink').innerHTML="<input type='button' name='CGIOption' value='Recorder Website' onClick='javascript:window.open(\"http://www.pershingcounty.net/recorderauditor.htm\");'>";
      }
      else {
        document.getElementById('recorderlink').innerHTML="<input type='button' name='CGIOption' value='Recorder Search' onClick='javascript:window.open(\"/cgi-bin/diw200?CGIOption=Search&srchsort=1&srespgs=50&sname=" + document.ads.ownaonamurl.value + "\");'>";
      }
    }
    catch(err) {}
    // in asw200, choose Elko or other counties parcel boxes
    try {
      if (document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ) {
        document.getElementById('asw200parcels').innerHTML="<input type='text' name='srchpar1' size='9' maxlength='9' value='" + document.ads.srchpar1.value + "' onBlur='this.value=this.value.toUpperCase()'> - <input type='text' name='srchpar2' size='9' maxlength='9' value='" + document.ads.srchpar2.value + "' onBlur='this.value=this.value.toUpperCase()'>&nbsp;9 characters, no dashes";
      }
      else {
        document.getElementById('asw200parcels').innerHTML="<input type='text' name='srchpar1' size='9' maxlength='8' value='" + document.ads.srchpar1.value + "' onBlur='this.value=this.value.toUpperCase()'> - <input type='text' name='srchpar2' size='9' maxlength='8' value='" + document.ads.srchpar2.value + "' onBlur='this.value=this.value.toUpperCase()'>&nbsp;8-digit #(s), no dashes";
      }
    }
    catch(err) {}
    // in asw300, choose Elko or other counties parcel boxes
    try {
      if (document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ) {
        document.getElementById('asw300parcels').innerHTML="<input type='text' name='srchpar1' size='10' maxlength='9' value='" + document.ads.srchpar1.value + "' onBlur='this.value=this.value.toUpperCase()'> - <input type='text' name='srchpar2' size='10' maxlength='9' value='" + document.ads.srchpar2.value + "' onBlur='this.value=this.value.toUpperCase()'>";
        document.getElementById('asw300parcdesc').innerHTML="(Parcel # is 9 letters/numbers)";
      }
      else {
        document.getElementById('asw300parcels').innerHTML="<input type='text' name='srchpar1' size='10' maxlength='8' value='" + document.ads.srchpar1.value + "'> - <input type='text' name='srchpar2' size='10' maxlength='8' value='" + document.ads.srchpar2.value + "'>";
        document.getElementById('asw300parcdesc').innerHTML="(Parcel # is 8 digits)";
      }
    }
    catch(err) {}
    // in tcw100pay, choose Elko or other counties parcel boxes
    try {
      if (document.ads.countyno.value=="EL" || document.ads.countyno.value=="04" ) {
        document.getElementById('tcw100payparcels').innerHTML="<input type='text' name='srchparc' size='9' maxlength='9' value='" + document.ads.srchparc.value + "' onBlur='this.value=this.value.toUpperCase()'> 9 characters, no dashes";
      }
      else {
        document.getElementById('tcw100payparcels').innerHTML="<input type='text' name='srchparc' size='9' maxlength='8' value='" + document.ads.srchparc.value + "'> 8 digits, no dashes";
      }
    }
    catch(err) {}
    // in tcw100 or tcw100pay, include instructions button based on county
    try {
      if (document.ads.countyno.value=="XX" || document.ads.countyno.value=="99" ) {
        document.getElementById('tcw100search').innerHTML="<input type='button' name='CGIOption' value='Instructions' onClick='javascript:window.open(\"/docs/tcw100i.htm\",\"_blank\");'><input type='submit' name='CGIOption' value='Search'>";
      }
      else {
        document.getElementById('tcw100search').innerHTML="<input type='submit' name='CGIOption' value='Search'>";
      }
    }
    catch(err) {}
  });

