$(document).ready(function(){
			var getWidth = 649;
			totalWidth = 0;
			totalSlides = 7;
			
			jQuery.each($('.holder'), function() {
    				totalWidth += $(this).width();
      			
      		});

         		var setWidth = 0;
         		$('#left').click(function(){
	   		if(setWidth == 0){
	   		setWidth = -getWidth*totalSlides+getWidth; 
	   				$('.cont').animate({left: setWidth}, 1500,'easeOutSine');
	   		}
	   		else{
         	        		setWidth = setWidth + getWidth; 
	   				$('.cont').animate({left: setWidth}, 1000,'easeOutSine');
	   		}
	   			return false;
	   		});
     
			$('#right').click(function(){
			if (setWidth <= (-getWidth*totalSlides + getWidth)){
				setWidth = 0;
				$('.cont').animate({left: setWidth}, 1500,'easeOutSine');
			}
			else{
            		setWidth = setWidth - getWidth;
				$('.cont').animate({left: setWidth}, 1000,'easeOutSine');
			}
            		return false;
			});
			
			$('.img').hover(function(){
				
				$('.launch').fadeIn();				
			
			
			},
			function(){
				
				$('.launch').fadeOut();				
			
			
			});
			
			$('.img').click(
			function(){
				
				img = $(this).attr('rel');
				url = 'loadImage.php?img=s_'+$(this).attr('rel');
				
				$('#viewer').css({width:100, height:100, top:-300});
				$('#img_cont').empty();
				$('#img_cont').animate({opacity:0},0,'easeOutSine');
				$('#viewer').fadeIn();
				$('body').prepend('<div style="background:#000; position:absolute;top:0;left:0; width:100%; height:100%; z-index:15;" id="bg"></div>');
				$('#bg').animate({opacity:.5},0);
				$('#viewer').animate({width: 550, height: 400, top:-420},700,'easeOutSine',function(){
				$('#img_cont').load(url,'',function(){
				
					$('#loader').remove();
					
					
					$('#img_cont').animate({opacity:1},500,'easeOutSine');
					$('#viewer').append('<div id="thumbs"><div class=thumb id=1 rel=loadImage.php?img=s_'+img+'><img src=img/s_'+img+' width=100 height=65/></div><div class=thumb id=2 rel=loadImage.php?img=2_'+img+'><img src=img/2_'+img+' width=100 height=65/></div><div class=thumb id=3 rel=loadImage.php?img=3_'+img+'><img src=img/3_'+img+' rel=loadImage.php?img=3_'+img+' width=100 height=65/></div></div>');
					$('#1').addClass('curImg');
					$('.thumb').animate({opacity:0.3},0,'easeOutSine');
					$('#1').animate({opacity:1},500,'easeOutSine');
					
					update();
					
					});
					
					
				
				
				});
			
			});
			
			
			function update(){ 
				$('.thumb').click(function(){
					thumb = $(this);
					url = $(this).attr('rel');
					$('#img_cont').animate({opacity:0},200,'easeOutSine',function(){
						
						$('#img_cont').load(url,'',function(){
							$('#img_cont').animate({opacity:1},200,'easeOutSine');
							$('.thumb').animate({opacity:.3},500,'easeOutSine');
							$('.thumb').removeClass('curImg');
							$(thumb).addClass('curImg');
							$(thumb).animate({opacity:1},500,'easeOutSine');
							
						});
					});
				});
								
								
			}
				
			$('#close').click(function(){
			
				$('#bg').remove();
				$('#thumbs').remove();
				$('#viewer').fadeOut();
			
			});
			
			$('#info').toggle(function(){
			
				$('#information').slideDown("slow");
				$(this).addClass('current');
				
			
			},function(){
			
				$('#information').slideUp("slow");
				$(this).removeClass('current');
				
				
			
			});
			
						
		
		
		});