﻿

//Add Event for object:
function AddEvent(obj,eventType,functionName)
{
   if(obj.addEventListener)
      obj.addEventListener(eventType,functionName,false);
   else if(obj.attachEvent)
      obj.attachEvent("on" + eventType,functionName);
   else
      obj["on"+eventType]=functionName;
}

function SelectHotel()
{
  var nidhotel = document.getElementById('nidhotel');
  if( nidhotel==null )
	  return;
  if( nidhotel.value=="*" )
      return;
  var text = nidhotel.options[nidhotel.selectedIndex].text;
  var domain = window.location.href.toLowerCase().indexOf('hoteljoint.com')==-1 ? "http://www.hotelsquery.com" : "http://www.hoteljoint.com";
   if( text.indexOf('Hotel HCC St. Moritz') != -1 )
	window.location.href = domain + '/Hotel/Hotel_HCC_Saint_Moritz_Barcelona.htm';
   if( text.indexOf('Hotel HCC Regente') != -1 )
	window.location.href = domain + '/Hotel/HCC_Regente_Hotel_Barcelona.htm';
   if( text.indexOf('Hotel HCC Montblanc') != -1 )
	window.location.href = domain + '/Hotel/HCC_Montblanc_Hotel_Barcelona.htm';
   if( text.indexOf('Hotel HCC Taber Hotel') != -1 )
	window.location.href = domain + '/Hotel/HCC_Taber_Hotel_Barcelona.htm';
   if( text.indexOf('Hotel HCC Covadonga') != -1 )
	window.location.href = domain + '/Hotel/HCC_Covadonga_Hotel_Barcelona.htm';
   if( text.indexOf('Hotel HCC Open') != -1 )
	window.location.href = domain + '/Hotel/HCC_Open_Hotel_Barcelona.htm';
   if( text.indexOf('Hotel HCC Ciutat de Berga') != -1 )
	window.location.href = domain + '/Hotel/Hotel_Ciutat_de_Barcelona.htm';
   if( text.indexOf('Hotel HCC Montsia') != -1 )
	window.location.href = 'http://www.hoteljoint.com/HotelSearch.aspx?hotelName=HCC';
}
if( document.getElementById('nidhotel') != null )
   AddEvent( document.getElementById('nidhotel'), 'change', SelectHotel );