// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function prepareIE(height, overflow){
    var bod = document.getElementsByTagName('body')[0];
    bod.style.height = height;
    bod.style.overflow = overflow;

    var htm = document.getElementsByTagName('html')[0];
    htm.style.height = height;
    htm.style.overflow = overflow; 
}

/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cyanide_7 |  */
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}

function swapTreatmentDescription(step) {
	var text = "";
	switch(step) {
		case 1:
		  text = "A pre-emergent crabgrass application is applied combined with a regular fertilizer to boost the speed of growth in your lawn.";
		  break;    
		case 2:
		  text = "An Application of fertilizer with dimension crabgrass preventative is applied to your lawn.  This will boost the speed of growth and color with your lawn for the spring.";
		  break;
		case 3:
		  text = "A weed control is applied for present weeds.  An additional feed fertilizer accompanies.";
		  break;
		case 4:
		  text = "An application of slow release organic fertilizer is applied to ensure continued growth through the dry season.  Spot weeding is also applied for any present weeds and crabgrass";
		  break;
		case 5:
		  text = "A second application of organic fertilizer is applied to green up the lawn as the season embarks into the wet and cool part of the year.  Spot weeding applied to control any present weeds.";
		  break;
		case 6:
		  text = "A Third application of organic fertilizer is applied to green up the lawn as the season embarks into the wet and cool part of the year.";
		  break;
		case 7:
		  text = "A winterizer fertilizer is applied to prepare the lawn for another harsh New England winter.  This application helps provide nutrients to the roots of the grass as it enters its dormant stage.";
		  break;		
		default:
		  text = "Hover over the above rounds to view a description.";
	}
	$('application-description').innerHTML = '';
	$('application-description').innerHTML = text;
}
