PageSourceSearch

https://www.diving.org.il/javascripts/common.js

js diving.org.il collected 2026-10-02 14:49:31 UTC 9,728 bytes, 336 lines download raw bytes

1
2/* ---------------------------------------------------------------- */
3/* commonSetCookie                                                  */
4/* ---------------------------------------------------------------- */
5function commonSetCookie(cookieName, cookieValue)
6{
7        document.cookie = cookieName + "=" + cookieValue + "; expires=";
8}
9
10/* ---------------------------------------------------------------- */
11/* commonGetCookie                                                  */
12/* ---------------------------------------------------------------- */
13function commonGetCookie(cookieName)
14{
15        var allCookie = document.cookie;
16        var theValue;
17        var start = allCookie.indexOf(cookieName+"=");
18        if (start == -1)
19			return "";
20			
21        var end = allCookie.indexOf(";", start);
22        
23        if (end == -1) 
24			end = allCookie.length;
25			
26        var name_value = allCookie.substring(start, end);
27        theValue = name_value.substring(cookieName.length+1, name_value.length);
28        
29        return theValue;
30}
31
32var showPopup = true;
33
34/* ---------------------------------------------------------------- */
35/* commonSetAutoStart                                               */
36/* ---------------------------------------------------------------- */
37function commonSetAutoStart(trueORfalse)
38{
39	commonSetCookie("cookieMusicAutoStart", trueORfalse);
40}
41
42var blink_speed=1200;
43var blink_on=0;
44
45function commonBlink()
46{
47	for (b=1; b<20; b++)
48	{
49		obj = eval("window.blink" + b);
50	
51		if (obj == undefined)
52			break;
53
54		if (blink_on==0)
55		{
56			obj.style.color = obj.parentNode.style.color;
57		}
58		else
59		{
60			obj.style.color = "red";
61		}
62	}
63
64	if (b != 1)
65	{
66		if (blink_on==0)
67		{
68			blink_on = 1;
69			speed = blink_speed;
70		}
71		else
72		{
73			blink_on = 0;
74			speed = blink_speed/2;
75		}
76		setTimeout("commonBlink();",speed);
77	}
78}
79
80/* ---------------------------------------------------------------- */
81/* commonEncode	- moved to LANG.js									*/
82/* ---------------------------------------------------------------- */
83
84/* ---------------------------------------------------------------- */
85/* commonDecode	- moved to LANG.js									*/
86/* ---------------------------------------------------------------- */
87
88/* ---------------------------------------------------------------- */
89/* commonSortXml													*/
90/* ---------------------------------------------------------------- */
91function commonSortXml (xml, sortColumn, sortType, sortDir)
92{
93	var xslDoc = new ActiveXObject("Microsoft.XMLDOM");
94    xslDoc.async = false;
95
96    var xsl =   " <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' " 	+
97				" version='1.0'> " 														+
98       	        " <xsl:template match='/'> " 											+
99           	    " <items> " 															+
100               	" <xsl:for-each select='items/item'> " 									+
101				" <xsl:sort select='" + sortColumn + "'" 								+
102			    "          order='" + sortDir+ "' data-type='" + sortType + "'/>" 		+
103   		    	"       <xsl:copy> " 													+
104           	    "           <xsl:copy-of select='*'/> " 								+
105               	"       </xsl:copy> " 													+
106                "   </xsl:for-each> " 													+
107   	            " </items> " 															+
108       	        " </xsl:template> " 													+
109           	    " </xsl:stylesheet> ";
110
111    // loading the xsl sorter
112	//--------------------------------------------------------------------
113    xslDoc.loadXML (xsl);
114
115	var toSortXml = new ActiveXObject("Microsoft.XMLDOM");
116	toSortXml.loadXML (xml.getElementsByTagName("items").item(0).xml);
117	
118	sortedXml = new ActiveXObject("Microsoft.XMLDOM");
119	sortedXml.loadXML ("<data>" + toSortXml.transformNode(xslDoc) + "</data>");
120
121	return sortedXml;	
122}
123
124/* ---------------------------------------------------------------- */
125/* commonPrintPage													*/
126/* ---------------------------------------------------------------- */
127function commonPrintPage (type, id)
128{
129	var xmlRequest = new xmlObj(false);
130	xmlRequest.init ("<data>"	+
131						"<command>private.getPrintPage</command>"	+
132						"<type>" + type + "</type>"	+
133						"<id>" + id + "</id>"	+
134					 "</data>");
135	xmlRequest.sendRequest ('server.php', xmlRequest.obj);
136
137	responseXml = xmlRequest.obj;
138
139	var printFileName = responseXml.getElementsByTagName("printFileName").item(0).text;
140
141	var height = screen.availHeight - 100;
142	var width  = screen.availWidth  - 100;
143
144	var y = 0;
145	var x = (screen.availWidth  - width)  / 2;
146
147	window.open ("tempPrints/" + printFileName, "",  "status=no,toolbar=no,menubar=yes,height=" + height + ", "	+
148					 "								  width =" + width  + ", left="+x+", top="+y);
149
150}
151
152/* ---------------------------------------------------------------- */
153/* commonAddLoadEvent												*/
154/* ---------------------------------------------------------------- */
155function commonAddLoadEvent(func)
156{
157	  var oldonload = window.onload;
158	  if (typeof window.onload != 'function') {
159	    window.onload = func;
160	  } else {
161	    window.onload = function() {
162	      if (oldonload) {
163	        oldonload();
164	      }
165	      func();
166	    }
167	  }
168}
169
170function common_clientWidth() {
171	return common_filterResults (
172		window.innerWidth ? window.innerWidth : 0,
173		document.documentElement ? document.documentElement.clientWidth : 0,
174		document.body ? document.body.clientWidth : 0
175	);
176}
177function common_clientHeight() {
178	return common_filterResults (
179		window.innerHeight ? window.innerHeight : 0,
180		document.documentElement ? document.documentElement.clientHeight : 0,
181		document.body ? document.body.clientHeight : 0
182	);
183}
184function common_scrollLeft() {
185	return common_filterResults (
186		window.pageXOffset ? window.pageXOffset : 0,
187		document.documentElement ? document.documentElement.scrollLeft : 0,
188		document.body ? document.body.scrollLeft : 0
189	);
190}
191function common_scrollTop() {
192	return common_filterResults (
193		window.pageYOffset ? window.pageYOffset : 0,
194		document.documentElement ? document.documentElement.scrollTop : 0,
195		document.body ? document.body.scrollTop : 0
196	);
197}
198function common_filterResults(n_win, n_docel, n_body) {
199	var n_result = n_win ? n_win : 0;
200	if (n_docel && (!n_result || (n_result > n_docel)))
201		n_result = n_docel;
202	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
203}
204
205var commonLateBanners = new Array();
206
207/* ---------------------------------------------------------------- */
208/* commonLateBannerHtml												*/
209/* ---------------------------------------------------------------- */
210function commonLateBannerHtml(middleWidth, bannerWidth, divId, htmlSource)
211{
212		if (((common_clientWidth() - middleWidth) / 2) - 10 > bannerWidth)
213		{
214			document.getElementById(divId).innerHTML = unescape(htmlSource);
215
216			if (commonLateBanners.length == 0) // first late banner show up
217			{
218				window.onresize = function () {commonLateBannerResize();}
219			}
220
221			commonLateBanners.push(middleWidth);
222			commonLateBanners.push(bannerWidth);
223			commonLateBanners.push(divId);
224		}
225}
226
227/* ---------------------------------------------------------------- */
228/* commonLateBannerResize												*/
229/* ---------------------------------------------------------------- */
230function commonLateBannerResize()
231{
232		divId = null;
233		bannerWidth = null;
234		middleWidth = null;
235
236		for (x in commonLateBanners)
237		{
238			if (middleWidth == null)
239			{
240					middleWidth = commonLateBanners[x];
241					continue;
242			}
243			if (bannerWidth == null)
244			{
245					bannerWidth = commonLateBanners[x];
246					continue;
247			}
248			if (divId == null)
249			{
250					divId = commonLateBanners[x];
251			}
252			if (((common_clientWidth() - middleWidth) / 2) - 10 > bannerWidth)
253				document.getElementById(divId).style.display = '';
254			else
255				document.getElementById(divId).style.display = 'none';
256
257			divId = null;
258			bannerWidth = null;
259			middleWidth = null;
260		}
261}
262
263/**
264 * [Amir 25/9/2011] included from tinymce/plugins/media/js/embed.js
265 * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
266 */
267
268function writeFlash(p) {
269	writeEmbed(
270		'D27CDB6E-AE6D-11cf-96B8-444553540000',
271		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
272		'application/x-shockwave-flash',
273		p
274	);
275}
276
277function writeShockWave(p) {
278	writeEmbed(
279	'166B1BCA-3F9C-11CF-8075-444553540000',
280	'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
281	'application/x-director',
282		p
283	);
284}
285
286function writeQuickTime(p) {
287	writeEmbed(
288		'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
289		'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
290		'video/quicktime',
291		p
292	);
293}
294
295function writeRealMedia(p) {
296	writeEmbed(
297		'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
298		'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
299		'audio/x-pn-realaudio-plugin',
300		p
301	);
302}
303
304function writeWindowsMedia(p) {
305	p.url = p.src;
306	writeEmbed(
307		'6BF52A52-394A-11D3-B153-00C04F79FAA6',
308		'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
309		'application/x-mplayer2',
310		p
311	);
312}
313
314function writeEmbed(cls, cb, mt, p) {
315	var h = '', n;
316
317	h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
318	h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
319	h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
320	h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
321	h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
322	h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
323	h += '>';
324
325	for (n in p)
326		h += '<param name="' + n + '" value="' + p[n] + '">';
327
328	h += '<embed type="' + mt + '"';
329
330	for (n in p)
331		h += n + '="' + p[n] + '" ';
332
333	h += '></embed></object>';
334
335	document.write(h);
336}

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.