
$(function () {  
  
  var p1 = document.getElementById("p1");
  var p2 = document.getElementById("p2");
  var p3 = document.getElementById("p3");
  var p4 = document.getElementById("p4");
  var p5 = document.getElementById("p5");
  var p6 = document.getElementById("p6");
  var p7 = document.getElementById("p7");
  var p8 = document.getElementById("p8");

    
  $('#p1').click(function(){
    p1.parentElement.removeChild(p1);
  }); 

  $('#p2').click(function(){
    p2.parentElement.removeChild(p2);
  }); 

  $('#p3').click(function(){
    p3.parentElement.removeChild(p3);
  }); 
  
  $('#p4').click(function(){
    p4.parentElement.removeChild(p4);
  }); 

  $('#p5').click(function(){
    p5.parentElement.removeChild(p5);
  }); 

  $('#p6').click(function(){
    p6.parentElement.removeChild(p6);
  }); 
  
  $('#p7').click(function(){
    p7.parentElement.removeChild(p7);
  }); 

  $('#p8').click(function(){
    p8.parentElement.removeChild(p8);
  }); 
  
  $('#arrow_right').click(function () {
    if (typeof licznik == 'undefined') {
      licznik = 2;
      $('img').attr({src:'img/7/2.jpg'}).css('opacity','1');
      document.getElementById("p4").style.visibility = "visible";
      document.getElementById("p5").style.visibility = "visible";  
      document.getElementById("p6").style.visibility = "visible";
      p1.parentElement.removeChild(p1);
      p2.parentElement.removeChild(p2);
      p3.parentElement.removeChild(p3);

    } else if (licznik = 2) {
      $('img').attr({src:'img/7/3.jpg'}).css('opacity','1');
      document.getElementById("p7").style.visibility = "visible";
      document.getElementById("p8").style.visibility = "visible";  
      p4.parentElement.removeChild(p4);
      p5.parentElement.removeChild(p5);
      p6.parentElement.removeChild(p6);
    };   
    
  });

});


