
/* This is a user-triggered function, but not marked as such */
/* Get information from the database using AJAX to fill the details box. */
function getInfo(id) {
	
	HideContent("ajax_data");
	
	// Where to retrieve the data from
	var url = "ajax.php" + "?id=" + id;
	
	loadXMLDoc(url);
}

/* When using loadXMLDoc(url), this function will be called when the request returns */
function whenRequestReceived(request) {
	var response = request.responseText;
	fillDetails(format(response));
}

/* Take the data retrieved from "ajax/event.php" and pull relevant information. */
function format(response) {
	var result = "";
	
	var data = response.split("\n");
	
	if (data[0]) {
		result += "<div><strong>Last Name:</strong> " + data[0] + "</div>" + "\n";
	}
	
	if (data[1]) {
		result += "<div><strong>First Name:</strong> " + data[1] + "</div>" + "\n";
	}
	
	if (data[2]) {
		result += "<div><strong>District Name:</strong> " + data[2] + "</div>" + "\n";
	}
	
	if (data[3]) {
		result += "<div><strong>Highest Degree:</strong> " + data[3] + "</div>" + "\n";
	}
	
	if (data[4]) {
		result += "<div><strong>Years of Experience:</strong> " + ((data[4] > 0) ? data[4] : "n/a") + "</div>" + "\n";
	}
	
	if (data[5]) {
		result += "<div><strong>Job Title:</strong> " + data[5] + "</div>" + "\n";
	}
	
	if (data[6]) {
		result += "<div><strong>Total Pay:</strong> " + data[6] + "</div>" + "\n";
	}
	
	if (data[7]) {
		result += "<div><strong>Base Salary:</strong> " + data[7] + "</div>" + "\n";
	}
	
	if (data[8]) {
		result += "<div><strong>School Name:</strong> " + data[8] + "</div>" + "\n";
	}
	
	if (data[9]) {
		result += "<div><strong>Disciplinary Action:</strong> " + data[9] + "</div>" + "\n";
	}
	
	if (data[10]) {
		result += "<div><strong>Disciplinary Action Date:</strong> " + data[10] + "</div>" + "\n";
	}
	
	return result;
}

/* Clear the details box. */
function closeInfo() {
	HideContent('ajax_data');
}


/* Fill the pop-up box with content. */
function fillDetails(content) {
	var close_button = '<div style="float:right; padding:3px"><a href="javascript:closeInfo()"><img src="window_close.gif" border="0"></a></div>';
	document.getElementById("ajax_data").innerHTML = close_button + content;
	ShowContent("ajax_data");
}


////////////////////////////////////////////////////////////////////////////////////
// Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) {
	document.onmousemove = UpdateCursorPositionDocAll;
} else {
	document.onmousemove = UpdateCursorPosition;
}
function AssignPosition(d) {
	if(self.pageYOffset) {
		rX = self.pageXOffset;
		rY = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		rX = document.documentElement.scrollLeft;
		rY = document.documentElement.scrollTop;
	} else if(document.body) {
		rX = document.body.scrollLeft;
		rY = document.body.scrollTop;
	}
	if(document.all) {
		cX += rX; 
		cY += rY;
	}
	d.style.left = (cX-30-400) + "px";
	d.style.top = (cY+15) + "px";
}
function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	dd.style.display = "block";
}
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	var dd = document.getElementById(d);
	AssignPosition(dd);
	if (dd.style.display == "none") {
		dd.style.display = "block";
	} else {
		dd.style.display = "none";
	}
}
////////////////////////////////////////////////////////////////////////////////////