// select/deselect all checkboxes

      function boxCheck(frm,stat){
         var frm_el=frm.elements;
         for(var i=0;i<frm_el.length;i++){
                if(frm_el[i].type=="checkbox")frm_el[i].checked=stat;
         }
      }


// select/deselect all checkboxes in a group

      function boxCheck2(frm,stat,imgId){
         var frm_el=frm;
         img = document.getElementById(imgId)
         imgSrc = img.src;
         imgArray= new Array(10);
         imgArray = imgSrc.split('/');
         thisImage=imgArray.pop();
         if (thisImage == 'selectAll_b.gif'){stat = ''} else {stat = 'true'}
         for(var i=0;i<frm_el.length;i++){
                if(frm_el[i].type=="checkbox"){
                  frm_el[i].checked=stat;
                }
         }
         countChecked(frm);
//         countCheckedAll(frm);
      }
// count the checked checkboxes in a group

      function countChecked(frm){
         var frm_el=frm;
         var count=0;
         var size=parseFloat(0);
         var total=frm_el.length-1;
         var val=0;
         for(var i=0;i<frm_el.length;i++){
             if(frm_el[i].type=="checkbox"){
                var chk=eval("frm_el[i].checked");
                if(chk){
                   var elem=document.getElementsByName(frm_el[i].value);
                   for(var j=0;j<elem.length;j++){
                      if(elem[j].type=="hidden" && elem[j].name == frm_el[i].value){
                          size = size + parseFloat(elem[j].value);
                      }
                   }
                   count++;
                }
             }
         }
         if(size < 1.0){
            size= parseInt(size*1024);
            var sizeStr = Math.round(size*10)/10 + " kB";
         }else{
            var sizeStr = Math.round(size*10)/10 + " MB";
         }

         for(var i=0;i<frm_el.length;i++){
             if(frm_el[i].type=="text"){frm_el[i].value=" "+count+" items (" + sizeStr +")"}
         }
//         countCheckedAll(frm);
      }
// count all checked checkboxes
      function countCheckedAll(){
         var frm_el=parent.leftcontent.document.selection;
         var count=0;
         var total=frm_el.length-1;
         var size=parseFloat(0);
         for(var i=0;i<frm_el.length;i++){
             if(frm_el[i].type=="checkbox"){
                var chk=eval("frm_el[i].checked");
                if(chk){
                   var elem=document.getElementsByName(frm_el[i].value);
                   for(var j=0;j<elem.length;j++){
                      if(elem[j].type=="hidden" && elem[j].name == frm_el[i].value){
                          size = size + parseFloat(elem[j].value);
                      }
                   }
                   count++;
                }
             }
         }
         if(size < 1.0){
            size= parseInt(size*1024);
            var sizeStr = Math.round(size*10)/10 + " kB";
         }else{
            var sizeStr = Math.round(size*10)/10 + " MB";
         }
//         parent.topcontent.document.requests.xitems.value=sizeStr+" / "+count+" ";
//         parent.topcontent.document.getElementById('loading').style.visibility="hidden";
      }
// delete all selected items

      function deleteSelected(frm,action){
         var frm_el=frm.elements;
         var list="";
         var selected = false;
         for(var i=0;i<frm_el.length;i++){
                if(frm_el[i].type=="checkbox" && frm_el[i].checked== true){
                   list=list + "&itemid="+frm_el[i].value;
                   selected = true;
                }
         }
         if ( selected == true){
            var inn="/mason/cart/cart.html?brkr_action="+ action + list;
            //
            // I have no good reason for having this write statement here, except the
            // fact that FireFox fails without it! If this issue is solved and this
            // write statement is removed, cart.html must be modified to have history(-1) attached
            // to the Back link, rather than history(-2) Manoch, October 17, 2005
            //
            parent.rightcontent.document.write(" ");
            if (action == 'confirmdelete'){
               parent.rightcontent.window.location.href=inn;
            }else{
               parent.leftcontent.window.location.href=inn;
               parent.rightcontent.window.location.href='/blank.html';
            }
         }else if(action == "remove"){
            var inn="/mason/cart/cart.html?brkr_action=confirmdelete&itemid=none";
            //
            // I have no good reason for having this write statement here, except the
            // fact that FireFox fails without it! If this issue is solved and this  
            // write statement is removed, cart.html must be modified to have history(-1) attached
            // to the Back link, rather than history(-2) Manoch, October 17, 2005
            //
            document.write(" ");
            parent.rightcontent.window.location.href=inn;
         }else{
            var inn="/mason/cart/cart.html?brkr_action=confirmdelete";
            parent.rightcontent.window.location.href=inn;
         }

      }
// bundle all selected items

      function bundleSelected(frm,action){
         var frm_el   = frm.elements;
         var list     = "";
         var selected = false;
         for(var i=0;i<frm_el.length;i++){
                if(frm_el[i].type=="checkbox" && frm_el[i].checked== true) {
                   list=list + "&itemid="+frm_el[i].value;
                   selected = true;
                }
                if(frm_el[i].type=="text" && frm_el[i].name=="displayName") list=list + "&displayName="+frm_el[i].value;
                if(frm_el[i].type=="radio" && frm_el[i].checked) list=list + "&encoding="+frm_el[i].value;
         }
         if ( selected == true){
            var inn="/mason/cart/cart.html?brkr_action="+ action + list;
            //
            // I have no good reason for having this write statement here, except the
            // fact that FireFox fails without it! If this issue is solved and this
            // write statement is removed, cart.html must be modified to have history(-1) attached
            // to the Back link, rather than history(-2) Manoch, October 17, 2005
            //
            parent.rightcontent.document.write(" ");
            if (action == 'confirmbundle'){
               parent.rightcontent.window.location.href=inn;
            }else if(action == "qcancel"){
               document.write(" ");
               parent.parent.content.window.location.href='/cgi-bin/cart-bin/e-comm?CHK';
            }else if(action == "mcancel"){
               document.write(" ");
               parent.rightcontent.window.location.href='/blank.html';
            }else{
               parent.leftcontent.window.location.href=inn;
               parent.parent.content.window.location.href='/cgi-bin/cart-bin/e-comm?MLD';
            }
         }else if(action == "bundle"){
            var inn="/mason/cart/cart.html?brkr_action=confirmbundle&itemid=none";
            //
            // I have no good reason for having this write statement here, except the
            // fact that FireFox fails without it! If this issue is solved and this 
            // write statement is removed, cart.html must be modified to have history(-1) attached
            // to the Back link, rather than history(-2) Manoch, October 17, 2005
            // 
            document.write(" ");
            parent.rightcontent.window.location.href=inn;
         }else if(action == "cancel"){
            var inn="/blank.html";
            document.write(" ");
            parent.rightcontent.window.location.href=inn;
         }else{
            var inn="/mason/cart/cart.html?brkr_action=confirmbundle";
            parent.rightcontent.window.location.href=inn;
         }
      }

