﻿function ShowMsgForm(toUserId, toUserName, subject) 
{
    
    //PopupRelocate("divMsgForm");
    document.getElementById("divMsgForm").style.display = "block";
    document.getElementById("divMsgConf").style.display = "none";

    ShowAJAXMsgForm();
    
    // main message form
    if (document.getElementById("tbxSubject"))
    {
        document.getElementById("tbxSubject").value = subject;
    }

    if (document.getElementById("hdnToUserId"))
    {
        document.getElementById("hdnToUserId").value = toUserId;
    }

    if (document.getElementById("hdnToUserName"))
    {
        document.getElementById("hdnToUserName").value = toUserName;
    }

    if (document.getElementById("lblToUserName"))
    {
        document.getElementById("lblToUserName").innerHTML = toUserName;
    }
 
}

 

function HideDiv(divId)
{
    var item = document.getElementById(divId);
    if (item) 
    {
        //item.style.visibility = "hidden";
        item.style.display = "none";
    }
}

function ShowDiv(divId) 
{
    var item = document.getElementById(divId);
    if (item) 
    {
        item.style.visibility = "visible";
    }
}


// drop down nav
$(document).ready(function () {

    SetHotelCityAutoComplete();

    $('#nav li').hover(
        function () {
            //show its submenu
            $('ul', this).slideDown(100);

        },
        function () {
            //hide its submenu
            $('ul', this).slideUp(100);
        }
    );
});

    var mArrHotelCities = new Array();

    function SetHotelCityAutoComplete() {
       

        $("#tbxHotelCity").autocomplete({
            dataType: "json",
            minLength: 2,
            source: function (request, response) {
                $.ajax({
                    url: "/Services/HotelService.asmx/GetAllCities",
                    data: "{ 'term': '" + $("#tbxHotelCity").val() + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                value: item
                            }
                        }))
                    },
                   

                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            },
            select: function (e, ui) {
                // nada
            }
        });
    }







    

    





