$(function(){
	
	/* optional manual loading of array
	var pages=Array(
				'features-overview.html',
				'features-pre-qualified-visitors.html',
				'features-real-websites.html',
				'features-one-listing-hundreds-pages.html',
				'features-vetted-for-quality.html',
				'features-no-middleman.html',
				'features-whats-the-secret.html',
				'features-limited-supply.html',
				'features-simple-setup.html',
				'features-month-to-month.html',
				'features-budgeting.html',
				'features-autopay.html',
				'features-low-maintenance.html'
				);*/ 
	/* 
	This loads the array automatically from the unordered list 
	*/
	var pages=Array();
	$('#featurelist a').each(function(){ 
		pages.push($(this).attr('href')); });
	/* 
	check array index of the current page 
	*/
// not supported by ie!	var current = pages.indexOf(location.href.split('/').pop());
	var current =  $.inArray(location.href.split('/').pop(),pages);
	
	if(current>-1){
		/*
		if page found and not the first page, create 'previous page' link in the navigation div
		*/
		if(current>0){
			$('#navigation').append(
				$('<a>').attr({'id':'prev','href':pages[current-1]}).html('previous page')
			);
		}
		
		/*
		if page found and not the last page, create 'next page' link in the navigation div
		*/
		if(current<pages.length-1){
			$('#navigation').append(				
				$('<a>').attr({'id':'next','href':pages[current+1]}).html('next page')
			);
		}
	}
	
});
