YAHOO.namespace('YAHOO.nestle.page');

YAHOO.nestle.page.Auth = function() {
	
	var loadHandler = function () {
		YAHOO.nestle.page.Auth.init();
	}
	
	YAHOO.util.Event.onDOMReady(loadHandler);
	// YAHOO.util.Event.on(window, 'load', loadHandler);
	
	/* public methods */
	return {
		
		init : function() {
			
			this.element = YAHOO.util.Dom.getElementsByClassName('cauthorize', 'div')[0];

			this.forgotLink = YAHOO.util.Dom.getElementsByClassName('forgot', 'a', this.element)[0];
			
//			this.messageLink = YAHOO.util.Dom.getElementsByClassName('msg-link', 'a', this.element)[0];
			
			// create panel
			// YUI panel: http://developer.yahoo.com/yui/container/panel/
			// YUI panel API documentation: http://developer.yahoo.com/yui/docs/YAHOO.widget.Panel.html
			
			var config = {context:["auth-panel-context", "tl", "tl"], width: '360px', draggable: true, visible: false, constraintoviewport: true};
			YAHOO.nestle.page.Auth.forgotPanel = new YAHOO.widget.Panel("forgot-panel", config);
			YAHOO.nestle.page.Auth.forgotPanel.render();
			
			/* create message panel */
//			var config = {context:["auth-panel-context", "tl", "tl"], width: '280px', draggable: true, visible: false, constraintoviewport: true};
//			YAHOO.nestle.page.Auth.messagePanel = new YAHOO.widget.Panel("message-panel", config);
//			YAHOO.nestle.page.Auth.messagePanel.render();
			
			YAHOO.util.Event.on(this.forgotLink, 'click', YAHOO.nestle.page.Auth.forgotPanel.show, YAHOO.nestle.page.Auth.forgotPanel, true);
//			YAHOO.util.Event.on(this.messageLink, 'click', YAHOO.nestle.page.Auth.messagePanel.show, YAHOO.nestle.page.Auth.messagePanel, true);
			
		}
		
	};
	
}();