String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

var tab_m = 1; //global variable to keep track of the tabs

//This function writes the tab definitions down at the location where it is called
function tabwrt(sa){
 var s = sa.trim();
 var arr = s.split(" ");
 var i = 0;
 document.write("<div id=\"tabs\" class=\"tabber\">");
 var m = tab_m;

 while (i < arr.length)
  {
   document.write("<div id=\"ttb_"+m+ "\" class=\"tabbertab\" title=\""+ arr[i]+"\"></div>");
   i += 2;
   m++;
  }
  document.write("</div>");
  var i = 1;
  m = tab_m;
  while (i < arr.length)
   {
    document.write("<div id=\"tb_"+ m +"\" style=\"display:none;\" >"+arr[i]+"</div>");
    i += 2;
    m++;
   }
  tab_m = m;
}

