function CheckAllChild(sParentControlID,sCheckAllID)
{
	var ctlParent = document.getElementById(sParentControlID);
	var bChecked = document.getElementById(sCheckAllID).checked;
	for (var i=0; i<ctlParent.all.length; i++) {
		var e = ctlParent.all(i);
		if (e.type == "checkbox") e.checked = bChecked; 
	}
}

function GetChildCheckedValues(sParentControlID,sCheckAllID,sSep)
{
	var ctlParent = document.getElementById(sParentControlID);
	var sReturn = "";
	for (var i=0; i<ctlParent.all.length; i++) {
		var e = ctlParent.all(i);
		if (e.type == "checkbox") {
			if (e.checked && e.id != sCheckAllID) sReturn = sReturn + e.value + sSep;
		}
	}
	if (sReturn != "") sReturn = sReturn.substring(0, sReturn.length-sSep.length);
	return sReturn;
}

function Go(sSRC)
{
    window.location = sSRC;
}

function ConfirmGo(sSRC, sQuestion)
{
	var bRet;
    bRet = confirm(sQuestion);
    if (bRet != false) window.location = sSRC;
}

function ShowPreview(sSrc) {
	var sFeatures = "toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,left=0,top=0,width=780,height=580;"
	window.open(sSrc, "_blank", sFeatures, true);
}

function AdjustPicture(sTableID,iWidth,iHeight) {
	var oTable = document.getElementById(sTableID);
	if (oTable == null) return;
	for (var i = 0; i < oTable.all.length; i++) {
		o = oTable.all(i);
		if (o.tagName == "IMG") {
			if (o.offsetWidth > iWidth) {
				o.height = (o.offsetHeight * iWidth) / o.offsetWidth;
				o.width = iWidth;
			}
			if (o.height > iHeight) {
				o.width = (o.width * iHeight) / o.height;
				o.height = iHeight;
			}
		}
	}
}

function AdjustPictureWidth(sTableID,iWidth) {
	var oTable = document.getElementById(sTableID);
	if (oTable == null) return;
	for (var i = 0; i < oTable.all.length; i++) {
		o = oTable.all(i);
		if (o.tagName == "IMG") {
			if (o.offsetWidth > iWidth) {
				o.height = (o.offsetHeight * iWidth) / o.offsetWidth;
				o.width = iWidth;
			}
		}
	}
}

function ModalDialog(iWidth, iHeight, sUrl, sTitle) {
	var sFeatures = "dialogWidth:" + iWidth + "px;dialogHeight:" + iHeight + "px;center:Yes;resizable:No;help:No;status:No";
	return window.showModalDialog("Dialog.aspx?SRC=" + sUrl + "&Title=" + sTitle, window, sFeatures);
}

function Dialog(iWidth, iHeight, sUrl, sTitle) {
	var sFeatures = "dialogWidth:" + iWidth + "px;dialogHeight:" + iHeight + "px;center:Yes;resizable:No;help:No;status:No";
	return window.showModelessDialog("dialog.aspx?SRC=" + sUrl + "&Title=" + sTitle, window, sFeatures);
}

function Window(iWidth, iHeight, sUrl) {
	var sFeatures = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + iWidth + ",height=" + iHeight + ";"
	window.open(sUrl, "_blank", sFeatures, true);
}
