
/******************************************* Page Header ******************************************************
*
*	buildPageHeader(docTitle, headerTabs, displaySearch, displayAdvert)
*	Display the header, parameters:
*		docTitle:		is displayed top right - usually the Title text of the page
*
*		headerTabs:		array containing [page URL, tab text, active tab]
*
*		displaySearch:	1 to enable Search box
*
*		see the CSS and styles for positioningx
*
***************************************************************************************************************/

function buildPageHeader(docTitle,headerTabs,displaySearch)
{
	var headerStuff =
		'<div class="pageTitle"> <a name="Top"></a>'+
			'<div class="titleTop">'+
				'<div class="contactButton">'+
					'<a href="http://kiwicelts.com/contact.php"  class="contactLink"><span></span></a>'+
				'</div>'+
				'<div class="homeButton">'+
					'<a href="http://kiwicelts.com/" class="homeLink"><span></span></a>'+
				'</div>'+
			'</div>'+
			'<div class="titleText">'+
				docTitle+
			'</div>';

	/* Navigation ---------------------------------------------------------------------------------
			ref: http://www.alistapart.com/articles/slidingdoors/ 
	*/
			
	headerStuff +=
			'<div class="navBar">'+
				'<div id="tabBar">'+
					'<ol>';

				for (var i=0; i<headerTabs.length ; i++ ) 
				{
					if (headerTabs[i][2]==1)
					{
						var activeTab='<li id="current">';
						var urlTab='#';
					}
					else
					{
						var activeTab='<li>';
						var urlTab=headerTabs[i][0];
					};
					headerStuff +=
						activeTab+
							'<a href="'+urlTab+'">'+headerTabs[i][1]+'</a>'+
						'</li>';
				};

		headerStuff +=
					'</ol>'+
				'</div>';

	// Search box ---------------------------------------------------------------------------------
			if (displaySearch==1)
			{
				headerStuff +=
					'<div class="searchBar">'+
						'<form action="http://kiwiCelts.com/search.html" id="cse-search-box">'+
							'<div>'+
								'<input type="hidden" name="cx" value="015002884697106039740:hsr9suyadku" />'+
								'<input type="hidden" name="cof" value="FORID:9" />'+
								'<input type="hidden" name="ie" value="UTF-8" />'+
								'<input type="text" name="q" size="31" />&#160'+
								'<input type="image" src="http://kiwicelts.com/pageHeadFoot/Images/search_32.png" style="vertical-align: -38%; height: 20px;" name="sa" title="Search" />'+
//	original					'<input type="submit" name="sa" value="Search" />'+
							'</div>'+
						'</form>'+
						'<script type="text/javascript" src="//www.google.com/cse/brand?form=cse-search-box&lang=en"></script>'+
					'</div>';
			};

	headerStuff +=
			'</div>'+
		'</div>';

	document.write (headerStuff);
};


/******************************************* Page Footer ******************************************************
*
*	Display the header, parameters:
*		docTitle:		displayed top centre - usually the Title text of the page
*		optMessage:		displayed bottom centre
*		displayAdvert:	1 to enable
*
*		see the CSS and styles for positioning
*
***************************************************************************************************************/

function fileModDate()
{
	if (Date.parse(document.lastModified) != 0) 
	{
		var modiDate = new Date(document.lastModified);
		var monthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
		var dateString = monthName[modiDate.getMonth()] + ' ' + modiDate.getDate() + ', ' + modiDate.getFullYear();
		return dateString;
	}	
};

function buildFooter(docTitle,optMessage)
{
	var thisYear = new Date().getFullYear();
	var footerStuff=
		'<div class="pageFooter">'+
			'<span class= "footerCopyright">'+
				'© Copyright Murray Lynn: 2004 to '+
				thisYear+
			'</span>'+
			'<span class= "footerDate">'+
				"Page last modified: " + 
				fileModDate()+
			'</span>'+
			'<span class= "footerTitle">'+
				'&#160;'+docTitle+
			'</span>'+
			'<div class= "footerNotes">'+
				optMessage+
			'</div>'+
		'</div>';
		
	document.write(footerStuff);
};
