
function doPreview(i)
{
  /* Opens a preview window for one of the ads in a new window.  Of course,
     this is completely possible using the 'target' attribute of the <a> tag,
     but we also want to size the window. */
  w=window.open('/preview.php?ad='+i,'Preview',"width=170,height=275, scrollbars=yes, menubar=no");
  w.focus();

  return(false);
}
function selectAll(checked,state)
{
  // Selects or deselects all brochures for the given state

  /* Get the rows of the destinations table, so we can check the state and
     check or uncheck the checkbox as appropriate */
  var rows=new getObj('destinations').obj.rows;

  for (var i=0; i<rows.length; i++)
  {
    var item=rows[i].getElementsByTagName('span');

    for (var j=0; j<item.length; j++)
    {
      if (item[j].innerHTML==state)
        rows[i].getElementsByTagName('input')[j].checked=checked;
    }
  }
  window.focus();
}
function getObj(name)
{
  if (document.getElementById)
  {
    this.obj=document.getElementById(name);
    this.style=document.getElementById(name).style;
  }
  else if (document.all)
  {
    this.obj=document.all[name];
    this.style=document.all[name].style;
  }
  else if (document.layers)
  {
    this.obj=document.layers[name];
    this.style=document.layers[name];
  }
}
