function setCookie(cookieName,cookieValue,nHours) {
     var today = new Date();
     var expire = new Date();
     if (nHours==null || nHours==0) nHours=1;
     expire.setTime(today.getTime() + 3600000*nHours);
     document.cookie = cookieName+"="+escape(cookieValue)
     + ";expires="+expire.toGMTString()+";path=/";
 }

 function deleteCookie(cookieName) {
     var today = new Date();
     var expire = new Date();
     expire.setTime(today.getTime() - 3600000*24*24);
     document.cookie = cookieName+"=0;expires="+expire.toGMTString()+";path=/";
 }

 function getCookie(cookieName) {
      var theCookie=""+document.cookie;
      var ind=theCookie.indexOf(cookieName);
      if (ind==-1 || cookieName=="") return "";
      var ind1=theCookie.indexOf(';',ind);
      if (ind1==-1) ind1=theCookie.length;
     return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
 }

function writeTab( name, url, selected ) {
   if( selected ){
      document.writeln('<li class="tabSel"><a href="' + url + '">' + name + '</a></li>');
   } else {
      document.writeln('<li class="tab"><a href="' + url + '">' + name + '</a></li>');
   }
}

function writeMenu( labelArray, selectedArray, urlArray ) {
    for( i=0;i<labelArray.length;i++ ) {
        if( urlArray[i]!='' ) {
            setCookie( 'tab'+i, urlArray[i],9999 );
        }
        writeTab( labelArray[i], getCookie('tab'+i), selectedArray[i] );
    }
/*     document.writeln('<div class="tabSpacer" style="float:left; width:' + afterwidth+ 'px;">&#160;</div>');
    document.writeln('<div class="tabUnder" style="width:' + underwidth+ 'px;">&#160;</div>'); */
}
