//
// $Id: ContentMap.js,v 1.1.1.1 2010/02/26 08:30:05 steve Exp $
//
var ContentMap = function() {

    this.cms      = new CMSActions()

    this.init = function() {
    
        var self = this
        
        $('img.mapEditButton').click( function() { self.showEditor($(this)) })
        $('img.mapDeleteButton').click( function() { self.cms.deleteSection($(this), 'Paragraph') })
        $('img.mapMoveUpButton').click( function() { self.cms.move($(this), 'Up', 'Paragraph') })
        $('img.mapMoveDownButton').click( function() { self.cms.move($(this), 'Down', 'Paragraph') })
        $('img.mapAddBeforeButton').click( function() { self.cms.showAddSection($(this), 'Before', 'Paragraph') })
        $('img.mapAddAfterButton').click( function() { self.cms.showAddSection($(this), 'After', 'Paragraph') })
    }
    
    this.showEditor = function(elem) {

        var self = this
        
        var id     = $(elem).attr('id').split('_')
        var editor = 'mapEditorEdit_' + id[1]
        var left   = $(elem).offset().left
        var top    = $(elem).offset().top
        
        $('#' + editor).css('top', top + 'px')
        $('#' + editor).css('left', left + 'px')
        $('#' + editor).fadeIn()
    }
}
