var ie5 = (document.all && document.getElementById) ? true:false;
var ns6 = (!document.all && document.getElementById) ? true:false;
var ns4 = (document.layers) ? true:false;
function get_winW()
{
	if(ns4||ns6) return window.innerWidth;
	if(ie5) return document.body.clientWidth;
}
function st(mis)
{
	document.all.pointer.innerHTML = '&nbsp;'+mis;
}
function pb()
{
	document.all.pointer.innerHTML = '&nbsp;ID: <input type="text" size=2 style="font-size:8pt;"> <input type="submit" value="Otsi" style="background-Color:white;font-size:8pt;border: navy 1 solid;padding-left:5;padding-right:5;">';
}
function c(mis)
{
	var W = get_winW();
	document.all[mis].style.left=Math.round((W-760)/2)+360;
}
function sw(mis)
{
	if(mis=='buss') {
		document.all['myyk_in'].style.visibility = 'hidden';
		document.all['myyk_in'].style.display = 'none';
	} else {
		document.all['buss'].style.visibility = 'hidden';
		document.all['buss'].style.display = 'none';
	}
	document.all[mis].style.visibility = 'visible';
	document.all[mis].style.display = 'block';
	return false;
}
function show(mis)
{
	document.all[mis].style.visibility = (document.all[mis].style.visibility=='hidden' || document.all[mis].style.visibility=='') ? 'visible':'hidden';
	document.all[mis].style.display = (document.all[mis].style.display=='none' || document.all[mis].style.display=='') ? 'block':'none';
	return false;
}

function kirjuta(mis,id)
{
      document.getElementById("intro").innerHTML = (mis=='') ? '':mis+' rannad';
      if(mis!=='') {
	document.getElementById("VAPP_inf").innerHTML = '<b>'+mis+'</b>';
	}
	if(parseInt(id)>0) {
	      document.getElementById("KAART").src = 'evp/map_' + id + '.png';
	      document.getElementById("VAPP").src = 'evp/vapp_' + id + '.png';
	}
}

function init()
{
	var w = screen.width;
	var sl = (ns4) ? parseInt(window.innerWidth):parseInt(document.body.clientWidth);
	var sh1 = 250;
	var sh2 = 810;
	if(w > 1152) {
		window.top.document.body.style.backgroundColor = 'red';
		window.top.document.body.style.background = 'url(arossa/back1280.gif) no-repeat';
	} else if(w > 1024) {
		window.top.document.body.style.background = 'url(arossa/back1154.gif) no-repeat';
	} else if(w > 800) {
		window.top.document.body.style.background = 'url(arossa/back1024.gif) no-repeat';
	} else {
		window.top.document.body.style.background = 'url(arossa/back800.gif) no-repeat';
	}
	sl1 = ((sl-760)/2)+760-sh1;
	sl1 = ((sl-760)/2)+760-sh2;
	if(document.getElementById('buttons1')) document.all.getElementById('buttons1').style.left=sl1;
	if(document.getElementById('buttons2')) document.all.getElementById('buttons2').style.left=sl2;
}

function showpix(pilt,k6rgus,laius,alt)
{
	var def_h = 300
	var def_w = 400
	var def_p = 'spacer.gif'
	var win_t = 0
	var win_l = 0
	var add_h = 50
	var add_w = 30
	var x = document.forms.pix
	h = (k6rgus == 0) ? def_h:k6rgus
	w = (laius == 0) ? def_w:laius
	a = alt
	if(document.layers) {
		var win_t = (window.innerHeight - h + add_h) / 2
		var win_l = (window.innerWidth - w + add_w) / 2
	}
	else if(document.all) {
		var win_t = (document.body.clientHeight - h + add_h) / 2
		var win_l = (document.body.clientWidth - w + add_w) / 2
	}
	t = (win_t>0) ? win_t:0
	l = (win_l>0) ? win_l:0
	p = (pilt=='' || pilt==null) ? def_p:pilt
	x.p.value = p
	x.h.value = h
	x.w.value = w
	x.a.value = a
	pixwin = window.open('picture.php','pix','toolbar=no,directories=no,menubar=no,status=no,scrollbars=no,width='+(w+add_w)+',height='+(h+add_h)+',top='+t+',left='+l);
	pixwin.focus()
	return false
}

function draw_pilt()
{
	var x = opener.document.pix
	var p = x.p.value
	var h = x.h.value
	var w = x.w.value
	document.write('<a href="javascript:top.close()"><IMG SRC="'+p+'" BORDER=0 HEIGHT='+h+' WIDTH='+w+'></a>')
}

function draw_pealkiri()
{
	var a = opener.document.pix.a.value
	if(a!=='') {
		document.write(a)
	} else {
		document.write('&nbsp;')
	}
}

function printme(page)
{
	var t = 0
	var l = 0
	var h = 500
	var w = 450
	if(document.layers) {
		var t = (window.innerHeight - h) / 2
		var l = (window.innerWidth - w) / 2
	}
	else if(document.all) {
		var t = (document.body.clientHeight - h) / 2
		var l = (document.body.clientWidth - w) / 2
	}
	if(page!=='') {
		printwin = window.open(page+'&printme=yes','print','toolbar=no,directories=no,menubar=no,status=no,scrollbars=yes,width='+w+',height='+h+',top='+t+',left='+l);
		printwin.focus()
		top.print()
	}
}