﻿var Class = {
    create: function()
    {
        return function()
        {
            this.initialize.apply(this, arguments);
        }
    }
}

var Page = {

    // urlencoded original query
    url: null,

    onload: function()
    {
        if (this.load)
        {
            this.load();
        }
        var tryUfb = $('#try_ufb');
        if (tryUfb.length > 0)
        {
            tryUfb.get(0).submit();
        }
    },

    onunload: function()
    {
        if (this.unload)
        {
            this.unload();
        }
    },

    clearMapCookie: function()
    {
        var threeDays = 3 * 24 * 60 * 60 * 1000; //in millisecounds
        var expDate = new Date();
        expDate.setTime(expDate.getTime() - threeDays);
        document.cookie = 'RXC_MAP=foobar; expires=' + expDate.toGMTString();
    }
}

$.bind = function(object, method)
{
    var args = Array.prototype.slice.call(arguments, 2);
    return function()
    {
        return method.apply(object, args);
    };
}

$.create = function(tagName)
{
    return $(document.createElement(tagName));
}