function DoJSPopup(strURL,strWindowName,intWidth,intHeight)
{
    if (intWidth == null)
        intWidth = 600;
    if (intHeight == null)
        intHeight = 600;
    if (strWindowName == null)
        strWindowName = "jswindow";

    var objPopupWindow = window.open(strURL, strWindowName, 'toolbar=yes,location=no,resizable=yes,status=yes,scrollbars=yes,width='+intWidth+',height='+intHeight);
    objPopupWindow.focus();
}

function DoJSToolPopup(strURL,strWindowName,intWidth,intHeight)
{
    if (intWidth == null)
        intWidth = 600;
    if (intHeight == null)
        intHeight = 600;
    if (strWindowName == null)
        strWindowName = "jswindow";

    var objPopupWindow = window.open(strURL, strWindowName, 'toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width='+intWidth+',height='+intHeight);
    objPopupWindow.focus();
}

function CheckCategorySelection(objSelect, strSubCategorySelectName)
{
	var strID = objSelect.id;
	var objSubCategorySelect = null;
	
	var objSubCategorySelectList = document.getElementsByName(strSubCategorySelectName);
	
	for (var i=0; i<objSubCategorySelectList.length; i++)
	{
		objSubCategorySelect = objSubCategorySelectList[i];
		if (objSubCategorySelect.id == (strID+objSelect.value))
		{
			objSubCategorySelect.disabled = false;
			objSubCategorySelect.style.display = "inline";
		}
		else
		{
			objSubCategorySelect.disabled = true;
			objSubCategorySelect.style.display = "none";
		}
	} 
}

function UpdateMakePrivateField(intFieldNumber)
{
    var objTextInput = document.getElementById("txtField" + intFieldNumber);
    var objChkInput = document.getElementById("chkField" + intFieldNumber);
    var objHiddenInput = document.getElementById("hiddenField" + intFieldNumber);
    
    var strTxtValue = trim(objTextInput.value);
    objHiddenInput.value = strTxtValue.replace(",","@@comma@") + "," + (objChkInput.checked ? 1 : 0);
}

function trim(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}

