
var gBr = (navigator.appName) ? navigator.appName.toLowerCase() : "";

if(gBr.indexOf("opera") != -1 || navigator.product == "Gecko") {
	document.write('<style type="text/css"><!-- ');
	document.write('.page table tr th { background-image: url(http://www.rakli.fi/images/tHBg.png); } ');
	document.write('.page .oddrow td { background-image: url(http://www.rakli.fi/images/tRBg.png); } ');
	document.write('.page .evenrow td { background-image: url(http://www.rakli.fi/images/tRBg.png); } ');
	document.write(' --></style>');
}

function openForm(url, nimi) {
	var handle = window.open(url, nimi, "width=750,height=450,resizable=no,toolbar=no,status=no,location=no,titlebar=no");
	if (!handle.opener) handle.opener = self;
	childHandle = handle;
	handle.focus();
	return false;
}

function openResizableForm(url, nimi) {
	var handle = window.open(url, nimi, "width=750,height=450,resizable=yes,toolbar=no,status=no,location=no,titlebar=no");
	if (!handle.opener) handle.opener = self;
	childHandle = handle;
	handle.focus();
	return false;
}

var g_oGalleria = null;

function AvaaKuvagalleria() {
	
	var bAvaa = true;
	
	if(g_oGalleria) {
		bAvaa = (g_oGalleria.closed);
	}
	
	if(bAvaa)
		g_oGalleria = window.open("http://www.rakli.fi/kky/galleria/index.html", "Kuvagalleria", "width=730,height=720,resizable=no,toolbar=no,status=no,location=no,titlebar=no");
		
	g_oGalleria.focus();
		
}

function show(id) {

	var yOffset = 13;

	if(navigator.appName) {
		if(navigator.appName.indexOf("Opera") != -1)
			yOffset = 12;
	}
	
	if(navigator.product) {
		if(navigator.product == "Gecko")
			yOffset = 11;
	}
		
	if (document.getElementById) {

		var x             = 0;
		var y             = 0;
		var o             = document.getElementById('PDIV' + id);
		var tempElementti = o.offsetParent;
		x                 = o.offsetLeft;
		
		if(!tempElementti)
			alert("nope!");
		while (tempElementti != null) {
			x             += tempElementti.offsetLeft;
			tempElementti  = tempElementti.offsetParent;
		} 

		y             = o.offsetTop;
		tempElementti = o.offsetParent;
		
		while (tempElementti != null) {
			y             += tempElementti.offsetTop;
			tempElementti  = tempElementti.offsetParent;
		}
	
		var elementti = document.getElementById('C' + id);
		
		elementti.style.visibility = "visible";
		elementti.style.left       = (x);
		elementti.style.top        = (y + yOffset);
			
	} else if (document.all) {

		var x = 0;
		var y = 0;
		var o = document.all('PDIV' + id);
		x     = o.offsetLeft;
		
		tempElementti = o.offsetParent;
		
		while (tempElementti != null) {
			x             += tempElementti.offsetLeft;
			tempElementti  = tempElementti.offsetParent;
		}    
		
		y             = o.offsetTop;
		tempElementti = o.offsetParent;
		
		while (tempElementti != null) {
			y             += tempElementti.offsetTop;
			tempElementti  = tempElementti.offsetParent;
		}
		
		document.all('C' + id).style.visibility = "visible";
		document.all('C' + id).style.left       = x;
		document.all('C' + id).style.top        = (y+yOffset);

	} else if (document.layers) {

		var x  = 0;
		var y  = 0;
		
		x      = document.anchors['P' + id].x;
		y      = document.anchors['P' + id].y;
		
		document.layers['C' + id].visibility = "show";
		document.layers['C' + id].left       = x;
		document.layers['C' + id].top        = (y+yOffset);
		
	}

}
	

function hide(id) {

	if (document.getElementById) {
		elementti                  = document.getElementById("C" + id); 
		elementti.style.visibility = "hidden";
	}
	
	if (document.all) {
		document.all("C" + id).style.visibility = "hidden";
	}
	
	if (document.layers){
		document.layers["C" + id].visibility = "hide";
	}

}
