function openPopup(winURL, width, height, winName)
	/* this function will open a window and center it on the parent, it also controls the focus if the window is already open */
	{
		var iMyWidth;
		var iMyHeight;		

		//gets top and left positions based on user's resolution so hint window is centered.
		    
		//alert(window.screenLeft);
		
		//window.resizeTo(640, 480);
		//alert(document.body.offsetWidth)
		//alert(document.body.offsetHeight)
		
		iMyLeft = (document.body.offsetWidth / 2) - ((width / 2)) + window.screenLeft; //half the screen width minus half the new window width (plus 5 pixel borders).
		iMyTop = (document.body.offsetHeight / 2) - ((height / 2) + 50) + window.screenTop; //half the screen height minus half the new window height (plus title and status bars).
		
		var winPopup = window.open(winURL, winName, "width=" + width + ",height=" + height + ",status=no,resizable=yes,top=" + iMyTop + ",left=" + iMyLeft);
		//alert(height);
		//alert(winPopup.document.body.offsetHeight);
		winPopup.focus();
		//expand(winPopup, width + 2, height);
	}	
	
function expand(winName, width, height) 
	{ 		
		//document.snd.play(false);
		
		var newHeight = 0;
		//var width1 = winName.document.body.offsetWidth;
		//var height1 = winName.document.body.offsetHeight;
		//alert('test');
		//alert(width);
		//alert(winName.document.body.offsetWidth);		
		
		if (width > 0)
			{
				for(x = 104; x < width; x = x + 6)
					{
						var resizeByHeight = 0;
						if (newHeight < height)
							{ newHeight = newHeight + 1; 
							  resizeByHeight = 1;
							} 

						winName.resizeBy(6, 0);
					}
					
				return;
			}
			
		var newWidth = 0;
		
		/* 
		if (height > width)
			{ 
				for(x = 0; x < height; x = x + 3)
					{
						if (newWidth < width)
							{ newWidth = newWidth + 1; }

						winName.resizeTo(newWidth, x);
					}

				return;
			}
		*/
			

		/* 
		for(x = 0; x < 50; x++) 
			{ 
				winName.moveTo(screen.availWidth * -(x - 50) / 100, screen.availHeight * -(x - 50) / 100); 
				winName.resizeTo(screen.availWidth * x / 50, screen.availHeight * x / 50); 
			} 
		
		winName.moveTo(0,0); 
		winName.resizeTo(screen.availWidth, screen.availHeight); 
		*/

 
 	} 
	
function numberFormat(str)
	/* this function will strip a string of all it's ($,) */
	{					
		// Check if user entered $ or commas or () and eliminate them
		var newStr =  str.toString().replace(/\(\$/g,'-');		
		newStr = newStr.toString().replace(/\(|\)|\$|\,/g,'');
		return newStr;
	}
	
function dollarFormat(amt)
	/* this function will format a number with ($,.) */
	{	
		var newAmt = "";					
		var posCount = 0;
		
		// Check if user entered $ or commas and eliminate them
		amt = numberFormat(amt);
		
		// if number enter is not a number or is empty, then amt = 0
		// this way we make sure we always have a number
		if(isNaN(amt) || amt == "")	amt = "0";
		
		var sign = (amt == (amt = Math.abs(amt)));
		
		var intPart = amt;
		//var decPart = "00";	
				
		amt = amt.toString();		
		if (amt.toString().indexOf('.') != -1)
			{
				intPart = amt.slice(0, amt.indexOf('.'));
				//decPart = amt.slice(amt.indexOf('.') + 1, amt.length);
			}			
		
		intPart = intPart.toString();
		for(x = intPart.length; x > 0; x--)
			{				
				if (posCount == 3)
					{ newAmt = "," + newAmt; posCount = 0}
				
				newAmt = intPart.slice(x - 1, x) + newAmt;
				posCount = posCount + 1;
			}			
			
		//alert('before');
		var num = Math.floor(amt * 100 + 0.50000000001);
		var cents = num%100;		

		if(cents<10)
			cents = "0" + cents;
			
		//alert(cents);

		return ((sign)?'':'(') + "$" + newAmt + '.' + cents + ((sign)?'':')');
	}
	
function listSelectAllItems(theList) {
	for (x = 0; x < theList.length; x++) {
		theList.item(x).selected = true;
	}
}

function listMoveSelectedItems(fromList, toList) {		
	var addBox = toList;
	var removeBox = fromList;
	
	/* first, the items must be added */
	for (x = 0; x < removeBox.length; x++) {
		if (removeBox.item(x).selected) {
			newOpt = document.createElement("OPTION");
			newOpt.text = removeBox.item(x).text;
			newOpt.value = removeBox.item(x).value;

			addBox.add(newOpt, addBox.length);
		}
	}
	
	/* now, the selected items must be removed */
	x = removeBox.length - 1;
	while (x >= 0) {					
		if (removeBox.item(x).selected)
			{ removeBox.remove(x); }
				
		x = x - 1;
	}			
}
