toggle_visibility = function(elmid) {
  var subm = $(elmid);
  if (subm.style.display=='none' || subm.style.display=='')
      subm.style.display='block';
  else
      subm.style.display='none';
};

function show_photo(url, descr)
{
  $('fullfoto').style.background='#cccccc url('+url+') no-repeat center';
  $('bijschrift').innerHTML = descr;
}

function popup(url)
{

  newwindow = window.open(url,'name','scrollbars=yes','height=420,width=760,top=0,left=0');
  if (window.focus) {
    newwindow.focus()
  }

}

// ------------------------------------------------ AJAX spotlight search ------------------------------------------------
var old = '';

dolivesearch = function () {
  res = $('spotlightresults');
  qry = $('spotlightquery').value;
  if (qry != old) {
    if (qry == '' || qry == 'Livesearch website . . .') {
      res.innerHTML = '';
      res.style.display = 'none';
    } else
      intraxxion.submitform('DesignerTemplates/spotlightresults.html', $('livesearch'), displayresults);
  }
  old = qry;
  setTimeout('dolivesearch()', 700) ;
};
initsearch =function () {
  dolivesearch();
};

displayresults = function (data) {
  $('spotlightresults').style.display = 'block';
  $('spotlightresults').innerHTML = data.responseText;
};

// ------------------------------------------------ Page initialization --------------------------------------------------
connect(window, 'onload',
  function(evt) {
    initial_height();
    try {
      initsearch();
    } catch(e) {log(e);}
  }
);

/*
connect(window, 'onresize', 
  function(evt) {
    log('resize');
    initial_height();
  }
);
*/
function initial_height() {
  vp = getViewportDimensions();
  cd = getElementDimensions($('container'));
  fd = getElementDimensions($('footer'));
  log('container '+cd);
  log('viewport '+vp);
  log('footer '+fd)
  log('gewenst '+(vp.h - fd.h))
  log('cd+fd '+(cd.h + fd.h))
  if (document.all) {
    // Fix IE bugs
    ovp = vp.h
    if (document.documentElement && document.documentElement.clientHeight) {
      vp.h = document.documentElement.clientHeight;
    } else if (document.body) {
      vp.h = document.body.clientHeight;
    }
  }
  if ((cd.h+fd.h) < vp.h) {
    cd.h = vp.h - fd.h;
    $('container').style.height = cd.h+'px';
    $('content').style.height = (cd.h-160)+'px';
    $('content').style.height='auto';
  }
}


