
/* Last Modified $Date: 4/16/03 3:24p $ by $Author: Csamant $ (Version history stored in Source Control) */

// set up browser detect vars
//var isNS4 = (navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.charAt(0) == "4");
//var isMOZ = (navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion.charAt(0)) >= 5);
//var isIE = (navigator.appName.indexOf("Microsoft") != -1);

/*
 * This function highlights an image
 *
 * @param	image - the name of the image to be flipped
 * @param	dir - path to image dir (ex: "../images/nav/")
 * @param	imgName - optional, if name attribute is different from the image file name
 */
function over(image, dir, imgName) { 
	if (document.images) {
		var img = (imgName) ? findObject(imgName) : findObject(image);
		// store reference to old image for the out function
		img.rsrc = img.src;
		img.src = dir + image + "_on.gif";
	}
}

/**
 * This function restores an image
 *
 * @param	image - the name of the image to be flopped
 * @param	imgName - optional, if name attribute is different from the image file name
 */
function out(image) {
	if (document.images) {
		var img = findObject(image);
		// set source to stored reference to the old image
		img.src = img.rsrc;
	}
}

function preload(list, dir, suffix) {
    if (document.images) {
		// image object array
		var imgs = new Array();
		// loop through list
		for (i=0; i < list.length; i++) {
			imgs[i] = new Image();
			imgs[i].src = dir + list[i] + suffix;
		}
	}
}

// adapted from MM_findObj
function findObject(name, doc) {

	// get document, if it hasn't been passed
	if (!doc) doc = document;

	// declare object reference
	var obj = null;

	// check document and document.all collections	
	if (!(obj = doc[name]) && doc.all) {
		obj = doc.all[name];
	}
	
	// check document.layers collection
	if (!obj && document.layers) {
		for (var i = 0; !obj && i < doc.layers.length; i++) {	
			obj = findObject(name, doc.layers[i].document);
		}
	}
		
	if (!obj && doc.getElementById) {
		obj = doc.getElementById(name);
	}
	
	return obj;
}

function openSizedWindow(url, w, h, name) {
	if (!name) name = 'newWindow';
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	
	winprops = 'width=' + w + ',height=' + h + ',top=' + wint + ',left=' + winl + ',toolbar=no,menubar=no,scrollbars=yes,resizable=no';
	
	window.open(url,name,winprops);
}

function contactMeWindow(product) {
	
	openSizedWindow('/productPortfolio/contact.asp?product=' + escape(product),517,450,'contactMeForm');
}

