/* tiskanje dokumenta */

var strQueryString;
strQueryString = '';

function showHidee(isOn) {
  if (document.layers) {
    //Netscape 4
	if (document.hidee != null) {	
      document.hidee.visibility = isOn ? "show" : "hide";
	}
  }
  if (document.getElementById) {
    //Netscape 6
	if (document.getElementById("hidee") != null) {
      document.getElementById("hidee").style.visibility = isOn ? "visible" : "hidden";
	}
  }
  if (document.all) {
    //IE4+
	if (document.all("hidee") != null) {
      document.all("hidee").style.visibility = isOn ? "visible" : "hidden";
	}
  }
}
 
function printpreview()
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 640;
  var hght = 450;
  var lft;
  var tp;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var prn = null;
  var languagepath = location.pathname.substr(0,4)
  if(languagepath == '/en/') {
    prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + strQueryString, 'prnwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes');
  }
  else
  {
    prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + strQueryString, 'prnwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes');
  }
  if (prn.blur) prn.focus();
}

function printframe()
{
  parent.frame_print_bottom.focus();
  parent.frame_print_bottom.print();
}

/* tiskanje dokumenta */

/* preverjanje vnosnih polj */

function isChecked(checkbox, msg)
{
  if (checkbox.checked)
  {
	return true
  } 
  alert(msg)
  return false
}

function isEmpty(besedilo, msg)
{
	if (besedilo.value.length == 0)
	{
		alert(msg)
		besedilo.focus()
		return false
	} 
	return true
}

function isEmail(besedilo, msg)
{
	if (besedilo.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
	{
		alert(msg);
		besedilo.focus();
		return false;
	}
}

function isSelected(radio, msg)
{
  blnOK = false
  for (var intIndex = 0; intIndex < radio.length; intIndex++)
  {
    if (radio[intIndex].checked)
    {
      blnOK = true
    }
  }
  if (blnOK)
  {
    return true
  }
  else
  {
    alert(msg)
    return false
  }
}

function isSelectedAndEmpty(radio, condition, besedilo, msg)
{
	if (radio.selectedIndex == condition)
	{
		if (besedilo.value.length == 0)
		{
			alert(msg)
			besedilo.focus()
			return false
		}
		else
		{
			return true
		}
	}
	else
	{
		return true;
	}
}

/* preverjanje vnosnih polj */

/* flash detect */

flash_versions = 20;

var flash = new Object();
flash.installed=false;
flash.version='0.0';

if (navigator.plugins && navigator.plugins.length) {
	for (x=0; x < navigator.plugins.length; x++) {
		if (navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
			flash.installed = true;
			break;
		}
	}
}

else if (window.ActiveXObject) {
	for (x = 2; x <= flash_versions; x++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = x + '.0';
			}
		}
		catch(e) {}
	}
}

flash.ver = Array();
for(i = 4; i <= flash_versions; i++) {
	eval("flash.ver[" + i + "] = (flash.installed && parseInt(flash.version) >= " + i + ") ? true : false;");
}

/* flash detect */

/*open image*/

//really not important (the first two should be small for Opera's sake)
PositionX = 10;
PositionY = 10;
defaultWidth  = 600;
defaultHeight = 400;
 
//kinda important
var AutoClose = false;
 
//don't touch
function popImage(imageURL,imageTitle,dodatno)

{

  var languagepath = location.pathname.substr(0,4)
  if(languagepath == '/en/') {
		if (dodatno == "zapri"){ izpis = (document.layers?('<layer left="0" top="325" id="zapri">'):('<div style="position:absolute;left:0px;top:325px;" id="zapri">')) + '<img src="/library_en/images/zemljevid_zapri.gif" width="500" height="20" border="0" usemap="#Map"><map name="Map"><area shape="rect" coords="442,4,504,23" href="javascript:window.close();"><area shape="rect" coords="367,4,435,23" href="javascript:printpage();"></map>'+(document.layers?'<\/layer>':'<\/div>');} else { izpis = ''; }
  }
  else
  {
		if (dodatno == "zapri"){ izpis = (document.layers?('<layer left="0" top="325" id="zapri">'):('<div style="position:absolute;left:0px;top:325px;" id="zapri">')) + '<img src="/library_si/images/zemljevid_zapri.gif" width="500" height="20" border="0" usemap="#Map"><map name="Map"><area shape="rect" coords="442,4,504,23" href="javascript:window.close();"><area shape="rect" coords="367,4,435,23" href="javascript:printpage();"></map>'+(document.layers?'<\/layer>':'<\/div>');} else { izpis = ''; }
  }

        var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
        if( !imgWin ) { return true; } //popup blockers should not cause errors
        imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
               	'function printpage() {\n'+
				'	document.getElementById(\'zapri\').style.visibility=\'hidden\';\n'+
				'	window.print();\n'+
				'}\n'+
				'function show() {\n'+
				'	if (document.getElementById(\'zapri\').style.visibility==\'hidden\'){\n'+
				'		document.getElementById(\'zapri\').style.visibility=\'visible\';\n'+
				'	}\n'+
				'}\n'+
			   'function resizeWinTo() {\n'+
               'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
               'var oH = document.images[0].height, oW = document.images[0].width;\n'+
               'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
               'window.doneAlready = true;\n'+ //for Safari and Opera
               'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
               'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
               'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
               'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
               'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
               'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
               'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
               'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
               'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
               'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
               '}\n'+
               '<\/script>'+
               '<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
               (document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;">'))+
               '<img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();" onmousedown="show();">'+
               (document.layers?'<\/layer>':'<\/div>')+izpis+'<\/body><\/html>');
        imgWin.document.close();
        if( imgWin.focus ) { imgWin.focus(); }
        return false;
}

function openImage(imageURL,imageTitle,dodatno)

{

  var languagepath = location.pathname.substr(0,4)
	if (dodatno == "zapri"){ izpis = (document.layers?('<layer left="0" top="325" id="zapri">'):('<div style="position:absolute;left:0px;top:325px;" id="zapri">')) + '<img src="/library_en/images/zemljevid_zapri.gif" width="500" height="20" border="0" usemap="#Map"><map name="Map"><area shape="rect" coords="442,4,504,23" href="javascript:window.close();"><area shape="rect" coords="367,4,435,23" href="javascript:printpage();"></map>'+(document.layers?'<\/layer>':'<\/div>');} else { izpis = ''; }
	var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
			'function printpage() {\n'+
			'	document.getElementById(\'zapri\').style.visibility=\'hidden\';\n'+
			'	window.print();\n'+
			'}\n'+
			'function show() {\n'+
			'	if (document.getElementById(\'zapri\').style.visibility==\'hidden\'){\n'+
			'		document.getElementById(\'zapri\').style.visibility=\'visible\';\n'+
			'	}\n'+
			'}\n'+
		   'function resizeWinTo() {\n'+
		   'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		   'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		   'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		   'window.doneAlready = true;\n'+ //for Safari and Opera
		   'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
		   'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		   'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		   'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		   'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		   'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		   'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
		   'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		   'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		   'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		   '}\n'+
		   '<\/script>'+
		   '<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		   (document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;">'))+
		   '<img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();" onmousedown="show();">'+
		   (document.layers?'<\/layer>':'<\/div>')+izpis+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}


/*open image*/

/* popup window */

function openWindow(url, width, height)
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = width;
  var hght = height;
  var lft;
  var tp;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var openwnd = null;
  openwnd = window.open(url, 'openwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes');
  if (openwnd.blur) openwnd.focus();
}

/* popup window */

/* link open */
function submitLink(form) {
	var strGo = (form.linkList.options[form.linkList.selectedIndex].value);
	
	if (strGo != "")
	{
		window.location.href(strGo);
	}
}
/* link open */