function checkbox_all_set(frm, name, val){
        var el = frm.elements;
        var pattern = eval('/'+name+'\\[.*\\]/');
        for (count = 0; count < el.length; count++)
                if (el[count].name.match(pattern))
                        if (!el[count].disabled) el[count].checked = val;
}

function checkbox_all_test(frm, name, name2){
        var count2 = 0;
        var count3 = 0;
        var el = frm.elements;
        var pattern = eval('/'+name+'\\[.*\\]/');
        for (count = 0; count < el.length; count++)
                if (el[count].name.match(pattern)){
                        count3++;
                        if (el[count].checked || el[count].disabled) count2++;
                }
        frm.elements[name2].checked = (count2== count3);
}

function fcmd(form,cmd2,cmd){
  form.cmd2.value=cmd2;
  if (cmd) form.cmd.value=cmd;
  if(form.onsubmit != null)form.onsubmit();
  form.submit();
  return true;
}

var resId=0;
var imgWndw;
function popimg(imgLink, Title) {
  if (typeof(window.resizeBy)=='undefined') return true;
  imgWndw=window.open(imgLink,'','width=50,height=50'+ ',toolbar=no,menubar=no,location=no,status=no,'+ 'resizable=yes,scrollbars=no,left=0,top=0');
  self.focus();
  with (imgWndw.document){
    open();
    write('<ht'+'ml><he'+'ad><ti'+'tle>'+Title+'</ti'+'tle>'+ '</he'+'ad><bo'+'dy leftmargin="0" topmargin="0" '+ 'rightmargin="0" bottommargin="0" marginwidth="0" '+ 'style="margin:0;padding:0;position:fixed;overflow:none;" '+ 'marginheight="0"><img src="'+imgLink+'" border="0" '+ ' alt="'+Title+'" title="'+Title+'" class="r" /></bo'+ 'dy></ht'+'ml>');
    close();
  }
  resId=setInterval('imgResize()',100);
  return false
}

function imgResize() {
  var w=imgWndw.document.images[0].width;
  if (w>screen.availWidth) w=screen.availWidth;
  var h=imgWndw.document.images[0].height;
  if (h>screen.availHeight) h=screen.availHeight;
  if (w>50 && h>50) {
    var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)? imgWndw.document.body.clientWidth:null);
    var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)? imgWndw.document.body.clientHeight:null);
    if (ww && wh) { imgWndw.resizeBy(w-ww,h-wh);
    var sw=(screen.width-w)/2;
    var sh=(screen.height-h)/2;
    if (sh<0) sh=0; if (sw<0) sw=0;
    imgWndw.moveBy(sw,10);
    }
    imgWndw.focus();
    clearInterval(resId)
  }
}

