/********************************************************
/* Function: document.onselectstart
/* Purpose: Prevents highlighting of text in the document by cancelling
/*     the click and drag event.  If the event is triggered by an input or
/*     textarea element, then it is allowed.	
/*
/* Inputs: None
/* Output: None
/*******************************************************/
/*function document.onselectstart()
{
	var szTagName = event.srcElement.tagName.toLowerCase();
				
	if (szTagName != "input" && szTagName != "textarea")
	{
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
}
	
*/			
/********************************************************
/* Function:	OpenWindow
/* Purpose:	Opens a window based on the name of the ASP of HTML
/*		file.  The window will be centered on screen and will be given
/*		whatever name is passed in.
/*
/* Inputs: FileName to open, Window Name, Height, Width,
/*     Allow Bars (Menu, Location, Toolbar) (T/F), Allow Resizing (T/F),
/*     Allow Scrolling (T/F), Allow Status Bar (T/F).
/*
/* Output:	Returns a reference to the new window.
/*******************************************************/
function OpenWindow(szURL, szName, nHeight, nWidth, bBars, bResize, bScroll, bStatus)
{
	var szFeatures;
	var szBars = (bBars) ? "yes" : "no";
	var szResize = (bResize) ? "yes" : "no";
	var szScroll = (bScroll) ? "yes" : "no";
	var szStatus = (bStatus) ? "yes" : "no";
	var vArgsOut;
								
	szFeatures = "top=" + ((screen.availHeight - nHeight - 10)/2);
	szFeatures += ",left=" + ((screen.availWidth - nWidth - 10)/2);
	szFeatures += ",height=" + nHeight + ", width=" + nWidth;
	szFeatures += ",toolbar=" + szBars + ", menubar=" + szBars + ", location=" + szBars;
	szFeatures += ",directories=no, status=" + szStatus + ", scrollbars=" + szScroll;
	szFeatures += ",resizable=" + szResize;
								
	vArgsOut = window.open(szURL, szName, szFeatures);
	
	return vArgsOut;
}
				
/********************************************************
/* Function:	OpenModalWindow
/* Purpose:	Opens a modal window.
/*
/* Inputs:	FileName to open, Window Name, Height, Width,
/*     Allow Bars (Menu, Location, Toolbar) (T/F), Allow Resizing (T/F),
/*     Allow Scrolling (T/F), Allow Status Bar (T/F).
/*
/* Output:	Arguments returned from window.
/*******************************************************/
function OpenModalWindow(szURL, vArgsIn, nHeight, nWidth, bStatus)
{
	var szFeatures;
	var szStatus = (bStatus) ? "yes" : "no";
	var vArgsOut;
									
	szFeatures = "border:thick; center:yes";
	szFeatures += ";dialogHeight=" + nHeight + "px";
	szFeatures += ";dialogWidth=" + nWidth + "px";
	szFeatures += "; help:no; status:" + szStatus;
								
	vArgsOut = window.showModalDialog(szURL, vArgsIn, szFeatures);
					
	return vArgsOut;
}
				
/********************************************************
/*	Function:	OpenModalessWindow
/*	Purpose:	Opens a modaless window.
/*
/*	Inputs:	FileName to open, Window Name, Height, Width,
/*     Allow Bars (Menu, Location, Toolbar) (T/F), Allow Resizing (T/F),
/*     Allow Scrolling (T/F), Allow Status Bar (T/F).
/*
/* Output:	Arguments returned from window.
/*******************************************************/
function OpenModalessWindow(szURL, vArgsIn, nHeight, nWidth, bResize, bStatus)
{
	var szFeatures;
	var szResize = (bResize) ? "yes" : "no";
	var szStatus = (bStatus) ? "yes" : "no";
	var vArgsOut;
									
	szFeatures = "border:thick; center:yes";
	szFeatures += ";dialogHeight=" + nHeight + "px";
	szFeatures += ";dialogWidth=" + nWidth + "px";
	szFeatures += ";resizable=" + szResize;
	szFeatures += "; help:no; status:" + szStatus;
							
	vArgsOut = window.showModelessDialog(szURL, vArgsIn, szFeatures);
					
	return vArgsOut;
}
				
/********************************************************
/*	Function:	ParseChar
/*	Purpose:	Removes any characters from a string that are found
/*		in the array argument.
/*
/*	Inputs:	String to parse, Array of characters to remove.
/*
/* Output:	Parsed string
/*******************************************************/
function ParseChar(szValue, vParseArray)
{
	var nArrayLength = vParseArray.length;
	var nBeginAt;
	var nEndAt;
	var szParsed;
							
    for (var i=0; i < nArrayLength; i++)
    {
        nBeginAt = 0;
        nEndAt = szValue.indexOf(vParseArray[i]);
        szParsed = "";
						
        while (nEndAt != -1)
        {
            szParsed += szValue.substring(nBeginAt, nEndAt);
            nBeginAt = nEndAt + 1;
            nEndAt = szValue.indexOf(vParseArray[i], nBeginAt);
        }
				        
        szParsed += szValue.substring(szValue.lastIndexOf(vParseArray[i]) + 1, szValue.length);
        szValue = szParsed;
    }
						    
    return szParsed;
}

