
/* - ++resource++mylimburg.scripts/search_criteria.js - */
var slideDelay = 500; 

/**
* Submits search
*
**/
function submitSearch()
{
  document.getElementById('search').onclick();
}

function showOverlay(formId)
{
  var searchOverlay = document.getElementById('search_overlay');
  var searchForm = document.getElementById('search_criteria_form');
//  searchOverlay.style.left = searchForm.offsetLeft + 'px';
//  searchOverlay.style.top = searchForm.offsetTop -5 + 'px';
  searchOverlay.style.width = searchForm.offsetWidth + 'px';
  searchOverlay.style.height = searchForm.offsetHeight + 'px';  
  searchOverlay.style.display='block';

  var bottomOverlay = document.getElementById('bottom_overlay');
  var detailbottom = document.getElementById('detailbottom');

  if(detailbottom != null){
     bottomOverlay.style.left = detailbottom.offsetLeft + 'px';
     bottomOverlay.style.top = detailbottom.offsetTop + 5 + 'px';
     bottomOverlay.style.width = detailbottom.offsetWidth + 'px';
     bottomOverlay.style.height = detailbottom.offsetHeight + 5 + 'px';
     bottomOverlay.style.display = 'block';
  }
}


function applyLocation(country, region, district, place, title)
  {
    document.getElementById('country_hidden').value = country;
    document.getElementById('region_hidden').value = region;
    document.getElementById('district_hidden').value = district;
    document.getElementById('place_hidden').value = place;

    document.getElementById('title_location').value = title;
    document.getElementById('valueLocation').innerHTML = title;
  }

var hierarchy = new Array('country', 'region', 'district', 'place');

function replaceLocationTitle()
  {
    var titleAr = new Array();
    var l;
    for(var i=0; i < hierarchy.length; i++)
    {
      l = document.getElementById(hierarchy[i]);
      if (l.selectedIndex<0) continue;
      if (l.options[l.selectedIndex].value)
        titleAr[i] = l.options[l.selectedIndex].innerHTML;
    }

    var title;
    if (titleAr.length == 0)
      title = '';
    else
      title = titleAr.pop();

    document.getElementById('title_location').value = title;
    document.getElementById('valueLocation').innerHTML = title;
  }

function replaceThemeTitle(value, title, titleDesc, titleHiddenDesc, valueHiddenDesc)
  {
    document.getElementById(titleDesc).innerHTML = title
    document.getElementById(titleHiddenDesc).value = title
    document.getElementById(valueHiddenDesc).value = value
  }


function columnClick(id, defaultOrder)
{
  var directions = {'desc': 'asc', 'asc': 'desc'};
  var el = document.getElementById(id);
  if (el.value)
    el.value = directions[el.value];
  else
    el.value = defaultOrder;
}



