// JavaScript Document
window.defaultStatus = "Welcome to Winandy Greenhouse Company, makers of Sun-Mate\u00AE Greenhouses.";

var thumbnailWindow;
function showImage(linkTarget)	{
	thumbnailWindow = window.open(linkTarget, "thumbnailInfo", "toolbar = no,menubar = no, location = no, scrollbar = no, resizeable = no, width = 650, height = 650");
	thumbnailWindow.focus();
}

//thumbnail swaps
var revert = new Array();
var thumbnails = new Array('thumbnail1','thumbnail2','thumbnail3','thumbnail4','thumbnail5','thumbnail6','thumbnail7','thumbnail8','thumbnail9','thumbnail10');

if (document.images) {
  var flipped = new Array();
  for(i=0; i< thumbnails.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = "images/gallery/thumbnails/"+thumbnails[i]+"b.jpg";
  }
}

function swapThumb(num) {
  if(document.images) {
    revert[num] = document.images[thumbnails[num]].src;
    document.images[thumbnails[num]].src = flipped[num].src;
  }
}
function replaceThumb(num) {
  if(document.images) document.images[thumbnails[num]].src = revert[num];
}
//end thumbnail swaps




//navbar



startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

//end navbar

function displayRow(id)	{
var row2 = id;
var row1 = "ext" + row2.charAt(0);
var row = document.getElementById(row1);
	if (id == row2.charAt(0) + "yes")	{
	row.style.display = "block";
	}
	else if (id == row2.charAt(0) + "no")	{
	row.style.display = "none";
	}
	else {
	row.style.display = "none";
	}
}

//accessory image rolls

function roll(id)	{
var alt = id.slice(1);
document.getElementById(alt + ("1")).src = "images/accessories/" + alt + id.slice(0,1) + ".jpg";

}

//validation

function submitForm() {
	if (document.forms[0].name_contact.value == "")	{
		window.alert("Please enter a contact name.");
		document.forms[0].name_contact.focus();
		return false;
	}
	else if (document.forms[0].firm_name.value == "")	{
		window.alert("Please enter a firm name.");
		document.forms[0].firm_name.focus();
		return false;
	}
	else if (document.forms[0].firm_address.value == "")	{
		window.alert("Please enter a firm address.");
		document.forms[0].firm_address.focus();
		return false;
	}
	else if (document.forms[0].firm_city.value == "")	{
		window.alert("Please enter a firm city.");
		document.forms[0].firm_city.focus();
		return false;
	}
	else if (document.forms[0].firm_state.value == "")	{
		window.alert("Please enter a firm state.");
		document.forms[0].firm_state.focus();
		return false;
	}
	else if (document.forms[0].firm_zip.value == "")	{
		window.alert("Please enter a firm zip code.");
		document.forms[0].firm_zip.focus();
		return false;
	}
	return true;
}
	