ns6 = (!document.all && document.getElementById) ? true : false;
ie = (document.all)? true:false;
Opera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
document.onmousemove=Ruch;
document.write('<STYLE TYPE="text/css"><!--')
document.write('.weather{FONT-SIZE:8pt;COLOR:#262675;FONT-FAMILY:Verdana,Arial,Helvetica,sans-serif;TEXT-ALIGN:left}');
document.write('#Marker{LEFT:10px;TOP:10px;VISIBILITY:visible;WIDTH:30px;CLIP:rect(0px 15px 21px 0px);POSITION:absolute;HEIGHT:41px}');
 document.write('.leg_mala{FONT-SIZE: 10px; COLOR: black; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif}') 
document.write('--></STYLE>')

var PL= new Array("Polska","pol",434,415,1.015,0,3.8,294,189,0,0);
var kat="pol";
var nazwa_woj=0;
var skrot_woj=1;
var Xwoj=2;
var Ywoj=3;
var zom=4;
var odlX=5;
var odlY=6;
var stolX=7;
var stolY=8;
var mapX=9;
var mapY=10;
var model="dwd";
var modelURL;
var dwdURL = "forum";
var aladinURL = "alladin";
var query;
var empty="_progweb_mat/nic.gif";
var kat="pol"
document.write('<DIV id=Marker><IMG src="_progweb_mat/marker4.gif" name=mar onclick=wspolrzedne()></DIV>');
var bazaX=document.getElementById("baza").offsetLeft;
var bazaY=document.getElementById("baza").offsetTop;
document.getElementById("Marker").style.left = bazaX+PL[stolX]-1;
document.getElementById("Marker").style.top = bazaY+PL[stolY]-21; 
 	 											
function _siat(th,ka){
if(ka != kat){ka=kat}
zm(th,"_progweb_mat/"+ka+"/"+ka+"_siatka.gif")
}
function _rzek(th,ka){
if(ka != kat){ka=kat}
zm(th,"_progweb_mat/"+ka+"/"+ka+"_rzeki.gif")
}

function checkAll() {
  for (var j = 0; j < 2; j++){
    if(document.chekboxy[j].checked)
	document.chekboxy[j].checked = !document.chekboxy[j].checked
  }
}
function zm(object,backgr) {
  if(object.checked) {
    show(object.value,backgr);
	  }else {
    hide(object.value);
	}
}
function show(ident,tlo) {
		document.getElementById(ident).style.background='url('+tlo+')'
  }
function hide(ident) { 
	document.getElementById(ident).style.background='url('+empty+')'
  }
function wczytaj() // dodana cała funkcja
{
	if (document.forms[1].choragiewkaX.value != "" && document.forms[1].choragiewkaY.value != "")
	{
		document.getElementById("Marker").style.left = document.forms[1].choragiewkaX.value;
		document.getElementById("Marker").style.top = document.forms[1].choragiewkaY.value;
	}
}
function moveTo(ident,x,y) {
  if(ie) {  
document.getElementById(ident).style.left = x;
document.getElementById(ident).style.top = y;
  }
  else if (ns6)
  {
	document.getElementById(ident).style.left=x;
	document.getElementById(ident).style.top=y;
  }
}
function chooseModel(m){
	model = m.value;
	if(model=="dwd")
		modelURL=dwdURL;
	else
		modelURL=aladinURL;
}

function updateModel(m){
	model = m.value;
	if(model=="dwd")
		modelURL=dwdURL;
	else
		modelURL=aladinURL;
	if(query == null)
		query = "";

	window.open("/wl/" + modelURL + query,
'atmogram','toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=yes,top=50,left=380 width=700,height=300');
}

function Ruch(e) {
if (ns6) { 
	x=e.pageX;
	y=e.pageY;
	}
if (ie) {
	x=event.clientX+document.body.scrollLeft;
	y=event.clientY+document.body.scrollTop;
	}
	}
	function wspolrzedne() {
if(ns6){
	document.getElementById("Marker").style.left = x;
	document.forms[1].choragiewkaX.value = x; // dodane
	}
if(ie){
	document.getElementById("Marker").style.left = x-2;
	document.forms[1].choragiewkaX.value = x-2; // dodane
	}
if(Opera){
	document.getElementById("Marker").style.left = x+1;
	document.forms[1].choragiewkaX.value = x+1; // dodane
	}
document.getElementById("Marker").style.top = y-21;
document.forms[1].choragiewkaY.value = y-21; // dodane 
	wyznacz_stopnie()
	}

		function wyznacz_stopnie() {
zoom=PL[zom]
x= x-bazaX
y=y-bazaY  
 x=PL[odlX]+x/zoom
 y=PL[odlY]+y/zoom
lm0=21;
R=4003
t=x-290
u=3839-(y);
tmp0=Math.pow(t,2)+Math.pow(R,2);
tmp1=tmp0/Math.pow(R,2);
k=Math.sqrt(tmp1);
tmp3=Math.sin(u/R)/k;
my_fi=Math.asin(tmp3);
my_la=Math.asin(t/(R*Math.cos(u/R)));		
my_la_s=my_la*180/Math.PI + 21;
my_fi_s=my_fi*180/Math.PI;
my_la_s_c=Math.floor(my_la_s); // Wartosc calkowita z my_la_s
my_la_s_r=my_la_s-my_la_s_c; // Czesc ulamkowa z my_la_s
my_la_s_min=Math.round(my_la_s_r*60); // my_la_s_r przeliczone z ulamkow dziesietnych na minuty
if (my_la_s_min==60)
{
	my_la_s_c = my_la_s_c + 1;
	my_la_s_min = 0;
}
my_fi_s_c=Math.floor(my_fi_s); // Wartosc calkowita z my_fi_s
my_fi_s_r=my_fi_s-my_fi_s_c; // Czesc ulamkowa z my_fi_s
my_fi_s_min=Math.round(my_fi_s_r*60); // my_fi_s_r przeliczone z ulamkow dziesietnych na minuty
if (my_fi_s_min==60)
{
	my_fi_s_c = my_fi_s_c + 1;
	my_fi_s_min = 0;
}

// geog2nodes start
/* Pi18=0.01745329251994330;
la0=10.0;
fi0=57.5;
FiB=32.5*Pi18;
lamin=2.25;
fimin=-8.5;
dla=0.125;
dfi=0.125;
LaLa0 = (my_la_s-la0)*Pi18;
fi_ = my_fi_s*Pi18;
r1  = -Math.cos(FiB)*Math.cos(LaLa0)*Math.cos(fi_)+Math.sin(FiB)*Math.sin(fi_);
	rfi = Math.asin(r1);
	r1  = (Math.cos(FiB)*Math.sin(fi_)+Math.sin(FiB)*Math.cos(LaLa0)*Math.cos(fi_));
	r1  = r1/Math.cos(rfi);
	if (r1>1) {
		r1=1;
	}
	rla = Math.acos(r1)/Pi18;
	if ((my_la_s-la0)<0) {
		rla = -rla;
	}
	rfi = rfi/Pi18;
	nx=Math.round((rla-lamin)/dla+1);
	ny=Math.round((rfi-fimin)/dfi+1);
// geog2nodes end
rla=(Math.round(my_la_s*100))/100;
rfi=(Math.round(my_fi_s*100))/100;
status="Współrzędne:  "+rla+" E  "+rfi+" N"; */
query = "?szer_st="+my_fi_s_c+"&szer_min="+my_fi_s_min+"&dlug_st="+my_la_s_c+"&dlug_min="+my_la_s_min+"&model=cosmo&lang=pl&form=tab";
query2 = "?szer_st="+my_fi_s_c+"&szer_min="+my_fi_s_min+"&dlug_st="+my_la_s_c+"&dlug_min="+my_la_s_min+"&model=aladin&lang=pl&form=tab";

window.open("/cgi/prognumer" + query,
'atmogram','toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=yes,top=50,left=380 width=700,height=300')
window.open("/cgi/prognumer" + query2,
'atmogram2','toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=yes,top=50,left=380 width=700,height=300')


}
//Tymczasowe
function openwin(w){
	window.open(w,
'atmogram','toolbar=no,menubar=no,location=no,personalbar=no,scrollbars=no,directories=no,status=no,resizable=yes,top=50,left=380 width=700,height=300');
}


