﻿// JScript File
<!--

nMaxItem = 4;
NameIndex = 0;
OriginalState = 1;
MouseOverState = 2;
MouseClickState = 3;
MouseDownState = 4;
imgCounter = 0;

ImageList = new Array();

function AddImageToList(name, Original, MouseOver, MouseClick, MouseDown)
{
	ImageList[imgCounter] = new Array(nMaxItem);
	ImageList[imgCounter][NameIndex] = name;
	ImageList[imgCounter][OriginalState] = new Image();

	ImageList[imgCounter][OriginalState].src = Original;
	
	if (MouseOver != "")
	{
		ImageList[imgCounter][MouseOverState] = new Image();
		ImageList[imgCounter][MouseOverState].src = MouseOver;
	}
	if (MouseClick != "")
	{
		ImageList[imgCounter][MouseClickState] = new Image();
		ImageList[imgCounter][MouseClickState].src = MouseClick;
	}
	if (MouseDown != "")
	{
		ImageList[imgCounter][MouseDownState] = new Image();
		ImageList[imgCounter][MouseDownState].src = MouseDown;
	}

	imgCounter++;
}

function ReplaceImage(nameFrom, nameTo, state)
{
	for (i = 0; i < imgCounter; i++)
	{
		if (document.images[ImageList[i][NameIndex]] != null)
		{
			if ((nameFrom == ImageList[i][NameIndex]) && (ImageList[i][state] != null))
				document.images[nameTo].src = ImageList[i][state].src;
		}
	}
}

// --------------------------------------------------------------------------------

AddImageToList("M1", "images/btn-home.gif", "images/on-home.gif", "", "");
AddImageToList("M2", "images/btn-puppies.gif", "images/on-puppies.gif", "", "");
AddImageToList("M3", "images/btn-males.gif", "images/on-males.gif", "", "");
AddImageToList("M4", "images/btn-females.gif", "images/on-females.gif", "", "");
AddImageToList("M5", "images/btn-gallery.gif", "images/on-gallery.gif", "", "");
AddImageToList("M6", "images/btn-goldens.gif", "images/on-goldens.gif", "", "");

//-->
m = "Waiting List Request";

function CreateEmail() {
    // the following expression must be all on one line...
	u = "Name: " + document.eMailer.ContactName.value + " \n\n";
	u= u + "Address: " + document.eMailer.ContactAddress.value + " \n\n";
	u= u + "City: " + document.eMailer.ContactCity.value + " \n\n";
	u= u + "State: " + document.eMailer.ContactState.value + " \n\n";
	u= u + "Zip: " + document.eMailer.ContactZip.value + " \n\n";
	u= u + "Email: " + document.eMailer.EmailAddress.value + " \n\n";
	u= u + "Phone Number: " + document.eMailer.Telephone.value + " \n\n";
	u= u + "Price: " + document.eMailer.Price.value + " \n\n";
	u= u + "Short Description: " + document.eMailer.ShortDescription.value + " \n\n";
	u= u + "Description: " + document.eMailer.Description.value + " \n\n";
    window.location = "mailto:contact@buyoutwest.com?subject="+m+"&body="+u;
  }

//----------//
function validate(){
var invalid = " "; // Invalid character is a space

if (document.submitform.ContactName.value.length<1) {
	alert("The Name cannot be empty");
	return false;
}
if (document.submitform.ContactAddress.value.length<1) {
	alert("The Address cannot be empty");
	return false;
}
if (document.submitform.ContactCity.value.length<1) {
	alert("The City cannot be empty");
	return false;
}
if (document.submitform.ContactState.value.length<1) {
	alert("The State cannot be empty");
	return false;
}
if (document.submitform.ContactZip.value.length<1) {
	alert("The Zip cannot be empty");
	return false;
}

if (document.submitform.EmailAddress.value.search("@") == -1 || document.submitform.EmailAddress.value.search("[.*]") == -1){
	alert("The Email is not valid.");
	return false;

}

if (document.submitform.Telephone.value.length<1) {
	alert("The Telephone cannot be empty");
	return false;
}

if (document.submitform.CellPhone.value.length<1) {
	alert("The Cell Phone cannot be empty");
	return false;
}
if (document.submitform.Price.value.length<1) {
	alert("The Price cannot be empty");
	return false;
}
if (document.submitform.Shipping.value.length<1) {
	alert("The Shipping cannot be empty");
	return false;
}
if (document.submitform.ShortDescription.value.length<1) {
	alert("The Short Description cannot be empty");
	return false;
}
if (document.submitform.Description.value.length<1) {
	alert("The Description cannot be empty");
	return false;
}

//all fields are not null
myWindow = window.open("thankyou.htm");
return true;
}


