$(function(){
	
	var pages=Array(
				'index.html',
				'page1-2.html',
				'page3-4.html',
				'page5-6.html',
				'page7-8.html',
				'page9-10.html',
				'page11-12.html',
				'page13-14.html',
				'page15-16.html',
				'page17-18.html',
				'page19-20.html',
				'page21-22.html',
				'page23-24.html',
				'page25-26.html',
				'page27-28.html',
				'page29-30.html',
				'page31-32.html',
				'page33-34.html',
				'page35-36.html',
				'page37-38.html',
				'page39-40.html',
				'page41-42.html',
				'page43-44.html',
				'page45-46.html',
				'page47-48.html',
				'page49-50.html',
				'Contact.html'
				);
				
	/* 
	check array index of the current page 
	*/
	var current = $.inArray(location.href.split('/').pop(),pages);
	
	/*
	create the list in the #pages element
	*/
	var pagesTarget = $('#pages');
	pagesTarget.append('<ul>');
	
	/*
	loop through the pages array, create the listitem and link and append it to the new list
	*/
 	for(pageindex in pages){
		var page = pages[pageindex];
		$('ul',pagesTarget).append(
			$('<li>').append(
				$('<a>').attr('href',page).html(page.replace('.html','')).css('font-weight',(pageindex==current?'bold':''))
			)
		);
	};
	
	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('<img class="nb" src="images/back.gif">')
			);
		}
		if(current>0){
			$('#navigation1').append(
				$('<a>').attr({'id':'prev','href':pages[current-1]}).html('<img class="nb" src="images/back.gif">')
			);
		}
		
		/*
		if page found and not the last page, create 'next page' link in the navigation div
		*/
		if(current<pages.length-1){
			$('#navigation2').append(				
				$('<a>').attr({'id':'next','href':pages[current+1]}).html('<img class="nb" src="images/next.gif">')
			);
		}
		if(current<pages.length-1){
			$('#navigation3').append(				
				$('<a>').attr({'id':'next','href':pages[current+1]}).html('<img class="nb" src="images/next.gif">')
			);
		}
	}
	
});
