PageSourceSearch

http://www.legend.lv/js/iw.js

js legend.lv collected 2026-10-08 18:42:05 UTC 26,940 bytes, 941 lines download raw bytes

1/*************************************
2 *
3 *  Code By Attenzione
4 *  Started at 21.04.2008
5 *
6 *************************************/
7
8/*document.onkeyup  = function(e) {
9	e = _fixE( e );
10	if (e.keyCode == 8) {
11		refreshPage();
12	}
13}*/
14
15//var oldHref = window.location.href;
16//setInterval( function() { if (oldHref != window.location.href) { refreshPage(); } }, 500 );
17 
18var lastAjaxUrl = "";
19var allowAutoHide = true; //system! do not change!
20
21var iw = new Object();
22
23iw.functions = {
24	
25	getAjaxBody : function( responseText ) {
26		var bodyStart = responseText.toLowerCase().indexOf("<body>");
27		var bodyEnd = responseText.toLowerCase().indexOf("</body>");
28
29		if (bodyStart > -1 && bodyEnd > -1)	{
30			responseText = responseText.substring( bodyStart + 6, bodyEnd );
31		}
32		return responseText;
33	},
34	
35	scrollToName: function( name, offset ) {
36		var o = $('[name='+name+']');
37		if (!o.length) return false;
38		if (typeof offset == 'undefined') offset = 0;
39		window.scroll( 0, o.offset().top - offset );
40	}
41	
42};
43
44iw.viewport = {
45	windowX : function() { return (document.documentElement && document.documentElement.clientWidth) || window.innerWidth || self.innerWidth || document.body.clientWidth },
46	windowY : function() { return (document.documentElement && document.documentElement.clientHeight) || window.innerHeight || self.innerHeight || document.body.clientHeight },
47	scrollX : function() { return (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft },
48	scrollY : function() { return (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop },
49	pageX 	: function() { return (document.documentElement && document.documentElement.scrollWidth) ? document.documentElement.scrollWidth : (document.body.scrollWidth > document.body.offsetWidth) ? document.body.scrollWidth : document.body.offsetWidth },
50	pageY 	: function() { return (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight : (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight : document.body.offsetHeight }
51}
52
53iw.preloader = {
54	o : null,
55	p : null,
56	show : function( selector ) {
57		if (!this.init( selector )) return false;
58		this.p.removeClass('preloader-instance').prependTo( this.o ).show();
59		return true;
60	},
61	hide : function( selector ) {
62		if (!this.init( selector )) return false;
63		this.o.find('div.preloader').remove();
64		return true;
65	},
66	init : function( selector ) {
67		var o = $( selector );
68		if (!o.length) return false;
69		this.o = o;
70		//var p = $('div.preloader-instance');
71		//if (!p.length) return false;
72		var msg = typeof settings.preloader != 'undefined' ? settings.preloader : '';
73		this.p = $('<div class="preloader"><div><span>'+msg+'</span></div><div class="preloader-overlay"></div></div>');
74		var height = this.o.height();
75		var padding = height < 600 ? Math.max(0, Math.round( height / 2 ) - 15) : 250;
76		this.p.find('div').css({
77			'padding-top' : padding,
78			'height' : height - padding
79		});
80		return true;
81	}
82}
83
84function _$( id ) {
85	return document.getElementById( id );
86}
87
88String.prototype.trim = function() {
89	return this.replace(/^\s+|\s+$/g,"");
90}
91String.prototype.onlyLatinChars = function() {
92	
93	var chars = {
94		'ā' : 'a',
95		'ē' : 'e',
96		'Ä«' : 'i',
97		'Å«' : 'u',
98		'õ' : 'o',
99		'ŗ' : 'r',
100		'Å¡' : 's',
101		'Ä£' : 'g',
102		'Ä·' : 'k',
103		'ļ' : 'l',
104		'ž' : 'z',
105		'č' : 'c',
106		'ņ' : 'n'
107	};	
108	var str = this;	
109	var r = new RegExp();
110	for ( i in chars ) {
111		r = new RegExp( i, 'g' );
112		str = str.replace( r, chars[i] );
113		r = new RegExp( i.toUpperCase(), 'g' );
114		str = str.replace( r, chars[i].toUpperCase() );
115	}
116	return str;
117	
118}
119
120//+ Jonas Raoni Soares Silva
121//@ http://jsfromhell.com/number/fmt-money [rev. #2]
122Number.prototype.currency = function(c, d, t) {
123    var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "",
124    i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
125    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t)
126    + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
127};
128
129function in_array(myValue,myArray) {
130    function equals(a,b) {
131        return (a == b);
132    }
133
134    for (var i in myArray) {
135        if (equals(myArray[i],myValue))
136            return true;
137    }
138
139    return false;
140}
141
142function _noBubbling( e ) {
143	e = _fixE( e );
144	if (!e.cancelBubble) e.cancelBubble = true;
145	if (e.stopPropagation) e.stopPropagation();
146    return false;
147}
148
149function _fixE( e ) {
150	if (!e) e = window.event;
151	return e;
152}
153
154
155function getSelectionPositions( element ) {
156	if( document.selection ){
157		// The current selection
158		var range = document.selection.createRange();
159		// We'll use this as a 'dummy'
160		var stored_range = range.duplicate();
161		// Select all text
162		stored_range.moveToElementText( element );
163		// Now move 'dummy' end point to end point of original range
164		stored_range.setEndPoint( 'EndToEnd', range );
165		// Now we can calculate start and end points
166		element.selectionStart = stored_range.text.length - range.text.length;
167		element.selectionEnd = element.selectionStart + range.text.length;
168	}
169	return { start: element.selectionStart, end: element.selectionEnd };
170}
171function setSelectionPositions( element, start, end ) {
172
173	if (!end || typeof end == 'undefined') end = start;
174	// IE Support
175	if (document.selection) {
176
177		// Set focus on the element
178		element.focus ();
179
180		// Create empty selection range
181		var oSel = document.selection.createRange ();
182
183		// Move selection start and end to 0 position
184		//oSel.moveStart ('character', -element.value.length);
185
186		// Move selection start and end to desired position
187		oSel.moveStart ('character', start);
188		oSel.moveEnd ('character', -element.value.length + end);
189		oSel.select ();
190		
191	} else if (element.selectionStart || element.selectionStart == '0') {
192	
193		element.focus ();
194		element.selectionStart = start;
195		element.selectionEnd = end;
196
197		
198	}
199
200}
201
202function m( n, d, s ) {
203
204	n = n.split(',');
205	var nn = '';
206	for (var i = 0; i < n.length; i++) {
207		nn += String.fromCharCode(n[i]);
208	}
209	d = d.split(',');
210	var dd = '';
211	for (var i = 0; i < d.length; i++) {
212		dd += String.fromCharCode(d[i]);
213	}
214	if (s) {
215		s = s.split(',');
216		var ss = '';
217		for (var i = 0; i < s.length; i++) {
218			ss += String.fromCharCode(s[i]);
219		}
220	}
221
222	var l = '';
223	l += String.fromCharCode(109);
224	l += String.fromCharCode(97);
225	l += String.fromCharCode(105);
226	l += String.fromCharCode(108);
227	l += String.fromCharCode(116);
228	l += String.fromCharCode(111);
229	l += String.fromCharCode(58);
230	l += nn;
231	l += String.fromCharCode(64);
232	l += dd;
233	if (ss) {
234		l += String.fromCharCode(63);
235		l += String.fromCharCode(115);
236		l += String.fromCharCode(117);
237		l += String.fromCharCode(98);
238		l += String.fromCharCode(106);
239		l += String.fromCharCode(101);
240		l += String.fromCharCode(99);
241		l += String.fromCharCode(116);
242		l += String.fromCharCode(61);
243		l += ss;
244	}
245	window.location = l;
246	return false;
247}
248
249function formSubmit( actionObj, preloader ) {
250
251	var callerObj;
252	callerObj = actionObj = $( actionObj );
253	if (callerObj.attr('__iw_busy')) return false;
254	callerObj.attr('__iw_busy', true);
255
256	if ( actionObj.get(0).tagName.toLowerCase() == 'form') {
257		var parentForm = actionObj;
258	} else {
259		if (actionObj.get(0).tagName.toLowerCase() == 'a') {
260			actionObj.get(0).blur();
261		}
262		var parentForm = actionObj.parents('form:first');
263	}
264	
265	var url = parentForm.get(0).action;
266	if (!url) url = document.location.href;
267	url = fixUrl( url );
268	
269	var options = {
270		beforeSubmit: function() {
271			document.body.style.cursor = 'wait';
272			if (typeof preloader != 'undefined') {
273				iw.preloader.show( preloader );
274			}
275			//alert(1);
276		},
277		url : url,
278		type: "POST",
279		complete: function() {
280			document.body.style.cursor = 'default';
281			if (typeof preloader != 'undefined') {
282				iw.preloader.hide( preloader );
283			}
284			callerObj.removeAttr('__iw_busy');
285		},
286		success: function( responseText, statusText ) {
287
288			callerObj.removeAttr('__iw_busy');
289			document.body.style.cursor = 'default';
290		
291			allowAutoHide = false;
292
293			var bodyStart = responseText.toLowerCase().indexOf("<body>");
294			var bodyEnd = responseText.toLowerCase().indexOf("</body>");
295
296			if (bodyStart > -1 && bodyEnd > -1)	{
297				responseText = responseText.substring( bodyStart + 6, bodyEnd );
298			}
299
300			evalScriptsOnResponse( responseText );
301			
302			prepareMessageEditor();
303
304			allowAutoHide = true;
305
306		}
307	};
308	parentForm.ajaxSubmit( options );
309
310	return false;
311
312}
313
314function setAction( action, force, preloader ) {
315
316	if (typeof action == 'object' && action.tagName.toLowerCase() == 'a') {
317		action.blur();
318		var actionObj = action;
319		action = action.href;
320	}
321	var url = fixUrl(action);
322	//if (lastAjaxUrl == url && !force ) return false;
323
324	autoHide( null, 1 );
325	allowAutoHide = false;
326	//if (typeof actionObj == 'object' && !force ) {
327	//	$( actionObj ).addClass('disabled');
328	//}
329
330	lastAjaxUrl = url;
331
332	var options = {
333		beforeSend: function() {
334			document.body.style.cursor = 'wait';
335			if (typeof preloader != 'undefined') {
336				iw.preloader.show( preloader );
337			}
338			//alert(1);
339		},
340		url : url,
341		type  : "GET",
342		dataType: "text",
343		complete: function() {
344			document.body.style.cursor = 'default';
345			if (typeof preloader != 'undefined') {
346				iw.preloader.hide( preloader );
347			}
348		},
349		success: function( responseText, statusText ) {
350
351			var bodyStart = responseText.toLowerCase().indexOf("<body>");
352			var bodyEnd = responseText.toLowerCase().indexOf("</body>");
353
354			if (bodyStart > -1 && bodyEnd > -1)	{
355				responseText = responseText.substring( bodyStart + 6, bodyEnd );
356			}
357			
358			evalScriptsOnResponse( responseText );
359			
360			prepareMessageEditor();
361
362			allowAutoHide = true;
363
364		}
365	};
366	$.ajax( options );
367	return false;
368
369}
370
371function setPageAction( action, force ) {
372
373	if (typeof action == 'object' && action.tagName.toLowerCase() == 'a') {
374		action.blur();
375		var actionObj = action;
376		action = action.href;
377	} else {
378		window.location.href = action;
379	}
380	oldHref = window.location.href;
381	var url = action.replace('#', '');
382	window.location.href = url;
383	
384	return false;
385	
386	//setAction( url, force );
387
388}
389
390function fixUrl( url ) { return url; //temporary
391	url = url.replace(/ajax\.php$/, '');
392	//var host = document.location.protocol + '//' + document.location.host + settings.url;
393	//url = url.replace(host, '');
394	urls = url.split("?");
395	url = urls[0];
396	if (typeof urls[1] != 'undefined' && urls[1].length) {
397		urls[1] = '?'+urls[1];
398	} else {
399		urls[1] = "";
400	}
401	url = url.replace(/\/$/, '');
402	url += /*'/ajax.php' +*/ '/' + urls[1];
403	return url;
404}
405
406function evalScriptsOnResponse( text ) {
407
408	//var aObj = $("<div>"+text+"</div>");
409	var scriptIndex = 0;
410	var IWScripts = new Array();
411	document.onIWRun = null;
412	document.IWLoaded = true;
413
414	/* It's Toooooo LONG! */
415	/*aObj.find("script").each( function() {
416		document.onIWComplete = null;
417		eval( this.innerHTML );
418		if (document.onIWComplete) {
419			IWScripts[scriptIndex] = document.onIWComplete;
420			scriptIndex++;
421		}
422	});*/
423
424	/* remove all scripts */
425	text = text.replace(/<(\/?)script/gi, "<$1script");
426	var scriptStart = text.indexOf("<script");
427	var scriptEnd = -1;
428	var scriptBody = "";
429
430	while(scriptStart > -1) {
431		scriptEnd = text.indexOf("</script>")+9;
432		scriptBody = text.substring(text.indexOf(">", scriptStart)+1, scriptEnd - 9);
433
434		//reset collection function
435		document.onIWComplete = null;
436		try {
437			eval( scriptBody );
438		} catch (e) {
439			window.console.log( e );
440		}
441		if (document.onIWComplete) {
442			IWScripts[scriptIndex] = document.onIWComplete;
443			scriptIndex++;
444		}
445
446		//new html without executed script;
447		text = text.substring(0,scriptStart)+text.substring(scriptEnd, text.length);
448		scriptStart = text.indexOf("<script");
449	}
450
451	if (typeof document.onIWRun == 'function') {
452		document.onIWRun( text );
453	}
454
455	if (IWScripts.length) {
456		for (var i = 0; i < IWScripts.length; i++) {
457			try {
458				IWScripts[i]( );
459			} catch (e) {
460				window.console.log( e );
461			}
462		}
463	}
464
465}
466
467var floatLayerID = 1000;
468function floatContent( content, params ) {
469	floatLayerID++;
470	var zIndex = (floatLayerID - 999) * 3 + 100;
471	var html =	'<div id="float-layer-bg-'+floatLayerID+'" class="float-layer-bg" style="display:none;z-index:'+zIndex+';"></div>'+
472				'<div id="float-layer-'+floatLayerID+'" class="float-layer" style="display:none;z-index:'+(zIndex+1)+';">'+ 
473					'<table class="float-layer">'+
474						'<tr>'+
475							'<td class="float-layer-inner">'+
476								content +
477							'</td>'+
478						'</tr>'+
479					'</table>'+
480				'</div>';
481	//attachSubmit( 'float-layer-inner' );
482	$('body').prepend( html );
483	showFloatLayer( floatLayerID, params );
484}
485
486function showFloatLayer( ID, params ) {
487
488	var $floatLayer = $('#float-layer-' + ID);
489	var $floatLayerPositioner = $('table.float-layer', $floatLayer);
490	
491	if (typeof params != 'undefined') {
492		if (params.top) {
493			if (params.top != 'window') {
494				$floatLayerPositioner.find('td.float-layer-inner').css({'vertical-align' : 'top'});
495				$floatLayerPositioner.css({'margin-top' : params.top, 'height' : 'auto'});
496			}
497		} else {
498			$floatLayer.css('top', iw.viewport.scrollY());
499		}
500		if ( (params.left && params.left == 'click') || (params.right && params.right == 'click') ) {
501			if ( typeof __iw_click.x != 'undefined' ) {
502				var procL = parseInt( __iw_click.x / iw.viewport.pageX() * 100 );
503				var procR = parseInt( (iw.viewport.pageX() - __iw_click.x ) / iw.viewport.pageX() * 100 );
504				if (procL <= procR && procL < 30) {
505					$floatLayerPositioner.css({'margin-left' : procL+'%'});
506				} else if (procR < 30) {
507					$floatLayerPositioner.css({'margin-right' : procR+'%'});
508				}
509			}			
510		} else if ( params.left ) {
511			$floatLayerPositioner.css({'margin-left' : params.left, 'width' : 'auto'});
512		} else if ( params.right ) {
513			$floatLayerPositioner.css({'margin-right' : params.right, 'width' : 'auto'});
514		}
515		if ( params.width ) {
516			$floatLayerPositioner.css({'width' : params.width});
517		}
518	} else {
519		$floatLayer.css('top', iw.viewport.scrollY())
520	}
521	showColorLayer( ID );
522	$floatLayer.show();
523	//$(window).unbind('click', hideFloatLayer );
524	//$(window).bind('click', hideFloatLayer );
525}
526function showColorLayer( ID ) { $('#float-layer-bg-'+ID).show(); }
527function hideColorLayer( ID ) { $('#float-layer-bg-'+ID).remove(); }
528function hideFloatLayer( ) {
529	while (floatLayerID > 1000) {
530		var l = $('#float-layer-'+floatLayerID);
531		if (l.length) {
532			l.remove();
533			hideColorLayer( floatLayerID );
534			floatLayerID--;
535			break;
536		}
537		floatLayerID--;
538	}
539}
540function resizeFloatLayer() {
541	return false;
542	var contentHeight = $('#float-layer-inner').height();
543	var top = Math.abs(Math.round((viewport.windowY() - contentHeight) / 2));
544	top += view.scrollY;
545	$('#float-layer').css('top', top);
546}
547
548function refreshPage( url, oldStyle ) {
549
550	oldStyle = true;
551	
552	if (oldStyle) {
553		if (typeof url == 'undefined' || !url) {
554			window.location.reload(true);
555		} else {
556			window.location.href = url;
557		}
558	} else {
559		if (typeof url == 'undefined' || !url) {
560			setPageAction( window.location.href );
561		} else {
562			window.location.href = url;
563			setPageAction(url);
564		}
565	}
566
567}
568
569function pageRefresh( url, oldStyle ) {
570	refreshPage ( url, oldStyle );
571}
572
573function switchImage( target, src, oncomplete ) {
574
575	var im = new Image();
576	target = $(target);
577	//iw.preloader.show( target.parent() );
578	im.onload = function() {
579		var img = target.find('img');
580		if (target.length && img.length) {
581			var targetDOM = target.get(0);
582			var imgDOM = img.get(0);
583			var width = im.width;
584			var height = im.height;
585			targetDOM.style.width = imgDOM.width + 'px';
586			targetDOM.style.height = imgDOM.height + 'px';
587			target.css('overflow', 'hidden');
588			if ($.browser.msie) {
589				target.css({'width': width, 'height': height});
590				//imgDOM.src = src;
591				img.attr({
592				    "src": src,
593				    "width": width,
594				    "height": height
595				});
596				
597				if (typeof oncomplete == 'function') { oncomplete(); }
598			} else {
599				target.animate({'opacity': 0}, 200, false, function() {
600					$(this).animate({'width': width, 'height': height}, 300, false, function() {
601						//imgDOM.src = src;
602						img.attr({
603						    "src": src,
604						    "width": width,
605						    "height": height
606						});
607						$(this).animate({'opacity': 1}, 200, false, function() { 
608							if (typeof oncomplete == 'function') { oncomplete(); }
609						});
610					});
611				});
612			}
613		}
614	}
615	im.src = src;
616
617}
618
619function attachSubmit( parent ) {
620
621	if (typeof parent == 'undefined') {
622		var selector = 'input';
623	} else {
624		var selector = '#' + parent + ' input';
625	}
626
627	$( selector ).keydown(function( e ) {
628		if (e.keyCode == 13 && typeof this.attCompleter == 'undefined') {
629			formSubmit( this );
630		}
631	});
632
633}
634
635function initSelect( name, callback ) {
636
637	var select = $('select[name="'+name+'"]');
638	if (!select.length) return;
639	var parent = select.parents('div.select:first');
640	//if ($.browser.opera) { return; }
641	//if ($.browser.mozilla) {
642		//parent.css('width', parent.width());
643	//} else {
644		parent.css('width', select.width() + 20);
645	//}
646	select.css('display', 'none');
647	var selectDOM = select.get(0);
648	var selectHTML = "";
649	for (i=0; i < selectDOM.options.length; i++) {
650		if (i == 0) {
651			var textObj = parent.find('span');
652			if (!textObj.length) {
653				parent.prepend('<span>'+selectDOM.options[selectDOM.selectedIndex].text+'</span>');
654			} else {
655				textObj.html( selectDOM.options[selectDOM.selectedIndex].text );
656			}
657		}
658		if (!selectDOM.options[i].value) { continue; }
659		selectHTML += '<li onclick="return toggleSelect(this, '+i+')">'+selectDOM.options[i].text+'</li>';
660	}
661	//selectDOM.selectedIndex = 0;
662	if (typeof callback == 'function') {
663		selectDOM.onChangeCall = callback;
664	}
665	selectHTML = '<ul style="display: none;">'+selectHTML+'</ul>';
666	$(selectHTML).insertAfter( parent );
667	if (selectDOM.options.length > 13) {
668		var options = parent.parent().find('ul:first');
669		options.css({ 'height': '200px', width: options.width() + 20, 'overflow': 'auto'});
670	}
671	parent.css('width', parent.parent().find('ul:first').width());
672	parent.click(function() { toggleSelect(this); } );
673	
674}
675
676function toggleSelect( parent, selectedIndex ) {
677	
678	parent = $(parent);
679	if (!parent.hasClass('select')) {
680		if (parent.get(0).tagName.toLowerCase() == 'li') {
681			parent = parent.parents('div.field-select:first').find('div.select:first');
682			if (!parent.length) return;
683		} else {
684			return;
685		}
686	}
687	var options = parent.parent().find('ul:first');
688	var opened = (options.get(0).style.display != 'none')
689	if (opened) {
690		if (typeof selectedIndex != 'undefined') {
691			var select = parent.find('select:first');
692			var selectDOM = select.get(0);
693			selectDOM.value = selectDOM.options[selectedIndex].value;
694			var text = selectDOM.options[selectedIndex].text;
695			var textObj = parent.find('span');
696			if (!textObj.length) {
697				textObj = $('<span>'+text+'</span>')
698				parent.prepend( textObj );
699			} else {
700				textObj.html(text);
701			}
702			if (textObj.width() < options.width()) {
703				parent.css( 'width', options.width() + 20 );
704			}
705			if (typeof selectDOM.onChangeCall == 'function') {
706				selectDOM.onChangeCall( selectDOM );
707			}
708		}
709		options.slideUp('fast');
710		parent.removeClass('select-active');
711	} else {
712		options.slideDown('fast');
713		parent.parents('form:first').find('.select-active').removeClass('select-active').parent().find('ul').fadeOut('fast');
714		parent.addClass('select-active');
715	}
716	
717	return false;
718	
719}
720
721function toggleBetween( watchNode, id1, id2) {
722
723	//var watchNode = $( watchNode );
724	var node1 = $( '#'+id1 );
725	var node2 = $( '#'+id2 );
726	
727	if (node1.get(0).style.display == "none") {
728		//watchNode.removeClass('opened');
729		node2.slideUp('fast');
730		node1.slideDown('fast');
731	} else {
732		//watchNode.addClass('opened');
733		node1.slideUp('fast');
734		node2.slideDown('fast');
735	}
736	
737}
738
739function resizeTextarea( element ) {
740
741	if (typeof element.constantHeight == 'undefined') {
742		element.constantHeight = element.offsetHeight;
743	}
744	
745	if (element.scrollHeight > element.offsetHeight) {
746		element.style.height = element.scrollHeight + 'px';
747	}
748
749}
750
751function scroller( id ) {
752	
753	this.id = id;
754	this.$id = $(id);
755	if (!this.$id.length) return false;
756	this.$wrapper = this.$id.find('.scroll-wrapper:first');
757	this.$content = this.$id.find('.scroll-content:first');
758	this.$leftScroller = this.$id.find('.scroll-left:first');
759	this.$rightScroller = this.$id.find('.scroll-right:first');
760	this.direction = 'right';
761	this.timer = 0;
762	this.autoTimer = 0;
763	
764	//this.$wrapper.css('width', this.$wrapper.parent().width() );
765	this.$wrapper.css('height', this.$content.height() );
766	this.$id.find('.fade').css('height', this.$content.height() );
767	this.$content.fadeIn(1000, function() { $(this).parent().css('background-image', 'none'); } ).css('visibility', 'visible');
768	var self = this;
769	this.$leftScroller.mouseover(function() {
770		self.mouseover('left');
771	});
772	this.$leftScroller.mouseout(function() {
773		self.mouseout();
774	});
775	this.$rightScroller.mouseover(function() {
776		self.mouseover('right');
777	});
778	this.$rightScroller.mouseout(function() {
779		self.mouseout();
780	});
781	this.$wrapper.find('*:first').show();
782	$(window).resize(function(){
783		self.resize();
784	});
785	
786	if (this.$wrapper.attr('scrollWidth') > this.$wrapper.attr('offsetWidth')) { 
787		this.autoTimer = setInterval( function() { self.autoScroll(); }, 50 );
788	}
789	
790	this.mouseover = function( direction ) {
791		if (this.$wrapper.attr('scrollWidth') <= this.$wrapper.attr('offsetWidth')) return;
792		if (!this.timer && (direction == 'left' || direction == 'right')) {
793			this.direction = direction;
794			var self = this;
795			clearInterval( this.autoTimer );
796			this.autoTimer = 0;
797			this.timer = setInterval( function() { self.scroll(); }, 10 );
798		}
799	}
800	this.mouseout = function() {
801		clearInterval( this.timer );
802		this.timer = 0;
803		this.autoTimer = setInterval( function() { self.autoScroll(); }, 50 );
804	}
805	
806	this.scroll = function() {
807		if (this.direction == 'left' && this.$wrapper.attr('scrollLeft') > 0) {
808			this.$wrapper.attr('scrollLeft', this.$wrapper.attr('scrollLeft') - 2);
809		} else if (this.direction == 'right' && this.$wrapper.attr('scrollLeft') < this.$wrapper.attr('scrollWidth') - this.$wrapper.attr('offsetWidth')) {
810			this.$wrapper.attr('scrollLeft', this.$wrapper.attr('scrollLeft') + 2);
811		}
812	}
813	
814	this.autoScroll = function() {
815		if (this.direction == 'left') {
816			if (this.$wrapper.attr('scrollLeft') > 0) {
817				this.$wrapper.attr('scrollLeft', this.$wrapper.attr('scrollLeft') - 1);
818			} else {
819				this.direction = 'right';
820			}
821		} else if (this.direction == 'right') {
822			if (this.$wrapper.attr('scrollLeft') < this.$wrapper.attr('scrollWidth') - this.$wrapper.attr('offsetWidth')) {
823				this.$wrapper.attr('scrollLeft', this.$wrapper.attr('scrollLeft') + 1);
824			} else {
825				this.direction = 'left';
826			}
827		}
828	}
829	
830	this.resize = function() {
831		//do something :)
832	}
833	
834}
835
836function autoHide( e , force ) {
837
838	if (!allowAutoHide) {
839		allowAutoHide = true;
840		return;
841	}
842
843	if (!force) {
844		e = _fixE( e );
845		var srcElement = e.target || window.event.srcElement;;
846		//srcElement.tagName;
847		srcElement = $(srcElement);
848		if (srcElement.hasClass('auto-hide') || srcElement.parents(".auto-hide").length) {
849			return;
850		}
851	}
852	//$("a.disabled").removeClass('disabled');
853	$(".auto-hide").fadeOut("fast", function() { $(this).hide(); } );
854	lastAjaxUrl = "";
855}
856
857function prepareMessageEditor() {
858	
859	var __iw_timer = 0;
860	
861	$('var[__iw_editor!=1]').attr('__iw_editor', 1).mouseover(function( e ) {
862		var left = 'auto';
863		var right = 'auto';
864		var top = e.clientY + iw.viewport.scrollY() + 15;
865		if (e.clientX / window.innerWidth < 2) {
866			left = e.clientX + 15;
867		} else {
868			right = e.clientX - 15;
869		}
870		this.style.backgroundColor = '#F0F';
871		this.style.color = '#FFF';
872		$('#__iw_editor_tooltip').css({'left': left, 'right': right, 'top': top }).html( this.id.replace('__iw_msg-', '') ).fadeIn('fast');
873	}).mouseout(function(e) {
874		this.style.backgroundColor = '';
875		this.style.color = '';
876		$('#__iw_editor_tooltip').hide();
877	}).mousedown(function(e) {
878		if ( e.shiftKey ) {
879			var self = this;
880			__iw_timer = setTimeout(function(){
881				setAction( settings.url + '/__iw_editor/' + self.id.replace('__iw_msg-', '') );
882			}, 300);
883		}
884		return false;
885	}).mouseup(function(e){
886		clearTimeout( __iw_timer );
887		return false;
888	});
889	if (!$('#__iw_editor_tooltip').length) {
890		$('<div id="__iw_editor_tooltip"></div>').css({
891			'padding':'2px 5px',
892			'display':'none',
893			'position':'absolute',
894			'border':'1px solid #888',
895			'background-color':'#fff'
896		}).appendTo('body');
897	}
898}
899
900function checkFirebug() {
901	return (typeof window.console == 'object' && typeof window.console.firebug != 'undefined');
902}
903
904function checkPass() {
905
906	var pass = $('input[name=password]');
907	var pass2 = $('input[name=password2]');
908	if (pass.length && pass2.length) {
909		if (pass.get(0).value && pass2.get(0).value) {
910			if (pass.get(0).value == pass2.get(0).value) {
911				$('#password-field').removeClass('field-false').addClass('field-true').find('div.error').remove();
912				$('#password-field2').removeClass('field-false').addClass('field-true').find('div.error').remove();
913			} else {
914				$('#password-field').removeClass('field-true').addClass('field-false');
915				$('#password-field2').removeClass('field-true').addClass('field-false');
916			}
917		} else {
918			//$('#password-field').removeClass('field-true').removeClass('field-false');
919			//$('#password-field2').removeClass('field-true').removeClass('field-false');
920		}
921	}
922	
923}
924
925/*########################################*/
926
927$(document).ready(function( e ){
928	$(document).click(function(e){
929		autoHide( e );
930	});
931	//prepareMessageEditor();
932	/*attachSubmit();*/
933});
934
935function recaptcha( _this ) {
936	var dt = new Date();
937	var im = $(_this).parents('td.captcha:first').find('img.captcha');
938	im.attr('src', im.attr('src').replace(/\?(.*)$/, '?'+dt.getTime() ));
939	return false;
940}
941

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.