function spot(linkID, spotID, state)
{
	if(state == 1)
	{
		document.getElementById(spotID).style.backgroundImage = 'url(http://www.tyrnava.fi/kaavoitus/images/gui/kartta_' + spotID + '.gif)';
		document.getElementById(linkID).style.color = '#E43619';
	}
	else
	{
		document.getElementById(spotID).style.backgroundImage = '';
		document.getElementById(linkID).style.color = '#000';
	}
}

function popWindow(image, width, height)
{

	var scrollbars = 'no';

	var top = 0;
	var left = 0;

	var winwidth = parseInt(width);
	var winheight = parseInt(height);
	
	var offsetx = 80;
	var offsety = 80;

	var scrwidth = this.screen.availWidth;
	var scrheight = this.screen.availHeight;
	
	left = (scrwidth - winwidth) / 2;
	top = (scrheight - winheight) / 2;

	if(winwidth > (scrwidth - offsetx))
	{
		winwidth = scrwidth - offsetx * 2;
		left = offsetx;
		scrollbars = 'yes';
	}

	if(winheight > (scrheight - offsety))
	{
		winheight = scrheight - offsety * 2;
		top = offsety;
		scrollbars = 'yes';
	}

	var pop = window.open('', 'Kuva', 'left=' + left + ',top=' + top + ',width=' + winwidth + ',height=' + winheight + ',scrollbars=' + scrollbars + '');
	pop.document.open();
	pop.document.writeln('<html>');
	pop.document.writeln('<head>');
	pop.document.writeln('\t<title>kuvaikkuna</title>');
	pop.document.writeln('\t<style type="text/css" media="screen">HTML, BODY { margin: 0; padding: 0; } IMG { display: block; margin: 0; padding: 0; border: 0; }</style>');
	pop.document.writeln('</head>');
	pop.document.writeln('<body>');
	pop.document.writeln('\t<img src="' + image + '" width="' + width + '" height="' + height + '" alt="" />');
	pop.document.writeln('</body>');
	pop.document.writeln('</html>');
	pop.document.close();
}

function displayIcons(id)
{
	var parent = document.getElementById('iconsets');
	var divs = parent.getElementsByTagName('dl');

	for(var i = 0; i < divs.length; i++)
		divs[i].style.display = 'none';

	document.getElementById(id).style.display = 'block';
}

function process(id)
{
	var parent = document.getElementById('prosessitahot');
	var divs = parent.getElementsByTagName('div');

	for(var i = 0; i < divs.length; i++)
		divs[i].style.display = 'none';

	document.getElementById(id).style.display = 'block';
}
