/* Hakee hiiren tiedot muuttujaan! */	
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;

var mouseX = 0;
var mouseY = 0;

function getMouseXY(e) {
	// document.body.scrollTop does not work in IE 
	var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop; 
	var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
			
	if (IE) { // grab the x-y pos.s if browser is IE
		mouseX = event.clientX + scrollLeft;
		mouseY = event.clientY + scrollTop;
	} else {  // grab the x-y pos.s if browser is NS
		mouseX = e.pageX;
		mouseY = e.pageY;
	}  
	
	if (mouseX < 0) {mouseX = 0}
	if (mouseY < 0) {mouseY = 0}  
	
	return true;
} 
/* End of Hakee hiiren tiedot */


function toggleLayer(layerName,visibility) {
	if (visibility != undefined) {
		if (visibility && document.getElementById(layerName).style.display == "none")
			document.getElementById(layerName).style.display="block";
		else
			document.getElementById(layerName).style.display="none";
		
		
	} else {
		
	    if (document.getElementById(layerName).style.display=="block")
	      document.getElementById(layerName).style.display="none";
	    else
	      document.getElementById(layerName).style.display="block";
	     
	    
    }
}
function mailTo(mailto, address, link) {
	if (link == undefined)
		link = mailto + "@" + address;	
	document.write("<a href=\"mailto:" + mailto + "@" + address + "\" rel=\"external\>" + link + "</a>");  }
function setClass(layerName, newClassName) {	document.getElementById(layerName).className = newClassName;}

function nWin(winUrl,winWidth,winHeight,winName) {    
	if (winName == undefined)
		winName = "_BLANK";
			height=screen.height/2-winHeight/2;	width=screen.width/2-winWidth/2;	
	return window.open (winUrl,winName,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,fullscreen=0,top=0,left=0,height="+winHeight+",width="+winWidth+",top="+height+",left="+width)}