/************************************************
*						*
* 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;
}

// prevod?
if ( location.search.substring(0,6) === '?lang=' ) do_gTranslate(location.search.substring(6,8));

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, prefix) {
var win = null;
var i = 0;

  w = w || 700;
  h = h || 400;
  opt = opt || "width=" + w + ",height=" + h + ",toolbar=0,resize=0";
  wname = wname || "klub300A";
  prefix = prefix || "";

  win = window.open(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_preloadimages()
{
	var d = document;
	if(d.images)
	{
		if(!d.um_pics) d.um_pics=new Array();
		var i, j = d.um_pics.length, a = um_preloadimages.arguments;
		for(i=0; i<a.length; i++)
		{
			d.um_pics[j] = new Image;
			d.um_pics[j++].src = a[i];
		}
	}
}

function um_changeimg(i)
{
	if ( i.src.indexOf('_a.jpg') > 0 )
		{
			i.src = i.src.replace(/_a\.jpg/i, '.jpg');
		}
	else
		{
			i.src = i.src.replace(/\.jpg/i, "_a.jpg");
		}
}

function um_changeanc(anc)
{

	if ( anc.getElementsByTagName )
	{
		var i = anc.getElementsByTagName("IMG").item(0);
		if ( i ) um_changeimg(i);
	}
}


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)
}


function colorMe(e,c)
{
  e.style.backgroundColor = c;
}

function povecava(src,w,h) {
	window.open('/inc/zoom.asp?slika=' + src,'','scrolling=no,menu=no,toolbar=0,width=' + w + ',height=' + h,true);
}

var jsSlika_NS = (navigator.appName=="Netscape") ? true : false;
var jsSlika_img = new Image;
function jsSlika(url, tit) {
	if ( document.getElementById("jsSlikaDiv") ) {

		// fix position for older IE's
		if ( (navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.indexOf('MSIE 7') == -1) ) {
			/*
			with ( document.getElementById("jsSlikaDivFader").style ) {
				position = 'absolute';
				left = ( document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) + 'px';
				top = ( document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) + 'px';
			}
			with ( document.getElementById("jsSlikaDiv").style ) {
				position = 'absolute';
				left = ( document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) + 'px';
				top = ( document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) + 'px';
			}
			*/
			with ( document.getElementById("jsSlikaDivFader").style ) {
				position = "absolute"; 
				width = document.body.scrollWidth + 'px';
				height = document.body.scrollHeight + 'px';
				visibility = "visible";		
			}
			with ( document.getElementById("jsSlikaDiv").style ) {
				var divTopPos = 0;
				if (document.documentElement && document.documentElement.scrollTop)
					divTopPos = document.documentElement.scrollTop;
				else
					divTopPos = document.body.scrollTop;
				position = "absolute"; 
				width = document.body.scrollWidth + 'px';
				top =  divTopPos + 'px';
				height = "100%";
				visibility = "visible";		
			}
		} else {
			with ( document.getElementById("jsSlikaDivFader").style ) { width = '100%'; height = '100%'; visibility = "visible"; }
			with ( document.getElementById("jsSlikaDiv").style ) { width = '100%'; height = '100%'; visibility = "visible"; }
		}

		jsSlika_img.src = url;
		jsSlika_img.alt = tit;
		jsSlika_img.onload = jsSlikaPrikazi;
	}
}
function jsSlikaPrikazi() {
	if ( document.getElementById("jsSlikaImg") ) {
		document.getElementById("jsSlikaImg").src = jsSlika_img.src;
		document.getElementById("jsSlikaImg").alt = jsSlika_img.alt;
		document.getElementById("jsSlikaImg").title = jsSlika_img.alt;
	}
}
function jsSlikaPopupSkrij() {
	if ( document.getElementById("jsSlikaDiv") ) document.getElementById("jsSlikaDiv").style.visibility = "hidden";
	if ( document.getElementById("jsSlikaDivFader") ) document.getElementById("jsSlikaDivFader").style.visibility = "hidden";
	if ( document.getElementById("jsSlikaImg") ) document.getElementById("jsSlikaImg").src= "/img/loader.gif";
	
}

function do_gTranslate(lang) {
    var u = encodeURIComponent(location.protocol + "//" + location.hostname + location.pathname);
    var e = (document.charset || document.characterSet);
    location.href='http://translate.google.com/translate?u=' + u + '&langpair=sl|' + lang + '&tbb=1&ie=' + e;
}
