//ogolne funkcje sterujce dla calej strony
function Hide(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = "none" ;
}
function show(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = "block";
} 
        
 function  destroy(id)
{
    document.getElementById(id).innerHTML = "";
}    
      
function showHide(id) 
{
        
    obj = document.getElementById(id);
    obj.style.display = (obj.style.display == "block" ? "none" : "block");
}

function wartoscMinus1(id) 
{
        
    wartosc = document.getElementById(id).value;
    wartosc--;
    document.getElementById(id).value=wartosc;
}

function wolnyDiv()
{

  for(i=1;i<=10;i++)
  {
      div = 0;
      id = "wyborLek"+i;
      if(document.getElementById(id).style.display == "none")
      {
          div = id;
          break;
      }
      
   }
   
   if(div == 0)
      div = "wyborLek1";
      
   document.getElementById("wolny_div").innerHTML=div;

}

function getValue(id)
{
    var value = document.getElementById(id).value;
    return value;  
}

//XAJAX

xajax.callback.global.onRequest = function() {xajax.$('loadingPopup').style.display = 'block';}
xajax.callback.global.beforeResponseProcessing = function() {xajax.$('loadingPopup').style.display='none';} 
 
 var OnKeyRequestBuffer = 
    {
        bufferText: false,
        bufferTime: 300,
        
        modified : function(strId)
        {
                setTimeout('OnKeyRequestBuffer.compareBuffer("'+strId+'","'+xajax.$(strId).value+'");', this.bufferTime);
        },
        
        compareBuffer : function(strId, strText)
        {
            if (strText == xajax.$(strId).value && strText != this.bufferText)
            {
                this.bufferText = strText;
                if(strText != "")
                  OnKeyRequestBuffer.makeRequest(strId);
                else
                  Hide('LSResult_main');
            }
        },
        
        makeRequest : function(strId)
        {
            xajax_pokazLekBaza(xajax.$(strId).value);
        }
    }


