// populate some dropdowns dynamically

			// usage: populateCountry(document.landowners,???)
			function populateCounty(inForm,selected,arrid) {			    //alert("You made it, Rambo!");			    //alert(arrid);
				if (selected == "") {
    			    inForm.CountyID.options.length = 0;
					//eval("inForm.CountyID.options[0]=" + "new Option('Select County', '',true,true))";					inForm.CountyID.options[0]=new Option('Select County', '',true,true);
					return;
				}
	
				var selectedArray = eval("arr" + arrid + selected);				//alert ("arr" + arrid + selected);				//alert(selectedArray);
	
				while (selectedArray.length < inForm.CountyID.options.length) {
					inForm.CountyID.options[(inForm.CountyID.options.length - 1)] = null;
				}
	
				for (var i=0; i < selectedArray.length; i++) {
					eval("inForm.CountyID.options[i]=" + "new Option" + selectedArray[i]);
				}
			}


/*
//Set a yummy magic cookie!
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}


/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}


/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

// functions for playing movies in flash
var movieName = "flashmovie";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}
function playmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Play();
  }
}
function pausemovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).StopPlay();
  }
}
function stopmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Rewind();
  }
}



// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  // First make sure the movie's defined.
  if (typeof(theMovie) != "undefined") {
    // If it is, check how much of it is loaded.
    return theMovie.PercentLoaded() == 100;
  } else {
    // If the movie isn't defined, it's not loaded.
    return false;
  }
}

// Simple popup function
			function popUp(url,winName,w,h) {
			// If we don't want to use the winName (window name) variable, because
			// we want every image to open in the same popup window,
			// then set winName to a constant here...
			//winName = 'images';
			popit = window.open(url,winName,'toolbar=no,x=1,y=1,width=' + w + ',height=' + h + ',directories=no,status=no,scrollbars=no,menubar=no,resizable=no,location=no,titlebar=no');
			if (popit.opener == null) {
				popit.opener = self;
			}
			  // this brings the little popup window to the front, so that it doesn't get "lost"...
			popit.focus();
        }

// Checks to see if an email is valid
			function isValidEmail(email) {
			  if (email == '') {
			    checkEmailFormat = false;
			  }
			  else {
			    // This "validator" stinks...
			    //return (email.indexOf(".") > 2) && (email.indexOf("@") > 0);
			    // ...replace it with this one.
			    return /^[^@]+@[^.]+(\.[^.]+)+$/.test(email);
			  }
			}


// This is a helper function for the Image Thumbnail Viewer II above. (???)
// It allows for "pagination" of the thumbnails without refresh of the page.
<!--
var ThumbsDivCurrent = "Thumbs0";
var ThumbsLinkCurrent = "ThumbsLink0";


function showThumbs(ThumbsDiv,ThumbsLink) {

  var objThumbsDiv = ThumbsDiv;
  var objThumbsDivCurrent = ThumbsDivCurrent;
  var objThumbsLink = ThumbsLink;
  var objThumbsLinkCurrent = ThumbsLinkCurrent;

  collapse(objThumbsDivCurrent);
  hide(objThumbsDivCurrent);

  uncollapse(objThumbsDiv);
  show(objThumbsDiv);

  ThumbsDivCurrent = ThumbsDiv;
  
  if (ThumbsLink != ThumbsLinkCurrent) {
    setColor(objThumbsLink,'#cccccc');
    setColor(objThumbsLinkCurrent,'#E65A0F')
    ThumbsLinkCurrent = ThumbsLink;
  }
}


/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

var contractsymbol='- ' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='+ ' //HTML for expand symbol.


if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
for (i=0; i<rootobj.length; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var thestate=(ec=="expand")? "block" : "none"
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=thestate
inc++
}
revivestatus()
}


function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="block")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="block")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate



// Script to make sure only numbers can be /typed/ into a field.
// Use the onkeypress and onchange events to run this script:
//
//   onkeypress="return numbersonly(this, event)" onchange="return numbersonly(this, event)" 
//
//   to allow decimals, set the third parameter as true, e.g.
//
//   onkeypress="return numbersonly(this, event, true)" onchange="return numbersonly(this, event, true)" 
//
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly(myfield, e, dec) {
  var key;
  var keychar;

  if (window.event) {
    key = window.event.keyCode;
  }
  else if (e) {
    key = e.which;
  }
  else {
    return true;
  }
  keychar = String.fromCharCode(key);

  // control keys
  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) {
    return true;
  }
  // numbers
  else if ((("0123456789").indexOf(keychar) > -1)) {
   return true;
  }
  // decimal point jump
  else if (dec && (keychar == ".")) {
    //myfield.form.elements[dec].focus();
    return true;
  }
  else {
    return false;
  }
}
// Script to make sure only numbers can be /pasted/ into a field.
// Use the onblur and onkeyup events to run this script:
//
//   onblur="return numbersonly2(this, event)" onkeyup="return numbersonly2(this, event);"
//
//   to allow decimals, set the third parameter as true, e.g.
//
//   onblur="return numbersonly2(this, event, true)" onkeyup="return numbersonly2(this, event, true);"
//
// copyright 2006 Andrews Company, Inc.
// Based on numbersonly script by Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
function numbersonly2(myfield, e, dec) {
  if (isNav) {
    objString=eval("document." + myfield);
  }
  else if (isIE) {
    objString=eval("document.all." + myfield);
  }
  else if (isGecko) {
    // Don't know if this works
    objString=document.getElementById(myfield);
  }
  //alert(obj);
  if (objString.value == '') {
    //alert('myfield is blank');
    // do nothing!
    result = '';
  }
  else {
    a = objString.value;
    aLen = a.length;// - 1;
    result = '';
    for(i=0; i<aLen; i++) {
      b = a.charAt(i);
      if ((("0123456789").indexOf(b) > -1)) {
        result = result + b
      }
      else if (dec && (b == ".")) {
        result = result + b
      }
      else {
        // do nothing
      }
    }
    //alert(result);
    objString.value = result;
  }
}