var Root_URL = 'http://www.majklockan.se';


function avoid_spam(name, address, link)
{
	document.write("<a href=\"mailto:" + name + "@" + address + "\">" + link + "</a>");
}

function change_picture(pic, id)
{
	if (!document.getElementById)
		alert("Your browser is outdated, please upgrade");
	
	if (!id)
	{
		switch (pic)
		{
			case 1:
				var filename = '1 rok ho 81A-91.jpg';
				break;

			case 2:
				var filename = '1 rok ho 91.jpg';
				break;

			case 3:
				var filename = '1 rok horn 83-89.jpg';
				break;

			case 4:
				var filename = '2 rok ho 83-91.jpg';
				break;

			case 5:
				var filename = '2 rok gavel 83-91.jpg';
				break;

			case 6:
				var filename = '3 rok 83-85.jpg';
				break;
		}

		document.getElementById("pic_layout").src = Root_URL + "/pages/thumb.php?img=flogsta/layouts/" + filename + "&width=250&height=250";
		document.getElementById("pic_link").href = Root_URL + "/images/flogsta/layouts+positions/" + filename;
	}
	else
	{
		document.getElementById(id).src = Root_URL + "/images/" + pic;
	}
}

function openwindow(adress, width, height)
{
	if (width === undefined) width = 500;
	if (height === undefined) height = 350;
	var ran_number= Math.floor(Math.random()*5);
	window.open(adress, 'imagepop' + ran_number,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+width+', height='+height+', top=100, left=100');
}


window.onload = function()
{
	// Externa länkar, öppna i nytt fönster
	if (document.getElementsByTagName)
	{
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i < anchors.length; i++)
		{
			var ankare = anchors[i];
			if (ankare.getAttribute("href") && ankare.getAttribute("rel") == "external")
				ankare.target = "_blank";
		}
	}
}


function toggle(id)
{
	if (!document.getElementById || !document.getElementById(id)) return;
	var e = document.getElementById(id);
	e.style.display = (e.style.display == 'none') ?  '' : 'none';
}

