function popupWindow(url, win_name, w, h)
{
	var wx = 760;
	var hy = 570;
	if (typeof(w) != 'undefined') {
		if (!isNaN(w) && w > 0) {
			wx = w;
		}		
	}
	if (typeof(h) != 'undefined') {
		if (!isNaN(h) && h > 0) {
			hy = h;
		}
	}	
	window.open(url, win_name, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + wx + ',height=' + hy +',screenX=10,screenY=10,top=10,left=10');
}

function checkMultiBoxes(formname, boxgroup, boxid)
{
	var frm = eval('document.' + formname);
	var box = frm.elements[boxgroup];
	var count = 0;

	for (var i = 1; i < box.length; i++) {
		if (box[i].checked == true) {
			count++;
		}
	}
	
	if (boxid == 0) {
		if (box[0].checked == true) {
			for (var i = 1; i < box.length; i++) {
				box[i].checked = false;
			}
		}
		else if (count == 0) {
			box[0].checked = true;
		}
	}
	else if (box[0].checked == true) {
		box[0].checked = false;
	}
}

function SetAllCheckBoxes(FormName, FieldName, mthis)
{
  CheckValue = true;

  if (mthis.checked) CheckValue=true;
  else CheckValue=false;

  if(!document.forms[FormName])
    return;
  var objCheckBoxes = document.forms[FormName].elements[FieldName];
  if(!objCheckBoxes) return;

  var countCheckBoxes = objCheckBoxes.length;
  if(!countCheckBoxes) objCheckBoxes.checked = CheckValue;
  else
    // set the check value for all check boxes
    for(var i = 0; i < countCheckBoxes; i++)
      objCheckBoxes[i].checked = CheckValue;
}


