PageSourceSearch

https://www.forthvalleyrapecrisis.org.uk/scripting/fvrcc.js?0801

js forthvalleyrapecrisis.org.uk collected 2026-10-08 03:06:00 UTC 12,167 bytes, 458 lines download raw bytes

1function initCheckForm() {
2	$$('#pageform input, #pageform select').addEvent('change', checkForm);
3	checkForm();
4}
5function checkForm() {
6	if($('question_44')) {
7		if($('question_44').value == 4 || $('question_44').value == 0) {
8			var show = "none";
9			if($('question_45').value == "") $('question_45').value = "N/A";
10			if($('question_46').value == "") $('question_46').value = "N/A";
11			if($('question_47').value == "") $('question_47').value = "N/A";
12			if($('question_48').value == "") $('question_48').value = "[email protected]";
13			$('question_49').value = "6";
14		}
15		else {
16			var show = "block";
17			if($('question_45').value == "N/A") $('question_45').value = "";
18			if($('question_46').value == "N/A") $('question_46').value = "";
19			if($('question_47').value == "N/A") $('question_47').value = "";
20			if($('question_48').value == "[email protected]") $('question_48').value = "";
21		}
22		$('question_45').parentNode.setStyle('display', show);
23		$('question_46').parentNode.setStyle('display', show);
24		$('question_47').parentNode.setStyle('display', show);
25		$('question_48').parentNode.setStyle('display', show);
26		$('question_49').parentNode.setStyle('display', show);
27		
28		if($('question_58').value == 13) {
29			var show = "block";
30			if($('question_59').value == "N/A") $('question_59').value = "";
31		}
32		else {
33			var show = "none";
34			if($('question_59').value == "") $('question_59').value = "N/A";
35		}
36		$('question_59').parentNode.setStyle('display', show);
37
38		if($('question_60').value == 15) {
39			var show = "block";
40			if($('question_61').value == "N/A") $('question_61').value = "";
41		}
42		else {
43			var show = "none";
44			if($('question_61').value == "") $('question_61').value = "N/A";
45		}
46		$('question_61').parentNode.setStyle('display', show);
47
48	}
49}
50var faqsized = 0;
51function togglefaq(el) {
52	if(faqsized == 0) {
53		sizefaq();
54		setTimeout(function() {
55			togglefaq(el);
56		}, 10);
57	}
58	else {
59		var cn = el.target.parentNode.className;
60		if(cn.indexOf('faqshown') == -1) {
61			el.target.parentNode.className = 'faqjs faqshown';
62			window.location.hash = 'rl' + el.target.parentNode.id;
63		}
64		else el.target.parentNode.className = 'faqjs faq';
65	}
66}
67function initfaq() {
68	var h = window.location.hash.replace(/#/, '');
69	h = h.replace(/rlslider/, 'slider');
70	if(h.indexOf('slider') != -1) {
71		new Fx.Scroll(window).toElement(h);
72	}
73	$$('.questionanswer').each(function(el) {
74		if(h == el.parentNode.id) el.parentNode.className = "faqjs faqshown";
75		else el.parentNode.className = "faqjs faq";
76	});
77}
78function sizefaq() {
79	$$('.questionanswer').each(function(el) {
80		el.addClass('notrans');
81		setTimeout(function() {
82			el.addClass('answershown');
83			var h = el.getSize().y;
84			el.setStyle('max-height', h + 'px');
85			el.removeClass('answershown');
86			setTimeout(function() {
87				el.removeClass('notrans');
88			}, 5);
89		}, 5);
90	});
91	faqsized = 1;
92}
93
94
95// Change these
96var rotatetime = 4000; // Time for each image to be displayed in milliseconds
97var fadetime = 1500; // Time for cross-fade in milliseconds
98
99// Don't touch these!
100var rotateimgs = new Array();
101var pos = 0;
102var go;
103var inprogress = 0;
104
105function getimages(div) {
106	var container = $(div);
107	var nodes = "DIV";
108	for(var i = 0; i < container.childNodes.length; i++) {
109		if(container.childNodes[i].nodeName == nodes && container.childNodes[i].id != "intro") {
110			container.childNodes[i].id = "fadeimg_" + i;
111			$('fadeimg_' + i).style.display = "none";
112			rotateimgs[rotateimgs.length] = container.childNodes[i];
113			if(rotateimgs.length == 1) container.childNodes[i].style.display = "block";
114		}
115	}
116	if(rotateimgs.length > 1) go = setInterval(rotateimages, rotatetime + fadetime);
117}
118
119function rotateimages() {
120	if(!rotateimgs[pos + 1]) var newpos = 0;
121	else var newpos = pos + 1;
122	fadeimg(rotateimgs[newpos], rotateimgs[pos]);
123	pos = newpos;
124}
125
126function fadeimg(el, oldel) {
127	var myFade = new Fx.Tween($(el.id), {
128		duration: fadetime,
129		onStart: function() { inprogress = 1; },
130		onComplete: function() { 
131			oldel.style.display = "none";
132			inprogress = 0;
133		}
134	});
135	myFade.set('opacity', 0);
136	el.style.display = "block";
137	oldel.style.zIndex = 4;
138	el.style.zIndex = 5;
139	myFade.start('opacity', 1);
140}
141
142var picbottom = 0, imgpos = 0, lhf = -1;
143function checkpos() {
144	if($('imgfade')) {
145	var sp = window.getScroll().y;
146	if(picbottom == 0) {
147		imgpos = $('imgfade').getPosition().y;
148		picbottom = $('imgfade').getSize().y;
149	}
150
151	if(picbottom != 0) {
152		var np = 100 - (sp / (imgpos + picbottom) * 100);
153		if(np < 0) np = 0;
154		else if(np > 100) np = 100;
155		$$('#imgfade .img').setStyle('background-position', 'center ' + np + '%');
156	}
157	}
158
159}
160
161function sizeboxes() {
162	$$('.newsbox').setStyle('height', 'auto');
163	var nh = 0;
164	for(var i = 1; i <= 4; i++) {
165	    if($('newsboxcont_' + i)) {
166            var ch = $('newsboxcont_' + i).getSize().y;
167            if(ch > nh) nh = ch;
168        }
169	}
170	$$('.newsbox').setStyle('height', nh + 'px');
171
172	$$('.frontthree').setStyle('height', 'auto');
173	$$('.fronttwo').setStyle('height', 'auto');
174	var nh1 = 0, nh2 = 0;
175	for(var i = 1; i <= 3; i++) {
176		var ch1 = $('frontcont_' + i).getSize().y;
177		if(ch1 > nh1) nh1 = ch1;
178		if(i < 3) {
179			var ch2 = $('frontmidcont_' + i).getSize().y;
180			if(ch2 > nh2) nh2 = ch2;
181		}
182	}
183
184	$$('.frontthree').setStyle('height', nh1 + 'px');
185	$$('.fronttwo').setStyle('height', nh2 + 'px');
186	
187	
188}
189
190function leavesite() {
191	var leaveurl = "http://www.bbc.co.uk/news/";
192	var leavetitle = "Home - BBC News";
193	if(window.history.replaceState) {
194		document.title = leavetitle;
195		history.replaceState(null, null, "bbc.php");
196		var timewait = 100;
197	}
198	else var timewait = 0;
199	setTimeout(function() {
200		if(window.location.replace) window.location.replace(leaveurl);
201		else window.location = leaveurl;
202	}, timewait);
203}
204
205var heights = [];
206var myMenu = [];
207var prepped = 0;
208
209function menuin(el) {
210	el.childNodes[1].setStyle('max-height',sh[el.id] + 'px');
211}
212function menuout(el) {
213	el.childNodes[1].setStyle('max-height',0);
214}
215
216var prepped = 0, sh = [];
217function prepmenu() {
218	$$('.fl_menu > li').each(function(el) {
219		if(el.childNodes.length > 1) {
220			el.childNodes[1].addClass('size');
221			if(prepped == 0) {
222				el.addEvent('mouseenter', function(){
223					menuin(this);
224				});			
225				el.addEvent('mouseleave', function(){
226					menuout(this);
227				});			
228			}
229			el.childNodes[1].setStyle('max-height', 'none');
230			var h = el.childNodes[1].getSize().y;
231			el.childNodes[1].setStyle('max-height', 0);
232			setTimeout(function() { el.childNodes[1].removeClass('size'); }, 10);
233			sh[el.id] = h;
234		}
235	});
236	prepped = 1;
237
238
239}
240
241
242function doSlide(parentid, dir) {
243	var submenu = $(parentid).childNodes[1];
244	var elheight = heights[parentid].y;
245	if(!myMenu[parentid]) {
246		myMenu[parentid] = new Fx.Tween(submenu, {
247			duration: 200,
248			link: 'cancel',
249			property: 'height'
250		});
251	}
252	if(dir == 'in') myMenu[parentid].start(elheight);
253	else myMenu[parentid].start(0);
254}
255
256function is_touch_device() {
257    return (typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1);
258}
259function is_touch_support() {
260	return !!('ontouchstart' in window);
261}
262
263var curclicked = "", curlinks = [], screensize = 0, lastscreensize = 0, screeny = 0, lastscreeny = 0, menushown = 0, toggled = 0;
264function togglemenu() {
265	if(toggled == 0) {
266		if(menushown == 0) {
267			var show = "block";
268			menushown = 1;
269			var buttonclass = "menushown";
270		}
271		else {
272			var show = "none";
273			menushown = 0;
274			var buttonclass = "";
275		}
276		$('menu').removeClass('menunone');
277		$('menu').removeClass('menublock');
278		document.body.removeClass('menublock');
279		$('menu').addClass('menu' + show);
280		document.body.addClass('menu' + show);
281		$('menubutton').className = buttonclass;
282		toggled = 1;
283	}
284}
285
286var menuinpro = 0, menusize = 768;
287var active = [], prevent = 0, curclicked = '';
288
289window.addEvent('domready', function() {
290	$('escavail').setStyle('display', 'inline');
291    if(is_touch_device()) {
292    	$('escavail').setStyle('display', 'none');
293    	$('clicktap').innerHTML = "Tap";
294    }
295
296    screensize = window.getSize().x;
297    lastscreensize = screensize;
298    if(screensize < menusize) {
299		menushown = 0;
300		$('menu').addClass('menunone');
301		$('menu').removeClass('menublock');
302		document.body.removeClass('menublock');
303		$('menubutton').className = "";
304		setTimeout(function() {
305			$('menu').addClass('menutrans');
306		}, 50);
307    }
308    else prepmenu();
309
310	var preptouch = 1;
311	if(navigator.platform.indexOf('MacIntel') != -1 && is_touch_device()) preptouch = 0;
312
313	$$('.fl_menu > li').each(function(el) {
314		if(el.childNodes.length > 1) {
315			el.addClass('hassubmenu');
316			active[el.id] = 0;
317			el.firstChild.addEvent('click', function(e) {
318				if($('menu').className.indexOf('menublock') == -1 && is_touch_device()
318) {
319					e.preventDefault();
320					if(curclicked != el.id) {
321						if(curclicked != '') menuout($(curclicked));
322						curclicked = el.id;
323						menuin($(curclicked));
324						prevent = 1;
325						setTimeout(function() { prevent = 0; }, 400);
326					}
327					else window.location = el.firstChild.href;
328				}
329			});
330			el.childNodes[1].addEvent('click', function() {
331				if(preptouch == 1 || screensize < menusize) {
332					prevent = 1;
333					setTimeout(function() { prevent = 0; }, 400);
334				}
335			});
336			el.firstChild.firstChild.addEvent('click', function() {
337				if($('menu').className.indexOf('menublock') != -1 && (preptouch == 1 || screensize < menusize)) {
338					window.location.href = el.firstChild.href;
339					prevent = 1;
340					setTimeout(function() { prevent = 0; }, 400);
341				}
342			});
343			el.addEvent('click', function(e) {
344				if(prevent != 1 && $('menu').className.indexOf('menublock') != -1 && (preptouch == 1 || screensize < menusize)) {
345					e.preventDefault();
346					if(active[el.id] == 0) {
347						el.addClass('expanded');
348						el.childNodes[1].addClass('tapped');
349						active[el.id] = 1;
350					}
351					else {
352						el.removeClass('expanded');
353						el.childNodes[1].removeClass('tapped');
354						active[el.id] = 0;
355					}
356				}
357			});
358		}
359	});
360
361	$('menubutton').addEvent('click', function() {
362		toggled = 0;
363		togglemenu();
364	});
365	$('menubg').addEvent('click', function() {
366		toggled = 0;
367		togglemenu();
368	});
369
370	if($('front_1')) sizeboxes();
371   	if($('imgfade')) {
372   		getimages('imgfade');
373   		checkpos();
374   	}
375
376	if($('faq')) {
377		$$('.questiontitle').addEvent('click', togglefaq);
378		initfaq();
379	}
380	
381	if($('pageform')) initCheckForm();
382
383	document.body.addClass('hasjs');
384	$$('.bslvidwrap a').addEvent('click', function(e) {
385		e.preventDefault();
386		this.parentNode.parentNode.addClass('showvid');
387	});
388	$$('.bslvid').addEvent('click', function(e) {
389		e.stopPropagation();
390	});
391	$$('.bslvidcontainer').addEvent('click', function(e) {
392		this.parentNode.removeClass('showvid');
393	});
394	$$('.bslvidclose').addEvent('click', function(e) {
395		e.preventDefault();
396		this.parentNode.parentNode.parentNode.parentNode.removeClass('showvid');
397	});
398
399});
400window.addEvent('keydown', function(e) {
401	if(e.key == "esc") leavesite();
402});
403
404window.addEvent('load', function() {
405	if(screensize >= menusize) {
406		prepmenu();
407	}
408	if($('front_1')) sizeboxes();
409});
410
411if(is_touch_device()) {
412	window.addEvent('touchstart', function(e) {
413		setTimeout(function() {
414			if(curclicked != '' && prevent != 1) {
415				menuout($(curclicked));
416				curclicked = '';
417			}
418		}, 350);
419	});
420}
421
422window.addEvent('resize', function() {
423    screensize = window.getSize().x;
424    if(screensize != lastscreensize) {
425    	lastscreensize = screensize;
426		if($('faq')) sizefaq();
427		if(screensize >= menusize) {
428			menurun = 0;
429			menushown = 1;
430			$('menu').removeClass('menunone');
431			$('menu').removeClass('menublock');
432			$('menu').removeClass('menutrans');
433			document.body.removeClass('menublock');
434			prepmenu();
435		}
436		else {
437			menushown = 0;
438			$('menu').removeClass('menublock');
439			$('menu').addClass('menunone');
440			document.body.removeClass('menublock');
441			$('menubutton').className = "";
442			setTimeout(function() {
443				$('menu').addClass('menutrans');
444			}, 50);
445		}
446		if(curclicked != "") {
447			$(curclicked).removeClass('hovered');
448			curclicked = "";
449		}
450		if($('front_1')) sizeboxes();
451		picbottom = 0;
452		checkpos();
453	}
454});
455
456window.addEvent('scroll', checkpos);
457window.addEvent('touchstart', function() {});
458

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.