/*** 
 * functions.js 
 * AJ Gray 
 * 2002.01.14 
 * Contains functions for Cedar Creek
*/

//Accepts two images. replaces the first one (btnOld)
//with the new one (btnNew)
function replaceImage(btnName, btnNew) {
	
	var oButton = eval("document." + btnName);
	oButton.src = imagePath + btnNew;
	
}

//Accepts and array of image src's ("images/buttons/button1.gif")
//and creates a new instance of them.
//It's purpose is to preload the images on a page.
function loadImages(aryImages) {
	
	var imgLoad = new Array();
	for (i = 0; i <= aryImages.length - 1; i++) {
		
		imgLoad[i]		= new Image();
		imgLoad[i].src	= aryImages[i];
		
	}
	imgLoad = null;
	
}

//opens a window and centers it
//accepts a url to the page, a width and a height
function openWindow(sURL, sWidth, sHeight, sWindowName) {
	
	scrWidth  = screen.width;
	scrHeight = screen.height;
	scrWCal   = (scrWidth - sWidth) / 2;
	scrHCal   = (scrHeight - sHeight) / 2;
	
	if (sWindowName == null) {
		sWindowName = "newWin";
		
	}
     
	sOptions =	"scrollbars=yes," +
					"width=" + sWidth + "," + 
					"height=" + sHeight + "," +
					"top=" + scrHCal + "," +
					"left=" + scrWCal;
	window.open(sURL, sWindowName, sOptions);
	
}

//function nextField(sCurrentLength,sEndLength,sNextField)
//Takes the current length of the form field your in (sCurrentLength,
//The final length of the form field (sEndLength), and the next
//field on your form (sNextField) with it's path from the form ie:
//formname.elements['fieldName'].
//If the current length = the end length, it goes to the next
//field.
function nextField(sCurrentLength, sEndLength, sNextField) {
	
	if (sCurrentLength == sEndLength) {
		sNextField.focus();
		
	}
	
}

function getOverViewMap(add, city, state, zip) {
	
	var url = "http://www.mapquest.com/maps/map.adp?country=US&homesubmit=Get+Map" +
			  "&address=842+Farmington+Rd" +
			  "&city=Mocksville" +
			  "&state=NC" +
			  "&zipcode=27028"
	window.open(url, "MapquestOverview");
	
}