/**
 * Jetpack Notify Feature - Enables any website to send Growl notifications
 *
 * @version 1.1
 * @author Zach Waugh <zwaugh@gmail.com>
 * http://zachwaugh.com/projects/jetpack-notify
 *
 * Copyright (c) 2009 Zach Waugh - Licensed under the MIT license
 */

jetpack.tabs.onReady(init);
jetpack.tabs.onFocus(init);

function init(doc) {
	// Get reference to original window object - not safe window object
	// May need to change in future depending on API
  var win = this.contentWindow.wrappedJSObject;

  if (win.jetpackNotify === undefined) {
    win.jetpackNotify = notify;
  }
}

/**
 * Proxy function to underlying Jetpack notification API
 * @param {Object} notification - {title: '', body: '', icon: ''}
 */
function notify(notification) {
  jetpack.notifications.show(notification);
}