Subversion Repositories DevTools

Rev

Rev 13 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 13 Rev 29
Line 1... Line 1...
1
/*
1
/*
2
 *
2
 *
3
 *			Common Java Scripts
3
 *			Common Java Scripts
4
 *
4
 *
5
 */
5
 */
6
<!--
-
 
7
 
6
 
-
 
7
<!--
-
 
8
var clickedButton = false;
8
function MM_jumpMenu(targ,selObj,restore){ //v3.1
9
function check() {
9
  if (selObj.options[selObj.selectedIndex].value) {
10
	if (clickedButton) {
10
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
11
    	clickedButton = false;
-
 
12
        return true;
-
 
13
    } else {
11
	  if (restore) selObj.selectedIndex=0;
14
    	return false;
12
  }
15
	}
13
}
16
}
14
 
17
 
15
function MM_preloadImages() { //v3.0
18
function MM_preloadImages() { //v3.0
16
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
19
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
17
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
20
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
Line 24... Line 27...
24
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
27
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
25
}
28
}
26
MM_reloadPage(true);
29
MM_reloadPage(true);
27
 
30
 
28
 
31
 
-
 
32
function MM_swapImgRestore() { //v3.0
-
 
33
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
-
 
34
}
-
 
35
 
29
function MM_findObj(n, d) { //v4.0
36
function MM_findObj(n, d) { //v4.0
30
  var p,i,x;  
37
  var p,i,x;  
31
  if(!d) d=document; 
38
  if(!d) d=document; 
32
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
39
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
33
  	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
40
  	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
Line 37... Line 44...
37
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
44
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
38
  if(!x && document.getElementById) x=document.getElementById(n); 
45
  if(!x && document.getElementById) x=document.getElementById(n); 
39
  return x;
46
  return x;
40
}
47
}
41
 
48
 
-
 
49
function MM_swapImage() { //v3.0
-
 
50
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
-
 
51
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
-
 
52
}
42
 
53
 
43
function MM_openBrWindow(theURL,winName,features) { //v2.0
54
function MM_openBrWindow(theURL,winName,features) { //v2.0
44
  window.open(theURL,winName,features);
55
  window.open(theURL,winName,features);
45
}
56
}
46
 
57
 
-
 
58
function MM_jumpMenu(targ,selObj,restore){ //v3.1
-
 
59
  if (selObj.options[selObj.selectedIndex].value) {
-
 
60
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
-
 
61
	  if (restore) selObj.selectedIndex=0;
-
 
62
  }
-
 
63
}
-
 
64
 
-
 
65
function Cascaded_Menu(targ,url,selObj,restore){ //v3.1
-
 
66
  if (selObj.options[selObj.selectedIndex].value) {
-
 
67
	  eval(targ+".location='"+url+selObj.options[selObj.selectedIndex].value+"'");
-
 
68
	  if (restore) selObj.selectedIndex=0;
-
 
69
  }
-
 
70
}
-
 
71
 
-
 
72
function MM_validateForm() { //v5.0
-
 
73
	var i,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
-
 
74
	var myRE,REresults,HTMLchr;
-
 
75
	var pass,passc;
-
 
76
	//character range allowed
-
 
77
	myRE = /[^A-Za-z0-9\.\!\$\_\-\(\)]+/i;
-
 
78
	HTMLchr = /[\<\>\'\"]+/i;
-
 
79
	
-
 
80
					
-
 
81
	for (i=0; i<(args.length-2); i+=3) { 
-
 
82
		test=args[i+2]; 
-
 
83
		val=MM_findObj(args[i]);
-
 
84
		
-
 
85
		if (val) { 
-
 
86
			nm=args[i+1];
-
 
87
			val=val.value;
-
 
88
			
-
 
89
			
-
 
90
			
-
 
91
			if (val!="") {
-
 
92
				if (test.indexOf('isEmail')!=-1) { 
-
 
93
					p=val.indexOf('@');
-
 
94
					if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
-
 
95
				} 
-
 
96
				
-
 
97
				if (test.indexOf('isDate') != -1) {
-
 
98
					if (val.indexOf("/") != -1) { 
-
 
99
						tmpARR = val.split("/");
-
 
100
						if (tmpARR.length == 3) {
-
 
101
							if (!(tmpARR[0]>0  && tmpARR[0]<32  && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
-
 
102
								errors += '- '+name+' must be in DD/MM/YYYY format.\n';
-
 
103
							}
-
 
104
						} else {
-
 
105
							errors += '- '+name+' must be in DD/MM/YYYY format.\n';
-
 
106
						}
-
 
107
					} else {
-
 
108
						errors += '- '+name+' must be in DD/MM/YYYY format.\n';
-
 
109
					}
-
 
110
				}
-
 
111
				
-
 
112
				if (test.indexOf('isPackage')!=-1) {
-
 
113
					REresults = val.match(myRE);
-
 
114
					if (REresults) errors += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . ! $ - _\n'; 
-
 
115
				}
-
 
116
				
-
 
117
				if (test.indexOf('isChangePassword')!=-1) {
-
 
118
					pass=MM_findObj('FRpassword');
-
 
119
					passc=MM_findObj('FRpasswordc');
-
 
120
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
-
 
121
				}
-
 
122
				
-
 
123
				if (test.indexOf('maxLength')!=-1) {
-
 
124
					p=test.indexOf(':');
-
 
125
					max=test.substring(p+1);
-
 
126
					if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
-
 
127
				}
-
 
128
				
-
 
129
				if (test.indexOf('notHTML')!=-1) {
-
 
130
					if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
-
 
131
				}
-
 
132
				
-
 
133
				if (test.charAt(0)=='R') {
-
 
134
					
-
 
135
					if (test.indexOf('isNumber') != -1) { 
-
 
136
						if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
-
 
137
					}
-
 
138
					
-
 
139
					if (test.indexOf('inRange') != -1) { 
-
 
140
						p=test.indexOf(':');
-
 
141
						min=test.substring(8,p); 
-
 
142
						max=test.substring(p+1);
-
 
143
						if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
-
 
144
					} 
-
 
145
					
-
 
146
					if (test.indexOf('inLength')!=-1) {
-
 
147
					    pl=test.indexOf('inLength')
-
 
148
						p=test.indexOf(':');
-
 
149
		          		min=test.substring(pl+8,p); 
-
 
150
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
-
 
151
			    	}	
-
 
152
				} 
-
 
153
			} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';    
-
 
154
			
-
 
155
				
-
 
156
			if (test.indexOf('isPassword')!=-1) {
-
 
157
				pass=MM_findObj('FRpassword');
-
 
158
				passc=MM_findObj('FRpasswordc');
-
 
159
				if (!MM_findObj('FRdomainauth').checked) {
-
 
160
					if (test.indexOf('inLength')!=-1) {
-
 
161
					    pl=test.indexOf('inLength')
-
 
162
						p=test.indexOf(':');
-
 
163
		          		min=test.substring(pl+8,p); 
-
 
164
		          		if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
-
 
165
			    	}	
-
 
166
					if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
-
 
167
				} else {
-
 
168
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';   
-
 
169
				}
-
 
170
			} 
-
 
171
			
-
 
172
			if (test.indexOf('isDomainName')!=-1) {
-
 
173
				if (MM_findObj('FRdomainauth').checked) {
-
 
174
					if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';  
-
 
175
				}
-
 
176
			}
-
 
177
			
-
 
178
		}
-
 
179
	} 
-
 
180
	
-
 
181
	if (errors) {
-
 
182
		alert('The following error(s) occurred:\n\n'+errors);
-
 
183
		clickedButton=false;
-
 
184
	} else {
-
 
185
		clickedButton=true;
-
 
186
	}
-
 
187
	document.MM_returnValue = (errors == '');
-
 
188
	
-
 
189
	if (MM_findObj('ProgressBar') && document.MM_returnValue) MM_findObj('ProgressBar').style.visibility='visible';
-
 
190
}
-
 
191
 
-
 
192
function confirmDelete(m)
-
 
193
{
-
 
194
	var agree=confirm('Are you sure you want to delete '+m+'?');
-
 
195
	if (agree) {
-
 
196
		if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
-
 
197
		return true;
-
 
198
	} else {
-
 
199
		return false;
-
 
200
	}	
-
 
201
}
-
 
202
 
-
 
203
function confirmAction(m)
-
 
204
{
-
 
205
	var agree=confirm(m);
-
 
206
	if (agree) {
-
 
207
		ShowProgress();
-
 
208
		return true;
-
 
209
	} else {
-
 
210
		return false;
-
 
211
	}	
-
 
212
}
-
 
213
 
-
 
214
function ShowProgress ()
-
 
215
{
-
 
216
	if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
-
 
217
	if (MM_findObj('divProgressBar')) MM_findObj('divProgressBar').style.visibility='visible';
-
 
218
}
-
 
219
 
-
 
220
function DisplaySPAN(show) {
-
 
221
	if (show) {
-
 
222
		MM_findObj("spanHideDetails").style.display = "block";
-
 
223
		MM_findObj("spanPkgInfo").style.display = "block";
-
 
224
		MM_findObj("spanShowDetails").style.display = "none";
-
 
225
	} else {
-
 
226
		MM_findObj("spanHideDetails").style.display = "none";
-
 
227
		MM_findObj("spanPkgInfo").style.display = "none";
-
 
228
		MM_findObj("spanShowDetails").style.display = "block";
-
 
229
	}
-
 
230
}
47
 
231
 
48
function ToggleDisplay () {
232
function ToggleDisplay () {
49
	var i, args, div_name, visibility
233
	var i, args, div_name, visibility
50
	args=ToggleDisplay.arguments;
234
	args=ToggleDisplay.arguments;
51
	for (i=0; i<(args.length); i+=1) {
235
	for (i=0; i<(args.length); i+=1) {
Line 57... Line 241...
57
		}
241
		}
58
		
242
		
59
	}
243
	}
60
}
244
}
61
 
245
 
-
 
246
function Visible () {
-
 
247
	var i, args, div_name, visibility
-
 
248
	args=Visible.arguments;
-
 
249
	for (i=0; i<(args.length); i+=2) {
-
 
250
		div_name=args[i];
-
 
251
		visibility=args[i+1]
-
 
252
		MM_findObj(div_name).style.display = visibility;
-
 
253
		
-
 
254
	}
-
 
255
}
-
 
256
 
62
function DisplayArea() {
257
function DisplayArea() {
63
	var i, args, row_name, visibility, persist;
258
	var i, args, row_name, visibility, persist;
64
	
259
	
65
	args=DisplayArea.arguments;
260
	args=DisplayArea.arguments;
66
	for (i=0; i<(args.length); i+=3) { 
261
	for (i=0; i<(args.length); i+=3) { 
Line 70... Line 265...
70
		MM_findObj(row_name).style.display = visibility;
265
		MM_findObj(row_name).style.display = visibility;
71
		if (persist) {
266
		if (persist) {
72
			document.cookie = "DM_"+ row_name +"="+ visibility +";";
267
			document.cookie = "DM_"+ row_name +"="+ visibility +";";
73
		}
268
		}
74
	}
269
	}
75
	
-
 
76
}
270
}
77
 
271
 
78
function confirmAction(m)
272
function DisplayObjects () {
79
{
-
 
80
	var agree=confirm(m);
273
	var i, args, div_name
81
	if (agree) {
274
	args=DisplayObjects.arguments;
82
		ShowProgress();
275
	for (i=0; i<(args.length); i+=1) {
83
		return true;
276
		div_name=args[i];
84
	} else {
-
 
85
		return false;
277
		MM_findObj(div_name).style.display = 'block';
86
	}	
278
	}
87
}
279
}
88
 
280
 
89
 
-
 
90
function go_submit( formname, actionname )
281
function go_submit( formname, actionname )
91
{
282
{
92
	formname.action.value = actionname;
283
	formname.action.value = actionname;
93
	formname.submit();
284
	formname.submit();
94
}
285
}
95
 
286
 
96
function ShowProgress ()
-
 
97
{
-
 
98
	MM_findObj('divProgressBar').style.visibility='visible';
-
 
99
}
-
 
100
 
-
 
101
function ExpandAll()
287
function ExpandAll()
102
{
288
{
103
	var elem
289
	var elem
104
		
290
		
105
	if (document.all)
291
	if (document.all)
Line 144... Line 330...
144
		}
330
		}
145
	}
331
	}
146
 
332
 
147
}
333
}
148
 
334
 
149
/*
-
 
150
function getPaneStatus() {
335
function getWindowHeight()
-
 
336
{
151
	var i, args
337
	var h;
-
 
338
	if( typeof( window.innerHeight ) == 'number' ) 
-
 
339
	{
152
	args=getPaneStatus.arguments;
340
		h = window.innerHeight;
-
 
341
	}
-
 
342
	else if(document.documentElement&&(document.documentElement.clientHeight ))
-
 
343
	{
153
	for (i=0; i<(args.length); i+=1) {
344
		h = document.documentElement.clientHeight;
-
 
345
	} 
154
		MM_findObj(args[i]).style.display = GetCookie("DM_"+ args[i]);
346
	else if( document.body &&	document.body.clientHeight )
-
 
347
	{
-
 
348
		h = document.body.clientHeight;
155
	}
349
	}
-
 
350
	
-
 
351
	return h;
156
}
352
}
157
 
353
 
-
 
354
function getWindowWidth()
158
 
355
{
-
 
356
	var w;
159
function GetCookieVal (offset) {  
357
	if( typeof( window.innerWidth ) == 'number' ) 
-
 
358
	{
-
 
359
		w = window.innerWidth;
-
 
360
	}
-
 
361
	else if(document.documentElement&&(document.documentElement.clientWidth ))
-
 
362
	{
160
	var endstr = document.cookie.indexOf (";", offset);  
363
		w = document.documentElement.clientWidth;
-
 
364
	} 
161
	if (endstr == -1) { endstr = document.cookie.length; }
365
	else if( document.body &&	document.body.clientWidth )
-
 
366
	{
162
	return unescape(document.cookie.substring(offset, endstr));
367
		w = document.body.clientWidth;
-
 
368
	}
-
 
369
	
-
 
370
	return w;
163
}
371
}
164
 
372
 
165
 
373
/*
166
function GetCookie (name) {  
374
function GetCookie (name) {  
167
	var arg = name + "=";  
375
	var arg = name + "=";  
168
	var alen = arg.length;  
376
	var alen = arg.length;  
169
	var clen = document.cookie.length;  
377
	var clen = document.cookie.length;  
170
	var i = 0;  
378
	var i = 0;  
Line 176... Line 384...
176
		if (i == 0) break;   
384
		if (i == 0) break;   
177
	}  
385
	}  
178
 
386
 
179
	return null;
387
	return null;
180
}
388
}
-
 
389
 
-
 
390
 
-
 
391
function getPaneStatus() {
-
 
392
	var i, args
-
 
393
	args=getPaneStatus.arguments;
-
 
394
	for (i=0; i<(args.length); i+=1) {
-
 
395
		MM_findObj(args[i]).style.display = GetCookie("DM_"+ args[i]);
-
 
396
	}
-
 
397
}
-
 
398
 
-
 
399
 
-
 
400
function GetCookieVal (offset) {  
-
 
401
	var endstr = document.cookie.indexOf (";", offset);  
-
 
402
	if (endstr == -1) { endstr = document.cookie.length; }
-
 
403
	return unescape(document.cookie.substring(offset, endstr));
-
 
404
}
-
 
405
*/
-
 
406
 
-
 
407
 
-
 
408
/*
-
 
409
//use browser sniffing to determine if IE or Opera (ugly, but required)
-
 
410
var isOpera, isIE = false;
-
 
411
if(typeof(window.opera) != 'undefined'){isOpera = true;}
-
 
412
if(!isOpera && navigator.userAgent.indexOf('Internet Explorer')){isIE = true;}
-
 
413
 
-
 
414
//fix both IE and Opera (adjust when they implement this method properly)
-
 
415
if(isOpera || isIE)
-
 
416
{
-
 
417
	document.nativeGetElementById = document.getElementById;
-
 
418
	//redefine it!
-
 
419
	document.getElementById = function(id)
-
 
420
	{
-
 
421
		var elem = document.nativeGetElementById(id);
-
 
422
		if(elem)
-
 
423
		{
-
 
424
			//verify it is a valid match!
-
 
425
			if(elem.attributes['id'] && elem.attributes['id'].value == id)
-
 
426
			{
-
 
427
				//valid match!
-
 
428
				return elem;
-
 
429
			}
-
 
430
			else 
-
 
431
			{
-
 
432
				//not a valid match!
-
 
433
				//the non-standard, document.all array has keys for all name'd, and id'd elements
-
 
434
				//start at one, because we know the first match, is wrong!
-
 
435
				for(var i=1;i<document.all[id].length;i++)
-
 
436
				{
-
 
437
					if(document.all[id][i].attributes['id'] && document.all[id][i].attributes['id'].value == id)
-
 
438
					{
-
 
439
						return document.all[id][i];
-
 
440
					}
-
 
441
				}
-
 
442
			}
-
 
443
		}
-
 
444
		return null;
-
 
445
	};
-
 
446
}
181
*/
447
*/
-
 
448
 
182
//-->
449
//-->
183
450