
	 function ocena(typ,id,div)
        {
            advAJAX.setDefaultParameters({
                onSuccess : function(obj)
                {
                    document.getElementById(div).innerHTML = obj.responseText;
                },
                onLoading : function(obj)
                {
                      document.getElementById(div).innerHTML = 'Trwa ³adowanie...';
                },
				onError : function(obj) {
					alert("Error: " + obj.status);
				},			
            });
	    advAJAX.post({
                url: "http://www.kopiujwklej.pl/glosowanie.php",
		parameters : {
   		   "typ" : typ,
		   "id" : id
  		  }
		
            });
    
        }

 	 function pokaz(id)
  {
    current=(document.getElementById(id).style.display == 'none') ? 'block' : 'none';
    document.getElementById(id).style.display = current;
  }


	function sprawdz_dlugosc(Object, MaxLen)
	{
 	 if(Object.value.length > MaxLen)
 	 {     
 	   Object.value = Object.value.substring(0, MaxLen);
 	 }
	}
	
	function dodaj() {
			advAJAX.assign(document.getElementById("dodaj_form"), {
				onLoading : function(obj) {
					document.getElementById("box-dodawanie").innerHTML += "<img src='http://www.kopiujwklej.pl/img/loading.gif'> Trwa dodawanie...";
				},
				onSuccess : function(obj) {
					document.getElementById("box-dodaj").innerHTML += "<h1>"+(obj.responseText)+"</h1>";
					document.getElementById("box-dodawanie").style.display = "none";

				},
				onError : function(obj) {
					alert("Nie moÅŸna nawiÄ?zaÄ? poÅ?Ä?czenia.");
				}
			});
		
}

onl=window.onload||Function;
onload=function(){
    onl();
    for(var i=0,d,k; d=document.getElementsByTagName('*')[i++];){
        if(d.className=='zostalo'){
            d.m=+d.innerHTML;
            (k=d.previousSibling).onkeypress=k.onkeyup=function(){
                var n=this.nextSibling;
                if(this.value.length>n.m)this.value=this.value.slice(0,n.m);
                n.innerHTML=n.m-this.value.length;
            }
        }
    }
}
