var site_base = '';

//get basepath
if(a=document.getElementsByTagName("link")[0])
{
  site_base = a.href.substr(0,a.href.indexOf('/resources'));
}

function popup(url,w,h,scroll)
{
  var l = (screen.width-w)/2;
  var t = (screen.height-h)/2;
  window.open(url,'_blank','resizable=yes,location=no,menubar=no,scrollbars='+scroll+',status=no,toolbar=no,fullscreen=no,dependent=no,width='+w+',height='+h+',left='+l+',top='+t);
}

window.addEvent('domready', function()
{
  $$('.checkall').each(function(el)
  {
    var selitems   = $$('.'+el.id+'_single');
    selitems.each(function(sel)
    {

        sel.addEvent('click', function(e)
        {
          var newstate = el.checked;
          if(this==el)
          {
            selitems.each(function(el){
              el.checked=newstate;
            });
          }
          else if(this.checked==false)
          {
              el.checked=false;
          }
        })
    });
  });
  
  $$('.toggler').each(function(el)
  {
    if($(el.hash.substring(1)))
    {
      el.addEvent('click', function(e)
      {
        var el = $(this);
        $(this.hash.substring(1)).tween('height', $(this.hash.substring(1)).offsetHeight>0? 0:$(this.hash.substring(1)).scrollHeight);
        e.stop();
      });
    }
  });

});
