

function LoadHTMLInDiv(AJAXLocation, AlternativePageLocation, DivToLoadInto, DivToSpin) {
	// Start the spinner that indicates loading
	
	isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
	if ((!isIE6) && (DivToSpin != '')) {
		$(DivToSpin).spin({duration: 1});
	}
	var DivToChange;
	// Request the new HTML page via AJAX
	var req = new Request.HTML({url:AJAXLocation, 
		onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) { 
			// Load the new HTML into the Div
			$(DivToLoadInto).set('html', responseHTML);
			
			// Stop the spinner that indicates loading
			if ((!isIE6) && (DivToSpin != '')) {
				$(DivToSpin).unspin({duration: 1});
			}
			
			
			if ($(DivToLoadInto).style.display == 'none') {
				// Reveal the hidden node
				$(DivToLoadInto).reveal({duration: 700});
			} else {
				var myEffect = new Fx.Morph(DivToLoadInto, {
					duration: 1000, transition: Fx.Transitions.Sine.easeInOut
				});
			}
			
			//Run any Javascript in the response (important for dropdowns etc. to continue working
     		$exec(responseJavaScript);
		},
		
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will take users to the page they requested directly
		onFailure: function() {
			if ((AlternativePageLocation != '') && (AlternativePageLocation != undefined)) {
				document.location = AlternativePageLocation;
			}
			
		}, onComplete: function() {

    	}
	});
			
	// Actually carry out the code above
 	req.send();

}
