//Create 2 image objects which hold all of our images for swapping-------------------------------------
var ImagesUp = new Object();
var ImagesOver = new Object();

//Pass "imageName" when the normal image is "imageName_Up" and the over state is "imageName_Over"------
function CreateImgObjects(){

	if(document.images){
	
		var imagesArray =  CreateImgObjects.arguments;

		for(i=0; i<imagesArray.length; i++){
			
			cImage = imagesArray[i];	//get current imagename with extension and path
			splitName = cImage.split("/");	//split the path into it's parts seperated by "/"
			cImage = splitName[splitName.length-1];	//the last element is the imagename with extension
			
			//get the exension to the image
			cExt = cImage.substr(cImage.length-4,4);
			
			//get the basename of the image (no extension)
			cImage = cImage.substr(0,cImage.length-4);
			
			//put together the path to the image (without the name)
			cPath = "";
			for(p=0; p<(splitName.length-1); p++){
				cPath+=splitName[p]+"/";
			}
			
			ImagesUp[cImage] = new Image();
			ImagesUp[cImage].src = cPath + cImage + "_up" + cExt;
			ImagesOver[cImage] = new Image();
			ImagesOver[cImage].src = cPath + cImage + "_over" + cExt;
		}
	}
}
//-----------------------------------------------------------------------------------------------------


//pass an image name and a state ("up" or "over") to swap that image-----------------------------------
function ChangeImage(imgName, imgState){
	if(document.images){	
		if(imgState == "up"){
			document.images[imgName].src = ImagesUp[imgName].src;
			return true;
		}else if(imgState == "over"){
			document.images[imgName].src = ImagesOver[imgName].src;
			return true;
		}
	}
	return false;
}
//-----------------------------------------------------------------------------------------------------
/*SAMPLE (*Note: ImagesUp[this.name].src does not work instead of "../images/subpage_about_up.gif" for some reason. The image does not load properly!):
<A HREF="../aboutus.html"><IMG NAME="subpage_about" SRC="../images/subpage_about_up.gif" onMouseOver="ChangeImage(this.name, 'over')" onMouseOut="ChangeImage(this.name, 'up')" WIDTH="48" HEIGHT="25" BORDER="0"></A>
*/

<!--
<!--
function sf(){
document.f.firstname.focus();
}

//-->
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
		if (document.f.firstname.value == "" || document.f.firstname.value == null || document.f.lastname.value == "" || document.f.lastname.value == null || document.f.email2.value == "" || document.f.email2.value == null || document.f.city.value == "" || document.f.city.value == null) {
alert ("Please complete all the fields.");

	} else {
  document.f.submit();
}

}
//Image swap start
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//image swap stop
//-->

