  // functions for AJAX

  function showHint(str, focusID) { // example of user fuction
      prodDiv = document.getElementById("txtHint");
      loadingBar = document.getElementById("loadingbar");
      // nastavit zobrazovaci div ku produktu
      myOffsetObject = document.getElementById(focusID);
      prodDiv = document.getElementById("txtHint");
      prodDiv.style.top = myOffsetObject.offsetTop + "px";
      prodDiv.style.left = myOffsetObject.offsetLeft + "px";
      prodDiv.style.left = eval(screen.Width/2) -300 + "px";

      loadingBar.style.left = myOffsetObject.offsetLeft + "px";
      loadingBar.style.left = eval(screen.Width/2) -300 + "px";
      loadingBar.style.top = myOffsetObject.offsetTop + "px";

      prodDiv.style.top = myOffsetObject.offsetTop + "px";

      // variable test
        if (str.length==0) {
          document.getElementById("txtHint").innerHTML="";
          return;
        }
      // AJAX support test
        xmlHttp=GetXmlHttpObject()
        if (xmlHttp==null) {return;} // browser does not support AJAX!
      // Defines the url (filename) to send to the server
        var url="detailPR2.php";
      // Adds a parameter (q) to the url with the content of the input field
        url=url+"?idPR="+str;
      // Adds a random number to prevent the server from using a cached file
        url=url+"&sid="+Math.random();
      // Creates an XMLHTTP object, and tells the object to execute a function called stateChanged when a change is triggered
        xmlHttp.onreadystatechange=stateChanged;
      // Opens the XMLHTTP object with the given url
        xmlHttp.open("GET",url,true);
      // Sends an HTTP request to the server
        xmlHttp.send(null);
  }

  function GetXmlHttpObject() { // ajax init function
    var xmlHttp=null;
    try { /* Firefox, Opera 8.0+, Safari */
      xmlHttp=new XMLHttpRequest();
    }
    catch (e) { // Internet Explorer
      try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
      catch (e) {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
    }
    return xmlHttp;
  }

  function stateChanged() {
    if (xmlHttp.readyState==0) {} /* The request is not initialized */
    if (xmlHttp.readyState==1) {} /* The request has been set up */
    if (xmlHttp.readyState==2) {
          document.getElementById("loadingbar").style.display = "block";
          location.href="#loadingbar";
    } /* The request has been sent */
    if (xmlHttp.readyState==3) {} /* The request is in process */
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { //   The request is complete
      // Get the data from the server's response
      document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
      document.getElementById("loadingbar").style.display = "none";
      zobraz_produkt();
    }
  }



  function zobraz_produkt() {
      prodDiv = document.getElementById("txtHint");
      bgDiv = document.getElementById("txtHintOut");
      //focusDiv = document.getElementById(focusDiv);

      prodDiv.style.display="block";
      bgDiv.style.display="block";

      bgDiv.style.top="0px";
      bgDiv.style.left="0px";
      bgDiv.style.width = "100%"; //bodyWidth();
      bgDiv.style.height = bodyHeight();

      location.href="#txtHint";
  }


  function bodyWidth() {
    this.windowX = (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth;
    this.scrollX = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;
    this.pageX = (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth;
    return pageX + "px";
  }

  function bodyHeight() {
    this.windowY = (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight;
    this.scrollY = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
    this.pageY = (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight;
    return pageY + "px";
  }
