PageRenderTime 54ms CodeModel.GetById 13ms app.highlight 35ms RepoModel.GetById 1ms app.codeStats 0ms

/security/nss/cmd/certcgi/index.html

http://github.com/zpao/v8monkey
HTML | 821 lines | 739 code | 47 blank | 35 comment | 0 complexity | f154c5b58262934dbc82de368697d677 MD5 | raw file
  1<HTML>	<!-- -*- Mode: Java; tab-width: 8 -*- -->
  2<!-- ***** BEGIN LICENSE BLOCK *****
  3   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4   -
  5   - The contents of this file are subject to the Mozilla Public License Version
  6   - 1.1 (the "License"); you may not use this file except in compliance with
  7   - the License. You may obtain a copy of the License at
  8   - http://www.mozilla.org/MPL/
  9   -
 10   - Software distributed under the License is distributed on an "AS IS" basis,
 11   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 12   - for the specific language governing rights and limitations under the
 13   - License.
 14   -
 15   - The Original Code is the Netscape security libraries.
 16   -
 17   - The Initial Developer of the Original Code is
 18   - Netscape Communications Corporation.
 19   - Portions created by the Initial Developer are Copyright (C) 1994-2000
 20   - the Initial Developer. All Rights Reserved.
 21   -
 22   - Contributor(s):
 23   -
 24   - Alternatively, the contents of this file may be used under the terms of
 25   - either the GNU General Public License Version 2 or later (the "GPL"), or
 26   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 27   - in which case the provisions of the GPL or the LGPL are applicable instead
 28   - of those above. If you wish to allow use of your version of this file only
 29   - under the terms of either the GPL or the LGPL, and not to allow others to
 30   - use your version of this file under the terms of the MPL, indicate your
 31   - decision by deleting the provisions above and replace them with the notice
 32   - and other provisions required by the GPL or the LGPL. If you do not delete
 33   - the provisions above, a recipient may use your version of this file under
 34   - the terms of any one of the MPL, the GPL or the LGPL.
 35   -
 36   - ***** END LICENSE BLOCK ***** -->
 37<HEAD>
 38<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
 39<SCRIPT LANGUAGE="JavaScript1.2">
 40
 41script_url = 'http://interzone.mcom.com/cgi-bin/certomatic/bin/certcgi.cgi'
 42
 43ext_page_ver1 =
 44  make_page_intro('Version 1 extensions', "#FFFFFF") +
 45  '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext1">' +
 46  'Version 1 X.509 certs do not support extensions' +
 47  '</IFRAME>' +
 48  '</body></html>';
 49
 50num_ca = 0;
 51
 52your_certificate_index_label       = 'Your Certificate';
 53netscape_extensions_index_label    = 'Netscape X.509 Extensions';
 54standard_extensions_index_label    = 'Standard X.509 Extensions';
 55certifying_authorities_index_label = 'Certifying Authorities';
 56add_sub_alt_name_index_label       = 'Add Subject Alternative Name';
 57
 58index_list = 
 59  '0, your_certificate_index_label,' +
 60  '0, netscape_extensions_index_label,' +
 61  '0, standard_extensions_index_label,' +
 62  '0, certifying_authorities_index_label';
 63
 64add_index_list = '';
 65
 66ver = 3
 67
 68max_pages = 13;
 69cur_page = 1;
 70
 71ext_page_array = new Array(max_pages);
 72
 73index_label = 'Options';
 74
 75var main_page = 
 76  make_page_intro('Your Key', "#FFFFFF") +
 77  '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="main" SRC="main.html">' +
 78  '</IFRAME>' +
 79  '</body></html>' ;
 80
 81function setSubAltNameType(form)
 82{
 83  with(form) {
 84    if (SubAltNameRadio[0].checked) {
 85      return true;
 86    }
 87    if (SubAltNameRadio[3].checked || SubAltNameRadio[5].checked) {
 88      SubAltNameDataType.checked = true;
 89      return true;
 90    }
 91    if (SubAltNameRadio[1].checked || SubAltNameRadio[2].checked ||
 92	SubAltNameRadio[4].checked || SubAltNameRadio[6].checked ||
 93	SubAltNameRadio[7].checked || SubAltNameRadio[8].checked) {
 94      SubAltNameDataType.checked = false;
 95      return true;
 96    }
 97  }
 98  return true;
 99}
100
101function setIssuerAltNameType(form)
102{
103  with(form) {
104    if (IssuerAltNameRadio[0].checked) {
105      return true;
106    }
107    if (IssuerAltNameRadio[3].checked || IssuerAltNameRadio[5].checked) {
108      IssuerAltNameDataType.checked = true;
109      return true;
110    }
111    if (IssuerAltNameRadio[1].checked || IssuerAltNameRadio[2].checked ||
112	IssuerAltNameRadio[4].checked || IssuerAltNameRadio[6].checked ||
113	IssuerAltNameRadio[7].checked || IssuerAltNameRadio[8].checked) {
114      IssuerAltNameDataType.checked = false;
115      return true;
116    }
117  }
118  return true;
119}
120
121
122function setNameConstraintNameType(form)
123{
124  with(form) {
125    if (NameConstraintRadio[0].checked) {
126      return true;
127    }
128    if (NameConstraintRadio[3].checked || NameConstraintRadio[5].checked) {
129      NameConstraintNameDataType.checked = true;
130      return true;
131    }
132    if (NameConstraintRadio[1].checked || NameConstraintRadio[2].checked ||
133	NameConstraintRadio[4].checked || NameConstraintRadio[6].checked ||
134	NameConstraintRadio[7].checked || NameConstraintRadio[8].checked) {
135      NameConstraintNameDataType.checked = false;
136      return true;
137    }
138  }
139  return true;
140}
141
142
143function addSubAltName(form)
144{
145  with(form) {
146    var len = SubAltNameSelect.length;
147    var value;
148    var i = 0;
149    while(!(i == (SubAltNameRadio.length - 1)) & 
150          !(SubAltNameRadio[i].checked == true)) {
151      i++;
152    }
153    if (i != 0) {
154      value = SubAltNameText.value + " - " + (i + 1);
155    } else {
156      value = SubAltNameText.value + " - " + 
157              SubAltNameOtherNameOID.value + " - ";
158      if (SubAltNameDataType.checked) {
159	value += "1 - ";
160      } else {
161	value += "0 - ";
162      }
163      value += (i + 1);
164      if (SubAltNameOtherNameOID.value == "") {
165	alert("Other names must include an OID");
166	return false;
167      }
168    }
169
170    if ((SubAltNameText.value == "") | (SubAltNameRadio[i].checked != true)) {
171      alert("Alternative Names must include values for name and name type.");
172    } else {
173      SubAltNameSelect.options[len] = new Option(value, value);
174    }
175  }
176  return true;
177}
178
179function deleteSubAltName(form)
180{
181  with(form) {
182    while (SubAltNameSelect.selectedIndex >= 0) {
183      SubAltNameSelect[SubAltNameSelect.selectedIndex] = null;
184    }
185  }
186}
187  
188function addIssuerAltName(form)
189{
190  with(form)
191  {
192    var len = IssuerAltNameSelect.length;
193    var value;
194    var i = 0;
195
196    while(!(i == (IssuerAltNameRadio.length -1)) & 
197          !(IssuerAltNameRadio[i].checked == true)) {
198      i++;
199    }
200    if (i != 0) {
201      value = IssuerAltNameText.value + " - " + (i + 1);
202    } else {
203      value = IssuerAltNameText.value + " - " + 
204              IssuerAltNameOtherNameOID.value + " - ";
205      if (IssuerAltNameDataType.checked) {
206	value += "1 - ";
207      } else {
208	value += "0 - ";
209      }
210      value += (i + 1);
211      if (IssuerAltNameOtherNameOID.value == "") {
212	  alert("Other names must include an OID");
213	  return false;
214      }
215    }
216    if ((IssuerAltNameText.value == "") | 
217        (IssuerAltNameRadio[i].checked != true)) {
218      alert("Alternative Names must include values for name and name type.")
219    } else {
220      IssuerAltNameSelect.options[len] = new Option(value, value);
221    }
222  }
223  return true;
224}
225
226function deleteIssuerAltName(form)
227{
228  with(form) {
229    while (IssuerAltNameSelect.selectedIndex >= 0) {
230      IssuerAltNameSelect[IssuerAltNameSelect.selectedIndex] = null;
231    }
232  }
233}
234
235
236
237function addNameConstraint(form)
238{
239  with(form) {
240    var len = NameConstraintSelect.length;
241    var value;
242    var i = 0;
243    var min = NameConstraintMin.value;
244    var max = NameConstraintMax.value;
245
246    while(!(i == (NameConstraintRadio.length - 1) ) & 
247          !(NameConstraintRadio[i].checked == true)) {
248      i++;
249    }
250    value = NameConstraintText.value + " - ";
251    if (i == 0) {
252      value += NameConstraintOtherNameOID.value + " - ";
253      if (NameConstraintNameDataType.checked) {
254	value += "1 - ";
255      } else {
256	value += "0 - ";
257      }
258      if (NameConstraintOtherNameOID.value == "") {
259	alert("Other names must include an OID");
260	return false;
261      }
262    }
263    value += (i + 1) + " - ";
264    if (NameConstraintTypeRadio[0].checked == true) {
265      value += "p - ";
266    } else {
267      value += "e - ";
268    }
269    value += min + " - " + max;
270    if ((min == "") | (NameConstraintText.value == "") | 
271        (NameConstraintRadio[i].checked != true)) {
272      alert("Name Constraints must include values for minimum, name, and name type.")
273    } else {
274      NameConstraintSelect.options[len] = new Option(value, value);
275    }
276  }
277  return true;
278}
279
280function deleteNameConstraint(form)
281{
282  with(form) {
283    while (NameConstraintSelect.selectedIndex >= 0) {
284      NameConstraintSelect[NameConstraintSelect.selectedIndex] = null;
285    }
286  }
287}
288
289
290function submit_it()
291{
292  save_cur_page(cur_page);
293
294  var ver1 = (ver == 1);
295  var ver3 = (ver == 3);
296  var array_string;
297  var serial        = ext_page_array[0][10][0];
298  var serial_number = ext_page_array[0][12][0];
299  var manValidity   = ext_page_array[0][19][0];
300  var notBefore     = ext_page_array[0][20][0];
301  var notAfter      = ext_page_array[0][21][0];
302  var subject       = ext_page_array[0][22][0];
303
304  if (subject == "") {
305    alert("The DN field must contain some data");
306    return false;
307  }
308  if (!serial & serial_number == "") {
309    alert("No serial number specified");
310    return false;
311  }
312  if (ext_page_array[0][15][0]) {
313    var keygen = "<keygen name=\"key\" challenge=\"foo\">";
314  } else {
315    switch (ext_page_array[0][17][0]) {
316      case 2:
317        var keygen = "<keygen keytype=\"dsa\" pqg=\"MIGdAkEAjfKklEkidqo9JXWbsGhpy+rA2Dr7jQz3y7gyTw14guXQdi/FtyEOr8Lprawyq3qsSWk9+/g3JMLsBzbuMcgCkQIVAMdzIYxzfsjumTtPLe0w9I7azpFfAkEAYm0CeDnqChNBMWOlW0y1ACmdVSKVbO/LO/8Q85nOLC5xy53l+iS6v1jlt5UhklycxC6fb0ZLCIzFcq9T5teIAg==\" name=\"key\" challenge=\"foo\">";
318	break;
319      case 1:
320        var keygen = "<keygen keytype=\"dsa\" pqg=\"MIHaAmDCboVgX0+6pEeMlbwsasWDVBcJNHPKMzkq9kbCRK2U3k+tE15n+Dc2g3ZjDYr1um51e2iLC34/BwAAAAAAAAAAAAAAAAAAAAAAAAABbBhnlFN5Djmt0Mk8cdEBY5H8iPMCFMhUnFtbpjn3EyfH2DjVg3ALh7FtAmA2zWzhpeCwvOTjYnQorlXiv0WcnSiWmaC79CRYkFt5i+UEfRxwP1eNGJBVB1T+CPW6JGd4WhgsqtSf53pn5DEtv++O7lNfXyOhWhb3KaWHYIx8fuAXtioIWkWmpfEIVZA=\" name=\"key\" challenge=\"foo\">";
321	break;
322      case 0:
323        var keygen = "<keygen keytype=\"dsa\" pqg=\"MIIBHAKBgId8SiiWrcdua5zbsBhPkKfFcnHBG7T/bQla7c6OixGjjmSSuq2fJLvMKa579CaxHxLZzZZXIHmAk9poRgWl2GUUkCJ68XSum8OQzDPXPsofcEdeANjw3mIAAAAAAAAAAAAAAAAAAAAAAAAIE+MkW5hguLIQqWvEVi9dMpbNu6OZAhTIA+y3TgyiwA0D8pt686ofaL1IOQKBgAiZQC6UCXztr2iXxJrAC+51gN5oX/R9Thilln9RGegsWnHrdxUOpcm5vAWp1LU8TOXtujE8kqkm3UxIRhUWQORe9IxLANAXmZJqkw9FEVHkxj6Cy9detwT2MyBzSwS6avsf7aLisgHmI/IHSeapJsQ3NQa3rikb6zRiqIV+TVa6\" name=\"key\" challenge=\"foo\">";
324        break;
325    }
326  }
327  array_string =  build_array_string();
328  hiddens = "<input type=\"hidden\" name=\"subject\" value=\'" + subject + "\'> \n" +
329            "<input type=\"hidden\" name=\"serial-auto\" value=\"" + serial + "\"> \n" +
330            "<input type=\"hidden\" name=\"serial_value\" value=\"" + serial_number + "\"> \n" +
331            "<input type=\"hidden\" name=\"ver-1\" value=\"" + ver1 + "\"> \n" +
332            "<input type=\"hidden\" name=\"ver-3\" value=\"" + ver3 + "\"> \n" +
333            "<input type=\"hidden\" name=\"notBefore\" value=\"" + notBefore + "\"> \n" +
334            "<input type=\"hidden\" name=\"notAfter\" value=\"" + notAfter + "\"> \n" +
335            "<input type=\"hidden\" name=\"manValidity\" value=\"" + manValidity + "\"> \n" +
336            array_string;
337
338  var good_submit_page =
339    '<html>' +
340    '<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" BGCOLOR="#FFFFFF">' +
341    '<form method="post" action="' + script_url + '">' +
342    'Select size for your key:' + keygen + '</p>' +
343    '<input type="submit"></p>' +
344    hiddens +
345    '</form>\n' +
346    '</body>\n' +
347    '</html>\n';
348
349  window.frames['right'].document.write(good_submit_page);
350  window.frames['right'].document.close();
351  cur_page = max_pages + 1;
352  make_left_frame(window);
353  return false;
354}
355
356
357
358function build_array_string()
359{
360  var pg;
361  var array_string = '';
362  var pages;
363
364  if ((ext_page_array[3][4][0] > 0) && ext_page_array[3][3][0]) {
365    pages = 4 + parseInt(ext_page_array[3][4][0]);
366  } else {
367    pages = 4;
368  }
369  for (pg = 1; pg < pages; pg++) {
370    if ((pg > 1 || (ver == 3)) && (ext_page_array[pg].length > 1)) {
371      if (pg < 4) {
372	for (i = 0; i < ext_page_array[pg].length; i++) {
373	  if (ext_page_array[pg][i][3].indexOf("radio") == -1) {
374	    if (ext_page_array[pg][i][3].indexOf("multiple") == -1) {
375	      array_string +=  '<input type=\"hidden\" name=\"' + 
376                               ext_page_array[pg][i][1] + '\" value=\'' + 
377                               ext_page_array[pg][i][0] + '\'> \n';
378	    } else {
379	      for (k = 0; k < ext_page_array[pg][i][0].length; k++) {
380		array_string += '<input type=\"hidden\" name=\"' + 
381                                ext_page_array[pg][i][1] + k + '\" value=\'' + 
382                                ext_page_array[pg][i][0][k] + '\'> \n';
383	      }
384	    }
385	  } else {
386	    array_string += '<input type=\"hidden\" name=\"' + 
387                            ext_page_array[pg][i][1] + '-' + 
388			    ext_page_array[pg][i][2] + '\" value=\'' + 
389			    ext_page_array[pg][i][0] + '\'> \n';
390	  }
391	}
392      } else {
393	for (i = 0; i < ext_page_array[pg].length; i++) {
394	  if (ext_page_array[pg][i][3].indexOf("radio") == -1) {
395	    if (ext_page_array[pg][i][3].indexOf("multiple") == -1) {
396	      array_string += '<input type=\"hidden\" name=\"' + 
397	                      'CA#' + (pg - 3) + '-' + 
398			      ext_page_array[pg][i][1] + '\" value=\'' + 
399			      ext_page_array[pg][i][0] +'\'> \n';
400	    } else {
401	      for (k = 0; k < ext_page_array[pg][i][0].length; k++) {
402		array_string += '<input type=\"hidden\" name=\"' + 
403		                'CA#' + (pg - 3) + '-' + 
404				ext_page_array[pg][i][1] + k + '\" value=\'' + 
405				ext_page_array[pg][i][0][k] + '\'> \n';
406	      }
407	    }
408	  } else {
409	    array_string += '<input type=\"hidden\" name=\"' + 
410	                    'CA#' + (pg - 3) + '-' + 
411			    ext_page_array[pg][i][1] + '-' + 
412			    ext_page_array[pg][i][2] + '\" value=\'' + 
413			    ext_page_array[pg][i][0] + '\'> \n';
414	  }
415	}
416      }
417    }
418  }
419  return array_string;
420}
421
422
423
424function init_ext_page_array()
425{
426  for (i = 0; i < max_pages; i++) {
427    ext_page_array[i] = '';
428  }
429}
430
431function ca_num_change(n,ca_form)
432{
433  with(ca_form) {
434    n = parseInt(n,10);
435    if (caChoiceradio[2].checked) {
436      if (n) {
437	update_left_frame(n);
438      } else {
439	update_left_frame(0);
440      }
441    }
442  }
443}
444
445function choice_change(ca_form)
446{
447  with(ca_form) {
448    if (caChoiceradio[2].checked) {
449      ca_num_change(manCAs.value,ca_form);
450    } else {
451      update_left_frame(0);
452    }
453  }
454}
455
456function update_left_frame(n)
457{
458  var add_string = '';
459  for (var i = 0; i < n; i++) {
460    var j = i + 1;
461    add_string = add_string + ',1, \'CA #' + j + '\'';
462  }
463  top.add_index_list = add_string;
464  num_ca = n;
465  make_left_frame(window);
466}
467
468function set_ver1()
469// redraws the extensions page for version 1 certificates
470{
471  ver = 1
472  if (cur_page == 2 || cur_page == 3) {
473    switch_right_frame(window, cur_page, cur_page);
474  }
475}
476
477
478function set_ver3()
479// redraws the extensions page for version 3 certificates
480{
481  ver = 3
482  if (cur_page == 2) {
483    switch_right_frame(window, 0, 2);
484  } else if (cur_page == 3) {
485    switch_right_frame(window, 0, 3);
486  }
487}
488
489function reset_subject(marker, value, form)
490// Updates the subject field from a subordinate field
491{
492  with(form) {
493    var field_sep = '", ';
494    var begin_index = subject.value.indexOf(marker);
495    if (begin_index != 0 && subject.value[begin_index - 1] != ' ') {
496      begin_index = subject.value.indexOf(marker, begin_index +1);
497    }
498    var end_index = subject.value.indexOf(field_sep, begin_index);
499    if (begin_index > -1) {       // is it a delete/change?
500      if (end_index == -1) {      // is it the last one (includes only one)?
501        if (value.length > 0) {   // do I have to change it?
502          if (begin_index == 0) { // is is the only one?
503            subject.value = marker + '"' + value + '"';
504          } else {                // it is the last of many
505            subject.value = subject.value.substring(0,begin_index) + 
506	                    marker + '"' + value + '"';
507          }
508        } else {                  //  must be a delete
509          if (begin_index == 0) { // is it the only one?
510            begin_index += 2;
511          }
512          subject.value = subject.value.substring(0,(begin_index - 2));
513        }
514      } else {                    // it is the first of many or a middle one
515        if (value.length >0) {    // do I have to change it?
516          subject.value = 
517	  	subject.value.substring(0,(begin_index + marker.length + 1)) + 
518		value + subject.value.substring(end_index,subject.length);
519        } else {                  // it is a delete
520          subject.value = subject.value.substring(0,begin_index) + 
521	        subject.value.substring((end_index + 3),subject.length);
522        }
523      }
524    } else {                      // It is either an insert or a do nothing
525      if (value.length > 0) {     // is it an insert?
526        if (subject.value.length == 0) {  // is subject currently empty?
527          subject.value = marker + '"' + value + '"';
528        } else {
529          subject.value = subject.value + ', ' + marker + '"' + value + '"';
530        }
531      }
532    }
533  }
534}
535
536
537
538function reset_subjectFields(form)
539// updates all the subordinate fields from the subject field of a form
540// **** move the strings to global variables, to make maintentance easier ****
541{
542
543  update_subject_Field(form, 'CN=\"', form.name);
544  update_subject_Field(form, 'MAIL=\"', form.email);
545  update_subject_Field(form, 'O=\"', form.org);
546  update_subject_Field(form, 'C=\"', form.country);
547  update_subject_Field(form, ' L=\"', form.loc);
548  update_subject_Field(form, 'ST=\"', form.state);
549  update_subject_Field(form, 'E=\"', form.email);
550  update_subject_Field(form, 'OU=\"', form.org_unit);
551  update_subject_Field(form, 'UID=\"', form.uid);
552}
553
554function update_subject_Field(form, marker, update_field)
555//updates a single subordinate field from the subject field of a form
556// *** need to deal with the two types of e-mail addresses **************
557{
558  with(form) {
559    var field_sep = '", ';
560    var begin_index = subject.value.indexOf(marker) + marker.length;
561    var end_index = subject.value.indexOf(field_sep, begin_index);
562    if (end_index == -1) {
563      end_index = subject.value.indexOf('"',begin_index);
564    }
565    if (begin_index != (-1 + marker.length) ) {
566      update_field.value = subject.value.substring(begin_index, end_index);
567    } else {
568      update_field.value = '';
569    }
570  }
571}
572
573
574function switch_mail(form)
575// **** Do I want to delete the other type of e-mail address ? ************
576{
577  if (form.email_type[0].checked) {
578    var del = 'E=';
579    var ins = 'MAIL=';
580  } else {
581    var del = 'MAIL=';
582    var ins = 'E=';
583  }
584  reset_subject(del, '', form);
585  reset_subject(ins, form.email.value, form);
586}
587
588function make_page_intro(title, bgcolor)
589{
590  var style = '<STYLE TYPE="text/css">BODY{' +
591    'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
592    'font-size: 10pt;' +
593    '}' +
594    'TD{' +
595    'font-family: Geneva,MS Sans Serif,Arial,Lucida,Helvetica,sans-serif;' +
596    'font-size: 10pt;}' +
597    '</STYLE>';
598
599  if (bgcolor == null) { bgcolor = "#C0C0C0"; }
600  return '<HTML><HEAD>' +
601    '<TITLE>' + title + '</TITLE>' +
602    '</HEAD>' +
603    '<BODY TEXT="#000000" LINK="#000000" VLINK="#000000" ALINK="#FF0000" ' +
604          'BGCOLOR="' + bgcolor + '">';
605}
606
607
608function make_left_frame(window)
609{
610  with (window.frames['index']) {
611    eval ('index_string = make_left_frame_page(cur_page, ' 
612           + index_list + add_index_list + ' )');
613    fool1 = make_page_intro(index_label, "#FFFFFF") +
614      index_string + '</BODY></HTML>';
615    document.write(fool1);
616    document.close();
617  }
618}
619
620
621function save_cur_page(page_number)
622{
623  var len;
624  var pg = page_number - 1;
625  if (window.frames['right'].document.forms.length != 0) {
626    with (window.frames['right'].document) {
627      if ((page_number != 2 && page_number != 3 && page_number <= max_pages) || 
628	  ver == 3) {
629        ext_page_array[pg] = new Array(forms[0].elements.length);
630        for (i = 0; i < forms[0].elements.length; i++) {
631	  ext_page_array[pg][i] = new Array(4);
632	  switch (forms[0].elements[i].type) {
633	  case 'radio': 
634          case 'checkbox':
635	    ext_page_array[pg][i][0] = forms[0].elements[i].checked;
636	    break;
637	  case 'select-one':
638	    ext_page_array[pg][i][0] = forms[0].elements[i].selectedIndex;
639	    break;
640	  case 'select-multiple':
641	    len = forms[0].elements[i].options.length;
642	    ext_page_array[pg][i][0] = new Array(len);
643	    for(k = 0; k < len; k++) {
644	      ext_page_array[pg][i][0][k] = forms[0].elements[i].options[k].value;
645	    }
646	    break;
647	  default:
648	    ext_page_array[pg][i][0] = forms[0].elements[i].value;
649	  }
650	  ext_page_array[pg][i][1] = forms[0].elements[i].name;
651	  ext_page_array[pg][i][2] = forms[0].elements[i].value;
652	  ext_page_array[pg][i][3] = forms[0].elements[i].type;
653        }
654      }
655    }
656  }
657}
658
659function reload_form(page_number)
660{
661  var j = page_number - 1;
662  with (window.frames['right'].document) {
663    if (((page_number < 2 || page_number > 3) || ver == 3) 
664	&& page_number != 0 && (ext_page_array[j].length > 1)) {
665      for (i = 0; i < ext_page_array[j].length; i++) {
666	switch (forms[0].elements[i].type) {
667	case 'radio': case 'checkbox':
668	  forms[0].elements[i].checked = ext_page_array[j][i][0];
669	  break;
670	case 'select-one':
671	  forms[0].elements[i].selectedIndex = ext_page_array[j][i][0];
672	  break;
673	case 'select-multiple':
674	  for (k = 0; k < ext_page_array[j][i][0].length; k++) {
675	    forms[0].elements[i].options[k] = 
676	        new Option(ext_page_array[j][i][0][k], 
677			   ext_page_array[j][i][0][k]);
678	  }
679	  break;
680	default:
681	  forms[0].elements[i].value = ext_page_array[j][i][0];
682	}
683      }
684    }
685  }
686}
687
688function switch_right_frame(top_window, old_pane, new_pane)
689{
690  var ext_page_stnd =
691    make_page_intro(standard_extensions_index_label, "#FFFFFF") +
692    '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
693    'SRC="stnd_ext_form.html">' +
694    '</IFRAME></body></html>';
695
696  var ext_page_nscp = 
697    make_page_intro(netscape_extensions_index_label, "#FFFFFF") +
698    '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
699    'SRC="nscp_ext_form.html">' +
700    '</IFRAME></body></html>';
701
702  var ext_page_ca =
703    make_page_intro(certifying_authorities_index_label, "#FFFFFF") +
704    '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
705    'SRC="ca.html">' +
706    '</IFRAME></body</html>';
707
708  var ext_page_ca_exp =
709    make_page_intro('Certifying Authority Details', "#FFFFFF") +
710    '<IFRAME WIDTH="100%" HEIGHT="100%" FRAMEBORDER=0 ID="ext" ' +
711    'SRC="ca_form.html">' +
712    '</IFRAME></body></html>';
713
714
715  if (old_pane > 0 && cur_page <= max_pages) {
716    save_cur_page(old_pane);
717  }
718  cur_page = new_pane;
719  make_left_frame(top_window);
720  if (new_pane == 2 || new_pane == 3) {
721    if (ver == 1) {
722      frames['right'].document.write(ext_page_ver1);
723      frames['right'].document.close();
724    } else if (new_pane == 2) {
725      frames['right'].document.write(ext_page_nscp);
726      frames['right'].document.close();
727      reload_form(new_pane);
728    } else {
729      frames['right'].document.write(ext_page_stnd);
730      frames['right'].document.close();
731      reload_form(new_pane);
732    }
733  } else if (new_pane == 4) {
734    frames['right'].document.write(ext_page_ca);
735    frames['right'].document.close();
736    reload_form(new_pane);
737  } else if (new_pane == 1) {
738    frames['right'].document.write(main_page);
739    frames['right'].document.close();
740    reload_form(new_pane);
741  } else {
742    frames['right'].document.write(ext_page_ca_exp);
743    frames['right'].document.close();
744    reload_form(new_pane);
745  }
746}
747
748function make_left_frame_page(selected)
749{
750  var n_strings = ( make_left_frame_page.arguments.length - 1 ) / 2;
751  var table_background;
752  var command;
753  var indent;
754  var label;
755  var ret_string = "";
756    
757  ret_string += '<TABLE CELLSPACING=4>';
758  for ( var i = 1; i <= n_strings; i++ ) {
759    if ( i == selected ) {
760      table_background = 'BGCOLOR=#BBCCBB';
761    } else {
762      table_background = '';
763    }
764	
765    indent = make_left_frame_page.arguments[(i*2) - 1];
766    label =  make_left_frame_page.arguments[(i*2)];
767
768    if ( indent == 0 ) {
769      ret_string += ('<TR><TD COLSPAN=2 ' + table_background + '>');
770    } else {
771      ret_string += ('<TR><TD>&nbsp;&nbsp;</TD><TD ' + table_background + '>');
772    }
773
774    command = "'parent.switch_right_frame(parent," + selected + "," + i + ")'";
775    ret_string += ('<A HREF="javascript:void setTimeout(' + command + ',0)">');
776    if ( indent == 0 ) { ret_string += "<B>"; }
777    ret_string += label;
778    if ( indent == 0 ) { ret_string += "</B>"; }
779    ret_string += '</A></TD></TR>';
780  }
781  if (selected == (max_pages + 1)) {
782    table_background = 'BGCOLOR=#BBCCBB';
783  } else {
784    table_background = '';
785  }
786  ret_string +=
787    '<TR><TD COLSPAN=2 ' + table_background + 
788    '><b><A HREF="javascript:void setTimeout(\'top.submit_it()\', 0)">Finish</A></b>' +
789    '</TD></TR>' +
790    '<input type="submit"></form>' + 
791    '</TABLE>';
792  return(ret_string);
793}
794
795
796function make_page(window)
797// Draws the initial page setup
798{
799  selected = cur_page
800  init_ext_page_array()
801
802  with (window.frames['right']) {
803    location="main.html";
804//  document.write(main_page);
805//  document.close();
806  }
807
808  make_left_frame(window);
809
810}
811</script>
812
813</HEAD>
814<title>Cert-O-Matic</title>
815  <FRAMESET cols="150,*" BORDER=3 ONLOAD="make_page(window)">
816      <FRAME SRC="about:blank" ID="index" NAME="index"
817           MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>
818      <FRAME SRC="about:blank" ID="right" NAME="right"
819           MARGINWIDTH=15 MARGINHEIGHT=10 BORDER=3>
820  </FRAMESET>
821</HTML>