$.fn.JavaGalInit = function(width,height) {
		$('.ngg-galleryoverview').hide();

			 $('.ngg-galleryoverview').addClass("slideShowJs").before('<br clear="all" /><div id="pager"><div class="thumbs"></div><div class="prev"></div><div class="play"></div><div class="pause"></div><div class="next"></div></div><br clear="all"/>').before('<div class="thumbscontainer"><ul id="thumbnailsJS"></div>').cycle({ 
    			fx:     'fade', 
    			prev:   '.prev', 
    			next:   '.next',
    			timeout: 10000,
				cleartype:  1,
				fit: 0,
    			pager:  '#thumbnailsJS', 
    			pagerAnchorBuilder:  function(idx, slide) { 
				a = slide;
				b = $(a).children('div.desc').children('div.ngg-gallery-thumbnail').children('a').children('img');
				b = $(b).attr('src')
        		return '<li><a href="#"><img src="' + b + '" height="70" /></a></li>'; 
   				 } 
				});


			$('div.ngg-gallery-desc').toggle();
		


		
			$('.pause').click(function() { $('.slideShowJs').cycle('pause'); return false; });
   			$('.play').click(function() { $('.slideShowJs').cycle('resume'); return false; });
			
    		$('.thumbs').click(
				function() { $('.thumbscontainer').slideToggle(); }
				);
			
			 $(function(){
			  //Get our elements for faster access and set overlay width
			  var div = $('.thumbscontainer'),
						   ul = $('ul#thumbnailsJS'),
						   // unordered list's left margin
						   ulPadding = 15;
			
			  //Get menu width
			  var divWidth = div.width();
			
			  //Remove scrollbars
			  div.css({overflow: 'hidden'});
			
			  //Find last image container
			  var lastLi = ul.find('li:last-child');
			
			  //When user move mouse over menu
			  div.mousemove(function(e){
			
				//As images are loaded ul width increases,
				//so we recalculate it each time
				var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
			
				var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
				div.scrollLeft(left);
			  });
			});
			 
			 $('.loader').fadeOut();
			 $('.slideShowJs').fadeIn();
			}