/*----------------------------------------------------
File Name: func.js
Date Created: 01 August 2004

Purpose: Commonly used functinos will be found here.
----------------------------------------------------*/

/*-------------------------------------------
Globals & Macros
-------------------------------------------*/


/*-------------------------------------------
Function: dwr
Parameters: strText = text and html to write
Return: void
Purpose: quick way to access document.write()
--------------------------------------------*/
function dwr(strText)
{
	document.write(strText);
}


/*-----------------------------------------------------
Function: redirect
Parameters: url, waitms
Return:	void
Purpose: Redirect a page in X ms.
-----------------------------------------------------*/
function redirect(url, waitms)
{
	var myInterval = setInterval("wGo('"+ url +"')", waitms);
}
function wGo(url)
{
	window.location.href = url;
}


/*-----------------------------------------------------
Function: wOpen
Parameters: url, name
Return:	void
Purpose: open small window for admin controlls
-----------------------------------------------------*/
function wOpen(url, name)
{
	window.open(url, name, "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=640, height=480, top=50, left=50");
}


/*-----------------------------------------------------
Function: verifyForm01
Parameters: void
Return:	boolean (whether or not to pass the submitted data to the server)
Purpose: check form for errors on the contact form
-----------------------------------------------------*/
function verifyForm01()
{
	var bValid = false;
	var strInvalid = "";
	var formObjects = new Array("firstName",
				    "lastName",
				    "address1",
				    "city",
				    "email",
				    "zipCode",
				    "phone",
				    "request"
				   );
	var nObjCount = formObjects.length;

	for(var i=0;i<nObjCount;i++)
	{
		if(document.getElementById(formObjects[i]).value == "")
			strInvalid += (i+1) + ". " + formObjects[i] + "\n";
	}

	if(strInvalid.length == 0)
		bValid = true;

	if(!bValid)
	{
		strInvalid = "The following items must be filled out:\n\n" + strInvalid;
		alert(strInvalid);
	}

	return bValid;
}
