--- /dev/null
+/* $Id$
+ * Captive MS-Windows Driver Survey helper.
+ * Copyright (C) 2005 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+// Double-run protection due to the My::Web "text/javascript" compatibility hack.
+if (!window.var_project_captive_DriverSurvey_done) {
+ var var_project_captive_DriverSurvey_done=1;
+
+function DriverSurvey_validate(form)
+{
+ var e_kinds_array=form.elements["kind"];
+ var checked=0;
+ for (var kindi=0;kindi<e_kinds_array.length;kindi++)
+ if (e_kinds_array[kindi].checked)
+ checked++;
+ if (1!=checked) {
+ // FIXME: Unify with: project::captive::DriverSurvey
+ alert("Please check the appropriate leftmost checkmark.");
+ return false;
+ }
+ return true;
+}
+
+function DriverSurvey_error_check()
+{
+ var e_error=document.getElementById("error");
+ if (e_error && e_error.textContent)
+ alert(e_error.textContent);
+}
+
+function DriverSurvey_error_check_delayed()
+{
+ // HACK: 0ms - wait for 'css_inherit.js' finalization.
+ setTimeout('DriverSurvey_error_check();',0);
+}
+
+function display(name,state)
+{
+ var e=document.getElementById(name);
+ if (e)
+ e.style.display=(state ? "table-row" : "none");
+ return e;
+}
+
+var products_shown;
+
+function display_product(producti,state)
+{
+ for (var rowi=0;display("product"+producti+"_row"+rowi,state);rowi++);
+ return !!rowi;
+}
+
+function DriverSurvey_init()
+{
+ DriverSurvey_error_check_delayed();
+ display("product0_row0",0);
+ display_product("next",1);
+ products_shown=1;
+ for (var producti=products_shown;display_product(producti+0);producti++);
+}
+
+function Survey_productnext(form)
+{
+ display("product0_row0",1);
+ display_product(products_shown++,1);
+ if (!display_product(products_shown,0))
+ display_product("next",0);
+ return false;
+}
+
+function click_on(id)
+{
+ var e;
+ if (document.getElementById)
+ e=document.getElementById(id);
+ if (e)
+ e.click();
+}
+
+/* Origin: http://simon.incutio.com/archive/2004/05/26/addLoadEvent */
+function addLoadEvent(func)
+{
+ var onload_orig=window.onload;
+ if (typeof(onload_orig)!='function')
+ window.onload = func;
+ else
+ window.onload = function()
+ {
+ onload_orig();
+ func();
+ };
+}
+
+if (document.getElementById)
+ addLoadEvent(DriverSurvey_init);
+
+}