// THIS FUNCTION SHOWS ALL THE PLACES A SONG WAS PERFORMED OR RECORDED
function searchSong (searchType, songID) {
	var searchType = searchType;
	var songID = songID;

	var theSearchString = "http://www.fin-de-siecle.com/performance.php?t=" + searchType + "&m=" + songID;


	// CREATE CORRECT OBJECT PER BROWSER
	var xmlHttp = getXHR();
	
	// TEST AJAX COMPATIBILITY
	function getXHR(){
		var xmlHttp = "";
		
		try {   // Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
			}
	
		catch (e){ // Internet Explorer
		try {

			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e) {
		try {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		catch (e) {
			alert("Your browser does not support AJAX!");
			return false;
			}
		}

		}
		
		return xmlHttp;
	}



	
	
	// START PROCESSING
	xmlHttp.open("GET",theSearchString,true);
	


	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		document.getElementById('results').innerHTML = this.responseText;
//		document.getElementById('results').innerHTML = xmlHttp.responseText;
		}
	}
	
	xmlHttp.send(null);
	
	

	}



function searchDB (searchType, memberName) {
	var searchType = searchType;
	var memberName = memberName;

//	var theSearchString = "http://localhost/search.php?t=" + searchType + "&m=" + memberName;

	var theSearchString = "http://www.fin-de-siecle.com/search.php?t=" + searchType + "&m=" + memberName;

/*
alert(theSearchString);
return false; 
*/

	// TEST AJAX COMPATIBILITY
	var xmlHttp;
	try {   // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}

	catch (e){ // Internet Explorer
	try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	catch (e) {
	try {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	catch (e) {
		alert("Your browser does not support AJAX!");
		return false;
		}
		}
	}

	xmlHttp.open("GET",theSearchString,true);
	
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		document.getElementById('results').innerHTML = xmlHttp.responseText;
		}
	    }
	xmlHttp.send(null);


	}



/* ERROR CHECKCK AND CREATE THE OBJECT */
function GetXmlHttpObject() {

	var xmlHttp = null;

	// do error catching for diff browsers
	try {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  } catch (e) {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;

	}


// WHEN THE STATE CHANGES, UPDATED THE ID WITH THE RESULT OF THE SCRIPT
function stateChanged() {
	if (xmlHttp.readyState == 4) {
		document.getElementById("hints").innerHTML = xmlHttp.responseText;
		return;
		}
	}








/* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||| */
/* DYNAMICALLY LOADS TEXT AND PLACES IT IN A DIV ON THE PAGE */
/* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||| */

function loadData(thePage, theSection, theDestination) {

	var thePage = thePage;
	var theSection = theSection;
	var theDestination = theDestination;
	var sectionPath = "";

	// DETERMINE WHERE DATA IS
	if (theSection == "feat") {
		sectionPath = "content/features-pages/";
		}

	if (theSection == "stanton") {
		sectionPath = "content/stanton/";
		}

	// CONSTRUCT THE URL
	var url = mainPath + sectionPath + thePage + ".html";

	// TEST AJAX COMPATIBILITY
	var xmlHttp;
	try {   // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}

	catch (e){ // Internet Explorer
	try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	catch (e) {
	try {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	catch (e) {
		alert("Your browser does not support AJAX!");
		return false;
		}
		}
	}

	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
		document.getElementById(theDestination).innerHTML = xmlHttp.responseText;
		}
	}

}