 var xmlHttpReq;
 
 
if(typeof XMLHttpRequest != 'undefined')
{
  try
  {
    xmlHttpReq = new XMLHttpRequest();
  }
  catch(e)
  {
          try {
            xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
          } catch (e) {
          try {
            xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) {
          try{
            xmlHttpReq = new ActiveXObject('Msxml2.XMLHTTP.3.0');
          }
          catch (e){  
            alert('nelze vytvořit xmlHttpRequest');
          }  
          }
         }
  }
}
else
{
  try {
          xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
        try {
          xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
          try{
            xmlHttpReq = new ActiveXObject('Msxml2.XMLHTTP.3.0');
          }
          catch (e){  
            alert('nelze vytvořit xmlHttpRequest');
          }
  }
}
}

var data = sendRequest("POST", "/functions.php", "sender=sendRequest&type=new_tuts");

function reloadNewTuts(id)
{

  
  pocet = document.forms["formik"+id]["qty"+id].value;
  data = sendRequest("POST", "/functions.php", "sender=sendRequest&type=new_tuts&id="+id+"&pocet="+pocet);
  document.getElementById('my_conten').innerHTML = data;
  
  var ScrollTop = document.body.scrollTop;
  if (ScrollTop == 0){
    if (window.pageYOffset) ScrollTop = window.pageYOffset;
    else ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
  }
    
  if (window.innerWidth || window.innerHeight){ 
    docwidth = window.innerWidth; 
    docheight = window.innerHeight; 
  } 
  //IE Mozilla 
  if (document.body.clientWidth || document.body.clientHeight){ 
    docwidth = window.screen.width; 
    docheight = window.screen.height; 
  }
  
  
  document.getElementById('kosikok').style.left = Math.round((docwidth-300)/2)+'px';
  if(ScrollTop == 0) {
    document.getElementById('kosikok').style.top = Math.round((Math.abs(ScrollTop+(docheight)/2))-100)+'px';
  }
  else{
    document.getElementById('kosikok').style.top = Math.round(((docheight)/2+ScrollTop)-160)+'px';
  }
  
  $("#kosikok").fadeIn("slow").delay(2000).fadeOut("slow");
  
  
  
  
  

  
    
  
}

function newItem(poradi)

{
  
  
  data = sendRequest("POST", "/functions.php", "sender=sendRequest&type=new_item&typ="+poradi);
  
  
  $("#super").html(data).fadeIn("slow").delay(500);
  
  if(poradi=="start"){
    t = setTimeout("newItem('start')", 1500 );
    $("#super").fadeOut(200);
  }
  else{
    clearTimeout(t);
  }  
}

function reloadNewPicture(id)

{
  
  data = sendRequest("POST", "/functions.php", "sender=sendRequest&type=new_picture&id="+id);
  document.getElementById('picture').innerHTML = data;
}



function sendRequest(getOrPost, page, params)
{
  var strResult;
  if(getOrPost.toUpperCase() == "POST")
  {
    xmlHttpReq.open("POST", page, false);
    xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpReq.send(params);
  }
  else
  {
    xmlHttpReq.open("GET", page + "?" + params, false);
    xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlHttpReq.send(null);
  }
  strResult = xmlHttpReq.responseText;
  return strResult;
}


