$(document).ready(function(){
  
  //  $('#top-menu .menu .menu-link .menu-a .menupos').each(function() {
  //    $(this).parent().append('<span class="menuposshadow">'+$(this).text()+'</span>');
  //  });
  
  $(".menu-link").hover(
    function () {
      $(this).find('.submenu').css("display","block");
      $(this).css("padding-bottom","80px");
    },
    function () {
      $(this).find('.submenu').css("display","none");
      $(this).css("padding-bottom","0px");
    }
    );
      
  //slider facebook'a

  $("#fb-slide").hover(function(){
    $("#fb-slide").stop(true, false).animate({
      right:"0"
    },{
      queue:false,
      duration:500
    });
  },
  function(){
    $("#fb-slide").stop(true, false).animate({
      right:"-225"
    },{
      queue:false,
      duration:500
    });
  },400);  
  
  var fbTop=$(window).height();
  $("#fb-slide").css("top",fbTop/2-230+"px");
  
  //slider fb koniec
  
  $("div.single-realisation").hover(
    function () {
      $(this).addClass("single-realisation-active");
    },
    function () {
      $(this).removeClass("single-realisation-active");
    }
    );
        
  var currentGallery = 1;
  var galleryNumber;
  
//  drawShadowText(40, 28, 400, 200, "footer", "Bezpieczeństwo", "tahoma", 28, "#fff", "#000",0.5, 0);
//  drawShadowText(0, 0, 111,55, "footer", "Bezpieczeństwo", "tahoma", 33, "#fff", "#000",0, 0,0,1);
//  drawShadowText(39, 29, 117, 155, "ribbon", "Bezpieczeństwo   Zajebistość   Profesjonalizm   Zajebistość", "tahoma", 18, "#fff", "#000",0, 45,0,1);
  
})

var currentGallery = 1;
var galleryNumber;
  
function showNextGallery(){
    
  galleryNumber = $(".single-realisation").length;

  if (currentGallery<galleryNumber-4)
  {
    $('#gallery-body div:nth-child('+currentGallery+')').hide();
    $('#gallery-body div:nth-child('+(currentGallery+5)+')').show();
    currentGallery+=1;
  //    alert(currentGallery+' '+galleryNumber);
  }
}
  
function showPrevGallery(){
    
  galleryNumber = $(".single-realisation").length;

  if (currentGallery>1)
  {
    $('#gallery-body div:nth-child('+(currentGallery+4)+')').hide();
    $('#gallery-body div:nth-child('+(currentGallery-1)+')').show();
    currentGallery-=1;
  //        alert(currentGallery+' '+galleryNumber);
  }
}
  
function hideContent(){
    
  $('#left-content').hide();
  $('#refference-container').hide();
  $('.article')
    
}

function drawShadowText(posx, posy, width, height, target, text, font, size, color, strokecolor, strokewidth, rotate,shadowx,shadowy){
  
  var paper = new Raphael(document.getElementById(target), width, height);
  paper.setSize(width,height);
  
  var shadow = paper.text(posx+shadowx,posy+shadowy,text).attr({
    fill: "#000000",
    'font-size': size,
    'stroke': "#000000",
    'stroke-width': 1,
    'text-anchor': 'start',
    'font-weight': 'normal',
    'font-family': font,
    'stroke-opacity': 1
  });
  shadow.rotate(rotate,0,0);
  
  shadow.attr('x','20');

  var textToDraw = paper.text(posx,posy,text).attr({
    fill: color,
    'font-size': size,
    'stroke': strokecolor,
    'stroke-width': strokewidth,
    'text-anchor': 'start',
    'font-weight': 'normal',
    'font-family': font,
    'stroke-opacity': 1
  });
  textToDraw.rotate(rotate, 0, 0); 
  
// textToDraw.animate({x:-250}, 5000);
// shadow.animate({x:-250}, 5000);
 
//  textToDraw.attr({stroke: "#ff00ff", fill: "#555", translation: "14,14"});
};


