$(window).load(function() {
				sliderLeft=$('#thumbScroller .containerThumb').position().left;
				//padding=$('#outer_container').css('paddingRight').replace("px", "");
				sliderWidth=$('#thumbScroller').width();
				$('#thumbScroller').css('width',sliderWidth);
				var totalContent=0;
				$('#thumbScroller .contentThumb').each(function () {
					totalContent+=$(this).innerWidth();
					$('#thumbScroller .containerThumb').css('width',totalContent);
				});
				$('#thumbScroller').mousemove(function(e){
					if($('#thumbScroller  .containerThumb').width()>sliderWidth){
						var mouseCoords=(e.pageX - this.offsetLeft);
						var mousePercentX=mouseCoords/sliderWidth;
						var destX=-(((totalContent-(sliderWidth))-sliderWidth)*(mousePercentX));
						var thePosA=mouseCoords-destX;
						var thePosB=destX-mouseCoords;
						var animSpeed=600; //ease amount
						var easeType='easeOutCirc';
						if(mouseCoords==destX){
							$('#thumbScroller .containerThumb').stop();
						}
						else if(mouseCoords>destX){
							//$('#thumbScroller .containerThumb').css('left',-thePosA); //without easing
							$('#thumbScroller .containerThumb').stop().animate({left: -thePosA}, animSpeed,easeType); //with easing
						}
						else if(mouseCoords<destX){
							//$('#thumbScroller .containerThumb').css('left',thePosB); //without easing
							$('#thumbScroller .containerThumb').stop().animate({left: thePosB}, animSpeed,easeType); //with easing
						}
					}
				});
				$('#thumbScroller  .thumb').each(function () {
					$(this).fadeTo(fadeSpeed, 1);
				});
				var fadeSpeed=200;
				$('#thumbScroller .thumb').hover(
				function(){ //mouse over
					$(this).fadeTo(fadeSpeed, 0.6);
				},
				function(){ //mouse out
					$(this).fadeTo(fadeSpeed, 1);
				}
			);
			});
			
			 $(function() {
				//current thumb's index being viewed
				var current			= -1;
				//cache some elements
				var $btn_thumbs = $('#fp_thumbtoggle');
				var $loader		= $('#fp_loading');
				var $btn_next		= $('#fp_next');
				var $btn_prev		= $('#fp_prev');
				var $thumbScroller	= $('#thumbScroller');
				
				//total number of thumbs
				var nmb_thumbs		= $thumbScroller.find('.contentThumb').length;
				
				//preload thumbs
				var cnt_thumbs 		= 0;
				for(var i=0;i<nmb_thumbs;++i){
					var $thumb = $thumbScroller.find('.contentThumb:nth-child('+parseInt(i+1)+')');
					$('<img/>').load(function(){
						++cnt_thumbs;
						if(cnt_thumbs == nmb_thumbs)
				//display the thumbs on the bottom of the page
				;
					}).attr('src',$thumb.find('img').attr('src'));
				}
				
				
				//make the document scrollable
				//when the the mouse is moved up/down
				//the user will be able to see the full image
				//makeScrollable();
				
				//clicking on a thumb...
				
				
				//clicking on the "show thumbs"
				//displays the thumbs containerThumb and hides
				//the navigation arrows
				/*$btn_thumbs.bind('click',function(){
					showThumbs(500);
					hideNav();
				});*/
				
				/*function hideThumbs(){
					$('#outer_container').stop().animate({'bottom':'-160px'},500);
					showThumbsBtn();
				}*/

				/*function showThumbs(speed){
					$('#outer_container').stop().animate({'bottom':'0px'},speed);
					hideThumbsBtn();
				}*/
				
				/*function hideThumbsBtn(){
					$btn_thumbs.stop().animate({'bottom':'-50px'},500);
				}

				function showThumbsBtn(){
					$btn_thumbs.stop().animate({'bottom':'0px'},500);
				}

				function hideNav(){
					$btn_next.stop().animate({'right':'-50px'},500);
					$btn_prev.stop().animate({'left':'-50px'},500);
				}

				function showNav(){
					$btn_next.stop().animate({'right':'0px'},500);
					$btn_prev.stop().animate({'left':'0px'},500);
				}*/

				//events for navigating through the set of images
				/*$btn_next.bind('click',showNext);
				$btn_prev.bind('click',showPrev);*/
				
				//the aim is to load the new image,
				//place it before the old one and fadeOut the old one
				//we use the current variable to keep track which
				//image comes next / before
				/*function showNext(){
					++current;
					var $e_next	= $thumbScroller.find('.contentThumb:nth-child('+current+')');
					if($e_next.length == 0){
						current = 1;
						$e_next	= $thumbScroller.find('.contentThumb:nth-child('+current+')');
					}
					$loader.show();
					$('<img class="fp_preview"/>').load(function(){
						var $newimg 		= $(this);
						var $currImage 		= $('#fp_gallery').children('img:first');
						$newimg.insertBefore($currImage);
						$loader.hide();
						$currImage.fadeOut(2000,function(){$(this).remove();});
					}).attr('src',$e_next.find('img').attr('alt'));
				}*/
				
				/*function showPrev(){
					--current;
					var $e_next	= $thumbScroller.find('.contentThumb:nth-child('+current+')');
					if($e_next.length == 0){
						current = nmb_thumbs;
						$e_next	= $thumbScroller.find('.contentThumb:nth-child('+current+')');
					}
					$loader.show();
					$('<img class="fp_preview"/>').load(function(){
						var $newimg 		= $(this);
						var $currImage 		= $('#fp_gallery').children('img:first');
						$newimg.insertBefore($currImage);
						$loader.hide();
						$currImage.fadeOut(2000,function(){$(this).remove();});
					}).attr('src',$e_next.find('img').attr('alt'));
				}
				
                function makeScrollable(){
					$(document).bind('mousemove',function(e){
						var top = (e.pageY - $(document).scrollTop()/2) ;
						$(document).scrollTop(top);
                    });
				}*/
            });
