	function ajaxContact(formID){
		
		//var form = $('#' + formID);
		var form = document.getElementById(formID);
		var postString = '';
		postString += 'Name=' + form.Name.value;
		postString += '&Email=' + form.Email.value;
		postString += '&Question=' + form.Question.value;
		postString += '&submit=' + form.submit.value;
		postString += '&dataOnly=1';

		var URL = form.action;
		

		
		$.ajax({
			type: "POST",
			data: postString,
			cache: false,
			url: URL,
			timeout: 2000,
			success: function(theData) { 
				$('#animationDiv').data('ajaxURL', URL);
				$('#loadingDiv').slideDown(300);
				$('#animationDiv').slideUp(200, 
						function(e){updateData(theData, URL);}
				);
			}
		});
		
		
	}

	function readMore(id){

		var oldHeight = $('#newsDiv-'+id).data('oldHeight');
		$('#newsDiv-'+id).animate({
			height: oldHeight
		}, 500 ); // end animate
		
		$('#readMore-'+id).slideUp(200);
		return false;
		
	} // end readMore()

	
	// -- The following is for the read more boxes -- //
	function prepareReadMore(){
		
		if($('.readMore').length > 0){
			$('.newsItem').each(function (i){
				$(this).data('oldHeight', $(this).css('height'));

				if( $(this).height() < 190){								// if height is already small enough
					$(this).parent().find('.readMore').hide();				// hide readMore button
				} else {
					$(this).animate({height: '190px'}, 250);
				}
			});
			//$('.newsItem').css('height', '420px');
		} // end if readMore
		
	} // end prepareReadMore
		
	function whenReady(){
		
		
		var hash = window.location.hash.replace('#', '');
		if(jQuery.trim(hash) != ""){	 	// if hashed
			getPage(hash);
		} else {
		
			// Shrink readmore boxes and hide readMore links if necessary
			prepareReadMore();
			
			// Add click handlers for all links w/ class .ajaxLink  // 
			// This will create the dynamic ajax calls instead of full page loads //
			connectAjaxLinks();
	
		} // end else not hashed 
		
		return true;
	} // end whenReady()

	 function initialiseStateFromURL() {
	     var initialTab = window.location.hash;
	     //openTab(initialTab);
	   }
	
	 
	 
	// ------------------------------------------------------------------------- //
	// ------------ The following links connect / handle the ajax page calls --- //
	// ------------------------------------------------------------------------- //
	
	
	// Connect all .axajLink  class'd links to use the ajax call //
	function connectAjaxLinks(){
		
		$('.ajaxLink').each(function (i){
			doConnectAjaxLink($(this));
		}); // end each
		
		$('.parentAjaxLink > a').each(function (i){
			doConnectAjaxLink($(this));
		}); // end each
		
	} // end connectAjaxLinks
	
	// actually couple the object with the methods
	function doConnectAjaxLink( obj ){
		if(obj.data('ajaxLink') != true){
			obj.data('ajaxLink',true);
			obj.click(function(){
				getPage(obj.attr("href"));
				return false;
			}); // endclick
		} // end if ajaxLink != true
		
	} // end doConnectAjaxLink


	// -- getPage ( URL ) -- //
	// -- URL is page to ajax call html with get variable : dataOnly = 1   -- //
	function getPage( URL ){
		var animationDiv = $('#animationDiv');
		var contentMiddle = $('#contentMiddle');
		var loadingDiv = $('#loadingDiv');
		
		window.location.hash = URL;
		
		
		// --- Attached Data Variable : ajaxURL -- //
		// --- This variable is required in case another link is pressed during the loading process --- //
		// --- It will be used to check before loading page that another link has not been clicked and take appropriate action --- //
		var currentPage = animationDiv.data('ajaxURL');
		if(currentPage != URL){							// if not already on current page
			
			animationDiv.data('ajaxURL', URL);			// set new ajaxURL			
			$('#animationDiv').data('ajaxTry', 1);		// default to first try
			
			if(!animationDiv.data('gettingPage')) {		// if we are not getting a page already
				animationDiv.data('gettingPage', true);
				initialSlideContentUp(URL);
			} // end if not getting a page already
		} // end if currentPage != URL

	} // end getPage (URL)

	// ------------------------------------------------------------------------- //
	// ------------ The previous links connect / handle the ajax page calls ---- //
	// ------------------------------------------------------------------------- //

	
	
	
	// ----------- The following methods are to be used in a specefic sequence ---------------------------------- //
	// ----------- This means to not use them self standing unless you are sure there will be no side effect ---- //
	
	function initialSlideContentUp (URL){
		updateLoadingText(URL);
		updateRefreshLink(URL);		// incase 404 or slow internet add absolute link - no ajax -
		$('#loadingDiv').slideDown(300);
		$('#animationDiv').slideUp(800, 
			function(e){ajaxCall(URL);}
		);
	} // end initialSlideContentUp
	
	function ajaxCall(URL){
		// update URL in case it has changed
		// this could have been checked first, but the check would be more processing then just updating
		URL = $('#animationDiv').data('ajaxURL');
		$('#contentMiddle').html("");
		updateLoadingText(URL);		// calling this again in case another link was clicked between loading
		updateRefreshLink(URL);		// calling this again in case another link was clicked between loading
		
		// request and retrieve data
		var postString = "dataOnly=1";
		$.ajax({
			type: "POST",
			data: postString,
			cache: false,
			url: URL,
			timeout: 2000,
			error: function() {		// if error, call page not found post
				var notFoundURL =  "/page-not-found";
				
				if($('#animationDiv').data('ajaxTry') > 2){				// if already tried to call page twice
					$.post(notFoundURL, { dataOnly: '1' },  function(data){
						$('#animationDiv').slideUp(200, 
							function(e){updateData(data, URL);}
						);
					},"html"); // end get URL
				} else {												// has not tried twice
					var tryNum = $('#animationDiv').data('ajaxTry');
					tryNum++;
					$('#animationDiv').data('ajaxTry', tryNum );
					ajaxCall(URL);
				}
			},
			success: function(data) { 
				$('#animationDiv').slideUp(200, 
						function(e){updateData(data, URL);}
					);
			}
		});
		
	/*	$.post(URL, { dataOnly: '1' },  function(data, textStatus){
			alert(textStatus);
			$('#animationDiv').slideUp(200, 
				function(e){updateData(data, URL);}
			);
		},"html"); // end get URL
	*/
		
	} // end ajaxCall
	
	function updateData(data, URL){
		if($('#animationDiv').data('ajaxURL') != URL){			// if URL has been updated
			ajaxCall('');											// new URL could have been passed however ajaxCall will reset it
		} else {													// else if URL is still current
			
			$('#contentMiddle').html(data);
			//$('#loadingDiv').css('display','none');
			$('#loadingDiv').slideUp(300);
			$('#animationDiv').data('gettingPage', false);
			$('#animationDiv').slideDown(800, 
					function(e){
						prepareReadMore();
						connectAjaxLinks();
						
					}
			);	
		} // end else (if URL is still current)
	} // end updateData
	
	// ----------- The previous methods are to be used in a specefic sequence ---------------------------------- //
	// ----------- This means to not use them self standing unless you are sure there will be no side effect ---- //
	
	function updateLoadingText( newText ){
		
		var tempText = newText;
		tempText = tempText.replace('/','');
		tempText = tempText.replace('.php','');
		
		if(jQuery.trim(tempText) == ""){
			tempText = "Nicholas Tuck News"
		} // end if
		
		$('#loadingText').html(tempText);
		
	} // end updateLoadingText
	
	function updateRefreshLink ( URL ){
		$('#refreshLoadingLink').attr('href',URL);
	}
	

	
	
	// ---------------------------------------------------------------------------------------------------------------- //
	// ------ The following methods are no longer used in this project ------------------------------------------------ //
	// ------ However they have been left here for future use / refence, as a lot of time had gone into them and its hard to let go --- //
	// ---------------------------------------------------------------------------------------------------------------- //
	
	
	function resizeDiv( idToResize, idToMatch){
	
		var pixelsToSubtract = 326;
	
		var divToResize = document.getElementById(idToResize);
		var divToMatch  = document.getElementById(idToMatch);
		
		var height = 0;
		
		if (divToMatch.currentStyle){
			height = divToMatch.currentStyle["height"];
		} else if (window.getComputedStyle){
			height = document.defaultView.getComputedStyle(divToMatch,null).getPropertyValue("height");
			//document.defaultView.getComputedStyle(divToResize,null).setPropertyValue("height");
		}

		
		if( height != "auto"){								// if not in IE and style == 'auto'
			
				
				height = height.replace(/px/,'');			// Strip 'px'
				var heightY = parseInt(height);							
				heightY -= pixelsToSubtract;				// Subtract other sidebar buttons
				var leftOver = heightY % 164;
				leftOver -= 3;
				heightY -= leftOver;
				
				height = heightY + "px";					// append 'px'
			
			
		} else {
				height = '164px'; 							// if IE then make it only one button
		}

		
		divToResize.style.height = height;			// change height
		
	
	
	} // end function resizeDiv

	
	
	
	function scroll_userheaders()
	{

		var elem = '';		
		
		
		var len = headersToScroll.length;
		
		var i;
		for (i in headersToScroll)
		{		
			if(document.getElementById(headersToScroll[i]))
			{
				elem = document.getElementById(headersToScroll[i]);
				footerElem = document.getElementById('footer');
				
				if(document.body.scrollTop >= 230 )
					elem.style.top = document.body.scrollTop-240;
				else
					elem.style.top = 0;
					
				if(document.body.scrollBottom >= footerElem.style.top)
					elem.style.top = footerElem.style.top - 364;
			}
		}
	}

	// ---------------------------------------------------------------------------------------------------------------- //
	// ------ The previous methods are no longer used in this project ------------------------------------------------- //
	// ------ However they have been left here for future use / refence, as a lot of time had gone into them and its hard to let go --- //
	// ---------------------------------------------------------------------------------------------------------------- //
	