var resId=0;
var imgWndw;
function popimg(imgLink, Title) {
  if (typeof(window.resizeBy)=='undefined') return true;
  var sl=(document.body.clientWidth-100)/2;
  var st=(document.body.clientHeight-100)/2;
  imgWndw=window.open(imgLink,'swnd','width=50,height=50,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=yes,left='+sl+',top='+st);
  imgWndw.focus();
  var STitle = Title.replace(/"/g,'&quot;');
  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="'+STitle+'" title="'+STitle+'" /></bo'+ 'dy></ht'+'ml>');
    close();
  }

  resId=setInterval('imgResize()',200);
  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)
    {
     resWidth = w-ww;
     resHeight = h-wh;

   imgWndw.resizeBy(resWidth,resHeight);

     var sw=(document.body.clientWidth-w)/2;
     var sh=(document.body.clientHeight-h)/2;
     if (sh<0) sh=0; if (sw<0) sw=0;
     imgWndw.moveTo(sw,sh);
    }
    imgWndw.focus();
    clearInterval(resId)
  }
}

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;
}

