function menu () {
  var R = Raphael("menu", 600, 160);
  
  var passive = { 
    fill: "#333", 
    "stroke-linejoin": "round", 
    "fill-opacity":"0", 
    "stroke-width":"0",
    "stroke-opacity":"0"
  };
  
  var hover = { "fill-opacity":"0.1" };

  var guitar = {};

  guitar.istorija = R.path("m 317.83791,2.50062 c -0.71732,18.52537 59.35122,15.10161 46.21875,42.78125 8.76848,0.35054 26.51573,3.76493 43.28125,8.3125 18.355,4.9787 36.79441,12.24687 44.6875,21.96875 18.59925,-3.87919 36.86865,-8.36686 54.12505,-11.78125 13.2647,-2.62465 25.9235,-4.5908 37.7187,-5.15625 -49.3941,-8.19237 -91.07309,-28.69501 -116,-56.125 l -110.03125,0 z").attr(passive);
  guitar.klausk = R.path("m 430.61916,2.00062 c 27.03092,28.84114 73.3866,49.88523 127.7813,56.1875 14.3041,1.02365 27.7328,5.53444 37.9687,14.34375 1.3422,-15.82403 1.479,-31.82051 1.5,-46.6875 l 0,-23.84375 -167.25,0 z").attr(passive);
  guitar.pagrindinis = R.path("m 246.64242,50.68239 -142.3125,4.03125 c 4.17783,10.42286 4.49568,20.95598 1.53125,30.28125 l 138.71875,0 c 3.89613,-5.62634 5.87973,-10.86271 6.1875,-15.8125 0.30707,-4.93862 -1.06369,-11.03499 -4.125,-18.5 z").attr(passive);
  guitar.naujienos = R.path("m 362.99416,46.84437 -114.25,3.21875 c 2.9223,7.28716 4.32531,13.4556 4,18.6875 -0.31375,5.04605 -2.27026,10.30904 -5.78125,15.6875 l 141.0625,0 c 20.35017,-0.31035 41.27906,-4.72381 61.78125,-8.9375 -7.65564,-8.51668 -25.36198,-15.68452 -43,-20.46875 -14.35865,-3.76562 -29.05761,-7.27069 -43.8125,-8.1875 z").attr(passive);
  guitar.renginiai = R.path("m 506.52546,65.25062 c -36.4727,7.2166 -77.76954,20.33543 -117.4063,21.15625 14.48342,26.4066 -12.23532,30.39827 -29.3125,44 -8.23678,8.17036 7.82691,16.4014 19.84375,17.09375 21.7795,0.7768 40.5283,-10.50341 60.34375,-17.59375 7.50633,-2.29341 16.22147,-0.96857 25.5,2.09375 7.7506,-6.57893 25.3432,-18.45742 47.25,-25.09375 10.3328,-3.13015 21.7729,-5.18035 33.875,-5.15625 14.9289,-0.32957 29.1699,3.77439 42.8437,9.34375 3.5428,-11.76635 5.5202,-23.91552 6.6876,-36.125 -8.741,-7.97757 -20.304,-12.64274 -32.5938,-14.25 -19.0938,-2.3603 -38.2983,1.00733 -57.0312,4.53125 z").attr(passive);
  guitar.media = R.path("m 546.77546,103.71937 c -11.9722,-0.0229 -23.2944,2.01157 -33.4688,5.09375 -20.7184,6.27636 -37.5955,17.41042 -45.5625,23.9375 22.9129,8.14307 48.8118,25.78837 68,25.25 31.8513,-1.67826 45.6256,-21.61178 53.125,-44.96875 -14.336,-6.64029 -28.6207,-9.28669 -42.0937,-9.3125 z").attr(passive);


  for (var state in guitar) {
    (function (st, state) {
      st[0].style.cursor = "pointer";

      st.hover(function (event) {
        this.attr(hover);
        R.safari();
      }, function (event) {
        this.attr(passive);
        R.safari();
      });

      st.click (function (event) {
        location.href = "/index.php/lt/home-"+state+".html";
      });
    })(guitar[state], state);
  }
}

function heights () {
  $("#homePicture").height($("#homeVideo").height());
  $("#homeNewsItem").height(parseInt($("#homeEvents").outerHeight())+parseInt($("#homeNewsItems").outerHeight())-20);
}

function randomColors () {

}

function lightbox () {
  $('.lightbox a').lightBox({
    imageLoading: '/lcCorePlugin/images/jquery-lightbox/lightbox-ico-loading.gif',
    imageBtnClose: '/lcCorePlugin/images/jquery-lightbox/lightbox-btn-close.gif',
    imageBtnPrev: '/lcCorePlugin/images/jquery-lightbox/lightbox-btn-prev.gif',
    imageBtnNext: '/lcCorePlugin/images/jquery-lightbox/lightbox-btn-next.gif',
  }); 
}


var current;

function promotion () {
  if (current == undefined)
  {
    $("#promotionItems .content").hide();
    current = $("#promotionItems .content").first();
  }
  else if (current.attr('id') == null)
  {
    $("#promotionItems .content").hide();
    current = $("#promotionItems .content").first();   
  }
  else
  {
    current.prev().hide();
  }
  
  current.show();
  current = current.next();
}

$(document).ready(function() {
  menu();
  heights();
  randomColors();
  lightbox();
  promotion();
  setInterval(promotion, 10000);  
});

