| 64 |
jtweddle |
1 |
/*
|
|
|
2 |
* COMMON JAVASCRIPTS
|
|
|
3 |
*/
|
|
|
4 |
|
|
|
5 |
<!--
|
|
|
6 |
var clickedButton = false;
|
|
|
7 |
function check() {
|
|
|
8 |
if (clickedButton) {
|
|
|
9 |
clickedButton = false;
|
|
|
10 |
return true;
|
|
|
11 |
} else {
|
|
|
12 |
return false;
|
|
|
13 |
}
|
|
|
14 |
}
|
|
|
15 |
|
|
|
16 |
function MM_reloadPage(init) { //reloads the window if Nav4 resized
|
|
|
17 |
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
|
|
|
18 |
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
|
|
|
19 |
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
|
|
|
20 |
}
|
|
|
21 |
MM_reloadPage(true);
|
|
|
22 |
|
|
|
23 |
function MM_preloadImages() { //v3.0
|
|
|
24 |
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
|
|
|
25 |
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
|
|
|
26 |
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
function MM_swapImgRestore() { //v3.0
|
|
|
30 |
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
function MM_findObj(n, d) { //v4.0
|
|
|
34 |
var p,i,x;
|
|
|
35 |
if(!d) d=document;
|
|
|
36 |
if((p=n.indexOf("?"))>0&&parent.frames.length) {
|
|
|
37 |
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
|
|
|
38 |
}
|
|
|
39 |
if(!(x=d[n])&&d.all) x=d.all[n];
|
|
|
40 |
for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
|
|
|
41 |
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
|
|
|
42 |
if(!x && document.getElementById) x=document.getElementById(n);
|
|
|
43 |
return x;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
function MM_swapImage() { //v3.0
|
|
|
47 |
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
|
|
|
48 |
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
function MM_openBrWindow(theURL,winName,features) { //v2.0
|
|
|
52 |
window.open(theURL,winName,features);
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
function MM_jumpMenu(targ,selObj,restore){ //v3.1
|
|
|
56 |
if (selObj.options[selObj.selectedIndex].value) {
|
|
|
57 |
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
|
|
|
58 |
if (restore) selObj.selectedIndex=0;
|
|
|
59 |
}
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
function Cascaded_Menu(targ,url,selObj,restore){ //v3.1
|
|
|
63 |
if (selObj.options[selObj.selectedIndex].value) {
|
|
|
64 |
eval(targ+".location='"+url+selObj.options[selObj.selectedIndex].value+"'");
|
|
|
65 |
if (restore) selObj.selectedIndex=0;
|
|
|
66 |
}
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
function MM_validateForm() { //v5.0
|
|
|
70 |
var i,p,pl,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
|
|
|
71 |
var myRE,REresults,HTMLchr;
|
|
|
72 |
var pass,passc;
|
|
|
73 |
//character range allowed
|
|
|
74 |
myRE = /[^A-Za-z0-9\.\!\$\_\-\(\)]+/i;
|
|
|
75 |
HTMLchr = /[\<\>\'\"]+/i;
|
|
|
76 |
|
|
|
77 |
|
|
|
78 |
for (i=0; i<(args.length-2); i+=3) {
|
|
|
79 |
test=args[i+2];
|
|
|
80 |
val=MM_findObj(args[i]);
|
|
|
81 |
|
|
|
82 |
if (val) {
|
|
|
83 |
nm=args[i+1];
|
|
|
84 |
val=val.value;
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 |
if (val!="") {
|
|
|
89 |
if (test.indexOf('isEmail')!=-1) {
|
|
|
90 |
p=val.indexOf('@');
|
|
|
91 |
if (p<1 || p==(val.length-1) || test.charAt(0) == '@') errors+='- '+nm+' must contain an e-mail address.\n';
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
if (test.indexOf('isDate') != -1) {
|
|
|
95 |
if (val.indexOf("/") != -1) {
|
|
|
96 |
tmpARR = val.split("/");
|
|
|
97 |
if (tmpARR.length == 3) {
|
|
|
98 |
if (!(tmpARR[0]>0 && tmpARR[0]<32 && tmpARR[1]>0 && tmpARR[1]<13 && tmpARR[2]>1900 && tmpARR[2]<9999)) {
|
|
|
99 |
errors += '- '+name+' must be in DD/MM/YYYY format.\n';
|
|
|
100 |
}
|
|
|
101 |
} else {
|
|
|
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 |
}
|
|
|
108 |
|
|
|
109 |
if (test.indexOf('isPackage')!=-1) {
|
|
|
110 |
REresults = val.match(myRE);
|
|
|
111 |
if (REresults) errors += '- '+nm+' uses invalid character. Allowed characters are A-Z a-z 0-9 . ! $ - _\n';
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
if (test.indexOf('isChangePassword')!=-1) {
|
|
|
115 |
pass=MM_findObj('FRpassword');
|
|
|
116 |
passc=MM_findObj('FRpasswordc');
|
|
|
117 |
if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
if (test.indexOf('maxLength')!=-1) {
|
|
|
121 |
p=test.indexOf(':');
|
|
|
122 |
max=test.substring(p+1);
|
|
|
123 |
if (val.length>max) errors+='- '+nm+' can be maximum '+max+' characters long.\n';
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
if (test.indexOf('notHTML')!=-1) {
|
|
|
127 |
if (val.match(HTMLchr)) errors+='- '+nm+' has invalid characters like \'< > quotes\'\n';
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
if (test.charAt(0)=='R') {
|
|
|
131 |
|
|
|
132 |
if (test.indexOf('isNumber') != -1) {
|
|
|
133 |
if (isNaN(val)) errors+='- '+nm+' must be a number.\n';
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
if (test.indexOf('inRange') != -1) {
|
|
|
137 |
p=test.indexOf(':');
|
|
|
138 |
min=test.substring(8,p);
|
|
|
139 |
max=test.substring(p+1);
|
|
|
140 |
if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
if (test.indexOf('inLength')!=-1) {
|
|
|
144 |
pl=test.indexOf('inLength')
|
|
|
145 |
p=test.indexOf(':');
|
|
|
146 |
min=test.substring(pl+8,p);
|
|
|
147 |
if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
|
|
|
148 |
}
|
|
|
149 |
}
|
|
|
150 |
} else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n';
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
if (test.indexOf('isPassword')!=-1) {
|
|
|
154 |
pass=MM_findObj('FRpassword');
|
|
|
155 |
passc=MM_findObj('FRpasswordc');
|
|
|
156 |
if (!MM_findObj('FRdomainauth').checked) {
|
|
|
157 |
if (test.indexOf('inLength')!=-1) {
|
|
|
158 |
pl=test.indexOf('inLength')
|
|
|
159 |
p=test.indexOf(':');
|
|
|
160 |
min=test.substring(pl+8,p);
|
|
|
161 |
if (val.length<min) errors+='- '+nm+' must be at least '+min+' characters long.\n';
|
|
|
162 |
}
|
|
|
163 |
if (pass.value!=passc.value) errors+='- Password confirmation does not match.\n';
|
|
|
164 |
} else {
|
|
|
165 |
if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
|
|
|
166 |
}
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
if (test.indexOf('isDomainName')!=-1) {
|
|
|
170 |
if (MM_findObj('FRdomainauth').checked) {
|
|
|
171 |
if (MM_findObj('FRdomain_name').value=="") errors += '- Domain Name is required.\n';
|
|
|
172 |
}
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
}
|
|
|
176 |
}
|
|
|
177 |
|
|
|
178 |
if (errors) {
|
|
|
179 |
alert('The following error(s) occurred:\n\n'+errors);
|
|
|
180 |
clickedButton=false;
|
|
|
181 |
} else {
|
|
|
182 |
clickedButton=true;
|
|
|
183 |
}
|
|
|
184 |
document.MM_returnValue = (errors == '');
|
|
|
185 |
|
|
|
186 |
if (MM_findObj('ProgressBar') && document.MM_returnValue) MM_findObj('ProgressBar').style.visibility='visible';
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
function confirmDelete(m)
|
|
|
190 |
{
|
|
|
191 |
var agree=confirm('Are you sure you want to delete '+m+'?');
|
|
|
192 |
if (agree) {
|
|
|
193 |
if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
|
|
|
194 |
return true;
|
|
|
195 |
} else {
|
|
|
196 |
return false;
|
|
|
197 |
}
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
function confirmAction(m)
|
|
|
201 |
{
|
|
|
202 |
var agree=confirm(m);
|
|
|
203 |
if (agree) {
|
|
|
204 |
if (MM_findObj('ProgressBar')) MM_findObj('ProgressBar').style.visibility='visible';
|
|
|
205 |
return true;
|
|
|
206 |
} else {
|
|
|
207 |
return false;
|
|
|
208 |
}
|
|
|
209 |
}
|
|
|
210 |
|
|
|
211 |
function DisplaySPAN(show) {
|
|
|
212 |
if (show) {
|
|
|
213 |
MM_findObj("spanHideDetails").style.display = "block";
|
|
|
214 |
MM_findObj("spanPkgInfo").style.display = "block";
|
|
|
215 |
MM_findObj("spanShowDetails").style.display = "none";
|
|
|
216 |
} else {
|
|
|
217 |
MM_findObj("spanHideDetails").style.display = "none";
|
|
|
218 |
MM_findObj("spanPkgInfo").style.display = "none";
|
|
|
219 |
MM_findObj("spanShowDetails").style.display = "block";
|
|
|
220 |
}
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
function ToggleDisplay () {
|
|
|
224 |
var i, args, div_name, visibility
|
|
|
225 |
args=ToggleDisplay.arguments;
|
|
|
226 |
for (i=0; i<(args.length); i+=1) {
|
|
|
227 |
div_name=args[i];
|
|
|
228 |
if ( MM_findObj(div_name).style.display == 'block' ) {
|
|
|
229 |
MM_findObj(div_name).style.display = 'none';
|
|
|
230 |
} else {
|
|
|
231 |
MM_findObj(div_name).style.display = 'block';
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
}
|
|
|
235 |
}
|
|
|
236 |
|
|
|
237 |
function Visible () {
|
|
|
238 |
|
|
|
239 |
var i, args, div_name, visibility
|
|
|
240 |
args=Visible.arguments;
|
|
|
241 |
for (i=0; i<(args.length); i+=2) {
|
|
|
242 |
div_name=args[i];
|
|
|
243 |
visibility=args[i+1]
|
|
|
244 |
MM_findObj(div_name).style.display = visibility;
|
|
|
245 |
|
|
|
246 |
}
|
|
|
247 |
}
|
|
|
248 |
|
|
|
249 |
function DisplayObjects () {
|
|
|
250 |
var i, args, div_name
|
|
|
251 |
args=DisplayObjects.arguments;
|
|
|
252 |
for (i=0; i<(args.length); i+=1) {
|
|
|
253 |
div_name=args[i];
|
|
|
254 |
MM_findObj(div_name).style.display = 'block';
|
|
|
255 |
}
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
function GetCookieVal (offset) {
|
|
|
259 |
var endstr = document.cookie.indexOf (";", offset);
|
|
|
260 |
if (endstr == -1) { endstr = document.cookie.length; }
|
|
|
261 |
return unescape(document.cookie.substring(offset, endstr));
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
function GetCookie (name) {
|
|
|
266 |
var arg = name + "=";
|
|
|
267 |
var alen = arg.length;
|
|
|
268 |
var clen = document.cookie.length;
|
|
|
269 |
var i = 0;
|
|
|
270 |
|
|
|
271 |
while (i < clen) {
|
|
|
272 |
var j = i + alen;
|
|
|
273 |
if (document.cookie.substring(i, j) == arg) return GetCookieVal (j);
|
|
|
274 |
i = document.cookie.indexOf(" ", i) + 1;
|
|
|
275 |
if (i == 0) break;
|
|
|
276 |
}
|
|
|
277 |
|
|
|
278 |
return null;
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
function go_submit( formname, actionname )
|
|
|
282 |
{
|
|
|
283 |
formname.action.value = actionname;
|
|
|
284 |
formname.submit();
|
|
|
285 |
}
|
|
|
286 |
|
|
|
287 |
function ExpandAll()
|
|
|
288 |
{
|
|
|
289 |
var elem
|
|
|
290 |
|
|
|
291 |
if (document.all)
|
|
|
292 |
{
|
|
|
293 |
// Run this for IE
|
|
|
294 |
elem = document.all;
|
|
|
295 |
} else {
|
|
|
296 |
// Run this for other browsers
|
|
|
297 |
elem = document.getElementsByTagName('div');
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
for (i in elem)
|
|
|
301 |
{
|
|
|
302 |
if (elem[i].id)
|
|
|
303 |
{
|
|
|
304 |
if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'none';
|
|
|
305 |
if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'block';
|
|
|
306 |
}
|
|
|
307 |
}
|
|
|
308 |
|
|
|
309 |
}
|
|
|
310 |
|
|
|
311 |
function CollapseAll()
|
|
|
312 |
{
|
|
|
313 |
var elem
|
|
|
314 |
|
|
|
315 |
if (document.all)
|
|
|
316 |
{
|
|
|
317 |
// Run this for IE
|
|
|
318 |
elem = document.all;
|
|
|
319 |
} else {
|
|
|
320 |
// Run this for other browsers
|
|
|
321 |
elem = document.getElementsByTagName('div');
|
|
|
322 |
}
|
|
|
323 |
|
|
|
324 |
for (i in elem)
|
|
|
325 |
{
|
|
|
326 |
if (elem[i].id)
|
|
|
327 |
{
|
|
|
328 |
if (elem[i].id.indexOf('SHORT_') == 0) elem[i].style.display = 'block';
|
|
|
329 |
if (elem[i].id.indexOf('FULL_') == 0) elem[i].style.display = 'none';
|
|
|
330 |
}
|
|
|
331 |
}
|
|
|
332 |
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
//-->
|