/* constants */
// key name for resource requests
var RESOURCE_ID = '_r';

// number of items to keep current in the undo buffer
var UNDO_BUFFER = 5;

// when the command history = this plus the undo buffer,
// auto save is triggered
var AUTO_SAVE_BUFFER = 5;

var E_NOTICE = 1;
var E_WARNING = 2;
var E_FATAL = 4;

var URI =
{
    'self'      :   'index.php'
};

// for inheritance sugar
// flag indicates we just want the object for it's prototype - don't actually initialize it
var PURE = '_pure';

// keep track of selected element ids
var Selected_Id = false;

// these are events that the PageController will 
// watch for and dispatch
var Catch_events = new Array( 'onclick', 'onchange');

function init()
{
    var c = new snow.PageController();

    // register events
    for (var i = 0, len = Catch_events.length; i < len; i++)
    {
        window[Catch_events[i]] = function(evt) { c.main(evt); };
    }
}

function destroy()
{
    for (var i = 0, len = Catch_events.length; i < len; i++)
    {
        window[Catch_events[i]] = null;
    }
}

window.onload = init;
window.onunload = destroy;
