// Script published.js

function sb_category(item) {
	if (ajax) { 
		ajax.open('get', '/published_research/sb_category/' + item);
		ajax.onreadystatechange = reference_handle;
		ajax.send(null);
	} else { // Can't use Ajax!
		document.getElementById('ref_content').innerHTML = 'AJAX is unavailable';
	}
	return;
} 

function sb_date(item) {
	if (ajax) { 
		ajax.open('get', '/published_research/sb_date/' + item);
		ajax.onreadystatechange = reference_handle;
		ajax.send(null);
	} else { // Can't use Ajax!
		document.getElementById('ref_content').innerHTML = 'AJAX is unavailable';
	}
	return;
}

function sb_magazine(item) {
	if (ajax) { 
		ajax.open('get', '/published_research/sb_magazine/' + item);
		ajax.onreadystatechange = reference_handle;
		ajax.send(null);
	} else { // Can't use Ajax!
		document.getElementById('ref_content').innerHTML = 'AJAX is unavailable';
	}
	return;
}


// Function that handles the response from the PHP script:
function reference_handle() {

	// If everything's OK:
	if ( (ajax.readyState == 4) && (ajax.status == 200) ) {
		document.getElementById('ref_content').innerHTML = ajax.responseText;
		
	}
	return;
	
}

function sb_reference(item) {
	// Confirm that the object is usable:
	if (ajax) { 
		ajax.open('get', '/published_research/sb_reference/' + item);

		// Function that handles the response:
		ajax.onreadystatechange = information_handle;
		
		// Send the request:
		ajax.send(null);

	} else { // Can't use Ajax!
		document.getElementById('information').innerHTML = 'AJAX is unavailable';
	}
	return;
	
}
 
function information_handle() {

	// If everything's OK:
	if ( (ajax.readyState == 4) && (ajax.status == 200) ) {
		// Assign the returned value to a document element:
		document.getElementById('information').innerHTML = ajax.responseText;
	} else {
		//document.getElementById('information').innerHTML = ajax.readyState;
	}
	
}