
//this first function is for any sites that use Drop Downs from forms to link to stuff
function SelectLink(){
if (document.Links.Select.options[document.Links.Select.selectedIndex].value != "none")
          { document.location = document.Links.Select.options[document.Links.Select.selectedIndex].value}        
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_swapImgRestore() { //v3.0
  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_swapImage() { //v3.0
  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];}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  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_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function preload_Nav() {//v1.1
var d = document;
for(i=0;i<d.images.length; i++) {

var url = d.images[i].src;
var x = url.lastIndexOf('/') + 1;
var y = url.length;
var z = url.lastIndexOf('.');

var path = url.substring(0,x);
var fileName = url.substring(x,z);
var ext = url.substring(z,y);

if(d.images[i].name.indexOf('p') != "-1") {MM_preloadImages("" + path + fileName + "_o" + ext + "");}
}//end the for loop
}


function preLoaders() {
preload_Nav();
MM_preloadImages('/images/left_bg.gif','/images/right_bg.gif'); 
}

//the next 2 functions are used for the turf calculator
function calculateSquare() {
	var squareFeetSquare = (document.TurfCalculatorSquare.width.value * 
	document.TurfCalculatorSquare.length.value);
	var sodpieces = "0.38";
	var sodplugs = "0.36";
	var totalsodSquare = Math.round(squareFeetSquare * sodpieces);
	var totalplugsSquare = Math.round(squareFeetSquare * sodplugs);
	document.TurfCalculatorSquare.s_total_sq_ft.value = squareFeetSquare;
	document.TurfCalculatorSquare.s_pieces_of_sod.value = totalsodSquare;
	document.TurfCalculatorSquare.s_pieces_of_plugs.value = totalplugsSquare;
}
function clearValuesSquare() {
	document.TurfCalculatorSquare.width.value = "";
	document.TurfCalculatorSquare.length.value = "";
	document.TurfCalculatorSquare.s_total_sq_ft.value = "";
	document.TurfCalculatorSquare.s_pieces_of_sod.value = "";
	document.TurfCalculatorSquare.s_pieces_of_plugs.value = "";
}

//the next 2 functions are used for the turf calculator triangle
function calculateTriangle() {
	var squareFeetTriangle = (document.TurfCalculatorTriangle.base.value * 
	document.TurfCalculatorTriangle.height.value / 2);
	var sodpieces = "0.38";
	var sodplugs = "0.36";
	var totalsod_t = Math.round(squareFeetTriangle * sodpieces);
	var totalplugs_t = Math.round(squareFeetTriangle * sodplugs);
	document.TurfCalculatorTriangle.t_total_sq_ft.value = squareFeetTriangle;
	document.TurfCalculatorTriangle.t_pieces_of_sod.value = totalsod_t;
	document.TurfCalculatorTriangle.t_pieces_of_plugs.value = totalplugs_t;
}

function clearValuesTriangle() {
	document.TurfCalculatorTriangle.base.value = "";
	document.TurfCalculatorTriangle.height.value = "";
	document.TurfCalculatorTriangle.t_total_sq_ft.value = "";
	document.TurfCalculatorTriangle.t_pieces_of_sod.value = "";
	document.TurfCalculatorTriangle.t_pieces_of_plugs.value = "";
}

//the next 2 functions are used for the turf calculator circle
function calculateCircle() {
  //  var circleArea = (document.TurfCalculatorCircle.radius.value * document.TurfCalculatorCircle.radius.value);
	var squareFeetCircleLong = (Math.PI * Math.pow(document.TurfCalculatorCircle.radius.value,2) / 4);
	var squareFeetCircle = Math.round(squareFeetCircleLong);
	var sodpieces = "0.38";
	var sodplugs = "0.36";
	var totalsod_c = Math.round(squareFeetCircle * sodpieces);
	var totalplugs_c = Math.round(squareFeetCircle * sodplugs);
	document.TurfCalculatorCircle.c_total_sq_ft.value = squareFeetCircle;
	document.TurfCalculatorCircle.c_pieces_of_sod.value = totalsod_c;
	document.TurfCalculatorCircle.c_pieces_of_plugs.value = totalplugs_c;
}

function clearValuesCircle() {
	document.TurfCalculatorCircle.radius.value = "";
	document.TurfCalculatorCircle.c_total_sq_ft.value = "";
	document.TurfCalculatorCircle.c_pieces_of_sod.value = "";
	document.TurfCalculatorCircle.c_pieces_of_plugs.value = "";
}

//the next 2 functions are used for the plant calculator square
function calculateSquarePlants() {
	var squareFeetSquare = (document.PlantCalculatorSquare.width.value * 
	document.PlantCalculatorSquare.length.value);
	var plantspacingsmall = "1";
	var plantspacingmiddle = "1.25";
	var plantspacingwide = "1.34";
	var totalplantsSmall = Math.round(squareFeetSquare / plantspacingsmall);
	var totalplantsMiddle = Math.round(squareFeetSquare / plantspacingmiddle);
	var totalplantsWide = Math.round(squareFeetSquare / plantspacingwide);
	document.PlantCalculatorSquare.s_total_sq_ft.value = squareFeetSquare;
	document.PlantCalculatorSquare.s_small_dist_of_plants.value = totalplantsSmall;
	document.PlantCalculatorSquare.s_middle_dist_of_plants.value = totalplantsMiddle;
	document.PlantCalculatorSquare.s_wide_dist_of_plants.value = totalplantsWide;
}
function clearValuesSquarePlants() {
	document.PlantCalculatorSquare.width.value = "";
	document.PlantCalculatorSquare.length.value = "";
	document.PlantCalculatorSquare.s_total_sq_ft.value = "";
	document.PlantCalculatorSquare.s_small_dist_of_plants.value = "";
	document.PlantCalculatorSquare.s_middle_dist_of_plants.value = "";
	document.PlantCalculatorSquare.s_wide_dist_of_plants.value = "";
}

//the next 2 functions are used for the plant calculator triangle
function calculateTrianglePlants() {
	var squareFeetTriangle = (document.PlantCalculatorTriangle.base.value * 
	document.PlantCalculatorTriangle.height.value / 2);
	var plantspacingsmall_t = "1";
	var plantspacingmiddle_t = "1.25";
	var plantspacingwide_t = "1.34";
	var totalplantsSmall_t = Math.round(squareFeetTriangle / plantspacingsmall_t);
	var totalplantsMiddle_t = Math.round(squareFeetTriangle / plantspacingmiddle_t);
	var totalplantsWide_t = Math.round(squareFeetTriangle / plantspacingwide_t);
	document.PlantCalculatorTriangle.t_total_sq_ft.value = squareFeetTriangle;
	document.PlantCalculatorTriangle.t_small_dist_of_plants.value = totalplantsSmall_t;
	document.PlantCalculatorTriangle.t_middle_dist_of_plants.value = totalplantsMiddle_t;
	document.PlantCalculatorTriangle.t_wide_dist_of_plants.value = totalplantsWide_t;
}
function clearValuesTrianglePlants() {
	document.PlantCalculatorTriangle.width.value = "";
	document.PlantCalculatorTriangle.length.value = "";
	document.PlantCalculatorTriangle.t_total_sq_ft.value = "";
	document.PlantCalculatorTriangle.t_small_dist_of_plants.value = "";
	document.PlantCalculatorTriangle.t_middle_dist_of_plants.value = "";
	document.PlantCalculatorTriangle.t_wide_dist_of_plants.value = "";
}

//the next 2 functions are used for the plant calculator circle
function calculateCirclePlants() {
	var circleArea = (document.PlantCalculatorCircle.radius.value * document.PlantCalculatorCircle.radius.value);
	var squareFeetCircleLong = (Math.PI * Math.pow(document.PlantCalculatorCircle.radius.value,2) / 4);
	var squareFeetCircle = Math.round(squareFeetCircleLong);
	var plantspacingsmall_c = "1";
	var plantspacingmiddle_c = "1.25";
	var plantspacingwide_c = "1.34";
	var totalplantsSmall_c = Math.round(squareFeetCircle / plantspacingsmall_c);
	var totalplantsMiddle_c = Math.round(squareFeetCircle / plantspacingmiddle_c);
	var totalplantsWide_c = Math.round(squareFeetCircle / plantspacingwide_c);
	document.PlantCalculatorCircle.c_total_sq_ft.value = squareFeetCircle;
	document.PlantCalculatorCircle.c_small_dist_of_plants.value = totalplantsSmall_c;
	document.PlantCalculatorCircle.c_middle_dist_of_plants.value = totalplantsMiddle_c;
	document.PlantCalculatorCircle.c_wide_dist_of_plants.value = totalplantsWide_c;
}
function clearValuesCirclePlants() {
	document.PlantCalculatorCircle.radius.value = "";
	document.PlantCalculatorCircle.c_total_sq_ft.value = "";
	document.PlantCalculatorCircle.c_small_dist_of_plants.value = "";
	document.PlantCalculatorCircle.c_middle_dist_of_plants.value = "";
	document.PlantCalculatorCircle.c_wide_dist_of_plants.value = "";
}


