(function($) {
  var cache = [];
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);

$(document).ready(function() {
  if ($("#portfolio").length) {
		var portfolio = $("#portfolio");
    portfolio.scrollable({
      size: 1,
      clickable: false,
      globalNav: true,
      onSeek: function (event, index) {
        var api = portfolio.data("scrollable");
        var items = api.getItems();
        var currentItem = items[index];
        // window.location.hash = $(currentItem).attr("name");
      }
    });
    // var api = portfolio.data("scrollable");
    // var hash = window.location.hash.replace("#", "")
    // if (hash.length == 0) {
    //   window.location.hash = $(portfolio.data("scrollable").getItems()[0]).attr("name");
    // } else {
    //   $("#portfolio .items .page").each(function(index) {
    //     if ($(this).attr("name") == hash) {
    //       api.seekTo(index, 0);
    //     }
    //   });
    // }
  }
  $(".portfolioNavigation .turnLeft, .portfolioNavigation .turnRight").click(function() {
    return false;
  })
  jQuery.validator.messages.required = "";
	if (codeigniterLanguage == "ru") {
  	jQuery.validator.messages.email = "Пожалуйста, введите правильный email.";
	}
  $("#contactUsForm").validate();
	// if ($.cookie("hide_metaman") == "true") {
	// 	$(".metamanQuote").hide();
	// } else {
	// 	$(".metamanQuote").show();
	// }
	// $(".metamanQuote span a").click(function() {
	// 	$.cookie("hide_metaman", "true", {expires: 1});
	// 	$(this).parent().parent().slideUp();
	// 	return false;
	// });
});
