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));
}

//originally added for wedding donations.
function openEnlargeWindow(imgpath, ttltext)
{
	viewurl = "/utils/view-enlargement.jsp?image=" + imgpath;
	if (ttltext > "") 
		viewurl = viewurl + "&title=" + ttltext;
	window.open(viewurl,"enwindow","height=480,width=440,toolbar=no,resizable=yes,status=yes,location=no,menubar=no,scrollbars=no");
}

/** called by form onsubmit function, to ensure form submitted only once */
function onlyOnce(oForm)
{
    document.body.style.cursor = "wait";
	if (! oForm.wasSubmitted==true)
	{
		oForm.wasSubmitted = true;
		for (i = 0; i < oForm.length; i++)
		{
			var tempobj = oForm.elements[i];
			var eletype = tempobj.type.toLowerCase();
			if (eletype=="submit" || eletype=="reset" || eletype=="image")
			{
				tempobj.disabled = true;
			}
		}

		return true;
	}
	else
	{
		return false;
	}
}
