// JavaScript Document

		$(document).ready(function(){
			$('a.btn-power').click(function() {
			   $('body').toggleClass('light');
			   return false;
			});
			$('div.G1').galleryScroll({
				step:1,
				duration:300,
				funcOnclick:function(){
					$('p.margin').html($('ul',this).css('marginLeft'));
				}
			});
			$('div.G2').galleryScroll({
				step:2,
				duration:300,
				circleSlide: true
			});
			$.preloadImages("/images/bg-header-light.jpg", "/images/bg-main-light.gif", "/images/btn-next-active.png", "/images/btn-prev-active.png", "/images/btn-next-dis.png", "/images/btn-prev-dis.png", "/images/rur-light.gif", "/images/btn-prev-light.png", "/images/btn-next-light.png", "/link-holder-light.png");
			
			$('.one-product-priviews a').click(function(){
				$('.one-product-priviews li').removeClass('active');
				$(this).parent('li').addClass('active');
				$('#one-product-main-image img').attr('src', $(this).attr('href'));
				return false;
			});			
			
			$('.photos-previews a').click(function(){
				$('.photos-previews li').removeClass('active');
				$(this).parent('li').addClass('active');
				$('.main-photo img').attr('src', $(this).attr('href'));
				return false;
			});
			
			initButtons();
			var itemWidth = $('.item', '#projects-gallery').width() + 100;
			$('.next', '#projects-gallery').click(function(){
				if (!$(this).hasClass('disabled')) {					
					$('.items', '#projects-gallery').animate({'left' : "-="+itemWidth+"px"}, 500);
					var next = $('.item.current').next();
					$('.item.current').removeClass('current');
					next.addClass('current');
					initButtons();
				}
				return false;
			})
			$('.prev', '#projects-gallery').click(function(){
				if (!$(this).hasClass('disabled')) {					
					$('.items', '#projects-gallery').animate({'left' : "+="+itemWidth+"px"}, 500);
					var prev = $('.item.current').prev();
					$('.item.current').removeClass('current');
					prev.addClass('current');
					initButtons();
				}
				return false;
			})			
			
			
			function initButtons(){				
				if ($('.item.current', '#projects-gallery').next('.item').size() > 0) {
					$('.next', '#projects-gallery').removeClass('disabled');	
				} else {
					$('.next', '#projects-gallery').addClass('disabled');					
				}
				if ($('.item.current', '#projects-gallery').prev('.item').size() > 0) {
					$('.prev', '#projects-gallery').removeClass('disabled');	
				} else {
					$('.prev', '#projects-gallery').addClass('disabled');					
				}				
			}
		});
