Index: src/perl/register-dataset.cgi
===================================================================
--- src/perl/register-dataset.cgi	(revision 2402)
+++ src/perl/register-dataset.cgi	(revision 2403)
@@ -1082,7 +1082,7 @@
                     if (hasContent(param("kwType" . $tmp1)) &&
                        (param("kwType" . $tmp1) !~ "none") ) {
                          $doc .= "keywordType=\"";
-                         $doc .= param("kwType" . $tmp1);
+                         $doc .= lc(param("kwType" . $tmp1));
                          $doc .= "\"";
                     }
                     $doc .= ">";
@@ -1736,7 +1736,7 @@
   #      errMoreThanN("Additional Originators");
  #   } 
 
-    $$templateVars{'aoCount'} = $aoCount-1;
+    $$templateVars{'aoCount'} = $aoCount;
     
     dontOccur($doc, "./pubDate", "pubDate");
     dontOccur($doc, "./language", "language");
@@ -1754,22 +1754,24 @@
 
     $results = $doc->findnodes('//dataset/keywordSet');
 
-    my $count = 0;
+    my $count = 1;
     foreach $node ($results->get_nodelist) {
 	$tempResult = $node->findnodes('./keyword');
 	if ($tempResult->size() > 1) {
 	    errMoreThanOne("keyword");
 	} else {
-	    $count++;
 	    foreach $tempNode ($tempResult->get_nodelist) {
 		$$templateVars{"keyword$count"} = $tempNode->textContent();
 		if ($tempNode->hasAttributes()) {
 		    my @attlist = $tempNode->attributes();
-		    $$templateVars{"kwType$count"} = $attlist[0]->value;
+                    my $tmp = $attlist[0]->value;  #convert the first letter to upper case
+		    $tmp =~ s/\b(\w)/\U$1/g;
+		    $$templateVars{"kwType$count"} = $tmp;
 		}  
 	    }
 	}
 	$$templateVars{"kwTh$count"} = findValue($node, "keywordThesaurus");
+        $count++;
     }
     $$templateVars{'keyCount'} = $count;
     if($count > 0 ){
@@ -1834,7 +1836,13 @@
         errMoreThanOne("distribution/online");
     } else {
         foreach my $tempNode ($results->get_nodelist) {
-            $$templateVars{'dataMedium'} = findValue($tempNode, "mediumName");
+            my $temp = findValue($tempNode, "mediumName");
+            if(substr($temp, 0, 5) eq "other"){
+                $$templateVars{'dataMedium'} = substr($temp, 0, 5);
+                $$templateVars{'dataMediumOther'} = substr($temp, 5);
+            } else {
+                $$templateVars{'dataMedium'} = $temp;
+            }
             dontOccur($tempNode, "./mediumDensity", "/distribution/offline/mediumDensity");
             dontOccur($tempNode, "./mediumDensityUnits", "/distribution/offline/mediumDensityUnits");
             dontOccur($tempNode, "./mediumVolume", "/distribution/offline/mediumVolume");
@@ -2358,52 +2366,55 @@
         $$templateVars{'origEmailContact'} = normalizeCD($FORM::origEmailContact);    
     }
 
-    $$templateVars{'aoCount'} = $FORM::aoCount;
-    foreach my $origName (param()) {
-	if ($origName =~ /origNamefirst/) {
-	    my $origNameIndex = $origName;
-	    $origNameIndex =~ s/origNamefirst//; # get the index of the parameter 0, ..., 10
-	    my $origNamelast = "origNamelast".$origNameIndex;
-	    my $origRole = "origRole".$origNameIndex;
-	    if ( $origNameIndex =~ /[0-9]/  && $origNameIndex > 0){
-		if (hasContent(param($origName)) && hasContent(param($origNamelast)) && hasContent(param($origRole))) {
-		    debug("Registry processing keyword: $origName = ".param($origName)." $origNamelast = ".param($origNamelast)." $origRole = ".param($origRole));
-		    $$templateVars{$origName} = normalizeCD(param($origName));
-		    $$templateVars{$origNamelast} = normalizeCD(param($origNamelast));
-		    $$templateVars{$origRole} = normalizeCD(param($origRole));
-		}
-	    }
-	}
+    my $aoFNArray = \@FORM::aoFirstName;
+    my $aoLNArray = \@FORM::aoLastName;
+    my $aoRoleArray = \@FORM::aoRole;
+    my $aoCount = 1;
+
+    for(my $i = 0; $i <= $#$aoRoleArray; $i++){
+        if (hasContent($aoFNArray->[$i]) && hasContent($aoLNArray->[$i])) {
+            debug("Registry processing Associated Party: origName = ".$aoFNArray->[$i]
+                  ." origNamelast = ".$aoLNArray->[$i]." origRole = "
+                  .$aoRoleArray->[$i]);
+            $$templateVars{"origNamefirst".$aoCount} = normalizeCD($aoFNArray->[$i]);
+            $$templateVars{"origNamelast".$aoCount} = normalizeCD($aoLNArray->[$i]);
+            $$templateVars{"origRole".$aoCount} = normalizeCD($aoRoleArray->[$i]);
+            $aoCount++;
+	}    
     }
 
+    $$templateVars{'aoCount'} = $aoCount;
     $$templateVars{'abstract'} = normalizeCD($FORM::abstract);
-    $$templateVars{'keyCount'} = $FORM::keyCount;
-    foreach my $kyd (param()) {
-	if ($kyd =~ /keyword/) {
-	    my $keyIndex = $kyd;
-	    $keyIndex =~ s/keyword//; # get the index of the parameter 0, ..., 10
-	    my $keyType = "kwType".$keyIndex;
-	    my $keyTh = "kwTh".$keyIndex;
-	    if ( $keyIndex =~ /[0-9]/ ){
-		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
-		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
-		    $$templateVars{$kyd} = normalizeCD(param($kyd));
-		    $$templateVars{$keyType} = param($keyType);
-		    $$templateVars{$keyTh} = param($keyTh);
-		}
-	    }
-	}
-    }
+   
+   
+    my $keywordArray = \@FORM::keyword;
+    my $keywordTypeArray = \@FORM::keywordType;
+    my $keywordThArray = \@FORM::keywordTh;
+    my $keyCount = 1;
+   
+    for(my $i = 0; $i <= $#$keywordArray; $i++){
+        if (hasContent($keywordArray->[$i])) {
+            debug("Registry processing keyword: keyword = ".$keywordArray->[$i]."
+                  keywordType = ".$keywordTypeArray->[$i]."
+                  keywordTh = ".$keywordThArray->[$i]);
+            $$templateVars{"keyword".$keyCount} = normalizeCD($keywordArray->[$i]);
+            $$templateVars{"kwType".$keyCount} = normalizeCD($keywordTypeArray->[$i]);
+            $$templateVars{"kwTh".$keyCount} = normalizeCD($keywordThArray->[$i]);
+            $keyCount++;
+	}    
+    }    
+    $$templateVars{'keyCount'} = $keyCount;
+    
     $$templateVars{'addComments'} = normalizeCD($FORM::addComments);
     $$templateVars{'useConstraints'} = $FORM::useConstraints;
-    $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
+    if($FORM::useConstraints eq "other"){
+        $$templateVars{'useConstraintsOther'} = $FORM::useConstraintsOther;
+    }
     $$templateVars{'url'} = $FORM::url;
-    if($FORM::dataMedium eq "Select type of medium here."){
-        $$templateVars{'dataMedium'} = "";
-    }else{
-        $$templateVars{'dataMedium'} = $FORM::dataMedium;
-    }    
-    $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
+    $$templateVars{'dataMedium'} = $FORM::dataMedium;
+    if($FORM::dataMedium eq "other"){
+        $$templateVars{'dataMediumOther'} = normalizeCD($FORM::dataMediumOther);
+    }
     $$templateVars{'beginningYear'} = $FORM::beginningYear;
     $$templateVars{'beginningMonth'} = $FORM::beginningMonth;
     $$templateVars{'beginningDay'} = $FORM::beginningDay;
@@ -2429,25 +2440,25 @@
     $$templateVars{'longSec2'} = $FORM::longSec2;
     $$templateVars{'hemisphLong2'} = $FORM::hemisphLong2;
 
-    $$templateVars{'taxaCount'} = $FORM::taxaCount;
-    foreach my $trn (param()) {
-        if ($trn =~ /taxonRankName/) {
-            my $taxIndex = $trn;
-            $taxIndex =~ s/taxonRankName//; # get the index of the parameter 0, ..., 10
-            my $trv = "taxonRankValue".$taxIndex;
-            if ( $taxIndex =~ /[0-9]/ ){
-                if (hasContent(param($trn)) && hasContent(param($trv))) {
-                    debug("Registry processing taxon: $trn = ".param($trn)." $trv = ".param($trv));
-                    $$templateVars{$trn} = normalizeCD(param($trn));
-                    $$templateVars{$trv} = normalizeCD(param($trv));
-                }
-            }
-        }
+    my $taxonRankArray = \@FORM::taxonRank;
+    my $taxonNameArray = \@FORM::taxonName;
+    my $taxonCount = 1;
+
+    for(my $i = 0; $i <= $#$taxonNameArray; $i++){
+        if (hasContent($taxonRankArray->[$i]) && hasContent($taxonNameArray->[$i])) {
+            debug("Registry processing keyword: trv = ".$taxonRankArray->[$i]
+                    ." trn = ".$taxonNameArray->[$i]);
+            $$templateVars{"taxonRankName".$taxonCount} = normalizeCD($taxonNameArray->[$i]);
+            $$templateVars{"taxonRankValue".$taxonCount} = normalizeCD($taxonRankArray->[$i]);
+            $taxonCount++;
+	}    
     }
+
+    $$templateVars{'taxaCount'} = $taxonCount-1;
     $$templateVars{'taxaAuth'} = normalizeCD($FORM::taxaAuth);
 
     $$templateVars{'methodTitle'} = normalizeCD($FORM::methodTitle);
-
+ 
     my @tempMethodPara;
     for (my $i = 0; $i < scalar(@FORM::methodPara); $i++) {
 	$tempMethodPara[$i] = normalizeCD($FORM::methodPara[$i]);
@@ -2590,8 +2601,10 @@
 	    if ( $keyIndex =~ /[0-9]/ ){
 		if (hasContent(param($kyd)) && hasContent(param($keyType)) && hasContent(param($keyTh))) {
 		    debug("Registry processing keyword: $kyd = ".param($kyd)." $keyType = ".param($keyType)." $keyTh = ".param($keyTh));
-		    $$templateVars{$kyd} = param($kyd);
-		    $$templateVars{$keyType} = param($keyType);
+		    $$templateVars{$kyd} = param($kyd); 
+                    my $tmp = param($keyType);  #convert the first letter to upper case
+		    $tmp =~ s/\b(\w)/\U$1/g;
+                    $$templateVars{$keyType} = $tmp;
 		    $$templateVars{$keyTh} = param($keyTh);
 		}
 	    }
