// 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;
		}
	}
}

// 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(thislink, xwidth, yheight)
{
	var windowhref = thislink;
	var width = xwidth;
	var height = yheight;
	open (windowhref, "WindowViewer", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizeable=no,width=" + width + ",height=" + height)
}