jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
			return -c * ((t=t/d-1)*t*t*t - 1) + b;
		};
function showImg(id)
{
 jQuery('div.galleryimage').hide();
 
jQuery('div#image-'+id).show();

}
     jQuery("document").ready(function() {
		     //jQuery('#mycarousel').jcarousel({
        // Configuration goes here
	//scroll:1,
	
		     //});
		     
		     
		     
	var lastpos;	 
	var scrolll;
	var lastwidth;
	var totalwidths=new Array;
	 var offset=0;
	 var totalwidth=0;
	 var i=0;
	//jQuery('#slidecontainer').hide();	     
		     jQuery('div.galleryimage:lt(1)').fadeIn("slow");
        var theslider=jQuery('#slideshow');
         theslider.serialScroll({
				items:'li',
				prev:'a.prev',
				next:'a.next',
				axis:'x',
				offset:0, //when scrolling to photo, stop 230 before reaching it (from the left)
				start:0, //as we are centering it, start at the 2nd
				duration:4000,
				force:true,
				stop:true,
				lock:false,
				cycle:false, //don't pull back once you reach the end
				easing:'easeOutQuart', //use this easing equation for a funny effect
				jump: false, //click on the images to scroll to them
				exclude:0,
				onBefore:function( e, elem, $pane, $items, pos ){
					//console.log(lastpos);
					if (pos==lastpos) return false;
					
					
					//if ((lastoffs<=scrolll+860 && right)|| pos>size) return false;
				},
				onAfter:function( elem ){//if (jQuery('#slideshow').attr('sliding')=="true") jQuery('#slideshow').trigger('next');
				}
	 
			
	 
	 });
	 var thetimer=0;
	 var right=false;
	 //jQuery('#slideshow').trigger('goto',[firstbreak-1]);
	 
	 
	 jQuery('#prev').mouseover(function(){
	     right=false;
	    theslider.trigger('prev');
	    thetimer=setInterval(function(){
	    theslider.trigger('prev');},550);
	 });
	 jQuery('#next').mouseover(function(){
	   right=true;
	   theslider.trigger('next');
	  
	   thetimer=setInterval(function(){
	   
	   theslider.trigger('next');},550);
	  
	 });
	 
	 // jQuery('#prev').click(function(){
	 //    right=false;
	 //   theslider.trigger('prev');
	    
	 //});
	 //jQuery('#next').click(function(){
	 //  right=true;
	 //  theslider.trigger('next');
	  
	  
	 //});
	 jQuery(window).bind('load', function() {
	 jQuery('#slidecontainer').fadeIn("slow");
	 theslider.find('li').each(function(){
	 totalwidths.push(jQuery(this).width());
	 
	 //console.log(i+" : "+totalwidths);
	 
	
	 
	 
	 })
	 i=totalwidths.length+1;
	  while (thewidth=totalwidths.pop())
		 {
			
		  offset=offset+thewidth+8;
		  if (offset>760) break;
		  i--;
		 }
	 lastpos=i-1;
	 })
	 
	 jQuery('#prev').mouseout(function(){
			 right=false;
	  clearInterval(thetimer);
	 });
	 jQuery('#next').mouseout(function(){
			 right=false;
			 
	  clearInterval(thetimer);
	 });
     
     });


