$(function(){

  //---------------------------
  // intro dialog box
  $("#dialog-intro").dialog({
      bgiframe: true,
      width: 600,
      modal: true
    });

  // edit dialog box
  var edit_this, edit_fld = $("#edit_fld");
  $("#dialog-edit").dialog({
      bgiframe: true,
      autoOpen: false,
      width: 600,
      modal: true,
      buttons: {
          'Done': function () {
            $(edit_this).html(edit_fld.val());
            $(this).dialog('close');
          },
          Cancel: function() { $(this).dialog('close'); }
        }
    });


  //--------------------------------
  $("div#menu").before('<div id="topspacer">&nbsp;</div>');
  $("div.header").wrapInner("<h1></h1>");
  $("div.header, div.emp_header, div.pos_header, div[id$='desc'], ul[id$='detail']")
        .addClass('clearboth');

  // hide entire sections
  $("div.header").click(function(){
      $(this).toggle('fold',{},1000);
    });

  // hide employer description and details
  $("div.header, div.emp_header, div.edu_header").click(function(){
      var strTag = $(this).attr("id");
      $('[id^="' + strTag + '_"]').toggle('fold',{},1000);
    });

  // hide descriptions or individual list entries
  $('div[id$="_desc"], ul[id$="_detail"] li, ul#skill_list li').click(function(e) {
      if (e.metaKey && e.shiftKey) {
        // edit inplace
        edit_this = this;
		$("#edit_fld").val($(edit_this).html());
        $("#dialog-edit").dialog('open');
      }
      else {
        $(this).toggle('fold',{},1000); 
      }
    });

  // convert skill list to a two column list
  $("ul#skill_list").makeacolumnlists({cols:2, colWidth:0, equalHeight:false,startN:1});

});

