/************************************************
*						*
* splosnovizija					*
*						*
************************************************/
var isNN, isIE, isMac, isMoz;
var agent = navigator.userAgent;
var js_glo_jezik = "si";


isMac = (agent.lastIndexOf('Mac') < 0);

if (document.all){
	isIE = true;
} else if (document.layers){
	isNN = true;
	document.captureEvents(Event.MOUSEMOVE | Event.MOUSEUP | Event.RESIZE);
	window.onresize=um_resize;
} else if (navigator.userAgent.indexOf('Gecko') != -1) {
	isMoz = true;
}

// netscapove neumnosti...
if (isNN){
   var ws = window.innerWidth;
   var hs = window.innerHeight;
}

function um_resize(){
	if (isNN) {
		if ((window.innerWidth != ws) || (window.innerHeight != hs)){
			window.location.href = window.location.href;
		}
	}
}

// čisto nič
function donull () {}

function um_okno(url, w, h, opt, wname) {
var win = null;
var i = 0;

	w = w || 700;
	h = h || 400;
	opt = opt || "width=" + w + ",height=" + h + ",toolbar=0,resize=0";
	wname = wname || "NovomestoA";

	win = window.open("/" + js_glo_jezik + "/inc/okno/?v=" + url, wname, opt);

	if (!win.opener) {
		win.opener = self;
	}

	if (window.focus) {
		win.focus()
	}

}

function um_map(x, y, m) {
	um_okno('/' + js_glo_jezik + '/etc/karta/default.asp?data=' + x + '_' + y + '_' + m,790,580, null, 'NovomestoMap');
}

function um_slika(img, desc, sour) {
	desc = desc || '';
	sour = sour || '';
	um_okno('/' + js_glo_jezik + '/etc/slika/default.asp?data=' + img + '_' + desc + '_' + sour,0,0,'width=770,height=598,resizable=1', 'NovomestoSlika');
}

function um_print(w) {
	if (w.print) {
		w.print();
	} else {
		alert('Za tiskanje te strani izberite ustrezen ukaz v meniju ali gumb v orodjarni brskalnika!');
	}
	return true;
}


// stvaritev layerja - crossbrowser
function ustvari(ime,w,h,x,y,z,vidno,vsebina,dodatnoNN,dodatnoIE) {
	if (isNN) {
		vidno ? vidno = 'show' : vidno = 'hide';
		document.write('<layer width='+w+' height='+h+' left='+x+' top='+y+' name="'+ime+'" z-index='+z+' visibility="'+vidno+'" '+dodatnoNN+'>'+vsebina+'</layer>');
	} else if (isIE || isMoz) {
		vidno ? vidno = 'visible' : vidno = 'hidden';
		document.write('<div id="'+ime+'" style="position:absolute;width:'+w+';height:'+h+';left:'+x+';top:'+y+';z-index:'+z+';visibility:'+vidno+';'+dodatnoIE+'" >'+vsebina+'</div>');
	}
}

// premikanje layerja - crossbrowser
function premakni(id,x,y){
	if (isNN){
		if (x != null) document.layers[id].left = x;
		if (y != null) document.layers[id].top = y;
	} else if(isIE){
		if (x != null) document.all[id].style.posLeft = x;
		if (y != null) document.all[id].style.posTop = y;
	} else if (isMoz) {
		if (x != null) document.getElementById(id).style.left = x;
		if (y != null) document.getElementById(id).style.top = y;
	}
}


// vidnost layerja - crossbrowser
function vidnost(id, vidno) {
	if (isNN) {
		vidno ? vidno = 'show' : vidno = 'hide';
		if ( document.layers[id] ) document.layers[id].visibility = vidno;
	} else if (isIE) {
		vidno ? vidno = 'visible' : vidno = 'hidden';
		if ( document.all[id] ) document.all[id].style.visibility = vidno;
	} else if (isMoz) {
		vidno ? vidno = 'visible' : vidno = 'hidden';
		if ( document.getElementById(id) ) document.getElementById(id).style.visibility = vidno
	}
}

// premik & prikaz layerja - crossbrowser
function prikazxy(id, x, y, offsetx) {
	if (isNN) {
		if (x != null) document.layers[id].left = x + offsetx;
		if (y != null) document.layers[id].top = y;
		document.layers[id].visibility = 'show';
	} else if (isIE) {
		if (x != null) document.all[id].style.posLeft = x + offsetx;
		if (y != null) document.all[id].style.posTop = y;
		document.all[id].style.visibility = 'visible';
	} else if (isMoz) {
		if (x != null) document.getElementById(id).style.left = x + offsetx;
		if (y != null) document.getElementById(id).style.top = y;
		document.getElementById(id).style.visibility = 'visible';
	}
}

// menjava slike na layerju - crossbrowser
function menjajImg(kaj,novSrc,nnLayer){
	var layerInfo = "";
	if (isNN){
		layerInfo = nnLayer;
	}
	eval(layerInfo + "document.images['" + kaj + "'].src = '" + novSrc.src + "'");
}


// blinkovizija
function um_blink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}
function um_startblink() {
  // Make sure it is IE4, what about moz?
  if (document.all)
    setInterval("um_blink()",1000)
}
