window.onerror=TrapError;	

function TrapError(msg)
	{
	alert(msg);
	return true;
	}	

function OpenWindowCentered(szURL, szWindowName, nHeight, nWidth, bytSizable)
	{
	//Centers a window and removes toolbars and such
	//bytSizeable:	1=True; 0=False
	var intTop = (screen.availHeight - nHeight) / 2;
	var intLeft = (screen.availWidth - nWidth) / 2;
				
	window.open(szURL, szWindowName, "toolbar=no,  top=" + intTop + ", left=" + intLeft + ", location=no, directories=no, menubar=no, status=no, scrollbars=no, resizable=" + bytSizable + ", width=" + nWidth + ", height="+ nHeight + "");				
	}

function OpenWindowCenteredScroll(szURL, szWindowName, nHeight, nWidth, bytSizable)
	{
	//Centers a window and removes toolbars and such
	//bytSizeable:	1=True; 0=False
	var intTop = (screen.availHeight - nHeight) / 2;
	var intLeft = (screen.availWidth - nWidth) / 2;
				
	window.open(szURL, szWindowName, "toolbar=no,  top=" + intTop + ", left=" + intLeft + ", location=no, directories=no, menubar=no, status=no, scrollbars=yes, resizable=" + bytSizable + ", width=" + nWidth + ", height="+ nHeight + "");				
	}
	
function setRadioValue(radioName, value)
	{
	var collection = document.getElementsByName(radioName);
	
	for (i=0;i<collection.length;i++)
		{
		if (collection[i].value == value)
			{
			collection[i].checked = true;
			}
		}	
	}			
	
function getRadioValue(radioName)
	{
	var collection = document.getElementsByName(radioName);

	for (i=0;i<collection.length;i++)
		{
		if (collection[i].checked)
			return(collection[i].value);
		}
	}	
	
function move_in(img_name,img_src)
	{
	document[img_name].src=img_src;
	}

function move_out(img_name,img_src)
	{
	document[img_name].src=img_src;
	}
	
function toggle(e) 
	{
	if (e.style.display == "none") 
		{
		e.style.display = "";
		} 
	else 
		{
		e.style.display = "none";
		}
	}	
	
function ValidImage(szFileName)
	{
	//Valid Image Extensions
	var nLen = szFileName.length;
	var szExt = szFileName.substring(nLen - 3, nLen);
	
	switch(szExt.toLowerCase())
		{
		case "jpg":
			return(true);
		case "gif":
			return(true);
		case "bmp":
			return(true);
		case "png":
			return(true);
		case "psd":
			return(true);
		case "pcx":
			return(true);
		case "pax":
			return(true);
		case "tga":
			return(true);
		case "tif":
			return(true);
		case "tla":
			return(true);
		default:
			return(false);
		}
	}