// Pre-Load images for image swapping.
function wm_preloadimages()
{
	if (document.images)
	{
		if (typeof(document.wm) == 'undefined')
		{
			document.wm = new Object();
		}
		document.wm.loadedimages = new Array();
		var arglength = wm_preloadimages.arguments.length;
		for(arg=0;arg<arglength;arg++)
		{
			document.wm.loadedimages[arg] = new Image();
			document.wm.loadedimages[arg].src = wm_preloadimages.arguments[arg];
		}
	}
}

// Swap images function.
function wm_imageswap(dasrc, daimage)
{
	var objStr,obj;

	if(document.images)
	{
		if (typeof(daimage) == 'string')
		{
			objstr = 'document.' + daimage;
			obj = eval(objstr);
			obj.src = dasrc;
		}
		else if ((typeof(daimage) == 'object') && daimage && daimage.src)
		{
			daimage.src = dasrc;
		}
	}
}

function init() {
	wm_preloadimages('/images/navigation/ibcsprinklertradeoffs_over.gif','/images/navigation/smokeprotectionvideo_over.gif','/images/navigation/ssccommunications_over.gif','/images/navigation/links_over.gif','/images/navigation/contactus_over.gif');
}

// Generate anti SPAM E-mail links
function generate_address(appearance, username, hostname, tld)
{
	var atsign = "&#64;";

	// If SAMEADDRSS is present, then the E-mail address will be shown instead of a custom value
	if (appearance == "SAMEADDRESS")
	{
		appearance = username + atsign + hostname + "." + tld;
	}

	var addr = username + atsign + hostname + "." + tld;
	document.write("<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" + appearance + "<\/a>");
}

function opencustomwindow(thelink, width, height)
{
	var window_href = thelink;
	open (window_href, "_blank", "toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=" + width + ",height=" + height + "");
}