// Onload Functions
function onloadfunctions()
{
	wm_preloadimages('/images/gallery/kitchens/001.jpg','/images/gallery/kitchens/002.jpg','/images/gallery/kitchens/003.jpg','/images/gallery/kitchens/004.jpg','/images/gallery/kitchens/005.jpg','/images/gallery/kitchens/006.jpg','/images/gallery/kitchens/007.jpg','/images/gallery/kitchens/008.jpg','/images/gallery/kitchens/009.jpg');
	wm_preloadimages('/images/gallery/bathrooms/001.jpg','/images/gallery/bathrooms/002.jpg','/images/gallery/bathrooms/003.jpg','/images/gallery/bathrooms/004.jpg','/images/gallery/bathrooms/005.jpg','/images/gallery/bathrooms/006.jpg','/images/gallery/bathrooms/007.jpg');
	wm_preloadimages('/images/gallery/other/001.jpg','/images/gallery/other/002.jpg','/images/gallery/other/003.jpg','/images/gallery/other/004.jpg','/images/gallery/other/005.jpg','/images/gallery/other/006.jpg','/images/gallery/other/007.jpg','/images/gallery/other/008.jpg','/images/gallery/other/009.jpg');
}

// 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')
		{
			obj = document.getElementById(daimage);
			obj.src = dasrc;
		}
		else if ((typeof(daimage) == 'object') && daimage && daimage.src)
		{
			daimage.src = dasrc;
		}
	}
}

// Generate Anti-SPAM E-Mail
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>");
}