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 gIlmoittautumislomake = null;

function AvaaIlmoittautumislomake() {
	var bAvaa = false;
	if(gIlmoittautumislomake) {
		if(gIlmoittautumislomake.closed)
			bAvaa = true;
	} else {
		bAvaa = true;
	}
	if(bAvaa)
		gIlmoittautumislomake = window.open("http://www.isannointiliitto.fi/ilmoittautuminen.aspx", "Ilmoittautumislomake", "width=700,height=550,scrollbars=yes,resizable=yes,toolbar=no,status=no,location=no,titlebar=no");
	else 
		gIlmoittautumislomake.focus();
	return false;
}

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";
	}
}
