

                                       
	      // we will add our javascript code here                              
			$(document).ready(function() {
				// do stuff when DOM is ready
				 //Speed of the slideshow   
				 var speed = 2000;   
					 
				 //You have to specify width and height in #slider CSS properties   
				 //After that, the following script will set the width and height accordingly   
				 $('#mask-gallery, #gallery li').width($('#slider').width());       
				 $('#gallery').width($('#slider').width() * $('#gallery li').length);   
				 $('#mask-gallery, #gallery li, #mask-excerpt, #excerpt li').height($('#slider').height());   
					 
				 //Assign a timer, so it will run periodically   
				 var run = setInterval('newsslider(0)', speed);     
					 
				 $('#gallery li:first, #excerpt li:first, #links a:first').addClass('selected');   
			  
				
					 
				 //Next Slide by calling the function   
				 $('#btn-next').click(function () {   
					  newsslider(0);     
					  return false;   
				 });    
			  
				 //Previous slide by passing prev=1   
				 $('#btn-prev').click(function () {   
					  newsslider(1);     
					  return false;   
				 });    
					 
				 //Mouse over, pause it, on mouse out, resume the slider show   
				 $('#slider').hover(   
					 
					  function() {   
							clearInterval(run);   
					  },    
					  function() {   
							run = setInterval('newsslider(0)', speed);     
					  }   
				 );     
				
				
								 //Put this inside $(document).ready()   
			//For link/number button   
			$('#links a').click(function () { 
				 //stop the slide show   
				 clearInterval(run);   
						  
				 $('#links a').removeClass('selected');   
				 
				 //go to the item   
				 goto('.' + $(this).attr('rel'));       
						  
				 //resume the slideshow   
//				 run = setInterval('newscontroler(0)', speed);    
				 return false;   
			  
			});    
			});
			
			
			function newsslider(prev) {     
				//Get the current selected item (with selected class), if none was found, get the first item   
				var current_image = $('#gallery li.selected').length ? $('#gallery li.selected') : $('#gallery li:first');   
				var current_excerpt = $('#excerpt li.selected').length ? $('#excerpt li.selected') : $('#excerpt li:first');   
				var current_link = $('#links a.selected').length ? $('#links a.selected') : $('#links a:first');  
				
				//if prev is set to 1 (previous item)   
				if (prev) {   
					  
				  //Get previous sibling   
				  var next_image = (current_image.prev().length) ? current_image.prev() : $('#gallery li:last');   
				  var next_excerpt = (current_excerpt.prev().length) ? current_excerpt.prev() : $('#excerpt li:last');   
				  var next_link = (current_link.prev().length) ? current_link.prev() : $('#links a:last');   
				 
				//if prev is set to 0 (next item)   
				} else if( 1 == 0 ) {
				} else {   
					  
				  //Get next sibling   
				  var next_image = (current_image.next().length) ? current_image.next() : $('#gallery li:first');   
				  var next_excerpt = (current_excerpt.next().length) ? current_excerpt.next() : $('#excerpt li:first');   
				  var next_link = (current_link.next().length) ? current_link.next() : $('#links a:first');   
				  
				}   
				
				//clear the selected class   
				$('#excerpt li, #gallery li, #links a').removeClass('selected');   
				 
				//reassign the selected class to current items   
				next_image.addClass('selected');   
				next_excerpt.addClass('selected');  				  
				next_link.addClass('selected');  
				
				//Scroll the items   
				$('#mask-gallery').scrollTo(next_image, 800);          
				$('#mask-excerpt').scrollTo(next_excerpt, 800);                    
				 
				
		
		
	}          
			
			  
			//Add this function after newslider function   
			function goto(item) {   
				 $('#mask-gallery').scrollTo(item, 800);        
				 $('#mask-excerpt').scrollTo(item, 800);    
				 $(item).addClass('selected');                      
			}   
