var img = new Array ();

function Images (org, swap)
{
	if (document.images)
	{
	   this.org = new Image();
	   this.org.src = org;
	   this.swap = new Image();
	   this.swap.src = swap;
	}
}
	
function Add (iid,dir)
{
	img[iid] = new Images("images/"+dir+iid+".gif", "images/"+dir+iid+"_on.gif");
}
	
function Swap(iid,imgsrc)
	{
		/*if ( document.images[iid].src != img[iid].org.src)
			document.images[iid].src = img[iid].org.src;
		else document.images[iid].src = img[iid].swap.src;*/
		document.getElementById(iid).src = imgsrc;
	}
	
function validate_phone(phone)
{
		if ( !phone.match(/^[(]?\d{3}[)]?[ -]?\d{3}[ -]?\d{4}$/) )
			return false;
		return true;
}

function validate_zipcode(zip)
{
	if ( !zip.match(/^\d{5}$|^\d{5}-\d{4}$/) )
		return false;
	return true;
}

function validate_email(email)
{
	if(!email.match(/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/))
		return false;
	return true;
}

function IsNumber(strString)
   //  check for valid numeric strings	
{
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult; i++)
   {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1) blnResult = false;
   }
   return blnResult;
}
