//new product slider
$(document).ready(function(){
  $('.last-pro li:first').show().addClass('on');
  
  $('.l').click(function() {
    var Current = $('.last-pro li.on');
	
	if(Current.next().length){
      
	  Current.hide().removeClass('on');
      Current.next().fadeIn().addClass('on');
    }
	else
	{
	//alert ($('.last-pro li').size());
	  
	    if(!Current.next().next().length){
	      $(this).css('background', 'url(http://babuca.gol.ge/wp-content/themes/Mze/images/nav-buttons.jpg) bottom right');
        }
	}
	
  });

  $('.r').click(function() {
    var Current = $('.last-pro li.on');
	
	if(Current.prev().length){
      
	  Current.hide().removeClass('on');
      Current.prev().fadeIn().addClass('on');
    }
	else
	{
	//alert ('distance');
	  $(this).css('background', 'url(http://babuca.gol.ge/wp-content/themes/Mze/images/nav-buttons.jpg) bottom left');
	}
	
  });

});


$(document).ready(function(){

$('#tabs a').click(function(event) {
  event.preventDefault();
  
  $('#tabs a').removeClass('selected');
  $(this).addClass('selected');
  
  $('.tab-content').hide();
  $($(this).attr('href')).fadeIn();
});

});

$(document).ready(function(){

$('.compare-this a').click(function(event) {
  event.preventDefault();
  
  $.cookie('sampleCookie', 'cookieValue');
  
  alert ($.cookie('sampleCookie'));
  alert ('distance');
});

});


$(document).ready(function(){

$('.grid-view').click(function(event) {
  $('.product-list').addClass('product-grid').removeClass('product-list');
  $('.list-view').addClass('link');
  $('.grid-view').removeClass('link');
});

$('.list-view').click(function(event) {
  $('.product-grid').addClass('product-list').removeClass('product-grid');
  $('.list-view').removeClass('link');
  $('.grid-view').addClass('link');
});

});


//
function update() {
  var Current = $('.gbslider li.on').fadeOut(1000).removeClass('on');
  Current.next().fadeIn(1000).addClass('on');
  
  window.setTimeout(update, 4000);
  
  if(!Current.next().length){
	$('.gbslider li:first').fadeIn().addClass('on');
  }
}

$(document).ready(function(){
  $('.gbslider li:first').show().addClass('on');
  update();
});
