//Setup a PlanetTagger namespace
var PT = PT || {};

PT.window = {};

PT.window.bind = function( $dom ){
	
	SDNA.forms.bind( $dom );

}

PT.window.open = function( e, data ){

	PT.window.bind( $j(data.dom) );
	
	SDNA.Event.publish('window.open', data );
}

PT.window.open.handler = function( content ){
	
	//broadcast that this window was opened to any listeners
	SDNA.Event.trigger('window.open', { window: this, dom: content } );
}

PT.window.close = function( e, data ){
	
	SDNA.Event.publish('window.close', data );

}

PT.window.close.handler = function( data ){
	
	//broadcast that this window was opened to any listeners
	SDNA.Event.trigger('window.close', { window: this } );
	
}


//Tell the window class to run PT.window.open and close any 
//time any popup window is opened
Window.defaults.open 	= PT.window.open.handler;
Window.defaults.close 	= PT.window.close.handler;