function hideloader() {
	
	document.getElementById('ajax_loader').style.display = 'none';
}

function showloader() {
	
	document.getElementById('ajax_loader').style.display = 'block';
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		}
	]

};
BrowserDetect.init();


function show_secadd()
{
  var style = document.getElementById("secadd").style;
  style.display = style.display == "none"? "inline" : "none";
}
function addfavorites(){
	
	var tytul = 'Szkoła Podstawowa nr 29 im. Adama Mickiewicza';
	var adres = 'http://www.sp29.lublin.pl';
	
	//FireFox
  if (window.sidebar) { 

      window.sidebar.addPanel(tytul, adres, ""); 

	//IE
  } else if (window.external) {

			window.external.AddFavorite(adres, tytul); 
	}
	else if (window.opera) {
	
		var f = document.getElementById('fav');
		f.setAttribute('href', adres);
		f.setAttribute('title', tytul);
		f.setAttribute('rel','sidebar');	
	}
}

function spr_text(text,q) { 

with(document.forms[0]) { //dla Opery
 
  var maxlen = 300;
  var normal = 0;
  var enters = 0; 
	
	if (navigator.appName == "Netscape") {
	
	for (i=0; i<text.value.length; i++) { 

		if (text.value.charAt(i) == "\n") { //gdy enter
       normal++; 
       enters++; 
			}
		else {normal++;}		
	
	}
	
	q.value = maxlen - normal - enters;
	
  if (normal+enters>maxlen) { 	
      text.value = text.value.substring(0,maxlen-enters);
			
		q.value = 0; 	
    alert("Maksymalna długość wpisu to " + maxlen +"!"); 			
		}
		
	}//Netscape
	
	else {
	
	for (i=0; i<text.value.length; i++) { 

		normal++;
		
  }
	
	q.value = maxlen - normal;
	
  if (normal>maxlen) { 	
      text.value = text.value.substring(0,maxlen);
			
		q.value = 0; 	
    alert("Maksymalna długość wpisu to " + maxlen +"!"); 			
		}	

	
	}//else
	
}//with

}	

function MyScroll(o) {

  this.z=document.getElementById(o);     
  this.n=document.getElementById(o+'W'); 
  this.s=this.n.style;                 
  
  this.l=0;  //stoper
  this.y=0;  //pozycja

  this.w=this.n.offsetHeight-this.z.offsetHeight; 

  this.obj=o+"Ob"; //ten obiekt nazwiemy... jak warstwa + Objt
  eval(this.obj+"=this") //odwołanie do samego siebie
  
  this.krok=ScrollKrok;
  this.przesun=ScrollPrzesun;
  this.stop=ScrollStop;
	this.begin = ScrollBegin;
  
  function ScrollStop()  {
    
		clearInterval(this.l)
  }
    
	function ScrollBegin() {
	
		this.y = 0;
	}
	
  function ScrollPrzesun(k) {
	
    this.stop();
    this.l=setInterval(this.obj+'.krok('+k+')',200)
  }
  
  function ScrollKrok(k) {
	
   if (k<0 && this.y<=0 ) {
      
			this.y-=k;
      this.s.top=this.y+'px';
   } 
	 else if (k>0 && this.y>-this.w) {
	 
      this.y-=k;
      this.s.top=this.y+'px';   
   }
	 else this.y = 0; // przesuwanie od początku
  }
} 

function inicjuj(k){

	S1 = new MyScroll('pierwszyScroll'); 
	S1.przesun(k);
} 
