function miniGalerija(query, ww, hh) {
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	my_w = window.open(query, 'my_w', "toolbars=no,location=no,menubar=no,resizable=no,scrollbars=no,height="+hh+",width="+ww+",left="+l+",top="+t);
	my_w.focus();
	//my_w.moveTo(l,t);
	
}

function komentari(query,ww,hh)
{
	w=400; h=480;
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	
	my_window = window.open(query,'my_window',"toolbars=no,location=no, menubar=no,resizable=no,scrollbars=yes,height="+w+",width="+h+",left="+l+",top="+t);
	my_window.focus();
}

function slika_komentari(query,ww,hh)
{
	w=400; h=480;
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	
	my_window = window.open(query,'my_window',"toolbars=no,location=no, menubar=no,resizable=no,scrollbars=yes,height="+w+",width="+h+",left="+l+",top="+t);
	my_window.focus();
}

function novosti_komentari(query,ww,hh)
{
	w=400; h=480;
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	
	my_window = window.open(query,'my_window',"toolbars=no,location=no, menubar=no,resizable=no,scrollbars=yes,height="+w+",width="+h+",left="+l+",top="+t);
	my_window.focus();
}

function dodaj_komentar(query,ww,hh)
{
	w=260; h=480;
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	
	my_window2 = window.open(query,'my_window2',"toolbars=no,location=no, menubar=no,resizable=no,scrollbars=yes,height="+w+",width="+h+",left="+l+",top="+t);
	my_window2.focus();
}

function prikazi_sliku(query,ww,hh)
{
	w=500; h=500;
	l = screen.width/2 - ww/2;
	t = screen.height/2 - hh/2;
	
	my_window3 = window.open(query,'my_window3',"toolbars=no,location=no, menubar=no,resizable=no,scrollbars=no,height="+w+",width="+h+",left="+l+",top="+t);
	my_window3.focus();
}

function showHideOpr(div1_name, div2_name, img_name) {
	wd = window.document;
	if (wd.getElementById(div1_name).style.display == 'none') {
		wd.getElementById(div1_name).style.display = 'block';
		wd.getElementById(div2_name).style.display = 'block';
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_down.gif';
	} else {
		wd.getElementById(div1_name).style.display = 'none';
		wd.getElementById(div2_name).style.display = 'none';	
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_right.gif';
	}
}
function showHideLink(div1_name, img_name) {
	wd = window.document;
	if (wd.getElementById(div1_name).style.display == 'none') {
		wd.getElementById(div1_name).style.display = 'block';
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_down.gif';
	} else {
		wd.getElementById(div1_name).style.display = 'none';
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_right.gif';
	}
}
function showLink(div1_name, img_name) {
	wd = window.document;

		wd.getElementById(div1_name).style.display = 'block';
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_down.gif';
}
function hideLink(div1_name, img_name) {
	wd = window.document;

		wd.getElementById(div1_name).style.display = 'none';
		wd.getElementById(img_name).src = 'img/public/trokutic_sivi_right.gif';

}
function hideOpr(div1_name, div2_name) {
	wd = window.document;
	wd.getElementById(div1_name).style.display = 'none';
	wd.getElementById(div2_name).style.display = 'none';	

}
function showOpr(div1_name, div2_name) {
	wd = window.document;
	wd.getElementById(div1_name).style.display = 'block';
	wd.getElementById(div2_name).style.display = 'block';
}

function showHideDiv(div_name) {
	wd = window.document;
 //alert('bbb');
	if (wd.getElementById(div_name).style.display == 'block') {
		wd.getElementById(div_name).style.display = 'none';
	} else {
		wd.getElementById(div_name).style.display = 'block';
	}
}

// STAR FROM http://www.kjd-zagreb.hr

 function NeuKnoten(){
  with(document.bf){
   ms.value="";
   knoten.value=Math.round(knoten.value);
   beaufort.value="";
   kmh.value="";
   mph.value="";
  }
 }

 function NeuMph(){
  with(document.bf){
   ms.value="";
   knoten.value="";
   beaufort.value="";
   kmh.value="";
   mph.value=Math.round(mph.value);
  }
 }

 function NeuKmh(){
  with(document.bf){
   ms.value="";
   knoten.value="";
   beaufort.value="";
   kmh.value=Math.round(kmh.value);
   mph.value="";
  }
 }

 function NeuMs(){
  with(document.bf){
   ms.value=Math.round(ms.value);
   knoten.value="";
   beaufort.value="";
   kmh.value="";
   mph.value="";
  }
 }

 function NeuBeaufort(){
  with(document.bf){
   ms.value="";
   knoten.value="";
   kmh.value="";
   mph.value="";
  }
 }
//-->
 
 function CheckZahl(Eingabe){
  var nur_das ="0123456789";
  for (var i = 0; i < Eingabe.length; i++)
   if (nur_das.indexOf(Eingabe.charAt(i))<0 ) return false;
  return true;
 }

 function pruef_ms(ms){
   if(ms<0)
     ms=0;
   if(!CheckZahl(ms))
     ms=0;

   return ms;
 }

 function pruef_kmh(kmh){
   if(kmh<0)
     kmh=0;
   if(!CheckZahl(kmh))
     kmh=0;

   return kmh;
 }

 function pruef_mph(mph){
   if(mph<0)
     mph=0;
   if(!CheckZahl(mph))
     mph=0;

   return mph;
 }


 function pruef_knoten(knoten){
   if(knoten<0)
     knoten=0;
   if(!CheckZahl(knoten))
     knoten=0;

   return knoten;
 }

 function pruef_beaufort(beaufort){
   if(beaufort<0)
     beaufort=0;
   if(beaufort>12)
     beaufort=0;

   if(!CheckZahl(beaufort))
     beaufort=0;

   return beaufort;
 }

 function kmh2ms(kmh){
   ms=0;
   ms=kmh/3.6;

   return ms;
 }

 function kmh2mph(kmh){
   mph=0;
   mph=0.6215*kmh;

   return mph;
 }

 function ms2knoten(ms){
   var knoten=0;
   knoten=1.9438*ms;
   return knoten;
 }

 function kmh2knoten(kmh){
   knoten=0;
   ms=0;
   ms=kmh2ms(kmh);
   knoten=ms2knoten(ms);

   return knoten;
 }


 function knoten2beaufort(knoten){
 
   if (knoten==0)
    return 0;
   if (knoten<=3)
    return 1;
   if (knoten<=6)
    return 2;
   if (knoten<=10)
    return 3;
   if (knoten<=15)
    return 4;
   if (knoten<=21)
    return 5;
   if (knoten<=27)
    return 6;
   if (knoten<=33)
    return 7;
   if (knoten<=40)
    return 8;
   if (knoten<=47)
    return 9;
   if (knoten<=55)
    return 10;
   if (knoten<=63)
    return 11;
   else
    return 12;   
 }


 function ms2kmh(ms){
   var kmh=0;
   kmh=ms*3.6;
   return kmh;
 }

 function ms2mph(ms){
   var mph=0;
   var kmh=0;
   kmh=ms2kmh(ms);
   mph=kmh2mph(kmh);
   return mph;
 }

 function mph2kmh(mph){
   var kmh=0;
   kmh=1.609*mph;
   return kmh;
 }

 function mph2ms(mph){
   var ms=0;
   var kmh=0;

   kmh=mph2kmh(mph);
   ms=kmh2ms(kmh);
   return ms;
 }

 function mph2knoten(mph){
  var knoten=0;
  var ms=0;
  ms=mph2ms(mph);
  knoten=ms2knoten(ms);
  return knoten;

 }

 function mph2beaufort(mph){
   var beaufort=0;
   var knoten=0;
   knoten=mph2knoten(mph);
   beaufort=knoten2beaufort(knoten);
   return beaufort;

 }



 function ms2beaufort(ms){
   var knoten=0;
   var beaufort=0;
   knoten=ms2knoten(ms);
   beaufort=knoten2beaufort(knoten);
   return beaufort;   
 }

 function kmh2beaufort(kmh){
   beaufort=0;
   ms=0;
   ms=kmh2ms(kmh);
   beaufort=ms2beaufort(ms);
   return beaufort;
 }

 function knoten2ms(knoten){
   var ms=0;
   ms = 0.51444*knoten
   return ms;
 }

 function knoten2mph(knoten){
   var mph=0;
   ms=0;
   ms=knoten2ms(knoten);
   mph=ms2mph(ms);
   return mph;
 }

 function knoten2kmh(knoten){
   var ms=0;
   var kmh=0;
   ms=knoten2ms(knoten);
   kmh=ms2kmh(ms);
   return kmh;
 }


 function beaufort2knoten(beaufort){
   var knoten="0";


   if(beaufort==1)
     knoten="1 - 3"
   if(beaufort==2)
     knoten="4 - 6"
   if(beaufort==3)
     knoten="7 - 10"
   if(beaufort==4)
     knoten="11 - 15"
   if(beaufort==5)
     knoten="16 - 21"
   if(beaufort==6)
     knoten="22 - 27"
   if(beaufort==7)
     knoten="28 - 33"
   if(beaufort==8)
     knoten="34 - 40"
   if(beaufort==9)
     knoten="41 - 47"
   if(beaufort==10)
     knoten="48 - 55"
   if(beaufort==11)
     knoten="56 - 63"
   if(beaufort==12)
     knoten="> 64"
   
   return knoten;   
 }

 function beaufort2ms(beaufort){
    var ms=0;

   if(beaufort==1)
     ms="0.3 - 1.5"
   if(beaufort==2)
     ms="1.6 - 3.3"
   if(beaufort==3)
     ms="3.4 - 5.4"
   if(beaufort==4)
     ms="5.5 - 7.9"
   if(beaufort==5)
     ms="8.0 - 10.7"
   if(beaufort==6)
     ms="10.8 - 13.8"
   if(beaufort==7)
     ms="13.9 - 17.1"
   if(beaufort==8)
     ms="17.2 - 20.7"
   if(beaufort==9)
     ms="20.8 - 24.4"
   if(beaufort==10)
     ms="24.5 - 28.4"
   if(beaufort==11)
     ms="28.5 - 32.6"
   if(beaufort==12)
     ms="> 32.6"

    return ms;
 }


 function beaufort2kmh(beaufort){
   var kmh=0;

   if(beaufort==1)
     kmh="1.1 - 5.4"
   if(beaufort==2)
     kmh="5.5 - 11.9"
   if(beaufort==3)
     kmh="12.0 - 19.4"
   if(beaufort==4)
     kmh="19.5 - 28.4"
   if(beaufort==5)
     kmh="28.5 - 38.5"
   if(beaufort==6)
     kmh="38.6 - 49.7"
   if(beaufort==7)
     kmh="49.8 - 61.5"
   if(beaufort==8)
     kmh="61.6 - 74.5"
   if(beaufort==9)
     kmh="74.6 - 87.8"
   if(beaufort==10)
     kmh="87.9 - 102.2"
   if(beaufort==11)
     kmh="102.3 - 117.3"
   if(beaufort==12)
     kmh="> 117.4"

   return kmh;

 }

 function beaufort2mph(beaufort){
   var mph=0;

   if(beaufort==1)
     mph="0.7 - 3.5"
   if(beaufort==2)
     mph="3.6 - 7.5"
   if(beaufort==3)
     mph="7.6 - 12.2"
   if(beaufort==4)
     mph="12.3 - 17.8"
   if(beaufort==5)
     mph="17.9 - 24.0"
   if(beaufort==6)
     mph="24.1 - 31.0"
   if(beaufort==7)
     mph="31.1 - 38.3"
   if(beaufort==8)
     mph="38.4 - 46.4"
   if(beaufort==9)
     mph="46.5 - 54.7"
   if(beaufort==10)
     mph="54.8 - 63.6"
   if(beaufort==11)
     mph="63.7 - 73.0"
   if(beaufort==12)
     mph="> 73"


   return mph;
 }



 function racunajVjetar(){
   var ms=document.bf.ms.value;
   var knoten=document.bf.knoten.value;
   var beaufort=document.bf.beaufort.value;
   var kmh=document.bf.kmh.value;
   var mph=document.bf.mph.value;
   if (document.bf.ms.value != ""){
     ms=pruef_ms(ms);
     knoten=ms2knoten(ms);
     beaufort=ms2beaufort(ms);
     kmh=ms2kmh(ms);
     mph=ms2mph(ms);
     document.bf.knoten.value=Math.round(knoten);
     document.bf.beaufort.value=Math.round(beaufort);     
     document.bf.ms.value=Math.round(ms);
     document.bf.kmh.value=Math.round(kmh);
     document.bf.mph.value=Math.round(mph);
     return;
   }
   if (document.bf.knoten.value != ""){
     knoten=pruef_knoten(knoten);
     ms=knoten2ms(knoten);
     beaufort=knoten2beaufort(knoten);
     kmh=knoten2kmh(knoten);
     mph=knoten2mph(knoten);
     document.bf.ms.value=Math.round(ms);
     document.bf.beaufort.value=Math.round(beaufort);     
     document.bf.knoten.value=Math.round(knoten);
     document.bf.kmh.value=Math.round(kmh);
     document.bf.mph.value=Math.round(mph);
     return;
   }
   if (document.bf.beaufort.value != ""){
     beaufort=pruef_beaufort(beaufort);
     ms=beaufort2ms(beaufort);
     knoten=beaufort2knoten(beaufort);
     kmh=beaufort2kmh(beaufort);
     mph=beaufort2mph(beaufort);
     document.bf.ms.value=ms;
     document.bf.knoten.value=knoten;     
     document.bf.beaufort.value=beaufort;
     document.bf.kmh.value=kmh;
     document.bf.mph.value=mph;
     return;
   }
   if (document.bf.kmh.value != ""){
     kmh=pruef_kmh(kmh);
     ms=kmh2ms(kmh);
     knoten=kmh2knoten(kmh);
     beaufort=kmh2beaufort(kmh);
     mph=kmh2mph(kmh);
     document.bf.ms.value=Math.round(ms);
     document.bf.knoten.value=Math.round(knoten);     
     document.bf.beaufort.value=Math.round(beaufort);
     document.bf.kmh.value=Math.round(kmh);
     document.bf.mph.value=Math.round(mph);

     return;
   }
   if (document.bf.mph.value != ""){
     mph=pruef_mph(mph);
     ms=mph2ms(mph);
     knoten=mph2knoten(mph);
     beaufort=mph2beaufort(mph);
     kmh=mph2kmh(mph);
     document.bf.ms.value=Math.round(ms);
     document.bf.knoten.value=Math.round(knoten);     
     document.bf.beaufort.value=Math.round(beaufort);
     document.bf.kmh.value=Math.round(kmh);
     document.bf.mph.value=Math.round(mph);
     return;
   }


 }


 function brisiVjetar(){
   with(document.bf){
     ms.value="";
     knoten.value="";
     beaufort.value="";
     kmh.value="";
     mph.value="";
   }
 }

 function neu_knoten(){
   with(document.bf){
     knoten.value=Math.round(knoten.value);
     ms.value="";
     beaufort.value="";
     kmh.value="";
     mph.value="";
   }
 }
 
 // Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

function insertTag(taName, bbopen, bbclose) {
	var txtarea = window.document.getElementById(taName);

	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			txtarea.value += bbopen + bbclose;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		txtarea.focus();
		return;
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbopen, bbclose);
		return;
	}
	else
	{
		txtarea.value += bbopen + bbclose;
		txtarea.focus();
	}
	storeCaret(txtarea);
}

function insertOneTag(objName, text) {
	var txtarea = window.document.getElementById(objName);
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

// ZA ROLLOVER TEXT

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.firefox=this.agent.indexOf("Firefox")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.firefox)
	return this
}
var bw=new lib_bwcheck()

fromX = 0 //How much from the actual mouse X should the description box appear?
fromY = 0 //How much from the actual mouse Y should the description box appear?

//To set the font size, font type, border color or remove the border or whatever,
//change the clDescription class in the stylesheet.

//Makes crossbrowser object.
function makeObj(obj){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;		
	this.writeIt=b_writeIt;																
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_writeIt(text){
	if (bw.ns4){this.wref.write(text);this.wref.close()}
	else this.wref.innerHTML = text
}

//Capturing mousemove
var descx = 0
var descy = 0
function popmousemove(e){descx=bw.ns4||bw.ns6?e.pageX:event.x; descy=bw.ns4||bw.ns6?e.pageY:event.y}

var oDesc;
//Shows the messages
function popup(message){
    if(oDesc){
		oDesc.writeIt('<div class="clDescription">'+message+'</div>')
		if(bw.ie5||bw.ie6) descy = descy+document.body.scrollTop
		oDesc.css.left = (descx+fromX)+px
		oDesc.css.top = (descy+fromY)+px
		oDesc.css.visibility = "visible"
    }
}

//Hides it
function popout(){
	if(oDesc) oDesc.css.visibility = "hidden"
}
function setPopup(divname){
   	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove = popmousemove;
	oDesc = new makeObj(divname)
}

// END FROM kjd