function showPicture(url, width, height) {
document.getElementById('aaaaa').style.display = 'none';
document.getElementById('picture').src = 'gfx/spacer.gif';
document.getElementById('main_pict').src = url;
document.getElementById('picture').src = url;
document.getElementById('aaaaa').style.display = 'block';
document.onmousedown=drags;
document.onmouseup=new Function("dragapproved=false");
}


function select_click (id)
{
	//	Close other tags.
	for (i = 0; i < handle_select_z_ids.length; i++)
	{
		if (null !== _(handle_select_z_ids[i]) && handle_select_z_ids[i] != id + '_option_container')
		{
			_(handle_select_z_ids[i]).style.display = 'none';
		}
	}

	var select_tag = document.getElementById(id + '_select_tag');
	var option_container = select_tag.getElementsByTagName('DIV')[1];

	set_div_top(id + '_option_container');

	//alert('option_container: ' + option_container.className);

	if (option_container.style.display == 'none')
	{
		Effect.SlideDown(id + '_option_container', {duration:0.5});
	}
	else
	{
		Effect.SlideUp(id + '_option_container', {duration:0.5});
	}
}
function option_click (id, a)
{
	var select_tag = document.getElementById(id + '_select_tag');
	var select_tag_title = select_tag.getElementsByTagName('DIV')[0];
	var option_container = select_tag.getElementsByTagName('DIV')[1];

	//alert('select_tag_title: ' + select_tag_title.className);
	//alert('option_container: ' + option_container.className);

	//	Hide options.
	option_container.style.display = 'none';

	//	Handle labels & values.
	var option_value = a.getElementsByTagName('DIV')[0];
	var option_title = a.getElementsByTagName('DIV')[1];
	var select_tag_value = document.getElementById(id + '_select_tag_value');

	select_tag_title.innerHTML = option_title.innerHTML;
	select_tag_value.value = option_value.innerHTML;
}
function _(id)
{
	return document.getElementById(id);
}

var handle_select_z_ids = new Array();
function set_div_top(target)
{
	if (null == target || 0 == target.length)
	{
		return;
	}

	//	Initialize.

	//	handle_select_z_ids initalized and gathered globally.
	//	var handle_select_z_ids = new Array('orderContainer','wizardContainer', 'newContainer');

	var z = new Array();
	var ids_relation = new Array();
	var start = 5;

	//	Load.
	for (i = 0; i < handle_select_z_ids.length; i++)
	{
		if (null !== _(handle_select_z_ids[i]))
		{
			var z_index = _(handle_select_z_ids[i]).style.zIndex;
			z.push(z_index);
			ids_relation[z_index] = handle_select_z_ids[i];
		}
		//_('debug').innerHTML += handle_select_z_ids[i] + ': ' + z_index + '<br />';
	}
	z.sort(function(a,b){return a - b});

	//_('debug').innerHTML += '<br />';

	//	Set.
	for (i = 0; i < z.length; i++)
	{
		if (ids_relation[z[i]] == target)
		{
			ids_relation[z[i]] = null;
			z[i] = z[z.length - 1] * 1 + 1;
			ids_relation[z[i]] = target;
			break;
		}
	}
	z.sort(function(a,b){return a - b});

	//	Save.
	for (i = 0, j = start; i < z.length; i++, j++)
	{
		if (null !== _(ids_relation[z[i]]))
		{
			//	IE6 fix.
			_(ids_relation[z[i]]).parentNode.style.zIndex = j;

			_(ids_relation[z[i]]).style.zIndex = j;
			//_('debug').innerHTML += ids_relation[z[i]] + ': ' + j + '<br />';
		}
	}
	//_('debug').innerHTML += '<hr />';
}
function getElementsByClassName(classname, node)
{
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
	var els = node.getElementsByTagName("*");
	for (var i=0,j=els.length; i<j; i++)
	{
		if(re.test(els[i].className))
		{
			a.push(els[i].id);
		}
	}
	return a;
}
function initialize_select()
{
	//handle_select_z_ids = getElementsByClassName('option-container');
	handle_select_z_ids = new Array('kangas_option_container', 'viimistlus_option_container', 'color_picker_option_container');
}

function save_color()
{
	document.forms['add_to_cart'].color.value = document.getElementById('color_picker_select_tag_value').value;
}