//this write out the passed URL to the div AJAX_INNER in the tumbleblog insert on the main blog page
function ajax_tumbleblogswitch(passed_url){

var url = passed_url;

//if we are calling the archives, then redirect the url to display the tumbleblog archives page
if (passed_url == 'archives') {
	var url = "/tumbleblog/archives/archives.html";
}
	
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser doesn't support AJAX!");
				return false;
			}
		}
	}
	
	
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 1){
			document.getElementById('ajax_inner').innerHTML = "<p align=\"center\"><img src=\"/interactive/ajax/images/loader.gif\"/><br />loading...<\/p>";
		}
		
		if(ajaxRequest.readyState == 4){
			var text = ajaxRequest.responseText;
			document.getElementById('ajax_inner').innerHTML = text;
		}

//		if(ajaxRequest.status == '404'){
//			document.getElementById('ajax_inner').innerHTML = "error 404 file not found";
//			}

	}	//ajaxRequest.onreadystatechange
	
	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null); 
}
