function genCode(form)
{
   //check table width
   txtCode = "<script type=\"text/javascript\" src=\"http://www.angelslight.org/cgi-bin/daily.cgi?tablewidth=";
   //linkCode = "../cgi-bin/dailypreview.cgi?tablewidth=";
   linkCode = "javascript:void openPreview('../cgi-bin/dailypreview.cgi?tablewidth=";
   
   //check table width
   if (form.tablewidth.value == "")
   {
      txtCode += "200";
      linkCode += "200";
   }
   txtCode += form.tablewidth.value;
   linkCode += form.tablewidth.value;
   
   //check border width
   txtCode += "&borderwidth=";
   linkCode += "&borderwidth=";
   if (form.borderwidth.value == "")
   {
      txtCode += "2";
      linkCode += "2";
   }
   txtCode += form.borderwidth.value;
   linkCode += form.borderwidth.value;
   
   //check border color
   txtCode += "&bordercolor=";
   linkCode += "&bordercolor=";
   if (form.bordercolor.value == "")
   {
      if (form.bordercolorother.value != "")
      {
         txtCode += form.bordercolorother.value;
         linkCode += form.bordercolorother.value;    
      }
      else
      {
         txtCode += "000000";
         linkCode += "000000";
      }
   }
   else
   {
      txtCode += form.bordercolor.value; 
      linkCode += form.bordercolor.value;      
   }
   
   //check font color
   txtCode += "&fontcolor=";
   linkCode += "&fontcolor=";
   if (form.fontcolor.value == "")
   {
      if (form.fontcolorother.value != "")
      {
         txtCode += form.fontcolorother.value; 
         linkCode += form.fontcolorother.value;    
      }
      else
      {
         txtCode += "000000";
         linkCode += "000000";
      }
   }
   else
   {
      txtCode += form.fontcolor.value; 
      linkCode += form.fontcolor.value;     
   }
   
   //check graphic color
   txtCode += "&graphiccolor=";
   linkCode += "&graphiccolor=";
   for(var i = 0; i < 7; i++)
   {
      if (form.graphiccolor[i].checked)
      {
         txtCode += form.graphiccolor[i].value;
         linkCode += form.graphiccolor[i].value;
      }
   }
   
   txtCode += "&linkclass=";
   linkCode += "&linkclass=";
   txtCode += form.linkclass.value;
   linkCode += form.linkclass.value;
      
   txtCode += "\"></script>";
   
   linkCode += "');";
   form.code.value = txtCode;
   form.code.style.visibility = "visible";
   
   document.anchors[0].href= linkCode;
   document.getElementById('clickcode').style.visibility = "visible";
   document.getElementById('directions').style.visibility = "visible";

}
