
function openPopupWindow(url, name, width, height, returnWindow)
{
	var horizontalOffset, verticalOffset, offsetAmount, windowToReturn, closethiswindow;
		
	offsetAmount = 0;
	
	if(width == -1)
	{
	
  	if ((screen.Height >= 0) && (screen.Width >= 0)) {
     		 width = screen.Width - 10;
 	 }
  	else if ((screen.availHeight >= 0) && (screen.availWidth >= 0)) {
      		 width = screen.availWidth - 10;
  	}
	}	
	
	if(height == -1)
	{
	if ((screen.Height >= 0) && (screen.Width >= 0)) {
     		 height = screen.Height - 75;
    }
  	else if ((screen.availHeight >= 0) && (screen.availWidth >= 0)) {
      		 height = screen.availHeight - 45;
    }
	}
	
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		horizontalOffset = window.screenLeft + offsetAmount;
		verticalOffset = window.screenTop + offsetAmount;
	}
	else
	{
		horizontalOffset = window.screenX + offsetAmount;
		verticalOffset = window.screenY + offsetAmount;
	}
	
	if(horizontalOffset + width > screen.availWidth || verticalOffset + height > screen.availHeight)
	{
		horizontalOffset = 0;
		verticalOffset = 0;
	}
		
	windowToReturn = window.open(url, name, "toolbar=0,location=0,directories=0,status=yes,menubar=no,scrollbars=1,resizable=yes,screenX=" + horizontalOffset + ",screenY=" + verticalOffset + ",left=" + horizontalOffset + ",top=" + verticalOffset + ",width=" + width + ",height=" + height);
	//Please do not publish with the return window statement
	//if(returnWindow)
	//{
	//	return(windowToReturn);
	//}
}



function createTarget(form) 
{
	_target = form.target;
	_colon = _target.indexOf(":");
	if(_colon != -1) 
	{
		form.target = _target.substring(0,_colon);
		form.args = _target.substring(_colon+1);
	} 
	else if(typeof(form.args)=="undefined") 
	{
		form.args = "";
	}
	if(form.args.indexOf("{")!=-1) 
	{
		_args = form.args.split("{");
		form.args = _args[0];
		for(var i = 1; i < _args.length;i++) 
		{
			_args[i] = _args[i].split("}");
			form.args += eval(_args[i][0]) + _args[i][1];
		}
	}
	
	form.args = form.args.replace(/ /g,"");
	_win = window.open('',form.target,form.args);
	
	if(typeof(focus)=="function")
		_win.focus();
	return true;
}