function el(el_id) {
    return $(el_id);
}

function openPopup(url, winName, width, height) {
    var prop = 'width='+ width + ',height='+ height + ',scrollbars=yes,toolbar=no,location=no,menubar=no,resizable=yes';
    var win = window.open(url, winName, prop);
    win.focus();
    return win;
}

function showTour(tourId, width, height) {
    var winName = 'tourinfo';
    
    var oldAction = el("bookingParamsForm").action;
    el("bookingParamsForm").action += "&tourId=" + tourId;
    
    //el("bookingParamsForm").innerHTML += '<input type="hidden" id="tourId" name="tourId" value="' + tourId + '" />';
    openPopup('', winName, width, height);
    el("bookingParamsForm").target = winName;
    el("bookingParamsForm").submit();
    
    el("bookingParamsForm").action = oldAction;
}

function ScrollToElement(theElement) {
  var selectedPosX = 0;
  var selectedPosY = 0;

  while(theElement != null){
    selectedPosX += theElement.offsetLeft;
    selectedPosY += theElement.offsetTop;
    theElement = theElement.offsetParent;
  }
 window.scrollTo(selectedPosX,selectedPosY);
}
