$(document).ready(function(){
    $("#advancedSearch").click(function () {		
        $("#innerSearch").toggleClass("expandSearch");			
    });	
});	

function show_loading()
{
    $("#loading").dialog({
        modal: true,
        draggable: false,
        resizable: false,
        title: $("#loading_text").val(),
        closeOnEscape: false,
        open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }
    });
}

function hide_loading()
{
    $("#loading").dialog('close');
}

function SerializeObject(obj, indentValue)
{
    var hexDigits = "0123456789ABCDEF";
    function ToHex(d)
    {
        return hexDigits[d >> 8] + hexDigits[d & 0x0F];
    }
    function Escape(string)
    {
        return string.replace(/[\x00-\x1F'\\]/g,
            function (x)
            {
                if (x == "'" || x == "\\") return "\\" + x;
                return "\\x" + ToHex(String.charCodeAt(x, 0));
            })
    }

    var indent;
    if (indentValue == null)
    {
        indentValue = "";
        indent = ""; // or " "
    }
    else
    {
        indent = "\n";
    }
    return GetObject(obj, indent).replace(/,$/, "");

    function GetObject(obj, indent)
    {
        if (typeof obj == 'string')
        {
            return "'" + Escape(obj) + "',";
        }
        if (obj instanceof Array)
        {
            result = indent + "[";
            for (var i = 0; i < obj.length; i++)
            {
                result += indent + indentValue +
                GetObject(obj[i], indent + indentValue);
            }
            result += indent + "],";
            return result;
        }
        var result = "";
        if (typeof obj == 'object')
        {
            result += indent + "{";
            for (var property in obj)
            {
                result += indent + indentValue + "'" +
                Escape(property) + "' : " +
                GetObject(obj[property], indent + indentValue);
            }
            result += indent + "},";
        }
        else
        {
            result += obj + ",";
        }
        return result.replace(/,(\n?\s*)([\]}])/g, "$1$2");
    }
}

