
function stripslashes(str) {
  str=str.replace(/\\'/g,'\'');
  str=str.replace(/\\"/g,'"');
  str=str.replace(/\\0/g,'\0');
  str=str.replace(/\\\\/g,'\\');
return str;
}

$(document).ready(function(){

  $('.przycisk').mouseover(
    function(){
        var adres=$(this).attr('src');
        var pozycja = adres.indexOf('.');
        var dlugosc = adres.length;
        var nazwa = adres.substring(0, pozycja)
        var ext = adres.substring(pozycja, dlugosc+1)
        $(this).attr('src',nazwa+'2'+ext);
      }
  )
  $('.przycisk').mouseout(
    function(){
        var adres=$(this).attr('src');
        var pozycja = adres.indexOf('.');
        var dlugosc = adres.length;
        var nazwa = adres.substring(0, pozycja-1)
        var ext = adres.substring(pozycja, dlugosc+1)
        $(this).attr('src',nazwa+ext);
      }
  )
});

$(document).ready(
function(){

  $(".search-q").focus(
    function(){
      this.value="";
    }
  );
  
  $("#komentarz").focus(
    function(){
      if(this.value=="Komentarz...") this.value="";
    }
  );

	$(".readmore").click(function(){
		var kod = $(this).attr("id");
		//$(this).children().attr("src","layout/blog/loading.png");
		var e = this;
	   $.ajax({
      type: "POST",
      url: "system/trescprovider.php",
      data: "q="+kod,
      success: function(msg){
      document.getElementById("blog-ajax-"+kod).innerHTML = msg;
      $("#blog-ajax-"+kod).toggle("blind", { direction: "vertical" }, 2000);
		  if($(e).html()=="Schowaj artykuł")
		    $(e).html("Rozwiń artykuł");
		      else $(e).html("Schowaj artykuł");
      }
	   });
  });
});

$(document).ready(
function(){
  $(".galeria-fota img").fadeTo(0,0.6);
  $(".galeria-fota img").mouseover(function(){
      $(this).fadeTo(500,1);
  });
  $(".galeria-fota img").mouseout(function(){
      $(this).fadeTo(500,0.6);
  });
  $("div.kod").each(function(){
    var d = $(this).children().html();
    $(this).children().text(d);
  });
  $("div.kod").not('.no').each(function(){
    var d = $(this).children().text();
    var l = $(this).attr('name');
    var ref = $(this);
    $.ajax({
      type: "POST",
      url: "system/geshi.php",
      data: 'd='+encodeURIComponent(d)+'&l='+l,
      success: function(msg){
        ref.html(msg);
      }
	   });
  });
});

function addcomment(){

var dane = "nick="+encodeURIComponent(document.getElementById('nick').value)+
           "&komentarz="+encodeURIComponent(document.getElementById('komentarz').value)+
           "&web="+document.getElementById('web').value+
           "&art="+document.getElementById('art').value;

$.ajax({
   type: "POST",
   url: "system/addcomment.php",
   data: dane,
   success: function(msg){
     $("#addkomentarz").fadeOut(500,function () {
      $("#addkomentarz").html(msg);
      $("#addkomentarz").fadeIn(500);
     });
     
   }
 });
}

function addcommentgalery(){

var dane = "nick="+encodeURIComponent(document.getElementById('nick').value)+
           "&komentarz="+encodeURIComponent(document.getElementById('komentarz').value)+
           "&web="+document.getElementById('web').value+
           "&art="+document.getElementById('art').value;

$.ajax({
   type: "POST",
   url: "system/addcommentgalery.php",
   data: dane,
   success: function(msg){
     $("#addkomentarz").fadeOut(500,function () {
      $("#addkomentarz").html(msg);
      $("#addkomentarz").fadeIn(500);
     });
     
   }
 });
}
