/*Lataa dynaamisesti kalenterikorjaukset erillisesta scriptista ja kuvalogon linkitys 22/01/09, paivitetty 10/11/09 IL*/

function loaderi()
{

var u = location.href; 
var s = u.split("/");



	if(s[5] == null)
	{
		if(s[4] == null && s[3] == null)
		{
		return false;
		}
		if(s[4] == null && s[3] != null)
		{
		s[4] = "";
		}
	s[5] = "";
	}
	else
	{
	}



if(s[4].match("tapahtumat.html") != null || s[5].match("tapahtumat.html") != null || s[3].match("tapahtumat.html") != null) 
	{
	var h = document.getElementsByTagName("head")[0]; 
	var n = document.createElement('script');
	n.type = 'text/javascript';

		if(s[5].match("tapahtumat.html") != null)
		{
		n.src='http://www.kansalliskirjasto.fi/extra/js/palvelut_kalenteri.js';
		}
		if(s[4].match("tapahtumat.html") != null || s[3].match("tapahtumat.html") != null)
		{
		tmo = 0;
		n.src="http://www.kansalliskirjasto.fi/attachments/5zlDCZRTh/5EhAsGBBt/Files/CurrentFile/kanavat_kalenteri.js";
		}      
		
 
	h.appendChild(n);
	}
	else
	{
	} 




}
var ux = location.href; 
var sx = ux.split("/");
 if(sx[3].match("tapahtumat.html") != null)
 {
  setTimeout("loaderi();",1000); //timeoutti jos käytetään etusivun kalenteria
 }
 else
 {
  loaderi();
 }
if(document.getElementById("etusivuKKLogo") != null)
{
	if(sx[2].match("www.kansalliskirjasto.fi") != null || sx[2].match("www.nationalbiblioteket.fi") != null || sx[2].match("www.nationallibrary.fi") != null )
	{
		
		//muista kieliversiourlit
		p = document.getElementById("etusivuKKLogo");
		if( p.attachEvent ){
   		p.onclick =  function(){window.location.assign('http://'+sx[2]+'/')};

		} else {
   		p.setAttribute('onclick', 'window.location.assign("http://"+sx[2]+"/")'); 
		}
		p.style.cursor="pointer";
		
	}
}
