function isInteger (s)
{
    var i;

     if (isEmpty(s))
     if (isInteger.arguments.length == 1) return 0;
     else return (isInteger.arguments[1] == true);

     for (i = 0; i < s.length; i++)
     {
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
     }

    return true;
}

function isEmpty(s)
{
   return ((s == null) || (s.length == 0))
}

function isDigit (c)
{
     return ((c >= "0") && (c <= "9"))
}

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.ie6 = (this.version.indexOf('MSIE 6')>0)
	this.ie7 = (this.version.indexOf('MSIE 7')>0)
	this.ff  = (navigator.userAgent.indexOf("Firefox")>0)
	this.ff2 = (navigator.userAgent.indexOf("Firefox/2")>0)
	this.min = (this.ns||this.ie)
}
is = new BrowserCheck()

var stat

function statBar(txt,time) {
   clearTimeout(stat);
   window.status = txt;
   stat=setTimeout("statErase()",time);
}

function statErase() {
   window.status="dLibra - biblioteka cyfrowa";
}

function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}

function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src")
	}
}

function setCookie(name, value, expires, path, domain)
{
    var exp = new Date();
    var ex = new Date(exp.getTime()+expires);
    var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + ex.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "");
    document.cookie = curCookie; 
} 

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results )
    return ( unescape ( results[1] ) );
  else
    return null;
}

function hideLinks( whichSelect, link, val )
{
   if(document.forms.collections[whichSelect].value == val)
   {
     document.getElementById(link).style.visibility = 'hidden';
   }
   else
   {
     document.getElementById(link).style.visibility = 'visible'
   }
}
function hideSelect(){
  
  for (j=0; j<document.forms.length; j++) 
  {
       var tform = document.forms[j]
       for(i=0; i<tform.elements.length; i++)
       {
         if(tform.elements[i].type == "select-one") 
         {
           tform.elements[i].style.visibility = "hidden";
         }
       }
  }
}
function unhideSelect(){

 for (j=0; j<document.forms.length; j++) 
 {
      var tform = document.forms[j]
      for(i=0; i<tform.elements.length; i++)
      {
        if(tform.elements[i].type == "select-one") 
        {
          tform.elements[i].style.visibility = "visible";
        }
      }
 }
}




