/*******************************************************
Author:			Tim Miller
Date:			8/5/2009
Filename:		ERWaitTime.js

Get current ER wait time from text file and display on page. Requires prototype.js as well.

prop. name				| description													|	default
-------------------------------------------------------------------------------------------------
ERWaitTimeContainerId	| ID of the element the wait time should be put in.				|	ERWaitTimeContainer
ERWaitTimeTextFile		| Location of text file containing wait time. Relative to the	|	ERWaitTime/delay.txt
                          calling page.

Example:
	ER patients are currently experiencing <span id="ERWaitTimeContainer"></span> minutes of wait time.
	<script type="text/javascript">new ERWaitTime();</script>
OR
	ER patients were experiencing <span id="ERWaitTimeLastHourContainer"></span> minutes of wait time an hour ago.
	<script type="text/javascript">new ERWaitTime("ERWaitTimeLastHourContainer", "delay1.txt");</script>
*******************************************************/

function ERWaitTime(id, file){
	var ERWaitTimeContainerId = (typeof id == "undefined")? "ERWaitTimeContainer" : id;
	var ERWaitTimeTextFile = (typeof file == "undefined")? "ERWaitTime/delay.txt" : "ERWaitTime/"+file;
	
	//Get wait time from text file.
	new Ajax.Request(ERWaitTimeTextFile, {
		method: "get",
		onSuccess: function (transport){
			$(ERWaitTimeContainerId).innerHTML = transport.responseText;
		}
	});
}