function glosuj(idf,ocena,ip)
{


url = "users.php?fun=glosuj&idf="+idf+"&ocena="+ocena+"&ip="+ip;
  startGETRequest(url, odpGlosuj, onEnd);
}


function showFilmFoto(id, fun, obj)
{


  if(!obj) return;



  var tooltipDiv = document.getElementById("filmOpis");


  
  tooltipDiv.innerHTML = "Wczytuję dane...";
  tooltipDiv.style.display = "block";

  url = "view.php?fun="+fun+"&id="+id;
  startGETRequest(url, onComplete, onEnd);
}


function addReview(id)
{

var tooltipDiv = document.getElementById("filmOpis");
  tooltipDiv.innerHTML ='<form><table><tr><td>Tre&#347;&#263;</td><td><textarea id="REC_text" class="te_rec"></textarea></td></tr><tr><td>Nick<input type="hidden" id="idFilm" value="'+id+'"></td><td><input type="text" id="autor" class="in_rec"><br/><br/><a href="javascript:sendRec();">wy&#347;lij</a></td></tr></table>';
}


function sendRec()
{

 taArea  = document.getElementById('REC_text').value;
 taAutor  = document.getElementById('autor').value;
 taId  = document.getElementById('idFilm').value;
 
 if(taArea==""){alert("Proszę wprowadzic text"); return;}
 url="recenzje.php";
 params = "tresc="+encodeURIComponent(taArea)+"&autror="+taAutor+"&idFilm="+taId;
 
 startPOSTRequest(url,params,onCompleteSendRec, onEnd);

}




function onCompleteSendRec()
{
var tooltipDiv = document.getElementById("filmOpis");
tooltipDiv.innerHTML = "<b>Recenzja została wysłana. Dziękujemy.</b>";

}


function showZwiasFoto(id, fun, obj)
{


  if(!obj) return;



  var tooltipDiv = document.getElementById("filmOpis");



  tooltipDiv.innerHTML = "Wczytuję dane...";
  tooltipDiv.style.display = "block";

  url = "view_z.php?fun="+fun+"&id="+id;
  startGETRequest(url, onComplete, onEnd);
}

function closeTooltip()
{
  var tooltipDiv = document.getElementById("filmOpis");
  tooltipDiv.style.display = "none";
}

function onComplete(text, xml)
{
  var tooltipDiv = document.getElementById("filmOpis");
  tooltipDiv.innerHTML = text;
}

function onEnd(text, xml)
{

}



function rem_film(id,idb)
{
  url = "users.php?fun=rem_film&id="+id+"&idb="+idb;
  startGETRequest(url, odp, onEnd);


}

function odpGlosuj(text,xml)
{
document.getElementById("filmUser").innerHTML = text;

}

function odp1(text,xml)
{

      document.getElementById("filmUser").innerHTML = text;
}


function rem_film_free(idrem,id2rem, typ,iddiv)
{

  
   $.post("users.php?fun=rem_film_free", { idrem: idrem, id2rem: id2rem, typ:typ, iddiv:iddiv },function(data){
    $("#dodano"+iddiv+"").html(data);  });


}

function rem_film_free_home(idrem,id2rem, typ,iddiv)
{

  
  $.post("vod/users.php?fun=rem_film_free", { idrem: idrem, id2rem: id2rem, typ:typ, iddiv:iddiv },function(data){
    $("#dodano"+iddiv+"").html(data);  });




}


function del_films(myid)
{
  urlx = "users.php?fun=del_films&myid="+myid;
  startGETRequest(urlx, del_films2, onEnd);


}


function del_film(myid, cok)
{
  urlx = "users.php?fun=del_film&myid="+myid+"&cok="+cok;
  startGETRequest(urlx, del_film2, onEnd);


}

function del_film_home(myid, cok)
{
  urlx = "vod/users.php?fun=del_film&myid="+myid+"&cok="+cok;
  startGETRequest(urlx, del_film2, onEnd);


}


function del_films2(text,xml)
{
 document.getElementById("delLink").innerHTML = text;


}

function del_film2(text,xml)
{
 document.getElementById("delLink").innerHTML = text;


}
