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

//Setup the event
PT.activatePhone = function( e, options ){
	
	//show the user that this target is loading
	SDNA.loading(options.target);
	
	var $action = $j(options.target);
	
	if( $action.is('[href*=.htm]') ){
		
		Window.pop( 
			options.url,
			{
				close: function(){
					SDNA.loaded(options.target);
				}
			} 
		);
		
	}
}

PT.phoneActivated = function( response ){
	//Publish a activated event to all listeners
	SDNA.Event.publish('phone_activated',response);	
}

//Handles a DOM click event on links with a class of change_home
//and triggers the activate_phone event action with this link as the target
PT.activatePhone.click = function( e ){	              
	
	//keep this link from functioning
	e.preventDefault();
	
	//Trigger the global follow action
	SDNA.Event.trigger(
		'activate_phone',  
		{ 
			url: $j(this).attr('href'), 
			target: this 
		}
	);

};

//Binds any link with a class of "activate_phone" to the dom handler
PT.activatePhone.bind = function(){

	$j('a.activate_phone').live('click.activate_phone', PT.activatePhone.click );
	
};