function man_gos_tabbed_content_init() {

  var MODULE_URL = null;
  $('script').map(function(i) { 
    if (this.src.match(/man_gos_tabbed_content_init\.js(\?.*)?$/)) {
      MODULE_URL = this.src.replace(/\/man_gos_tabbed_content_init\.js(\?.*)?$/, '');
    }
  });  
  
  
  
  
  

  $("*[sancho_entity_type='ManGosTabbedContent']").each(function(i) {

    ////////////////////// START TOOLTIP ////////////////////////  
    $('#camargue_tooltip').unbind('mouseup');
  	$(this).bind('mouseup', function(e) { 
      //this one line will disable the right mouse click menu  
      if(!e.ctrlKey) $(document)[0].oncontextmenu = function() {return false;}  
      var rightclick;
      if (!e) var e = window.event;
      if (e.which) rightclick = (e.which == 3);
      else if (e.button) rightclick = (e.button == 2);
      if (rightclick) {
      	Camargue.Tooltip.hide(); 
        Camargue.Tooltip.keepVisible = true;
        Camargue.Tooltip.empty();  
        var params = '';
        params += 'sancho_entity_id=' + $(this).attr('sancho_entity_id');
        params += '&sancho_page_area_name=content_main'; 
        params += '&sancho_content_slot_id=' + $(this).parent().attr('sancho_entity_id');       
        ///////////// START ACTIONS //////////////
        var credits = 'module: _ tabbed content _ v.0.2 _ vendor: _ <a href="http://www.manadv.com">man</a> _ last update: _ 30-12-09';
        Camargue.Tooltip.addBlockTitle('Tabbed content');            
        Camargue.Tooltip.addLink('Remove', MODULE_URL + '/remove.php' + '?' + params, credits, {type: 'delete', modalWidth: 550, modalHeight: 110, modalName: 'man_tabbed_content_remove'});  
		///////////// END ACTIONS ///////////////
      	Camargue.Tooltip.show(e);
        e.stopPropagation();
      }            
    });
    $('*').click(function(){
    	Camargue.Tooltip.hide(); 
    });    
    //////////////////////// END TOOLTIP //////////////////////////                  
	});

  
  
    

  $("*[sancho_entity_type='ManGosTabbedContent'] *[sancho_entity_type='SanchoFile'] ").each(function(i) {

    ////////////////////// START TOOLTIP ////////////////////////  
    $('#camargue_tooltip').unbind('mouseup');
  	$(this).bind('mouseup', function(e) { 
      //this one line will disable the right mouse click menu  
      if(!e.ctrlKey) $(document)[0].oncontextmenu = function() {return false;}  
      var rightclick;
      if (!e) var e = window.event;
      if (e.which) rightclick = (e.which == 3);
      else if (e.button) rightclick = (e.button == 2);
      if (rightclick) {
      	Camargue.Tooltip.hide(); 
        Camargue.Tooltip.keepVisible = true;
        Camargue.Tooltip.empty();  
        var params = '';
        params += 'sancho_entity_id=' + $(this).attr('sancho_entity_id');
        params += '&sancho_page_area_name=comments_tab_2_contents'; 
        ///////////// START ACTIONS //////////////
        var credits = 'module: _ tabbed content _ v.0.2 _ vendor: _ <a href="http://www.manadv.com">man</a> _ last update: _ 30-12-09';
        Camargue.Tooltip.addBlockTitle('File editor');   
        Camargue.Tooltip.addLink('Edit', '/SANCHO_MODULES/camargue/camargue_file_editor/edit_file.php' + '?' + params, credits, {type: 'edit', modalWidth: 570, modalHeight: 350, modalName: 'camargue_file_editor_add'});          
        Camargue.Tooltip.addLink('Remove', '/SANCHO_MODULES/camargue/camargue_file_editor/remove.php' + '?' + params, credits, {type: 'delete', modalWidth: 450, modalHeight: 110, modalName: 'camargue_file_editor_remove'});  
		///////////// END ACTIONS ///////////////
      	Camargue.Tooltip.show(e);
        e.stopPropagation();
      }            
    });
    $('*').click(function(){
    	Camargue.Tooltip.hide(); 
    });    
    //////////////////////// END TOOLTIP //////////////////////////                  
	});
  
  
  
  $("*[sancho_entity_type='ManGosTabbedContent'] li[sancho_entity_type='ManGosUserComment'] ").each(function(i) {

    ////////////////////// START TOOLTIP ////////////////////////  
    $('#camargue_tooltip').unbind('mouseup');
  	$(this).bind('mouseup', function(e) { 
      //this one line will disable the right mouse click menu  
      if(!e.ctrlKey) $(document)[0].oncontextmenu = function() {return false;}  
      var rightclick;
      if (!e) var e = window.event;
      if (e.which) rightclick = (e.which == 3);
      else if (e.button) rightclick = (e.button == 2);
      if (rightclick) {
      	Camargue.Tooltip.hide(); 
        Camargue.Tooltip.keepVisible = true;
        Camargue.Tooltip.empty();  
        var params = '';
        params += 'sancho_entity_id=' + $(this).attr('sancho_entity_id');
        params += '&sancho_page_area_name=comments_tab_1'; 
        ///////////// START ACTIONS //////////////
        var credits = 'module: _ tabbed content _ v.0.2 _ vendor: _ <a href="http://www.manadv.com">man</a> _ last update: _ 30-12-09';
        Camargue.Tooltip.addBlockTitle('Manage comment');   
        Camargue.Tooltip.addLink('Enable', MODULE_URL + '/enable_comment.php' + '?' + params, credits, {type: 'edit', modalWidth: 450, modalHeight: 110, modalName: 'man_tabbed_content_enable_comment'});          
        Camargue.Tooltip.addLink('Remove', MODULE_URL + '/remove_comment.php' + '?' + params, credits, {type: 'delete', modalWidth: 450, modalHeight: 110, modalName: 'man_tabbed_content_remove_comment'});  
		///////////// END ACTIONS ///////////////
      	Camargue.Tooltip.show(e);
        e.stopPropagation();        
      }            
    });
    $('*').click(function(){
    	Camargue.Tooltip.hide(); 
    });    
    //////////////////////// END TOOLTIP //////////////////////////                  
	});  
	
	
	
  // 'add file' link in admin
	if ($('#tabbed_content_add_file').length) {
   	$('#tabbed_content_add_file').click(function(e) {
   		var descr= '';
      var fv = new FancyViewer({theme: 'camargue'});
      fv.addToSet('/SANCHO_MODULES/camargue/camargue_file_editor/edit_file.php?sancho_page_id=' + Sancho.curPageId + '&sancho_page_area_name=comments_tab_2_contents&add_to_id=' + Sancho.curTocId, 'Add file', descr, {width: 570, height: 350});
      fv.open(0);
      Camargue.modals['camargue_file_editor_add'] = fv;
      return false;    
    }); 
  }
  
}
