function initPropertyTabs() {

	var menuAnchors = $( 'property_nav' ).getElements( 'a' );

	for ( var i = 0; i < menuAnchors.length; i++ ) {

		if ( menuAnchors[ i ].getAttribute( 'href' ) && menuAnchors[ i ].getAttribute( 'rel' ) == 'swap' ) {

			menuAnchors[ i ].addEvent( 'click', function() {
				
				// Remove the active state from all links
				for ( var j = 0; j < menuAnchors.length; j++ ) {
					
					menuAnchors[ j ].removeClass( 'active' );
					
				}
				
				swapPropertyContent( this.id );

			});

		}

	}

}

function swapPropertyContent( _id ) {
	
	// Set the active state on the selected link
	$( _id ).addClass( 'active' );

	var tabs = $$( '#property_detail .tab_content' );
	
	for ( var i = 0; i < tabs.length; i++ ) {

		tabs[ i ].setStyle( 'display', 'none' );		

	}

	var newID = 'content_' + _id;

	var content = $( newID ).setStyle( 'display', 'block' );
	
	// Check to see if the map is being displayed.  If so we need to call the drawMap function
	if ( _id == 'property_map' ) drawMap();
	
}

window.addEvent( 'load', function() {
							  
	if ( $( 'property_detail' ) ) initPropertyTabs();
	
});
