function dialogOpen(strUrl, objArguments, intWidth, intHeight, strFeatures, strFrame)
{
	if ((strFeatures == '') || (strFeatures == null))
	{
		strFeatures = 'resizable:no;status:no;scroll:no;help:no';
	}
	strFeatures = 'dialogWidth:' + intWidth + 'px; dialogHeight:' + intHeight + 'px; ' + strFeatures;
	
	var objArgArray = new Array();
	objArgArray[0] = strUrl;
	objArgArray[1] = objArguments;
	
	var nRet;

  if (window.showModalDialog) 
  { // IE
   	nRet = showModalDialog('../Admin/WebDialog.htm', objArgArray, strFeatures) * 1;
  }
  else
  {
    window.open('../Admin/WebDialog.htm', window, strFeatures + ',modal=yes')
  }

	//
	// Refresh selected iframe
	//
	if (nRet < 0)
	{
		if (strFrame == 'top')
		{
			document.location.reload();
		}
		else if (strFrame == 'dialog')
		{
			document.location.href = document.location.href;
		}
		else
		{
			var frm = window.document.frames;
			for (i=0; i < frm.length; i++)
			{
				if (frm(i).name == strFrame)
				{
					frm(i).location.reload();
				}
			}
		}
	}
	
	//
	// Invalid login information
	//
	
	if (nRet == 9999)
	{
		top.document.location='USR_login.aspx';
	}
	
	// return nRet < 0 ? - nRet : nRet ;
}

function dialogOpenReturnString(strUrl, objArguments, intWidth, intHeight, strFeatures)
{
	if ((strFeatures == '') || (strFeatures == null))
	{
		strFeatures = 'resizable:no;status:no;scroll:no;help:no';
	}
	strFeatures = 'dialogWidth:' + intWidth + 'px; dialogHeight:' + intHeight + 'px; ' + strFeatures;
	
	var objArgArray = new Array();
	objArgArray[0] = strUrl;
	objArgArray[1] = objArguments;
	
	var strRet;
	
	strRet = showModalDialog('WebDialog.htm', objArgArray, strFeatures);
	
	//
	// Invalid login information
	//
	if (strRet == '$$$$')
	{
		top.document.location='USR_login.aspx';
	}
	
	if (strRet == '$$$')
		return null;
	else
		return strRet;
}


function dialogOpenFromDialog(strUrl, objArguments, intWidth, intHeight, strFeatures, strFrame, prevDialog)
{
	if(prevDialog.dialogLeft)
	{
		strFeatures =	'resizable:no;status:no;scroll:no;help:no;';
		var left = parseInt(prevDialog.dialogLeft.substr(0, prevDialog.dialogLeft.length - 2)) + 200;
		strFeatures += 'dialogLeft:' + left + 'px';
	}
	return dialogOpen(strUrl, objArguments, intWidth, intHeight, strFeatures, strFrame)
}

function dialogOpenAtLocation(strUrl, objArguments, intWidth, intHeight, strFeatures, strFrame, intLeft)
{
	strFeatures =	'resizable:no;status:no;scroll:no;help:no;dialogLeft:' + intLeft + 'px';
	return dialogOpen(strUrl, objArguments, intWidth, intHeight, strFeatures, strFrame)	
}


function adminWindow(url, width, height)
{
    var okno = window.open(url, 'admin', 'width=' + width + ',height=' + height + ',resizable=yes,status=0');
    okno.focus();
}