<!--
function browserCheck()
{
	this.br = navigator.appName.toLowerCase();
	this.version = navigator.appVersion.toLowerCase();
	this.agent = navigator.userAgent.toLowerCase();
	this.platform = navigator.platform.toLowerCase();
	this.major = parseInt( navigator.appVersion );
	this.minor = parseFloat( navigator.appVersion );
	this.is_safari = ( this.version.indexOf( 'safari' ) != -1 );
	this.is_opera = ( this.agent.indexOf( 'opera' ) != -1 );
	this.is_mozilla = ( this.agent.indexOf( 'gecko' ) != -1 );
	this.is_ns = ( this.br == 'netscape' && !this.is_opera );
	this.is_ie = ( this.br == 'microsoft internet explorer' && !this.is_opera );
	this.is_ns4 = ( this.is_ns && this.major == 4 && !this.is_opera );
	this.is_ns6 = ( this.is_ns && this.major == 5 && !this.is_opera );
	this.is_ie4 = ( this.version.indexOf( 'msie 4.0' ) != -1 && !this.is_opera );
	this.is_ie5 = ( this.version.indexOf( 'msie 5.0' ) != -1 && !this.is_opera );
	this.is_ie55 = ( this.version.indexOf( 'msie 5.5' ) != -1 && !this.is_opera );
	if( this.is_ie55 ) this.is_ie5 = true;
	this.is_ie6 = ( this.version.indexOf( 'msie 6.0' ) != -1 && !this.is_opera );
	this.is_windows = ( this.platform.indexOf( 'win' ) != -1 );
	this.is_mac = ( this.agent.indexOf( 'mac' ) != -1 );
	this.is_linux = ( this.platform.indexOf( 'linux' ) != -1 || this.platform.indexOf( 'x11' ) != -1 ) ? true : false;
	this.is_dom = ( document.getElementById ) ? true : false;
}
br = new browserCheck();

String.prototype.trim = new Function(
		'	var beginIndex = 0;' +
		'	var endIndex = this.length;' +
		'	while(this.charAt(beginIndex) == \' \')' +
		'		beginIndex++;' +
		'	while(this.charAt(endIndex-1) == \' \')' +
		'		endIndex--;' +
		'	return this.slice(beginIndex, endIndex);' );

var elid = '', pid = -1, isrc = '', state = false;
function spop( elid, pid, isrc, state )
{
	if( document.getElementById( elid ) )
	{
		if( isrc.trim() != '' && document.images[ 'iml_' + pid ] )
		{
			// vaihdetaan kuvaa
			document.images[ 'iml_' + pid ].setAttribute( 'src', isrc );
		}
		if( document.getElementById( 'sbox_' + pid ) )
		{
			// suljetaan kaikki pomppuvalikot
			hidepops( state ? true : false );
			if( state )
			{
				// avataan pomppuvalikko
				openpop( elid, 'sbox_' + pid );
			}
		}
		keepopen( 'sbox_' + pid );
	}
}

var boxid = '';
function openpop( elid, boxid )
{
	if( document.getElementById( elid ) && document.getElementById( boxid ) )
	{
		var el = document.getElementById( elid );
		document.getElementById( boxid ).style.visibility = 'visible';
		x = 0;
		y = 0;
		var ot = ( br.is_ie ? el.parentNode.offsetTop : el.offsetTop ) - 2;
		//var ol = ( br.is_ie ? el.parentNode.offsetLeft : el.offsetLeft );
		var ol = el.offsetLeft;
		while( ( el = el.offsetParent ) != null )
		{
			//window.alert( el + ', ' + el.parentNode.offsetTop + 'x' + el.parentNode.offsetLeft );
			ot += parseInt( ( br.is_ie ? el.parentNode.offsetTop : el.offsetTop ), 10 );
			ol += parseInt( ( br.is_ie ? el.parentNode.offsetLeft : el.offsetLeft ), 10 );
		}
		y = ot;// - document.body.scrollTop;
		x = ol;// - document.body.scrollLeft;
		//window.alert( y + ' (' + ot + ') by ' + x + ' (' + ol + ')' );
		document.getElementById( boxid ).style.left = ( x - 8 ) + 'px';
		document.getElementById( boxid ).style.top = ( y + 28 - ( br.is_ie ? 67 : ( br.is_mozilla ? 8 : 0 ) ) ) + 'px';
	}
}

var immediately = false;
function hidepops( immediately )
{
	if( immediately )
	{
		dontclose = false;
		trulyhidepops();
	}
	else
	{
		timeri = setTimeout( 'trulyhidepops()', 3000 );
	}
}

var dontclose = false;
function keepopen( boxid )
{
	dontclose = true;
}

function stopkeepopen( boxid )
{
	dontclose = false;
	hidepops();
}

function trulyhidepops()
{
	if( !dontclose )
	{
		var pops = document.getElementsByTagName( 'DIV' );
		if( pops.length > 0 )
		{
			for( var i = 0; i < pops.length; i++ )
			{
				if( pops[ i ].getAttribute( 'id' ) )
				{
					if( pops[ i ].getAttribute( 'id' ).substr( 0, 5 ) == 'sbox_' )
					{
						pops[ i ].style.visibility = 'hidden';
					}
				}
			}
		}
		//if ( timer )
		//{	
		//	clearTimeout( timer );
		//}		
	}
}
// -->
