2 * Captive MS-Windows Driver Survey helper.
3 * Copyright (C) 2005 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // Double-run protection due to the My::Web "text/javascript" compatibility hack.
21 if (!window.var_project_captive_DriverSurvey_done) {
22 var var_project_captive_DriverSurvey_done=1;
24 function DriverSurvey_validate(form)
26 var e_kinds_array=form.elements["kind"];
28 for (var kindi=0;kindi<e_kinds_array.length;kindi++)
29 if (e_kinds_array[kindi].checked)
32 // FIXME: Unify with: project::captive::DriverSurvey
33 alert("Please check the appropriate leftmost checkmark.");
39 function DriverSurvey_error_check()
41 var e_error=document.getElementById("error");
42 if (e_error && e_error.textContent)
43 alert(e_error.textContent);
46 function DriverSurvey_error_check_delayed()
48 // HACK: 0ms - wait for 'css_inherit.js' finalization.
49 setTimeout('DriverSurvey_error_check();',0);
52 function display(name,state)
54 var e=document.getElementById(name);
56 e.style.display=(state ? "table-row" : "none");
62 function display_product(producti,state)
64 for (var rowi=0;display("product"+producti+"_row"+rowi,state);rowi++);
68 function DriverSurvey_init()
70 DriverSurvey_error_check_delayed();
71 display("product0_row0",0);
72 display_product("next",1);
74 for (var producti=products_shown;display_product(producti+0);producti++);
77 function Survey_productnext(form)
79 display("product0_row0",1);
80 display_product(products_shown++,1);
81 if (!display_product(products_shown,0))
82 display_product("next",0);
89 if (document.getElementById)
90 e=document.getElementById(id);
95 /* Origin: http://simon.incutio.com/archive/2004/05/26/addLoadEvent */
96 function addLoadEvent(func)
98 var onload_orig=window.onload;
99 if (typeof(onload_orig)!='function')
100 window.onload = func;
102 window.onload = function()
109 if (document.getElementById)
110 addLoadEvent(DriverSurvey_init);