// JScript source code

// Used in FindYourHotelContainer.php
function selectedcity(cityname)
{
document.frmFindHotelContainer.Destination.value = cityname;
}

// This function will remove spaces from star and end os string.
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
// Used in index.php - topDestinationContainer.php and hotel_results.php
// This function is used for navigation of page to toDestination page.
// frmName parameter ia added 
function toDestination(cityId,frmName)
{
//alert(document.getElementById(frmName).value);
  frm = document.getElementById(frmName).value;
  document.getElementById('city_id').value=cityId;
  document.getElementById(frm).action = "top_destination.php";
  document.getElementById(frm).submit();
}

// Used in hotel_results.php
// To display the total results found on the top of hotel_results page.
function displayTotalResult(totalResultsFound,offset,limit,available,onrequest)
{
  if(totalResultsFound != 0)
  {
    offset = offset+1;
  }
  if(onrequest != 0)
  {
    document.getElementById('totalResultDiv').innerHTML = 'We have found <strong style="color:red">'+available+' Available</strong> and <strong style="color:green">'+onrequest+' On Request</strong> hotels matching criteria.<BR> Hotel(s) '+offset+' - '+limit+' of '+totalResultsFound;
  }
  else
  {
    document.getElementById('totalResultDiv').innerHTML = 'We have found <strong style="color:red">'+available+' Available</strong> hotels matching criteria.<BR> Hotel(s) '+offset+' - '+limit+' of '+totalResultsFound;
  }
}

// Used in hotel_results.php 
// This function is used for pagination in hotel_results.php. 
function sortPagination(searchid, pageNo, filterquery, orderbyquery,fromPrice,toPrice,filteravailable,activeSuppliers)
{
document.getElementById('page').value=pageNo;
document.getElementById('filterQuery').value=filterquery;
document.getElementById('orderbyQuery').value=orderbyquery;
document.getElementById('fromPrice').value=fromPrice;
document.getElementById('toPrice').value=toPrice;
document.getElementById('filterQueryAvailable').value=filteravailable;
document.getElementById('activeSuppliers').value=activeSuppliers;

document.sortPaginationFrm.action="hotel_results.php?searchId="+searchid;
document.sortPaginationFrm.submit();
}

/**
* This function sends request to the Hotel_info page.
*/
function MoreInfo(hotelId, searchId, currency)
{
  var sPath = "hotel_info.php?hotelId=" + hotelId + "&searchId=" + searchId; 
  window.location = sPath;
}

/**
* This function sends request to the Booking page.
*/
function BookNow(hotelId, searchId, mainId, searchRoomId)
{
  var sPath = "pre_booking.php?hotelId=" + hotelId + "&searchId=" + searchId + "&searchRoomId=" + searchRoomId + "&mainId=" + mainId;
  window.location = sPath;
}

// Used in FilterSortcontainer.php
function newSearch()
{
    document.filterResult.submit();
}

// Used to Bookmark the page.
function setBookmark() 
{
  url=document.location.href;
  if (window.sidebar) 
  { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(url, url,"");
  }
  else if( window.external )
  { // IE Favorite
    window.external.AddFavorite( url, url);
  }
  else if(window.opera && window.print) 
  { // Opera Hotlist
    return true;
  }
}