ail.
var createLinks = function(div){
  var linkCreated = false;
  while(!linkCreated){
    var txt =  ui_utils.generateWords(20).split(/\s/g);
    for(var j=0;j<txt.length; j++){
      if(Math.random() < 0.2){
        txt[j] = '<span class="alink">' + txt[j] + '</span>';
        linkCreated = true;
      }
    }
  }

  div.html(div.html() + txt.join(' '));
  return txt;
}


var resetUI = function(div){
  if(div.html().length > 0) $('#dialog').dialog('destroy');
  div.empty(); // clear previous problem, if 