PageSourceSearch

https://grosse-scheidegg.ch/include/xoops.js?ts=1783871606

js grosse-scheidegg.ch collected 2026-10-02 13:33:56 UTC 42,003 bytes, 1,663 lines download raw bytes

1
2
3/**
4 *
5 *  Base64 encode / decode
6 *  http://www.webtoolkit.info/
7 *
8 **/
9
10
11
12var Base64 = {
13
14	// private property
15	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
16
17	// public method for encoding
18	encode : function (input) {
19		var output = "";
20		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
21		var i = 0;
22
23		input = Base64._utf8_encode(input);
24
25		while (i < input.length) {
26
27			chr1 = input.charCodeAt(i++);
28			chr2 = input.charCodeAt(i++);
29			chr3 = input.charCodeAt(i++);
30
31			enc1 = chr1 >> 2;
32			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
33			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
34			enc4 = chr3 & 63;
35
36			if (isNaN(chr2)) {
37				enc3 = enc4 = 64;
38			} else if (isNaN(chr3)) {
39				enc4 = 64;
40			}
41
42			output = output +
43				this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
44				this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
45
46		}
47
48		return output;
49	},
50
51	// public method for decoding
52	decode : function (input) {
53		var output = "";
54		var chr1, chr2, chr3;
55		var enc1, enc2, enc3, enc4;
56		var i = 0;
57
58		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
59
60		while (i < input.length) {
61
62			enc1 = this._keyStr.indexOf(input.charAt(i++));
63			enc2 = this._keyStr.indexOf(input.charAt(i++));
64			enc3 = this._keyStr.indexOf(input.charAt(i++));
65			enc4 = this._keyStr.indexOf(input.charAt(i++));
66
67			chr1 = (enc1 << 2) | (enc2 >> 4);
68			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
69			chr3 = ((enc3 & 3) << 6) | enc4;
70
71			output = output + String.fromCharCode(chr1);
72
73			if (enc3 != 64) {
74				output = output + String.fromCharCode(chr2);
75			}
76			if (enc4 != 64) {
77				output = output + String.fromCharCode(chr3);
78			}
79
80		}
81
82		output = Base64._utf8_decode(output);
83
84		return output;
85
86	},
87
88	// private method for UTF-8 encoding
89	_utf8_encode : function (string) {
90		string = string.replace(/\r\n/g,"\n");
91		var utftext = "";
92
93		for (var n = 0; n < string.length; n++) {
94
95			var c = string.charCodeAt(n);
96
97			if (c < 128) {
98				utftext += String.fromCharCode(c);
99			}
100			else if((c > 127) && (c < 2048)) {
101				utftext += String.fromCharCode((c >> 6) | 192);
102				utftext += String.fromCharCode((c & 63) | 128);
103			}
104			else {
105				utftext += String.fromCharCode((c >> 12) | 224);
106				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
107				utftext += String.fromCharCode((c & 63) | 128);
108			}
109
110		}
111
112		return utftext;
113	},
114
115	// private method for UTF-8 decoding
116	_utf8_decode : function (utftext) {
117		var string = "";
118		var i = 0;
119		var c = c1 = c2 = 0;
120
121		while ( i < utftext.length ) {
122
123			c = utftext.charCodeAt(i);
124
125			if (c < 128) {
126				string += String.fromCharCode(c);
127				i++;
128			}
129			else if((c > 191) && (c < 224)) {
130				c2 = utftext.charCodeAt(i+1);
131				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
132				i += 2;
133			}
134			else {
135				c2 = utftext.charCodeAt(i+1);
136				c3 = utftext.charCodeAt(i+2);
137				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
138				i += 3;
139			}
140
141		}
142
143		return string;
144	}
145}
146
147//End Base64
148
149
150
151// Start Ajax functions
152window.urlData=Array();
153
154
155var xmlHttp = createXMLHttpRequest();
156
157function createXMLHttpRequest() {
158	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
159	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
160	try { return new XMLHttpRequest(); } catch(e) {}
161	alert("XMLHttpRequest not supported");
162	return null;
163}
164
165var onLoadContentOverlibFunction=function(){
166	if (xmlHttp.readyState == 4) {  changeOverlibContent(xmlHttp.responseText); }
167};
168
169
170
171
172
173function loadOverlibContent(url, f){
174
175	// Open a connection to the server
176	xmlHttp.open("GET", url, true);
177
178	if (!f) {
179		f=onLoadContentOverlibFunction;
180	}
181	// Setup a function for the server to run when it's done
182	xmlHttp.onreadystatechange = f;
183
184	// Send the request
185	xmlHttp.send(null);
186}
187
188
189function handleAJAXCallStateChange(){
190	if (xmlHttp.readyState == 4) {  
191		alert("I am a dummy function [handleAJAXCallStateChange].\nYou must override me.\n\nBy the way the ready state is " + xmlHttp.readyState); 
192	}
193}
194
195function doAJAXPostCall(url, params, f){
196	//You have to either pass your function or override the handleAJAXCallStateChange
197
198	// Open a connection to the server
199	xmlHttp.open("POST", url, true);
200
201	if (!f) {
202		f=handleAJAXCallStateChange;
203	}
204	// Setup a function for the server to run when it's done
205	xmlHttp.onreadystatechange = f;
206	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
207
208	xmlHttp.send(params);
209}
210
211function doAJAXGetCall(url, f){
212	//You have to either pass your function or override the handleAJAXCallStateChange
213
214	// Open a connection to the server
215	xmlHttp.open("GET", url, true);
216
217	if (!f) {
218		f=handleAJAXCallStateChange;
219	}
220	// Setup a function for the server to run when it's done
221	xmlHttp.onreadystatechange = f;
222
223	xmlHttp.send(null);
224}
225
226
227
228function changeOverlibContent(str){
229	showOverlib(str);
230	return false;
231
232
233}
234
235
236function showOverlib(data,caption){
237
238	if (!caption) {
239		if (window.overlibCaption){
240			caption=window.overlibCaption;
241		} else {
242			caption="&nbsp;";
243		}
244	}
245	if (!window.overLibX) {
246		window.overLibX=cursor.x;
247	}
248	if (!window.overLibY) {
249		window.overLibY=cursor.y;
250	}
251
252
253	return overlib(data, 
254			CAPTION, caption,
255			FIXX, window.overLibX,
256			FIXY, window.overLibY,
257
258
259			STICKY, 
260			FGCOLOR , '#bce0ec', 
261			BGCOLOR, '#153A46', 
262			CAPCOLOR  , '#ffffff',
263			CLOSETEXT, '<img src=/images/close.gif border=0>',
264			CLOSECLICK);
265}
266
267// -- end ajax functions
268
269
270
271
272function xoopsGetElementById(id){
273	if (document.getElementById) {
274		return (document.getElementById(id));
275	} else if (document.all) {
276		return (document.all[id]);
277	} else {
278		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
279			return (document.layers[id]);
280		}
281	}
282}
283
284function xoopsSetElementProp(name, prop, val) {
285	var elt=xoopsGetElementById(name);
286	if (elt) elt[prop]=val;
287}
288
289function xoopsSetElementStyle(name, prop, val) {
290	var elt=xoopsGetElementById(name);
291	if (elt && elt.style) elt.style[prop]=val;
292}
293
294
295function getFormDataAsQueryString(fname){
296	var frm=document.forms[fname];
297	var text="";
298
299	var els = frm.elements; 
300
301	for(i=0; i<els.length; i++){ 
302		_value=null;
303
304		switch(els[i].type){
305			case "select-one" :
306				_value=els[i].options[els[i].selectedIndex].value;
307
308				break;
309
310			case "text":
311				_value=els[i].value;
312				break;
313
314			case "hidden":
315				_value=els[i].value;
316				break;
317
318			case "password":
319				_value=els[i].value;
320				break;
321		}
322		if (_value) {
323			text+=els[i].name+"="+_value+"&"
324		}
325	}
326	return text;
327
328}
329function xoopsGetFormElement(fname, ctlname) {
330	var frm=document.forms[fname];
331	return frm?frm.elements[ctlname]:null;
332}
333
334function justReturn() {
335	return;
336}
337
338function open_xoops_fields_window(url){
339	params="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
340	return openWithSelfMain(url, "fieldsManagement", 800, 600, params);
341}
342
343
344function openWithSelfMain(url,name,width,height,params) {
345	if (!params) {
346		params="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
347	}
348	var options = "width=" + width + ",height=" + height + "," + params;
349
350	new_window = window.open(url, name, options);
351	window.self.name = "main";
352	new_window.focus();
353}
354
355function setElementBackgroundColor(id, color){
356	xoopsGetElementById(id).style.backgroundColor = "#" + color;
357}
358
359function setElementColor(id, color){
360	xoopsGetElementById(id).style.color = "#" + color;
361}
362
363function setElementFont(id, font){
364	xoopsGetElementById(id).style.fontFamily = font;
365}
366
367function setElementSize(id, size){
368	xoopsGetElementById(id).style.fontSize = size;
369}
370
371function changeDisplay(id){
372	var elestyle = xoopsGetElementById(id).style;
373	if (elestyle.display == "") {
374		elestyle.display = "none";
375	} else {
376		elestyle.display = "block";
377	}
378}
379
380function setVisible(id){
381	xoopsGetElementById(id).style.visibility = "visible";
382}
383
384function setHidden(id){
385	xoopsGetElementById(id).style.visibility = "hidden";
386}
387
388function toggleVisibility(id){
389	if (xoopsGetElementById(id).style.visibility == "hidden"){
390		setVisible(id);
391	} else {
392		setHidden(id);
393	}
394
395}
396
397function setLayerDisplay(id, display){
398	if (!display) {
399		display="inline";
400	}
401	thisLayer=document.getElementById(id);
402	thisLayer.style.display=display
403}
404
405function showHide(id){
406	thisLayer=document.getElementById(id);
407
408	if (thisLayer.style.display=="block") {
409		thisLayer.style.display="none"
410	} else {
411		thisLayer.style.display="block"
412	}
413}
414
415function showHideInline(id){
416	thisLayer=document.getElementById(id);
417
418	if (thisLayer.style.display=="inline") {
419		thisLayer.style.display="none"
420	} else {
421		thisLayer.style.display="inline"
422	}
423}
424
425function resizeTextBox(e, d, n){
426	element=document.getElementById(e);
427	
428	
429
430	if (d=="height"){
431		currHeight=parseInt(element.style.height);
432		newHeight=currHeight+n;
433		if (newHeight>0) {
434			element.style.height=newHeight+"px";
435		}
436	}
437
438	if (d == "width"){
439		currWidth=parseInt(element.style.width);
440		newWidth=currWidth+n;
441		if (newWidth>0) {
442			element.style.width=newWidth+"px";
443		}
444	}
445
446}
447
448
449function resizeSelectBox(e, n, d){
450	element = document.getElementById(e);
451	if (!d) {
452		d="height";
453	}
454	if (d=="height"){
455		currHeight=parseInt(element.style.height);
456		newHeight=currHeight+n;
457		if (newHeight>0) {
458			element.style.height=newHeight+"px";
459		}
460	}
461
462	if (d=="width"){
463		currWidth = parseInt(element.style.width);
464		newWidth = currWidth + n;
465		if (!newWidth){
466			newWidth = "200";
467		}
468		
469		if (newWidth>0) {
470			element.style.width=newWidth+"px";
471		}
472	}
473
474}
475
476
477function makeBold(id){
478	var eleStyle = xoopsGetElementById(id).style;
479	if (eleStyle.fontWeight != "bold" && eleStyle.fontWeight != "700") {
480		eleStyle.fontWeight = "bold";
481	} else {
482		eleStyle.fontWeight = "normal";
483	}
484}
485
486function makeItalic(id){
487	var eleStyle = xoopsGetElementById(id).style;
488	if (eleStyle.fontStyle != "italic") {
489		eleStyle.fontStyle = "italic";
490	} else {
491		eleStyle.fontStyle = "normal";
492	}
493}
494
495function makeUnderline(id){
496	var eleStyle = xoopsGetElementById(id).style;
497	if (eleStyle.textDecoration != "underline") {
498		eleStyle.textDecoration = "underline";
499	} else {
500		eleStyle.textDecoration = "none";
501	}
502}
503
504function makeLineThrough(id){
505	var eleStyle = xoopsGetElementById(id).style;
506	if (eleStyle.textDecoration != "line-through") {
507		eleStyle.textDecoration = "line-through";
508	} else {
509		eleStyle.textDecoration = "none";
510	}
511}
512
513function appendSelectOption(selectMenuId, optionName, optionValue){
514	var selectMenu = xoopsGetElementById(selectMenuId);
515	var newoption = new Option(optionName, optionValue);
516	selectMenu.options[selectMenu.length] = newoption;
517	selectMenu.options[selectMenu.length].selected = true;
518}
519
520function disableElement(target){
521	var targetDom = xoopsGetElementById(target);
522	if (targetDom.disabled != true) {
523		targetDom.disabled = true;
524	} else {
525		targetDom.disabled = false;
526	}
527}
528function xoopsCheckAll(formname, switchid) {
529	var ele = document.forms[formname].elements;
530	var switch_cbox = xoopsGetElementById(switchid);
531	for (var i = 0; i < ele.length; i++) {
532		var e = ele[i];
533		if ( (e.name != switch_cbox.name) && (e.type == 'checkbox') ) {
534			e.checked = switch_cbox.checked;
535		}
536	}
537}
538
539function xoopsCheckGroup(formname, switchid, groupid) {
540	var ele = document.forms[formname].elements;
541	var switch_cbox = xoopsGetElementById(switchid);
542	for (var i = 0; i < ele.length; i++) {
543		var e = ele[i];
544		if ( (e.type == 'checkbox') && (e.id == groupid) ) {
545			e.checked = switch_cbox.checked;
546			e.click(); e.click();  // Click to activate subgroups
547			// Twice so we don't reverse effect
548		}
549	}
550}
551
552function xoopsCheckAllElements(elementIds, switchId) {
553	var switch_cbox = xoopsGetElementById(switchId);
554	for (var i = 0; i < elementIds.length; i++) {
555		var e = xoopsGetElementById(elementIds[i]);
556		if ((e.name != switch_cbox.name) && (e.type == 'checkbox')) {
557			e.checked = switch_cbox.checked;
558		}
559	}
560}
561
562function xoopsSavePosition(id)
563{
564	var textareaDom = xoopsGetElementById(id);
565	if (textareaDom.createTextRange) {
566		textareaDom.caretPos = document.selection.createRange().duplicate();
567	}
568}
569
570function xoopsInsertText(domobj, text)
571{
572	if (domobj.createTextRange && domobj.caretPos){
573		var caretPos = domobj.caretPos;
574		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1)
575			== ' ' ? text + ' ' : text;
576	} else if (domobj.getSelection && domobj.caretPos){
577		var caretPos = domobj.caretPos;
578		caretPos.text = caretPos.text.charat(caretPos.text.length - 1)
579			== ' ' ? text + ' ' : text;
580	} else {
581		domobj.value = domobj.value + text;
582	}
583}
584
585function xoopsCodeSmilie(id, smilieCode) {
586	var revisedMessage;
587	var textareaDom = xoopsGetElementById(id);
588	xoopsInsertText(textareaDom, smilieCode);
589	textareaDom.focus();
590	return;
591}
592
593function showImgSelected(imgId, selectId, imgDir, extra, xoopsUrl) {
594	if (xoopsUrl == null) {
595		xoopsUrl = "./";
596	}
597	imgDom = xoopsGetElementById(imgId);
598	selectDom = xoopsGetElementById(selectId);
599	imgDom.src = xoopsUrl + "/"+ imgDir + "/" + selectDom.options[selectDom.selectedIndex].value + extra;
600}
601
602function xoopsCodeUrl(id, enterUrlPhrase, enterWebsitePhrase){
603	if (enterUrlPhrase == null) {
604		enterUrlPhrase = "Enter the URL of the link you want to add:";
605	}
606	var text = prompt(enterUrlPhrase, "");
607	var domobj = xoopsGetElementById(id);
608	if ( text != null && text != "" ) {
609		if (enterWebsitePhrase == null) {
610			enterWebsitePhrase = "Enter the web site title:";
611		}
612		var text2 = prompt(enterWebsitePhrase, "");
613		if ( text2 != null ) {
614			if ( text2 == "" ) {
615				var result = "[url=" + text + "]" + text + "[/url]";
616			} else {
617				var pos = text2.indexOf(unescape('%00'));
618				if(0 < pos){
619					text2 = text2.substr(0,pos);
620				}
621				var result = "[url=" + text + "]" + text2 + "[/url]";
622			}
623			xoopsInsertText(domobj, result);
624		}
625	}
626	domobj.focus();
627}
628
629function xoopsCodeImg(id, enterImgUrlPhrase, enterImgPosPhrase, imgPosRorLPhrase, errorImgPosPhrase){
630	if (enterImgUrlPhrase == null) {
631		enterImgUrlPhrase = "Enter the URL of the image you want to add:";
632	}
633	var text = prompt(enterImgUrlPhrase, "");
634	var domobj = xoopsGetElementById(id);
635	if ( text != null && text != "" ) {
636		if (enterImgPosPhrase == null) {
637			enterImgPosPhrase = "Now, enter the position of the image.";
638		}
639		if (imgPosRorLPhrase == null) {
640			imgPosRorLPhrase = "'R' or 'r' for right, 'L' or 'l' for left, or leave it blank.";
641		}
642		if (errorImgPosPhrase == null) {
643			errorImgPosPhrase = "ERROR! Enter the position of the image:";
644		}
645		var text2 = prompt(enterImgPosPhrase + "\n" + imgPosRorLPhrase, "");
646		while ( ( text2 != "" ) && ( text2 != "r" ) && ( text2 != "R" ) && ( text2 != "l" ) && ( text2 != "L" ) && ( text2 != null ) ) {
647			text2 = prompt(errorImgPosPhrase + "\n" + imgPosRorLPhrase,"");
648		}
649		if ( text2 == "l" || text2 == "L" ) {
650			text2 = " align=left";
651		} else if ( text2 == "r" || text2 == "R" ) {
652			text2 = " align=right";
653		} else {
654			text2 = "";
655		}
656		var result = "[img" + text2 + "]" + text + "[/img]";
657		xoopsInsertText(domobj, result);
658	}
659	domobj.focus();
660}
661
662function xoopsCodeEmail(id, enterEmailPhrase){
663	if (enterEmailPhrase == null) {
664		enterEmailPhrase = "Enter the email address you want to add:";
665	}
666	var text = prompt(enterEmailPhrase, "");
667	var domobj = xoopsGetElementById(id);
668	if ( text != null && text != "" ) {
669		var result = "[email]" + text + "[/email]";
670		xoopsInsertText(domobj, result);
671	}
672	domobj.focus();
673}
674
675function xoopsCodeQuote(id, enterQuotePhrase){
676	if (enterQuotePhrase == null) {
677		enterQuotePhrase = "Enter the text that you want to be quoted:";
678	}
679	var text = prompt(enterQuotePhrase, "");
680	var domobj = xoopsGetElementById(id);
681	if ( text != null && text != "" ) {
682		var pos = text.indexOf(unescape('%00'));
683		if(0 < pos){
684			text = text.substr(0,pos);
685		}
686		var result = "[quote]" + text + "[/quote]";
687		xoopsInsertText(domobj, result);
688	}
689	domobj.focus();
690}
691
692function xoopsCodeCode(id, enterCodePhrase){
693	if (enterCodePhrase == null) {
694		enterCodePhrase = "Enter the codes that you want to add.";
695	}
696	var text = prompt(enterCodePhrase, "");
697	var domobj = xoopsGetElementById(id);
698	if ( text != null && text != "" ) {
699		var result = "[code]" + text + "[/code]";
700		xoopsInsertText(domobj, result);
701	}
702	domobj.focus();
703}
704
705function xoopsCodeText(id, hiddentext, enterTextboxPhrase){
706	var textareaDom = xoopsGetElementById(id);
707	var textDom = xoopsGetElementById(id + "Addtext");
708	var fontDom = xoopsGetElementById(id + "Font");
709	var colorDom = xoopsGetElementById(id + "Color");
710	var sizeDom = xoopsGetElementById(id + "Size");
711	var xoopsHiddenTextDomStyle = xoopsGetElementById(hiddentext).style;
712	var textDomValue = textDom.value;
713	var fontDomValue = fontDom.options[fontDom.options.selectedIndex].value;
714	var colorDomValue = colorDom.options[colorDom.options.selectedIndex].value;
715	var sizeDomValue = sizeDom.options[sizeDom.options.selectedIndex].value;
716	if ( textDomValue == "" ) {
717		if (enterTextboxPhrase == null) {
718			enterTextboxPhrase = "Please input text into the textbox.";
719		}
720		alert(enterTextboxPhrase);
721		textDom.focus();
722	} else {
723		if ( fontDomValue != "FONT") {
724			textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
725			fontDom.options[0].selected = true;
726		}
727		if ( colorDomValue != "COLOR") {
728			textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
729			colorDom.options[0].selected = true;
730		}
731		if ( sizeDomValue != "SIZE") {
732			textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
733			sizeDom.options[0].selected = true;
734		}
735		if (xoopsHiddenTextDomStyle.fontWeight == "bold" || xoopsHiddenTextDomStyle.fontWeight == "700") {
736			textDomValue = "[b]" + textDomValue + "[/b]";
737			xoopsHiddenTextDomStyle.fontWeight = "normal";
738		}
739		if (xoopsHiddenTextDomStyle.fontStyle == "italic") {
740			textDomValue = "[i]" + textDomValue + "[/i]";
741			xoopsHiddenTextDomStyle.fontStyle = "normal";
742		}
743		if (xoopsHiddenTextDomStyle.textDecoration == "underline") {
744			textDomValue = "[u]" + textDomValue + "[/u]";
745			xoopsHiddenTextDomStyle.textDecoration = "none";
746		}
747		if (xoopsHiddenTextDomStyle.textDecoration == "line-through") {
748			textDomValue = "[d]" + textDomValue + "[/d]";
749			xoopsHiddenTextDomStyle.textDecoration = "none";
750		}
751		xoopsInsertText(textareaDom, textDomValue);
752		textDom.value = "";
753		xoopsHiddenTextDomStyle.color = "#000000";
754		xoopsHiddenTextDomStyle.fontFamily = "";
755		xoopsHiddenTextDomStyle.fontSize = "12px";
756		xoopsHiddenTextDomStyle.visibility = "hidden";
757		textareaDom.focus();
758	}
759}
760
761function IsNumeric(strString){
762	//  check for valid numeric strings (integer)
763
764	var strValidChars = "0123456789";
765	var strChar;
766	var isNum = true;
767
768	if (strString.length == 0){
769		return false;
770	}
771
772	//  test strString consists of valid characters listed above
773	for (i = 0; i < strString.length && isNum == true; i++){
774		strChar = strString.charAt(i);
775		if (strValidChars.indexOf(strChar) == -1){
776			isNum = false;
777		}
778	}
779	return isNum;
780}
781
782function    xoopsValidateFCK(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
783	var oEditor = FCKeditorAPI.GetInstance(textareaId) ;
784	var editorcontent = oEditor.GetHTML();
785
786	var subjectDom = xoopsGetElementById(subjectId);
787	var submitDom = xoopsGetElementById(submitId);
788
789	if (editorcontent == "" || subjectDom.value == "") {
790		if (plzCompletePhrase == null) {
791			plzCompletePhrase = "Please complete the subject and message fields.";
792		}
793		alert(plzCompletePhrase);
794		return false;
795	}
796
797}
798
799function xoopsValidate(subjectId, textareaId, submitId, plzCompletePhrase, msgTooLongPhrase, allowedCharPhrase, currCharPhrase) {
800	var maxchars = 65535;
801	var subjectDom = xoopsGetElementById(subjectId);
802	var textareaDom = xoopsGetElementById(textareaId);
803	var submitDom = xoopsGetElementById(submitId);
804	if (textareaDom.value == "" || subjectDom.value == "") {
805		if (plzCompletePhrase == null) {
806			plzCompletePhrase = "Please complete the subject and message fields.";
807		}
808		alert(plzCompletePhrase);
809		return false;
810	}
811	if (maxchars != 0) {
812		if (textareaDom.value.length > maxchars) {
813			if (msgTooLongPhrase == null) {
814				msgTooLongPhrase = "Your message is too long.";
815			}
816			if (allowedCharPhrase == null) {
817				allowedCharPhrase = "Allowed max chars length: ";
818			}
819			if (currCharPhrase == null) {
820				currCharPhrase = "Current chars length: ";
821			}
822			alert(msgTooLongPhrase + "\n\n" + allowedCharPhrase + maxchars + "\n" + currCharPhrase + textareaDom.value.length + "");
823			textareaDom.focus();
824			return false;
825		} else {
826			submitDom.disabled = true;
827			return true;
828		}
829	} else {
830		submitDom.disabled = true;
831		return true;
832	}
833}
834
835
836
837function printURL(){
838
839	if (window.printLayout) {
840		printLayout=window.printLayout;
841	} else {
842		printLayout="print";
843	}
844	if (window.printAuto) {
845		printAuto=window.printAuto;
846	} else {
847		printAuto="0";
848	}
849
850
851
852	var pathname=self.location.pathname;
853	var query=self.location.search;
854
855	//  direct call for SEF startpage url (ie: http://{hostname}/)
856	if (pathname == '/' && query == '') {
857		return pathname+"index.php?layout="+printLayout+"&autoprint="+printAuto;
858	}
859
860	var parameters=new Array();
861	var params =new Array();
862	var seenLayout=false;
863	var seenPrintAuto=false;
864
865
866	query = query.substr(1, query.length - 1);
867	query = query.replace(/%26/,'&');
868	params= query.split('&');
869
870	for (i = 0; i < params.length; i++){
871		if (params[i] != '') {
872			parameters[i]=params[i].split('=');
873
874			if (parameters[i][0]=="layout"){
875				seenLayout=true;
876				parameters[i][1]=printLayout;
877			}
878			if (parameters[i][0]=="autoprint"){
879				seenPrintAutot=true;
880				parameters[i][1]=printAuto;
881			}
882
883		}
884	}
885	if (!seenLayout){
886		parameters.push(new Array("layout", printLayout));
887	}
888	if (!seenPrintAuto){
889		parameters.push(new Array("autoprint", printAuto));
890	}
891	params=new Array();
892	for (i = 0; i < parameters.length; i++){
893		params[i]=parameters[i][0]+"="+parameters[i][1];
894	}
895	query=params.join('&');
896	if (pathname.match(/^\/\d+$/)){
897		pathname +='/';
898	}
899
900	return pathname + "?" + query;
901}
902
903function replaceParamFromLocation(param2replace, replacement_value){
904	// replaces value of a parameter from the URL
905
906	var pathname=self.location.pathname;
907	var query=self.location.search;
908
909	var parameters=new Array();
910	var params =new Array();
911	var seenLayout=false;
912	var seenParam2replace=false;
913
914	query = query.substr(1, query.length - 1);
915	query = query.replace(/%26/,'&');
916	params= query.split('&');
917
918	for (i = 0; i < params.length; i++){
919		parameters[i]=params[i].split('=');
920	}
921
922
923	params=new Array();
924	for (i = 0; i < parameters.length; i++){
925		if (parameters[i][0]==param2replace) {
926			seenParam2replace=true;
927			parameters[i][1]=replacement_value;
928		}
929		if (parameters[i][0] && parameters[i][1]) {
930			params[i]=parameters[i][0]+"="+parameters[i][1];
931		}
932	}
933
934	if (!seenParam2replace) {
935		params[i]=param2replace+"="+replacement_value;
936
937	}
938	query=params.join('&');
939
940	return pathname + "?" + query;
941
942}
943
944
945
946function replaceParamFromURL(url, param2replace, replacement_value){
947	// replaces value of a parameter from the URL
948
949
950	var tokens=url.split("?");
951	var pathname=tokens[0];
952	var query=tokens[1];
953
954
955	var parameters=new Array();
956	var params =new Array();
957	var seenLayout=false;
958	var seenParam2replace=false;
959
960	query = query.replace(/%26/,'&');
961	params= query.split('&');
962
963	for (i = 0; i < params.length; i++){
964		parameters[i]=params[i].split('=');
965	}
966
967
968	params=new Array();
969	for (i = 0; i < parameters.length; i++){
970		if (parameters[i][0]==param2replace) {
971			seenParam2replace=true;
972			parameters[i][1]=replacement_value;
973		}
974		if (parameters[i][0] && parameters[i][1]) {
975			params[i]=parameters[i][0]+"="+parameters[i][1];
976		}
977	}
978
979	if (!seenParam2replace) {
980		params[i]=param2replace+"="+replacement_value;
981
982	}
983	query=params.join('&');
984
985	return pathname + "?" + query;
986
987}
988
989function getParamFromLocation(param2get){
990	// get value of a parameter from the URL
991
992	var query=self.location.search;
993
994	var parameters=new Array();
995	var params =new Array();
996	var seenLayout=false;
997
998
999	query = query.substr(1, query.length - 1);
1000	query = query.replace(/%26/,'&');
1001	params= query.split('&');
1002
1003	for (i = 0; i < params.length; i++){
1004		parameters[i]=params[i].split('=');
1005	}
1006
1007
1008	params=new Array();
1009	for (i = 0; i < parameters.length; i++){
1010		if (parameters[i][0]==param2get) {
1011			return parameters[i][1];
1012		}
1013
1014	}
1015
1016	// parameter not found
1017	return false;
1018
1019}
1020
1021function openPrintWindow(){
1022	
1023	if(window.printLayout == 'wsContainerPrint'){
1024		window.print();
1025	} else {
1026		oNewWindow = window.open(printURL(), "_blank");
1027	}
1028}
1029
1030
1031function gotoWsContentPage(pageId){
1032
1033	var pathname=self.location.pathname;
1034	if (window.location_id > 0) {
1035		var location_id = window.location_id;
1036	} else {
1037		var location_id = 0;
1038	}
1039	// Handle first page
1040	var gotoUrl=false;
1041
1042	if (pathname=="/" ) {
1043		gotoUrl="/content/" + location_id + "/"+pageId+"/";
1044		//alert("First Page!\nGotoURL is "+gotoUrl);
1045
1046	} else {
1047		path_tokens=pathname.split('/');
1048		if (typeof(path_tokens)=="object") {
1049			if (path_tokens[1]) {
1050				//alert(path_tokens[1]);
1051				if (path_tokens[1].match(/^\d\d*$/)) {
1052					gotoUrl="/content/"+path_tokens[1]+"/"+pageId+"/";
1053					//alert("This is a location id\nGotoURL is "+gotoUrl);
1054				} else if (path_tokens[1].match(/^content*$/)) {
1055					gotoUrl="/content/"+path_tokens[2]+"/"+pageId+"/";
1056					//alert("This is content\nGotURL is "+gotoUrl);
1057				} else if (path_tokens[1].match(/^modules*$/) && path_tokens[2].match(/^wsContent*$/)) {
1058					gotoUrl=replaceParamFromLocation("page", pageId);
1059					//alert("Module/wsContent.\nGotoURL is " + gotoUrl);
1060				}
1061			}
1062		}
1063	}
1064	if (!gotoUrl) {
1065		gotoUrl="/content/" + location_id + "/"+pageId+"/";
1066	}
1067	if (gotoUrl) {
1068		self.location=gotoUrl;
1069	}
1070	return false;
1071
1072
1073
1074
1075
1076
1077}
1078
1079
1080function switchLanguage(lang_code){
1081	
1082	// Match urls that have language in them
1083	// such as https://www.sailingworld.eu/en/content/61/48/sailing-jets
1084	
1085	url_path_info = URLPathInfo.getPathInfo(window.location.href);
1086	pathParts = url_path_info.path.split('/');
1087	// console.log(url_path_info);
1088	// console.log(pathParts);
1089	// console.log(pathParts[1]);
1090	
1091	if (pathParts[1].match(/^[a-z][a-z]$/)){
1092		if (pathParts[1] == lang_code){
1093			console.log('same lang');
1094			return;
1095		}
1096		// console.log('its a lang');
1097		pathParts[1] = lang_code;
1098		new_url_path = pathParts.join('/');
1099		console.log('Must go to ' + new_url_path);
1100		self.location = new_url_path;
1101		return;
1102	}
1103	
1104	
1105	gotoUrl=replaceParamFromLocation("wslanguage", lang_code);
1106	if (gotoUrl) {
1107		self.location=gotoUrl;
1108	}
1109
1110}
1111
1112function downloadFile(fileId) {
1113	var location_id = getParamFromLocation('location_id') || 0 ;
1114	var page_id = getParamFromLocation('page');
1115	var hostname = self.location.host;
1116
1117	var path_upload = '/modules/uploadmanager11/admin/index.php?action=file_download&file_id='+fileId;
1118	var href_file = 'http://'+hostname+path_upload+'&location_id='+location_id;
1119
1120	window.open(href_file);
1121	//self.location.href =  href_file;
1122	//return false;
1123}
1124
1125
1126function filemanagerDownload(fileId, fileName){
1127
1128	var location_id = getParamFromLocation('location_id') || 0 ;
1129	var page_id = getParamFromLocation('page');
1130	var hostname = self.location.host;
1131
1132	var path_upload = '/files/' + fileId  + '/' + fileName;
1133	var href_file = 'http://'+hostname+path_upload;
1134
1135	window.open(href_file);
1136
1137}
1138
1139function scrollToTop(){
1140	window.scroll(0,0);
1141}
1142
1143
1144//window.onload=scrollToTop;
1145//window.attachEvent("onload", scrollToTop);
1146
1147
1148
1149function argObject(name,value) {
1150	this.name=name;
1151	this.value=value;
1152
1153}
1154
1155
1156function remoteCall (url,args){
1157	var n = args[0];
1158	var head = document.getElementsByTagName('head').item(0);
1159
1160	var old  = document.getElementById(n.value);
1161	if (old) {
1162		head.removeChild(old);
1163	}
1164
1165	script = document.createElement('script');
1166
1167	script.type = 'text/javascript';
1168	script.defer = true;
1169
1170	script.id = n.value; // Just call it somehow....
1171	var text="?";
1172	for(var i=0;i<args.length;++i){
1173		text=text + args[i].name + "=" + args[i].value + "&";
1174	}
1175	//alert(url+text);
1176	script.src = url+text;
1177	void(head.appendChild(script));
1178
1179}
1180
1181
1182function showHideHelpText(id){
1183	showHide(id);
1184
1185}
1186
1187/*********************************************************************************
1188  dw_cookies.js - cookie functions for www.dyn-web.com
1189  Recycled from various sources
1190 **********************************************************************************/
1191
1192// Modified from Bill Dortch's Cookie Functions (hidaho.com)
1193// (found in JavaScript Bible)
1194function setCookie(name,value,days,path,domain,secure) {
1195	var expires, date;
1196	if (typeof days == "number") {
1197		date = new Date();
1198		date.setTime( date.getTime() + (days*24*60*60*1000) );
1199		expires = date.toGMTString();
1200	}
1201	document.cookie = name + "=" + escape(value) +
1202		((expires) ? "; expires=" + expires : "") +
1203		((path) ? "; path=" + path : "") +
1204		((domain) ? "; domain=" + domain : "") +
1205		((secure) ? "; secure" : "");
1206}
1207
1208// Modified from Jesse Chisholm or Scott Andrew Lepera ?
1209// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
1210function getCookie(name) {
1211	var nameq = name + "=";
1212	var c_ar = document.cookie.split(';');
1213	for (var i=0; i<c_ar.length; i++) {
1214		var c = c_ar[i];
1215		while (c.charAt(0)==' ') c = c.substring(1,c.length);
1216		if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
1217	}
1218	return null;
1219}
1220
1221// from Bill Dortch's Cookie Functions (hidaho.com)
1222function deleteCookie(name,path,domain) {
1223	if (getCookie(name)) {
1224		document.cookie = name + "=" +
1225			((path) ? "; path=" + path : "") +
1226			((domain) ? "; domain=" + domain : "") +
1227			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
1228	}
1229}
1230
1231function confirm2go(msg, url){
1232	if (confirm(msg)) {
1233		location.href=url;
1234	}
1235}
1236
1237var cursor = {x:0, y:0};
1238
1239
1240function prepare_deferred_redirection(href, target) {
1241	window.deferred_redirection_parameters = { 'href': href, 'target':target};
1242}
1243
1244function process_deferred_redirection() {
1245	var href = window.deferred_redirection_parameters.href;
1246	var target = window.deferred_redirection_parameters.target;
1247
1248	handle_link(href, target);
1249}
1250
1251
1252function handle_link(href, target) {
1253	if (href.toLowerCase().indexOf("javascript:")==0) {              // Java script presents
1254		eval(href.substring(11,href.length));
1255	} else {
1256		if (!target || target=="_self") {
1257			location.href = href;
1258		} else {
1259			window.open (href, target);
1260		}
1261	}
1262}
1263
1264
1265
1266function requestAttachFile(id,lang,thumbnail_preview_width,thumbnail_preview_height) {
1267
1268	_hostname=window.location.host;
1269	var input = document.getElementById(id);
1270	if (!input) {
1271		return false;
1272	}
1273	_uploader_url="https://webuploader.worldsoft-cms.info/index.php";
1274	if (window.uploader_url){
1275		_uploader_url=window.uploader_url;
1276	}
1277	var url = _uploader_url+'?lang='+lang+'&rid='+encodeURIComponent(id)+'&red='+encodeURIComponent(window.location.protocol+'//'+_hostname+'/uploadcallback.php');
1278	if(thumbnail_preview_width){
1279		url += '&thumbnail_preview_width='+thumbnail_preview_width;
1280	}
1281	if(thumbnail_preview_height){
1282		url += '&thumbnail_preview_height='+thumbnail_preview_height;
1283	}
1284	var w = window.open(url,'','width=400,height=100,status=no,resizable=no,location=yes,menubar=no');
1285
1286}
1287
1288function processAttachmentFile(id, attachment, extra_params) {
1289	var response = document.getElementById(id);
1290	if	(!response) {
1291		return false;
1292	}
1293	var display = document.getElementById('display'+id);
1294	if (!display) {
1295		return false;
1296	}
1297
1298
1299	response.value= attachment.uri;
1300	var suffix = response.value.slice(-3).toLowerCase();
1301	if (suffix == 'gif' || suffix == 'jpg' || suffix == 'bmp' || suffix == 'png' ) {
1302		var x = 80;
1303		var y = 0;
1304		if(extra_params.thumbnail_width){
1305			x = extra_params.thumbnail_width;
1306		}
1307		if(extra_params.thumbnail_height){
1308			y = extra_params.thumbnail_height;
1309		}
1310		var preview_image_src = response.value.replace(/^update:\/mounts\/cms-nas\/ecms\/(.*)\.([a-zA-Z]{3})$/,'https://images.worldsoft-cms.info/$1.resize_to.'+x+'x'+y+'.$2');
1311		var img = document.createElement('img');
1312		display.innerHTML = '<img src="'+preview_image_src+'" alt="'+attachment.display_name+'" > '+attachment.display_name+'&nbsp;';
1313	} else {
1314		display.innerHTML = attachment.display_name+'&nbsp;';
1315	}
1316
1317
1318	if (matches = id.match(/^(.*)_multi_([0-9]+)$/)) {
1319		var fct = 'handler_'+matches[1].replace(/[\[\]]/g,"_");
1320		var cmd = fct+"('"+id+"')";
1321		eval(cmd);
1322	} else {
1323		var delete_btn_id = 'deletebutton'+id;
1324		var delete_btn = document.getElementById(delete_btn_id);
1325		if (delete_btn) {
1326			delete_btn.style.display='inline';
1327		}
1328	}
1329
1330
1331
1332	if (window.direct_execute_after_processing_attachment) {
1333		form_id=window.direct_execute_after_processing_attachment;
1334		form=document.getElementById(form_id);
1335		form.submit();
1336	}
1337
1338}
1339
1340
1341function resizeIFrame(frame){
1342	//find the height of the internal page
1343	var the_height=frame.contentWindow.
1344		document.body.scrollHeight;
1345
1346	var the_width=frame.contentWindow.
1347		document.body.scrollWidth;
1348
1349	//change the height of the iframe
1350	frame.height=the_height+10;
1351
1352	//change the width of the iframe
1353	frame.width=the_width+100;
1354}
1355
1356
1357
1358function getDeleteLabel() {
1359	return "Delete";
1360}
1361
1362function addOption(parentNode, eleName, widget, size, maxlength){
1363
1364	var countId = eleName + "_counter";
1365
1366	var lastId = parseInt(document.getElementById(countId).value);
1367
1368	var nextId = lastId + 1;
1369	var item = document.createElement("tr");
1370	var td1 = document.createElement("td");
1371	var td2 = document.createElement("td");
1372	item.appendChild(td1);
1373	item.appendChild(td2);
1374	item.id = nextId;
1375	item.className = 'odd';
1376	parentNode.parentNode.insertBefore(item,parentNode);
1377
1378	var s1 = "<input class='text' name='" + eleName +"["+nextId+"]' id='" + eleName +"["+nextId+"]' size='"+size+"' maxlength='"+maxlength+"' value='' type='"+widget+"'>";
1379
1380	var s2 = "<input class='button' src='https://images.worldsoft-cms.info/data/icons/aa-Vista-e/PNG/16X16/bt_delete.png' name='delopt["+ eleName +"["+nextId+"]' id='delopt["+ eleName +"["+nextId+"]' value='"+getDeleteLabel()+"' type='image' onclick='delOption(this.parentNode,\""+eleName+"\",0);' >";
1381
1382	td1.innerHTML = s1;
1383	td2.innerHTML = s2;
1384	document.getElementById(countId).value++;
1385}
1386
1387function delOption(parentNode,eleName,next){
1388	var countId = eleName + "_counter";
1389	var count = document.getElementById(countId).value;
1390
1391	if(count == 1){
1392		return;
1393	}
1394
1395	parentNode.parentNode.parentNode.removeChild(parentNode.parentNode);
1396
1397
1398	document.getElementById(countId).value--;
1399	/*
1400	   if(next > 0){
1401	   var item = document.createElement("input");
1402	   item.type = "hidden";
1403	   item.name = eleName + "[delete_values]["+next+"]";
1404	   item.value = next;
1405	   document.objects_form.appendChild(item);
1406	   }
1407	   */
1408
1409}
1410
1411function changeStyle(o,c){
1412	o.className = c;
1413}
1414
1415function openWSMediaStreamer(url, width, height) {
1416	params="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
1417	return openWithSelfMain(url,"wsMediaStreamer",width,height, params);
1418
1419}
1420
1421function openWSVideoStreamer(flv, width, height, videotype, autostart) {
1422	if (!flv) {
1423		return;
1424	}
1425	if (!width) {
1426		width=400;
1427	}
1428	if (!height) {
1429		height=300;
1430	}
1431
1432	if (!videotype) {
1433		videotype="file";
1434	}
1435
1436
1437	windowWidth=width;
1438	windowHeight=height+20;
1439
1440	if (videotype=="yt") {
1441		_url="/modules/wsVideoStreamer/player/index.php?yt="+flv;
1442	} else {
1443		_url="/modules/wsVideoStreamer/player/index.php?file="+flv;
1444	}
1445
1446	_url+="&autostart="+autostart;
1447
1448
1449	if (width) {
1450		_url+="&width="+width;
1451	}
1452	if (height) {
1453		_url+="&height="+height;
1454	}
1455
1456	params="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
1457	return openWithSelfMain(_url,"wsVideoStreamer",windowWidth,windowHeight, params);
1458}
1459
1460
1461function openIRCChatWindow(width, height) {
1462	if (!width) {
1463		width=640;
1464	}
1465	if (!height) {
1466		height=480;
1467	}
1468
1469	if (!window.uid) {
1470		return;
1471	}
1472	if (!window._domain_id) {
1473		return;
1474	}
1475
1476	if (!window.chatName) {
1477		return;
1478	}
1479
1480	windowWidth=width;
1481	windowHeight=height;
1482
1483	//_url="http://217.196.177.143:2001/chat.html?nickname=" +  window.chatName + "&channel=" + window._domain;
1484	_url="http://chatserver.worldsoft-cms.info:2001/chat.html?key=u"+window.uid+"d"+window._domain_id;
1485
1486
1487
1488	if (width) {
1489		_url+="&width="+width;
1490	}
1491	if (height) {
1492		_url+="&height="+height;
1493	}
1494
1495	return openWithSelfMain(_url,"ircChatWindow",windowWidth,windowHeight, "status=no,location=no");
1496}
1497
1498
1499function checkout(id,qty){
1500	lyr=xoopsGetElementById("checkout_"+id);
1501	_url="/checkout.php?article_id="+id+"&quantity="+qty;
1502	//self.location="/checkout.php?article_id="+id+"&quantity="+qty;
1503	lyr.innerHTML="<br><iframe height=400 width=100%  src='"+_url+"'></iframe>";;
1504	//self.location="/checkout.php?article_id="+id+"&quantity="+qty;
1505}
1506
1507function normalizeDomain(domain){
1508	value = domain.toLowerCase();
1509	value=value.replace(/\s/g, '');
1510	value=value.replace(/^http:\/\//, '');
1511	value=value.replace(/^https:\/\//, '');
1512	value=value.replace(/^www\./, '');
1513	value=value.replace(/\/.*/, '');
1514	value=value.replace(/:.*/, '');
1515	return value;
1516}
1517
1518
1519
1520function doLostPassword(){
1521    if (window._wbs) {
1522        window.location = window._wbs_widget_url + "/access/forgot-mode-choose/" + window._wbs_company_id;  
1523        return;
1524    }
1525	return openDialog('/ajax/lost.pass.request.php');
1526}
1527
1528function doQuickLogin(type){
1529	var url = type == 'wbsshop' ? '/modules/wbsShop/ajax/quickdlogin.php' : '/ajax/quicklogin.php';
1530    console.log("xoops.js:doQuickLogin. Opening url: " + url);
1531	var params = '';
1532	if (typeof(arguments[0])=='object') {
1533		for (var i in arguments[0]) {
1534			params += i + '=' + encodeURIComponent(arguments[0][i]);
1535		}
1536	}
1537	return openDialog(url+(params?'?'+params:''), 400);
1538	
1539}
1540function openDialog(url, width){
1541	if (!width) {
1542		width=600;
1543	}
1544	if (!xoopsGetElementById("dialog")){
1545		console.log("Creating a div with id dialog");
1546		jQuery('body').append('<div id="dialog"></div>');
1547	}
1548
1549	if (xoopsGetElementById("dialog")){
1550		// jQuery("#dialog").dialog("destroy");
1551		jQuery("#dialog").load(url).dialog({ width: width, modal: true, draggable: false, resizable: false, open: function() {
1552			var $btn = $(this).closest('.ui-dialog').find('.ui-dialog-titlebar-close');
1553			$btn.addClass('ui-button ui-corner-all ui-widget ui-button-icon-only')
1554			.html('<span class="ui-button-icon ui-icon ui-icon-closethick"></span><span class="ui-button-icon-space"> </span>Close');
1555            $(this).closest('.ui-dialog').css('max-width', width).css('width', '100%');
1556		} }).parent('.ui-dialog').css('zIndex',9999999);
1557        if(jQuery("#dialog").hasClass("ui-dialog-content") && jQuery("#dialog").dialog("isOpen")) {
1558            jQuery("#dialog").closest('.ui-dialog').css('max-width', width).css('width', '100%');
1559        }
1560		return;
1561	}
1562	
1563	
1564}
1565function openJQMWindow(url,width,height){
1566	return openDialog(url, width);
1567}
1568
1569
1570// Returns the translation of a string for JS consumption
1571function getPO(str){
1572	translation_div_name="JSPO"+str;
1573	html=jQuery('#'+translation_div_name).html();
1574	return (html)?html:str;
1575}
1576
1577
1578// Replace, remove or add js or css file.
1579function removejscssfile(filename, filetype){
1580	var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from
1581 	var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
1582 	var allsuspects=document.getElementsByTagName(targetelement)
1583 	for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
1584  		if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1)
1585   		allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild()
1586 	}
1587}
1588
1589function createjscssfile(filename, filetype){
1590	if (filetype=="js"){ //if filename is a external JavaScript file
1591  		var fileref=document.createElement('script');
1592  		fileref.setAttribute("type","text/javascript");
1593  		fileref.setAttribute("src", filename);
1594 	} else if (filetype=="css"){ //if filename is an external CSS file
1595  		var fileref=document.createElement("link");
1596  		fileref.setAttribute("rel", "stylesheet");
1597  		fileref.setAttribute("type", "text/css");
1598  		fileref.setAttribute("href", filename);
1599 	}
1600 	return fileref;
1601}
1602
1603function replacejscssfile(oldfilename, newfilename, filetype){
1604 	var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using
1605 	var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for
1606 	var allsuspects=document.getElementsByTagName(targetelement)
1607 	for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
1608  		if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(oldfilename)!=-1){
1609   			var newelement=createjscssfile(newfilename, filetype)
1610   			allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])
1611  		}
1612 	}
1613}
1614
1615
1616
1617// Open imagemanager to choose an image
1618function openImagemanager(target){
1619	openWithSelfMain("/modules/system/admin.php?fct=images&from_fck=1&target="+target+"&callback_function=manageImageAfterLoad()","imgmanager",700,450);
1620	return false;
1621}                   
1622 
1623// Callback for the imagemanager
1624function manageImageAfterLoad(){
1625	console.log("Running manageImageAfterLoad");
1626	var img_id =  $('#image_id').val();  
1627	console.log("img_id is " + img_id);
1628    if(img_id.substring(0, 8) == "[img id="){
1629       var image_id = (img_id).substring(8,(img_id).indexOf("]",0));
1630		console.log("image_id retrieved is " + image_id);
1631		$('#image_id').val(image_id);  
1632		$('#thumbnail_image_id').attr('src',  '/image.php?id=' + image_id);
1633		
1634    }                         
1635    
1636}   
1637
1638function isValidAscii(str){
1639    if(typeof(str)!=='string'){
1640        return false;
1641    }
1642    for(var i=0;i<str.length;i++){
1643        if(str.charCodeAt(i)>127){
1644            return false;
1645        }
1646    }
1647    return true;
1648}
1649
1650function scriptLoader() {};
1651
1652scriptLoader.loaded = {};
1653
1654scriptLoader.loadOnce = function(script) {
1655	if (!scriptLoader.loaded[script]) {
1656		loadScript(script);
1657		scriptLoader.loaded[script]=true;
1658	} 
1659}
1660
1661
1662
1663

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.