<!--

// called from body onload
function init()
{
	preload_images();	
}


/*	
	Add linkbar images here. The pictures must be in
	the following format:
	File Format: gif
	Image Size: Width 150px, Height 48px
	
	The linkbar_images Array must be updated if more
	links are added to the linkbar. The linkbar in
	template.inc must be updated too.
	
	linkbar_images format:
		- only list the file name, no extenstion!
		- must reside in the images directory!
		- a mouseover image must exist too!
		
	Let's use the home_button as an example.
	- main image is home_button.gif
	- rollover image is home_button_mouseover.gif
	- both images are in the images directory
*/

var linkbar_images = new Array(
"home",
"properties",
"map",
"avail",
"future",
"contact");

var rollover_images;
var normal_images;
var img_width = 150;
var img_height = 48;


function preload_images()
{
	var x;
//       	alert("linkbar_images length is " + linkbar_images.length);
	
	rollover_images = new Array(linkbar_images.length);
	normal_images = new Array(linkbar_images.length);
	
	for (x=0; x<linkbar_images.length; x++)
	{
		rollover_images[x] = new Image();
		rollover_images[x].src = "images/"+linkbar_images[x]+"_mouseover.jpg";
		
		normal_images[x] = new Image();
		normal_images[x].src = "images/"+linkbar_images[x]+".jpg";
	}
	
} // end preload_images()


function altLinkImage(idx)
{
	var imageId = "LinkImage"+idx;
//       	alert("id is " + imageId);

   if ((rollover_images == null) ||
       (normal_images == null))
      preload_images();
	
	if (document.getElementById)
	{
		reference = document.getElementById(imageId);
		reference.src =	rollover_images[idx].src;
	}
	
} // end altLinkImage()


function normalLinkImage()
{
	var imageId;

   if ((rollover_images == null) ||
       (normal_images == null))
      preload_images();
	
	if (document.getElementById)
	{
		for (x=0; x<linkbar_images.length; x++)
		{
			imageId = "LinkImage"+x;
			
			reference = document.getElementById(imageId);
			reference.src =	normal_images[x].src;
		}

	}
	
} // end normalLinkImage()


function checkForm()
{
    var validateAddr = false; // temp

    if (document.cform.name.value == '' || document.cform.name.value == null)
    {
        alert("Please Enter a Name.");
        return false;
    }
    else
    if ((document.cform.phone.value == '' || document.cform.phone.value == null) && (document.cform.email.value == '' || document.cform.email.value == null))
    {
        alert("Please enter an email address or a phone number.");
        return false;
    }
    else
    if ((document.cform.email.value != '' && document.cform.email.value != null) && (validateAddr == true))
    {
        var tomatch=/[A-Za-z0-9]\w{2,}@[A-Za-z0-9-]{3,}\.\[A-Za-z]{3}/
        var addr = document.cform.email.value;

        if (tomatch.test(addr))
        {
            alert("Email address ok");
        }
        else
        {
            alert("Please check the format of your email address");
            return false;
        }
    }

    return true;

} // end checckForm()

//-->



