function swapImage(imgN,imgU){
   if(document.images)document.images[imgN].src=imgU;
}

function closeRefresh()
{
	window.opener.document.location.reload(); 
	self.close();
}

function hideSubmit()
{
	window.loading.style.display = "block";
	window.submit.style.display = "none";
}

function popUpCustom(URL, width, height, scroller) 
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=" + scroller + ",location=0,status=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",left = 200,top = 200');");
}

function verify(msg, where)
{
 where_to = false;
 var where_to = confirm(msg);
 if (where_to == true) {
   if (where != '')
     window.location=where;
   return true;
 } else {
   return false;
 }
 return true;
}

//==========================================
// Check all or uncheck all?
//==========================================
function CheckCheckAll(fmobj) {
  var TotalBoxes = 0;
  var TotalOn = 0;
  for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if (e.type=='checkbox') {
      TotalBoxes++;
      if (e.checked) {
       TotalOn++;
      }
    }
  }
  if (TotalBoxes==TotalOn) {
		  TurnThemOn(fmobj, false);
  }
  else {
			TurnThemOn(fmobj, true);
  }
}

function TurnThemOn(fmobj, tvar) {
		  for (var i=0;i<fmobj.elements.length;i++) {
    var e = fmobj.elements[i];
    if (e.type=='checkbox') {
       e.checked=tvar;
				}
  }
}

//==========================================
// Check all or uncheck all?
//==========================================

function CISCheckAll(area) {
  var TotalBoxes = 0;
  var TotalOn = 0;
   fields = document.cis.getElementsByTagName("input");
   for (var i = 0; i < fields.length; i++)
   {
     if (fields[i].name.indexOf(area) == 0)
     {
									if (fields[i].type='checkbox') {
            TotalBoxes++;
												if (fields[i].checked) {
												   TotalOn++;
												}
									}
     }
   }
			if (TotalBoxes==TotalOn) {
			    CISTurnOn(area, false);
			} else {
			    CISTurnOn(area, true);
			}
}

function CISTurnOn(area, tvar) {
		var txt = "All"+area;
  fields = document.cis.getElementsByTagName("input");
		for (var i=0;i<fields.length;i++) {
      if (fields[i].name.indexOf(area) == 0)
     {
									if (fields[i].type='checkbox') {
            fields[i].checked=tvar;
									}
     }
					if (fields[i].name.indexOf(txt) == 0)
     {
									if (fields[i].type='checkbox') {
            fields[i].checked=tvar;
									}
     }
  }
}