|
1
|
|
|
/**
|
|
2
|
|
|
* Generate a new password, which may then be copied to the form
|
|
3
|
|
|
* with suggestPasswordCopy().
|
|
4
|
|
|
*
|
|
5
|
|
|
* @param string the form name
|
|
|
|
|
|
|
6
|
|
|
*
|
|
7
|
|
|
* @return boolean always true
|
|
8
|
|
|
*/
|
|
9
|
|
|
function suggestPassword() {
|
|
10
|
|
|
// restrict the password to just letters and numbers to avoid problems:
|
|
11
|
|
|
// "editors and viewers regard the password as multiple words and
|
|
12
|
|
|
// things like double click no longer work"
|
|
13
|
|
|
var pwchars = "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ";
|
|
14
|
|
|
var passwordlength = 16; // do we want that to be dynamic? no, keep it simple :)
|
|
15
|
|
|
var passwd = document.getElementById('generated_pw');
|
|
16
|
|
|
passwd.value = '';
|
|
17
|
|
|
|
|
18
|
|
|
for ( i = 0; i < passwordlength; i++ ) {
|
|
|
|
|
|
|
19
|
|
|
passwd.value += pwchars.charAt( Math.floor( Math.random() * pwchars.length ) )
|
|
20
|
|
|
}
|
|
21
|
|
|
return passwd.value;
|
|
22
|
|
|
}
|
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
/**
|
|
26
|
|
|
* Copy the generated password (or anything in the field) to the form
|
|
27
|
|
|
*
|
|
28
|
|
|
* @param string the form name
|
|
|
|
|
|
|
29
|
|
|
*
|
|
30
|
|
|
* @return boolean always true
|
|
31
|
|
|
*/
|
|
32
|
|
|
function suggestPasswordCopy() {
|
|
33
|
|
|
document.getElementById('text_pma_pw').value = document.getElementById('generated_pw').value;
|
|
34
|
|
|
document.getElementById('text_pma_pw2').value = document.getElementById('generated_pw').value;
|
|
35
|
|
|
return true;
|
|
36
|
|
|
}
|
|
37
|
|
|
|
|
38
|
|
|
/**
|
|
39
|
|
|
* Opens calendar window.
|
|
40
|
|
|
*
|
|
41
|
|
|
* @param string calendar.php parameters
|
|
|
|
|
|
|
42
|
|
|
* @param string form name
|
|
|
|
|
|
|
43
|
|
|
* @param string field name
|
|
|
|
|
|
|
44
|
|
|
* @param string edit type - date/timestamp
|
|
|
|
|
|
|
45
|
|
|
*/
|
|
46
|
|
|
function openCalendar(params, form, field, type) {
|
|
47
|
|
|
window.open("../calendar/mini_calendar.php?" + params, "calendar", "width=400,height=200,status=yes");
|
|
48
|
|
|
dateField = eval("document." + form + "." + field);
|
|
|
|
|
|
|
49
|
|
|
dateType = type;
|
|
|
|
|
|
|
50
|
|
|
}
|
|
51
|
|
|
|
|
52
|
|
|
/**
|
|
53
|
|
|
* Formats number to two digits.
|
|
54
|
|
|
*
|
|
55
|
|
|
* @param int number to format.
|
|
|
|
|
|
|
56
|
|
|
* @param string type of number
|
|
|
|
|
|
|
57
|
|
|
*/
|
|
58
|
|
|
function formatNum2(i, valtype) {
|
|
59
|
|
|
f = (i < 10 ? '0' : '') + i;
|
|
|
|
|
|
|
60
|
|
|
if (valtype && valtype != '') {
|
|
61
|
|
|
switch(valtype) {
|
|
62
|
|
|
case 'month':
|
|
63
|
|
|
f = (f > 12 ? 12 : f);
|
|
64
|
|
|
break;
|
|
65
|
|
|
|
|
66
|
|
|
case 'day':
|
|
67
|
|
|
f = (f > 31 ? 31 : f);
|
|
68
|
|
|
break;
|
|
69
|
|
|
|
|
70
|
|
|
case 'hour':
|
|
71
|
|
|
f = (f > 24 ? 24 : f);
|
|
72
|
|
|
break;
|
|
73
|
|
|
|
|
74
|
|
|
default:
|
|
|
|
|
|
|
75
|
|
|
case 'second':
|
|
76
|
|
|
case 'minute':
|
|
77
|
|
|
f = (f > 59 ? 59 : f);
|
|
78
|
|
|
break;
|
|
79
|
|
|
}
|
|
80
|
|
|
}
|
|
81
|
|
|
|
|
82
|
|
|
return f;
|
|
83
|
|
|
}
|
|
84
|
|
|
|
|
85
|
|
|
/**
|
|
86
|
|
|
* Formats number to two digits.
|
|
87
|
|
|
*
|
|
88
|
|
|
* @param int number to format.
|
|
|
|
|
|
|
89
|
|
|
* @param int default value
|
|
|
|
|
|
|
90
|
|
|
* @param string type of number
|
|
|
|
|
|
|
91
|
|
|
*/
|
|
92
|
|
|
function formatNum2d(i, default_v, valtype) {
|
|
93
|
|
|
i = parseInt(i, 10);
|
|
94
|
|
|
if (isNaN(i)) return default_v;
|
|
|
|
|
|
|
95
|
|
|
return formatNum2(i, valtype)
|
|
96
|
|
|
}
|
|
97
|
|
|
|
|
98
|
|
|
/**
|
|
99
|
|
|
* Formats number to four digits.
|
|
100
|
|
|
*
|
|
101
|
|
|
* @param int number to format.
|
|
|
|
|
|
|
102
|
|
|
*/
|
|
103
|
|
|
function formatNum4(i) {
|
|
104
|
|
|
i = parseInt(i, 10)
|
|
105
|
|
|
return (i < 1000 ? i < 100 ? i < 10 ? '000' : '00' : '0' : '') + i;
|
|
106
|
|
|
}
|
|
107
|
|
|
|
|
108
|
|
|
/**
|
|
109
|
|
|
* Initializes calendar window.
|
|
110
|
|
|
*/
|
|
111
|
|
|
function initCalendar() {
|
|
112
|
|
|
if (!year && !month && !day) {
|
|
|
|
|
|
|
113
|
|
|
/* Called for first time */
|
|
114
|
|
|
if (window.opener.dateField.value) {
|
|
115
|
|
|
value = window.opener.dateField.value;
|
|
|
|
|
|
|
116
|
|
|
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
|
|
117
|
|
|
if (window.opener.dateType == 'datetime') {
|
|
118
|
|
|
parts = value.split(' ');
|
|
|
|
|
|
|
119
|
|
|
value = parts[0];
|
|
120
|
|
|
|
|
121
|
|
|
if (parts[1]) {
|
|
122
|
|
|
time = parts[1].split(':');
|
|
|
|
|
|
|
123
|
|
|
hour = parseInt(time[0],10);
|
|
|
|
|
|
|
124
|
|
|
minute = parseInt(time[1],10);
|
|
|
|
|
|
|
125
|
|
|
second = parseInt(time[2],10);
|
|
|
|
|
|
|
126
|
|
|
}
|
|
127
|
|
|
}
|
|
128
|
|
|
date = value.split("-");
|
|
|
|
|
|
|
129
|
|
|
day = parseInt(date[2],10);
|
|
|
|
|
|
|
130
|
|
|
month = parseInt(date[1],10) - 1;
|
|
|
|
|
|
|
131
|
|
|
year = parseInt(date[0],10);
|
|
|
|
|
|
|
132
|
|
|
} else {
|
|
133
|
|
|
year = parseInt(value.substr(0,4),10);
|
|
134
|
|
|
month = parseInt(value.substr(4,2),10) - 1;
|
|
135
|
|
|
day = parseInt(value.substr(6,2),10);
|
|
136
|
|
|
hour = parseInt(value.substr(8,2),10);
|
|
137
|
|
|
minute = parseInt(value.substr(10,2),10);
|
|
138
|
|
|
second = parseInt(value.substr(12,2),10);
|
|
139
|
|
|
}
|
|
140
|
|
|
}
|
|
141
|
|
|
if (isNaN(year) || isNaN(month) || isNaN(day) || day == 0) {
|
|
|
|
|
|
|
142
|
|
|
dt = new Date();
|
|
|
|
|
|
|
143
|
|
|
year = dt.getFullYear();
|
|
144
|
|
|
month = dt.getMonth();
|
|
145
|
|
|
day = dt.getDate();
|
|
146
|
|
|
}
|
|
147
|
|
|
if (isNaN(hour) || isNaN(minute) || isNaN(second)) {
|
|
|
|
|
|
|
148
|
|
|
dt = new Date();
|
|
149
|
|
|
hour = dt.getHours();
|
|
150
|
|
|
minute = dt.getMinutes();
|
|
151
|
|
|
second = dt.getSeconds();
|
|
152
|
|
|
}
|
|
153
|
|
|
} else {
|
|
154
|
|
|
/* Moving in calendar */
|
|
155
|
|
|
if (month > 11) {
|
|
156
|
|
|
month = 0;
|
|
157
|
|
|
year++;
|
|
158
|
|
|
}
|
|
159
|
|
|
if (month < 0) {
|
|
160
|
|
|
month = 11;
|
|
161
|
|
|
year--;
|
|
162
|
|
|
}
|
|
163
|
|
|
}
|
|
164
|
|
|
|
|
165
|
|
|
if (document.getElementById) {
|
|
166
|
|
|
cnt = document.getElementById("calendar_data");
|
|
|
|
|
|
|
167
|
|
|
} else if (document.all) {
|
|
168
|
|
|
cnt = document.all["calendar_data"];
|
|
169
|
|
|
}
|
|
170
|
|
|
|
|
171
|
|
|
cnt.innerHTML = "";
|
|
|
|
|
|
|
172
|
|
|
|
|
173
|
|
|
str = ""
|
|
|
|
|
|
|
174
|
|
|
|
|
175
|
|
|
//heading table
|
|
176
|
|
|
str += '<table class="calendar"><tr><th width="50%">';
|
|
177
|
|
|
str += '<form method="NONE" onsubmit="return 0">';
|
|
178
|
|
|
str += '<a href="javascript:month--; initCalendar();">«</a> ';
|
|
179
|
|
|
str += '<select id="select_month" name="monthsel" onchange="month = parseInt(document.getElementById(\'select_month\').value); initCalendar();">';
|
|
180
|
|
|
for (i =0; i < 12; i++) {
|
|
|
|
|
|
|
181
|
|
|
if (i == month) selected = ' selected="selected"';
|
|
|
|
|
|
|
182
|
|
|
else selected = '';
|
|
183
|
|
|
str += '<option value="' + i + '" ' + selected + '>' + month_names[i] + '</option>';
|
|
|
|
|
|
|
184
|
|
|
}
|
|
185
|
|
|
str += '</select>';
|
|
186
|
|
|
str += ' <a href="javascript:month++; initCalendar();">»</a>';
|
|
187
|
|
|
str += '</form>';
|
|
188
|
|
|
str += '</th><th width="50%">';
|
|
189
|
|
|
str += '<form method="NONE" onsubmit="return 0">';
|
|
190
|
|
|
str += '<a href="javascript:year--; initCalendar();">«</a> ';
|
|
191
|
|
|
str += '<select id="select_year" name="yearsel" onchange="year = parseInt(document.getElementById(\'select_year\').value); initCalendar();">';
|
|
192
|
|
|
for (i = year - 25; i < year + 25; i++) {
|
|
193
|
|
|
if (i == year) selected = ' selected="selected"';
|
|
|
|
|
|
|
194
|
|
|
else selected = '';
|
|
195
|
|
|
str += '<option value="' + i + '" ' + selected + '>' + i + '</option>';
|
|
196
|
|
|
}
|
|
197
|
|
|
str += '</select>';
|
|
198
|
|
|
str += ' <a href="javascript:year++; initCalendar();">»</a>';
|
|
199
|
|
|
str += '</form>';
|
|
200
|
|
|
str += '</th></tr></table>';
|
|
201
|
|
|
|
|
202
|
|
|
str += '<table class="calendar"><tr>';
|
|
203
|
|
|
for (i = 0; i < 7; i++) {
|
|
204
|
|
|
str += "<th>" + day_names[i] + "</th>";
|
|
|
|
|
|
|
205
|
|
|
}
|
|
206
|
|
|
str += "</tr>";
|
|
207
|
|
|
|
|
208
|
|
|
var firstDay = new Date(year, month, 1).getDay();
|
|
209
|
|
|
var lastDay = new Date(year, month + 1, 0).getDate();
|
|
210
|
|
|
|
|
211
|
|
|
str += "<tr>";
|
|
212
|
|
|
|
|
213
|
|
|
dayInWeek = 0;
|
|
|
|
|
|
|
214
|
|
|
for (i = 0; i < firstDay; i++) {
|
|
215
|
|
|
str += "<td> </td>";
|
|
216
|
|
|
dayInWeek++;
|
|
217
|
|
|
}
|
|
218
|
|
|
for (i = 1; i <= lastDay; i++) {
|
|
219
|
|
|
if (dayInWeek == 7) {
|
|
220
|
|
|
str += "</tr><tr>";
|
|
221
|
|
|
dayInWeek = 0;
|
|
222
|
|
|
}
|
|
223
|
|
|
|
|
224
|
|
|
dispmonth = 1 + month;
|
|
|
|
|
|
|
225
|
|
|
|
|
226
|
|
|
if (window.opener.dateType == 'datetime' || window.opener.dateType == 'date') {
|
|
227
|
|
|
actVal = "" + formatNum4(year) + "-" + formatNum2(dispmonth, 'month') + "-" + formatNum2(i, 'day');
|
|
|
|
|
|
|
228
|
|
|
} else {
|
|
229
|
|
|
actVal = "" + formatNum4(year) + formatNum2(dispmonth, 'month') + formatNum2(i, 'day');
|
|
230
|
|
|
}
|
|
231
|
|
|
if (i == day) {
|
|
232
|
|
|
style = ' class="selected"';
|
|
|
|
|
|
|
233
|
|
|
current_date = actVal;
|
|
|
|
|
|
|
234
|
|
|
} else {
|
|
235
|
|
|
style = '';
|
|
236
|
|
|
}
|
|
237
|
|
|
str += "<td" + style + "><a href=\"javascript:returnDate('" + actVal + "');\">" + i + "</a></td>"
|
|
238
|
|
|
dayInWeek++;
|
|
239
|
|
|
}
|
|
240
|
|
|
for (i = dayInWeek; i < 7; i++) {
|
|
241
|
|
|
str += "<td> </td>";
|
|
242
|
|
|
}
|
|
243
|
|
|
|
|
244
|
|
|
str += "</tr></table>";
|
|
245
|
|
|
|
|
246
|
|
|
cnt.innerHTML = str;
|
|
247
|
|
|
|
|
248
|
|
|
// Should we handle time also?
|
|
249
|
|
|
if (window.opener.dateType != 'date' && !clock_set) {
|
|
|
|
|
|
|
250
|
|
|
|
|
251
|
|
|
if (document.getElementById) {
|
|
252
|
|
|
cnt = document.getElementById("clock_data");
|
|
253
|
|
|
} else if (document.all) {
|
|
254
|
|
|
cnt = document.all["clock_data"];
|
|
255
|
|
|
}
|
|
256
|
|
|
|
|
257
|
|
|
str = '';
|
|
258
|
|
|
init_hour = hour;
|
|
|
|
|
|
|
259
|
|
|
init_minute = minute;
|
|
|
|
|
|
|
260
|
|
|
init_second = second;
|
|
|
|
|
|
|
261
|
|
|
str += '<fieldset>';
|
|
262
|
|
|
str += '<form method="NONE" class="clock" onsubmit="returnDate(\'' + current_date + '\')">';
|
|
|
|
|
|
|
263
|
|
|
str += '<input id="hour" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_hour, \'hour\'); init_hour = this.value;" value="' + formatNum2(hour, 'hour') + '" />:';
|
|
264
|
|
|
str += '<input id="minute" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_minute, \'minute\'); init_minute = this.value;" value="' + formatNum2(minute, 'minute') + '" />:';
|
|
265
|
|
|
str += '<input id="second" type="text" size="2" maxlength="2" onblur="this.value=formatNum2d(this.value, init_second, \'second\'); init_second = this.value;" value="' + formatNum2(second, 'second') + '" />';
|
|
266
|
|
|
str += ' ';
|
|
267
|
|
|
str += '<input type="submit" value="' + submit_text + '"/>';
|
|
|
|
|
|
|
268
|
|
|
str += '</form>';
|
|
269
|
|
|
str += '</fieldset>';
|
|
270
|
|
|
|
|
271
|
|
|
cnt.innerHTML = str;
|
|
272
|
|
|
clock_set = 1;
|
|
|
|
|
|
|
273
|
|
|
}
|
|
274
|
|
|
|
|
275
|
|
|
}
|
|
276
|
|
|
|
|
277
|
|
|
/**
|
|
278
|
|
|
* Returns date from calendar.
|
|
279
|
|
|
*
|
|
280
|
|
|
* @param string date text
|
|
|
|
|
|
|
281
|
|
|
*/
|
|
282
|
|
|
function returnDate(d) {
|
|
283
|
|
|
txt = d;
|
|
|
|
|
|
|
284
|
|
|
if (window.opener.dateType != 'date') {
|
|
285
|
|
|
// need to get time
|
|
286
|
|
|
h = parseInt(document.getElementById('hour').value,10);
|
|
|
|
|
|
|
287
|
|
|
m = parseInt(document.getElementById('minute').value,10);
|
|
|
|
|
|
|
288
|
|
|
s = parseInt(document.getElementById('second').value,10);
|
|
|
|
|
|
|
289
|
|
|
if (window.opener.dateType == 'datetime') {
|
|
290
|
|
|
txt += ' ' + formatNum2(h, 'hour') + ':' + formatNum2(m, 'minute') + ':' + formatNum2(s, 'second');
|
|
291
|
|
|
} else {
|
|
292
|
|
|
// timestamp
|
|
293
|
|
|
txt += formatNum2(h, 'hour') + formatNum2(m, 'minute') + formatNum2(s, 'second');
|
|
294
|
|
|
}
|
|
295
|
|
|
}
|
|
296
|
|
|
|
|
297
|
|
|
window.opener.dateField.value = txt;
|
|
298
|
|
|
window.close();
|
|
299
|
|
|
}
|
|
300
|
|
|
|
|
301
|
|
|
|
|
302
|
|
|
|
|
303
|
|
|
//-------------------------------------------------
|
|
304
|
|
|
function getE(id)
|
|
305
|
|
|
{
|
|
306
|
|
|
if (typeof id != "string")
|
|
307
|
|
|
{
|
|
308
|
|
|
return id;
|
|
309
|
|
|
}
|
|
310
|
|
|
else if (Boolean(document.getElementById))
|
|
311
|
|
|
{
|
|
312
|
|
|
return document.getElementById(id);
|
|
313
|
|
|
}
|
|
314
|
|
|
else if (Boolean(document.all))
|
|
315
|
|
|
{
|
|
316
|
|
|
return eval("document.all."+id);
|
|
|
|
|
|
|
317
|
|
|
}
|
|
318
|
|
|
else if (Boolean(document.ids))
|
|
319
|
|
|
{
|
|
320
|
|
|
return eval("document.ids."+id);
|
|
|
|
|
|
|
321
|
|
|
}
|
|
322
|
|
|
else
|
|
323
|
|
|
{
|
|
324
|
|
|
return null;
|
|
325
|
|
|
}
|
|
326
|
|
|
}
|
|
327
|
|
|
//-------------------------------------------------
|
|
328
|
|
|
function okno(action,winwidth,winheight,name,scroll,toolbar,status,resizable,menubar) {
|
|
329
|
|
|
var PROFILE = null;
|
|
|
|
|
|
|
330
|
|
|
|
|
331
|
|
|
PROFILE = window.open ("", name, "toolbar="+toolbar+",width="+winwidth+",height="+winheight+",directories=no,location=no,status="+status+",scrollbars="+scroll+",resizable="+resizable+",menubar="+menubar+"");
|
|
332
|
|
|
if (PROFILE != null) {
|
|
333
|
|
|
if (PROFILE.opener == null) {
|
|
334
|
|
|
PROFILE.opener = self;
|
|
|
|
|
|
|
335
|
|
|
}
|
|
336
|
|
|
PROFILE.location.href = action;
|
|
337
|
|
|
}
|
|
338
|
|
|
|
|
339
|
|
|
|
|
340
|
|
|
}
|
|
341
|
|
|
//-------------------------------------------------
|
|
342
|
|
|
function reokno(action,winwidth,winheight,name,scroll,toolbar,status,resize,menubar)
|
|
|
|
|
|
|
343
|
|
|
{
|
|
344
|
|
|
|
|
345
|
|
|
window.close();
|
|
346
|
|
|
|
|
347
|
|
|
b = window.opener;
|
|
|
|
|
|
|
348
|
|
|
a = b.closed;
|
|
|
|
|
|
|
349
|
|
|
|
|
350
|
|
|
if (!a)
|
|
351
|
|
|
{
|
|
352
|
|
|
var PROFILE = null;
|
|
|
|
|
|
|
353
|
|
|
PROFILE = self.open ("", "nalezen", "toolbar="+toolbar+",width="+winwidth+",height="+winheight+",directories=no, status="+status+",scrollbars="+scroll+",resize="+resize+",menubar="+menubar+"");
|
|
|
|
|
|
|
354
|
|
|
if (PROFILE != null) {
|
|
355
|
|
|
if (PROFILE.opener == null) {
|
|
356
|
|
|
PROFILE.opener = self;
|
|
357
|
|
|
}
|
|
358
|
|
|
PROFILE.location.href = action;
|
|
359
|
|
|
}
|
|
360
|
|
|
}
|
|
361
|
|
|
}
|
|
362
|
|
|
//-------------------------------------------------
|
|
363
|
|
|
function reoknoclen(action,winwidth,winheight,name,scroll,toolbar,status,resize,menubar)
|
|
|
|
|
|
|
364
|
|
|
{
|
|
365
|
|
|
|
|
366
|
|
|
window.close();
|
|
367
|
|
|
|
|
368
|
|
|
b = window.opener;
|
|
|
|
|
|
|
369
|
|
|
a = b.closed;
|
|
|
|
|
|
|
370
|
|
|
|
|
371
|
|
|
if (!a)
|
|
372
|
|
|
{
|
|
373
|
|
|
var PROFILE = null;
|
|
|
|
|
|
|
374
|
|
|
PROFILE = self.open ("", "clen", "toolbar="+toolbar+",width="+winwidth+",height="+winheight+",directories=no, status="+status+",scrollbars="+scroll+",resize="+resize+",menubar="+menubar+"");
|
|
|
|
|
|
|
375
|
|
|
if (PROFILE != null) {
|
|
376
|
|
|
if (PROFILE.opener == null) {
|
|
377
|
|
|
PROFILE.opener = self;
|
|
378
|
|
|
}
|
|
379
|
|
|
PROFILE.location.href = action;
|
|
380
|
|
|
}
|
|
381
|
|
|
}
|
|
382
|
|
|
}
|
|
383
|
|
|
//-------------------------------------------------
|
|
384
|
|
|
function GetElementById(id){
|
|
385
|
|
|
if (document.getElementById) {
|
|
386
|
|
|
return (document.getElementById(id));
|
|
387
|
|
|
} else if (document.all) {
|
|
388
|
|
|
return (document.all[id]);
|
|
389
|
|
|
} else {
|
|
390
|
|
|
if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
|
|
|
|
|
|
|
391
|
|
|
return (document.layers[id]);
|
|
392
|
|
|
}
|
|
393
|
|
|
}
|
|
394
|
|
|
}
|
|
395
|
|
|
//-------------------------------------------------
|
|
396
|
|
|
function CheckAll(formname, switchid) {
|
|
397
|
|
|
var ele = document.forms[formname].elements;
|
|
398
|
|
|
var switch_cbox = GetElementById(switchid);
|
|
399
|
|
|
for (var i = 0; i < ele.length; i++) {
|
|
400
|
|
|
var e = ele[i];
|
|
401
|
|
|
if ( (e.name != switch_cbox.name) && (e.type == 'checkbox') ) {
|
|
402
|
|
|
e.checked = switch_cbox.checked;
|
|
403
|
|
|
}
|
|
404
|
|
|
}
|
|
405
|
|
|
}
|
|
406
|
|
|
//-------------------------------------------------
|
|
407
|
|
|
function stylTextu(formname, policko, styl) {
|
|
408
|
|
|
if(styl == "a")
|
|
409
|
|
|
{
|
|
410
|
|
|
var adresa = prompt('Zadej adresu odkazu', '');
|
|
411
|
|
|
var text = prompt('Zadej název odkazu', '');
|
|
412
|
|
|
document.forms[formname].elements[policko].value += "<"+ styl +" href=\""+ adresa +"\">"+ text +"</"+ styl +">";
|
|
413
|
|
|
}
|
|
414
|
|
|
else
|
|
415
|
|
|
{
|
|
416
|
|
|
var text = prompt('Zadej text', '');
|
|
|
|
|
|
|
417
|
|
|
document.forms[formname].elements[policko].value += "<"+ styl +">"+ text +"</"+ styl +">";
|
|
418
|
|
|
}
|
|
419
|
|
|
}
|
|
420
|
|
|
//-------------------------------------------------
|
|
421
|
|
|
function anketa_check_form(formname,moznost) {
|
|
422
|
|
|
var ele = formname.moznost;
|
|
423
|
|
|
var chyba = "Nevybrali jste žádnou možnost!";
|
|
424
|
|
|
for (var i = 0; i < ele.length; i++) {
|
|
425
|
|
|
var e = ele[i];
|
|
426
|
|
|
if (e.checked == true){
|
|
427
|
|
|
var chyba = "";
|
|
|
|
|
|
|
428
|
|
|
}
|
|
429
|
|
|
}
|
|
430
|
|
|
if (chyba != ""){
|
|
431
|
|
|
alert (chyba);
|
|
432
|
|
|
return false;
|
|
433
|
|
|
}
|
|
434
|
|
|
else return true;
|
|
|
|
|
|
|
435
|
|
|
}
|
|
436
|
|
|
//-------------------------------------------------
|
|
437
|
|
|
function confirmation(adresa, hlaska)
|
|
438
|
|
|
{
|
|
439
|
|
|
var potvrdit = confirm (hlaska);
|
|
440
|
|
|
if (potvrdit)
|
|
441
|
|
|
{
|
|
442
|
|
|
//self.location.href = adresa;
|
|
443
|
|
|
window.location.replace(adresa);
|
|
444
|
|
|
}
|
|
445
|
|
|
}
|
|
446
|
|
|
//-------------------------------------------------
|
|
447
|
|
|
function validate_email(field, alerttxt)
|
|
448
|
|
|
{
|
|
449
|
|
|
with (field){
|
|
|
|
|
|
|
450
|
|
|
apos=value.indexOf("@");
|
|
451
|
|
|
dotpos=value.lastIndexOf(".");
|
|
452
|
|
|
if (apos<1||dotpos-apos<2){
|
|
453
|
|
|
alert(alerttxt);
|
|
454
|
|
|
return false;
|
|
455
|
|
|
}
|
|
456
|
|
|
else {return true;}
|
|
457
|
|
|
}
|
|
458
|
|
|
}
|
|
459
|
|
|
//-------------------------------------------------
|
|
460
|
|
|
function validate_empty(field, alerttxt)
|
|
461
|
|
|
{
|
|
462
|
|
|
with (field){
|
|
|
|
|
|
|
463
|
|
|
if (value == ""){
|
|
464
|
|
|
alert(alerttxt);
|
|
465
|
|
|
return false;
|
|
466
|
|
|
}
|
|
467
|
|
|
else {return true;}
|
|
468
|
|
|
}
|
|
469
|
|
|
}
|
|
470
|
|
|
//-------------------------------------------------
|
|
471
|
|
|
function UkazHide(div,stav)
|
|
472
|
|
|
{
|
|
473
|
|
|
var d = getE(div);
|
|
474
|
|
|
var _stav = stav;
|
|
475
|
|
|
|
|
476
|
|
|
if (d == null) return;
|
|
|
|
|
|
|
477
|
|
|
|
|
478
|
|
|
if (stav == 3)
|
|
479
|
|
|
{
|
|
480
|
|
|
if (d.style.display == "") _stav = 0;
|
|
|
|
|
|
|
481
|
|
|
else _stav = 1;
|
|
482
|
|
|
}
|
|
483
|
|
|
|
|
484
|
|
|
if (_stav == 0)
|
|
485
|
|
|
{
|
|
486
|
|
|
d.style.visibility = "hidden";
|
|
487
|
|
|
d.style.display = "none";
|
|
488
|
|
|
}
|
|
489
|
|
|
else
|
|
490
|
|
|
{
|
|
491
|
|
|
d.style.visibility = "visible";
|
|
492
|
|
|
d.style.display = "";
|
|
493
|
|
|
}
|
|
494
|
|
|
}
|
|
495
|
|
|
//-------------------------------------------------
|
|
496
|
|
|
function ZmenSelect(ele,value)
|
|
497
|
|
|
{
|
|
498
|
|
|
var d = getE(ele);
|
|
499
|
|
|
var v = value;
|
|
500
|
|
|
d.selectedIndex = v;
|
|
501
|
|
|
}
|
|
502
|
|
|
/*
|
|
503
|
|
|
function checkAllCheckboxes(field)
|
|
504
|
|
|
{
|
|
505
|
|
|
for (i = 0; i < field.length; i++)
|
|
506
|
|
|
field[i].checked = true ;
|
|
507
|
|
|
}
|
|
508
|
|
|
|
|
509
|
|
|
function uncheckAllCheckboxes(field)
|
|
510
|
|
|
{
|
|
511
|
|
|
for (i = 0; i < field.length; i++)
|
|
512
|
|
|
field[i].checked = false ;
|
|
513
|
|
|
}
|
|
514
|
|
|
|
|
515
|
|
|
function checkAll(theForm)
|
|
516
|
|
|
{
|
|
517
|
|
|
for (i=0;i<theForm.elements.length;i++)
|
|
518
|
|
|
if (theForm.elements[i].name.indexOf('checker') !=-1)
|
|
519
|
|
|
theForm.elements[i].checked = true;
|
|
520
|
|
|
}
|
|
521
|
|
|
|
|
522
|
|
|
function uncheckAll(theForm)
|
|
523
|
|
|
{
|
|
524
|
|
|
for (i=0;i<theForm.elements.length;i++)
|
|
525
|
|
|
if (theForm.elements[i].name.indexOf('checker') !=-1)
|
|
526
|
|
|
theForm.elements[i].checked = false;
|
|
527
|
|
|
}*/
|
|
528
|
|
|
|
|
529
|
|
|
function select(boolean) {
|
|
530
|
|
|
var theForm = document.checkerForm;
|
|
531
|
|
|
for (i=0; i<theForm.elements.length; i++) {
|
|
|
|
|
|
|
532
|
|
|
if (theForm.elements[i].name=='checker[]')
|
|
533
|
|
|
theForm.elements[i].checked = boolean;
|
|
|
|
|
|
|
534
|
|
|
}
|
|
535
|
|
|
} |