function prepareLinks()
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "previewLink")
		{
			anchor.onclick = function()
			{
				var previewURL = this.getAttribute("href")+'&width=480&height=360';
				window.open(previewURL,'Preview','width=480,height=360,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
				return false;

			}
		}
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "externalSite") anchor.target = "_blank";
	}
}

function dropdownLocation()
{
	if (!document.getElementById) return;
	var artistLocation = document.getElementById("artistLocation");
	var instrumentLocation = document.getElementById("instrumentLocation");
	if (artistLocation)
	{
		artistLocation.onchange = function()
		{
			var artistDestination = artistLocation.options[artistLocation.selectedIndex].value;
			if (artistDestination != '') document.forms.search.submit();
		}
	}
	if (instrumentLocation)
	{
		instrumentLocation.onchange = function()
		{
			var instrumentDestination = instrumentLocation.options[instrumentLocation.selectedIndex].value;
			if (instrumentDestination != '') document.forms.search.submit();
		}
	}
}

function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
	{
		window.onload = func;
	}
	else
	{
		window.onload = function()
	{
		if (oldonload)
		{
			oldonload();
		}
	func();
	}
	}
}

addLoadEvent(prepareLinks);
addLoadEvent(dropdownLocation);