var arImages = new Array();

function preloadArray(arNames) 
{ 
	for (var x in arNames) 
	{
		arImages[x] = new Image();
		arImages[x].src = arNames[x];
	}
}

function preloadList()
{
	var temp = preloadList.arguments; 
	
	preloadArray(temp);
}

function openPopUp(myurl)
{
	window.open(myurl,"newwindow","height=415,width=475,toolbar=no,resizable=yes,status=yes,location=no,menubar=no,scrollbars=yes");
}

function showDiabetesTerm(theTerm)
{
	if (window.screen)
	{
		var chasm = screen.availWidth;
		var mount = screen.availHeight;

		var w = 475;
		var h = 400;
								
		winprops = 'width=' + w + ',height=' + h + ',left=' + ((chasm - w - 10) * .5) + ',top=' + ((mount - h - 30) * .5) + ',toolbar=no,resizable=no,status=yes,location=no,menubar=no,scrollbars=yes';

		oHTMLWin = window.open("/diabetesterm.jsp?term=" + escape(theTerm) + "&requestingURL=" + escape(jspvalURL),'DiabetesTerm',winprops);
		oHTMLWin.window.focus();
	}			
}

function genericPopup(width, height, url)
{
	var params = "\'width=" + width + ",height=" + height + ",location=no,toolbar=no,resizable=yes,menubar=yes,scrollbars=yes'";
	window.open(url, 'newwindow', eval(params));
}


function adminActivitySelection(selection) {
	/*	Used on the volunteers admin system. Called when a CHECKBOX is selected. 
	*	Gets the value of the checked item and unchecks all associated items 
	*	(association is based on the value of other checkboxes with the same name)
	*/
	
	var theForm = selection.form;
	var elementName = selection.name;
	var elementValue = selection.value;
	// parse the elementValue and get it's attribute name defined in the DB
	var elementValueAttribute = elementValue.substring(0, elementValue.indexOf("="));
	var elementsLength = theForm.elements.length;
	
	if(selection.checked) {
		
		var tempvalue = "";
		for(i=0; i<elementsLength; i++) {
			
			if(theForm.elements[i].name == "frmEventSelectedOptions") { 
				tempvalue = theForm.elements[i].value;
				
				if((tempvalue.indexOf(elementValueAttribute) > -1) && (tempvalue != elementValue)) {
					theForm.elements[i].checked = false;
				}
			}
		}
	}	
}

function setMouseToWait()
{
	// changes the cursor to an hourglass
	document.body.style.cursor = "wait";
}
function setMouseToDefault()
{
	// changes the cursor to an arrow (default cursor)
	document.body.style.cursor = 'default';
}
function setMouseToArrow()
{
	// changes the cursor to an arrow (default cursor)
	setMouseToDefault();
}

