﻿function addToOnload(f2)
{		
	var f1;
	f1=window.onload;
	window.onload = function() {
		if (f1)
		{
			f1();
		}
		
		if (f2)
		{
			f2();
		}
	};
}

function $(element)
{
	return document.getElementById(element);
}

function openTimeline(href)
{
    win = window.open(href, 'aikajana', 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=1,height=900,width=800', true);
    if (win)
    {
        win.focus();
    }
}

function avaaEsitys(eurl, ew, eh, eid)
{
	var ewin = {};
	if (eid == null)
	{
		eid=0;
	}
	
	if (ew == null)
	{
		ew=800;
	}
	
	if (eh == null)
	{
		ew=600;
	}
	
	ewin[eid] = window.open(eurl,'Esitys' + eid,'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,height=' + ew + ',width=' + eh,true);
}

function snoobiDummy(a,b,c)
{
}

function getDimensions(whichone)
{
	if (self.innerHeight){
		xDim = self.innerWidth;
		yDim = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight){
		xDim = document.documentElement.clientWidth;
		yDim = document.documentElement.clientHeight;
	}
	else if (document.body){
		xDim = document.body.clientWidth;
		yDim = document.body.clientHeight;
	}

	if (whichone=='x'){
		return xDim;
	} else {
		return yDim;
	}
}

function getOffSet (whichone)
{
	var offsetX = -1;
	var offsetY = -1;
	if( typeof( window.pageYOffset ) == 'number' )
	{
		offsetY = window.pageYOffset;
		offsetX = window.pageXOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
	{
		offsetY = document.body.scrollTop;
		offsetX = document.body.scrollLeft;
	}
	else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
	{
		offsetY = document.documentElement.scrollTop;
		offsetX = document.documentElement.scrollLeft;
	}
	
	if (whichone=='x'){
		return offsetX;
	} else {
		return offsetY;
	}
}
