/* Based on Prototype.js */

// changing content (reset 'active' ClassName and set new)
function reset(elems,active){
  $$(elems).each(function(e){
    e.removeClassName('active');
  })
  $(active).addClassName('active');
}

// filter in-prague, out-prague or all hotels
function filter(show,where,elem) {
  reset('#'+where+' .submenu li a',elem);
  $$('#'+where+' .hotel-items .item').each(function(e){
    if(e.hasClassName(show)) { e.show(); }
    else { e.hide(); e.removeClassName('active'); }
  })
}

// select hotel in booking form
function book(hotelName,elem) {
  if (!elem) {
      return;
  }
  reset('#sidebar .hotel-detail',hotelName);
  reset('.hotel-items .item',elem);
  $$('#f-hotel option').each(function(e,index){
    if(e.value == hotelName){
      e.parentNode.selectedIndex = index;
    };
  })
}


