function Is() {
    var agent = navigator.userAgent.toLowerCase();
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
    this.ns2 = (this.ns && (this.major == 2));
    this.ns3 = (this.ns && (this.major == 3));
    this.ns4b = (this.ns && (this.minor < 4.04));
    this.ns4 = (this.ns && (this.major >= 4) && (this.major < 5));
    this.ie   = (agent.indexOf("msie") != -1);
    this.ie3  = (this.ie && (this.major == 2));
    this.ie4  = (this.ie && (this.major >= 4));
    this.op3 = (agent.indexOf("opera") != -1);
    this.win   = (agent.indexOf("win")!=-1);
    this.mac   = (agent.indexOf("mac")!=-1);
    this.unix  = (agent.indexOf("x11")!=-1);
    this.moz  = ((agent.indexOf("mozilla")!=-1) && (this.major >= 5));
}

var is = new Is();
function onerror() { document.location.href = "javascript:"; }

if(is.ns4||is.ns2||is.ns3||is.ns4b) { doc = "document"; sty = ""; htm = ".document"; hidden='hide'; visible='show' } 
else if(is.ie4) { doc = "document.all"; sty = ".style"; htm = "" ; hidden='hidden'; visible='visible'}

function hide(layer) {
		 if (document.all || document.layers) {
		 	 	  eval(layerRef + '["' + layer + '"]' + styleRef + '.visibility ="' + hidden + '"');
		 }
}
function show(layer) {
	if (is.ie4 || is.ns ) {
	    eval(doc + '["' + layer + '"]' + sty + '.visibility = "' + visible +'" ');
	}
	
}

function ChangeImg(prefix,newim,IndexMax,dok,iprefix) {
     newprev = newim - 1;
	 newnext = newim + 1;
	 if (newprev <= 0 ) {
	     newprev = IndexMax;
	 }
	 if (newnext > IndexMax) {
	     newnext = 1;
	 }
     dok.links[0].href = 'javascript:ChangeImg(prefix,' + newprev + ',IndexMax,document,iprefix)';
	 dok.links[0].onClick= 'dok.links[0].blur()';
 	 dok.links[1].onClick= 'dok.links[1].blur()';
     dok.links[1].href = 'javascript:ChangeImg(prefix,' + newnext + ',IndexMax,document,iprefix)';
	  dok.images["obraz"].src = 'grafika/p.gif';
//	 temp_img = new Image(); temp_img.src = 'grafika/' + prefix + '/' + iprefix + '-' + newim + '-b.jpg';
	
	 dok.images["obraz"].src = 'grafika/' + prefix + '/' + iprefix + '-' + newim + '-b.jpg';
	// 	 document.all.moment.style.visiblity = "visible";
     dok.title = prefix + '-' + newim; 	
}

function OpenWin(which,prefix,newim,IndexMax)
{
    
    if (navigator.appName == "Netscape" &&
parseInt(navigator.appVersion) >= 3)
    {
       Okno = window.open(which, "okno",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=580")
       Okno.focus();
	
    }
    else if (navigator.appName == "Microsoft Internet Explorer" &&
parseInt (navigator.appVersion) >= 4)
    {
       Okno = window.open(which, "okno",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=580")
	
    }
        else
        {
       Okno = window.open(which, "okno",
"toolbar=0,location=0,directories=0,status=0,menubar=s0,scrollbars=0,resizable=0,width=350,height=580")
          	Okno.onLoad = ChangeImg(prefix,newim,IndexMax,Okno.document);					
        }

}


function OpenWin2(which,width,height,name)
{
var scroll = 0;
if (screen.availHeight < height ){
	height = screen.availHeight;
	scroll = 1;
}
if (screen.availWidth < width ){
	width = screen.availWidth;
	scroll = 1;
}

x = (screen.availWidth - width)/2;
y = (screen.availHeight - height)/2;
    if (navigator.appName == "Netscape" &&
parseInt(navigator.appVersion) >= 3)
    {
      okno = window.open(which, name,
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0,width=" + width + ",height=" + height)
	  okno.moveTo(x,y);
      okno.focus();
    }
    else if (navigator.appName == "Microsoft Internet Explorer" &&
parseInt (navigator.appVersion) >= 4)
    {
     okno =   window.open(which,name,
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0,width=" + width + ",height=" + height);
   okno.moveTo(x,y);
      okno.focus();
    }
        else
        {
   okno = window.open(which,name,
"toolbar=0,location=0,directories=0,status=0,menubar=s0,scrollbars="+scroll+",resizable=0,width=" + width + ",height=" + height);
okno.moveTo(x,y);
      okno.focus();
        }
}

