function checkAll(prefix, blocked)
{
   jQuery(document).ready(function() {
    var is_checked = jQuery('#'+prefix).is(':checked');
    var patt = new RegExp(prefix+'_');
    var box = new RegExp('d_box_');

    if(blocked){
      jQuery('#c_media_locations ul').each(function(){
        if(box.test(this.id)){
            this.style.display = 'none';
        }
      });
    }
    jQuery('input:checkbox').each(function(){
      if(patt.test(this.id))
      {
        if(is_checked)
        {
          this.checked = !this.checked;
          if(blocked==true)
          {
            this.disabled = true;
          }
        }
        else
        {
          if(blocked==true)
          {
            this.disabled = false;
          }
          this.checked = !this.checked;
        }
      }
    })
   });
}

function roll(id)
{
  var box = jQuery('#c_'+id);
   if(box.css('display') == "" || box.css('display') == "none")
  {
    box.css('display', 'block');
  }
  else
  {
    box.css('display', 'none');
  }
}


function roll_box(id, name)
{
  var patt = new RegExp(name+'_'+id+'_');
  var box = jQuery('#d_box_'+id);
  if(box.css('display') == "" || box.css('display') == "none")
  {
    box.css('display', 'block');
    jQuery('input:checkbox').each(function(){
      if(patt.test(this.id))
      {
        this.disabled = false;
      }
    });
  }
  else
  {
    box.css('display', 'none');
    jQuery('input:checkbox').each(function(){
      if(patt.test(this.id))
      {
        this.disabled = true;
      }
    });
  }
}
