PageSourceSearch

http://www.redemptionplus.com/_PROJECT/_Script.js?674.4196

js redemptionplus.com collected 2026-09-30 23:09:16 UTC 21,066 bytes, 684 lines download raw bytes

1var g_menu = new Array();
2var smile = function() {}
3smile.String = function() {}
4smile.String.Trim = function(st) {
5	var len = st.length
6	var begin = 0, end = len - 1;
7	while (st.charAt(begin) == " " && begin < len) {
8		begin++;
9	}
10	while (st.charAt(end) == " " && begin < end) {
11		end--;
12	}
13	return st.substring(begin, end + 1);
14}
15smile.String.FormatPhone = function(s) {
16	var ov = smile.String.Trim(s);
17	var v = "";
18	var x = -1;
19
20	// is this phone number 'escaped' by a leading plus? 
21	if (0 < ov.length && '+' != ov.charAt(0)) { // format it 
22		// count number of digits 
23		var n = 0;
24		if ('1' == ov.charAt(0)) {  // skip it 
25			ov = ov.substring(1, ov.length);
26		}
27
28		for (i = 0; i < ov.length; i++) {
29			var ch = ov.charAt(i);
30
31			// build up formatted number 
32			if (ch >= '0' && ch <= '9') {
33				if (n == 0) v += "(";
34				else if (n == 3) v += ") ";
35				else if (n == 6) v += "-";
36				v += ch;
37				n++;
38			}
39			// check for extension type section; 
40			// are spaces, dots, dashes and parentheses the only valid non-digits in a phone number? 
41			if (!(ch >= '0' && ch <= '9') && ch != ' ' && ch != '-' && ch != '.' && ch != '(' && ch != ')') {
42				x = i;
43				break;
44			}
45		}
46		// add the extension 
47		if (x >= 0) v += " " + ov.substring(x, ov.length);
48
49		// if we recognize the number, then format it 
50		if (n == 10 && v.length <= 40) return v;
51	}
52	//if we make it this far just return the original value
53	return ov;
54}
55smile.String.toTitleCase = function (s) {
56    return s.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
57};
58
59smile.Emailer = function() {}
60smile.Emailer.Position = function(obj) {
61	var curleft = 0;
62	var curtop = 0;
63	if (obj.offsetParent) {
64		do {
65			curleft += obj.offsetLeft;
66			curtop += obj.offsetTop;
67		} while (obj = obj.offsetParent);
68	}
69	return [curleft, curtop];
70}
71smile.Emailer.Click = function(o) {
72	var aryPosition = smile.Emailer.Position(o);
73		
74	var oFra = document.getElementById("fraContact");
75	oFra.src = o.href;
76
77	//Set the position and make visible.
78	var oDivFra = document.getElementById("div-fraContact");
79	oDivFra.style.left = (aryPosition[0]) + 'px';
80	oDivFra.style.top = (aryPosition[1] + 35) + 'px';
81
82	//Show the email form.
83	smile.Emailer.Ready();
84
85	return false;
86}
87smile.Emailer.Ready = function() {document.getElementById("div-fraContact").style.display = 'block';}
88smile.Emailer.Close = function() {document.getElementById("div-fraContact").style.display = '';}
89
90smile.Link = function() {}
91smile.Link.SessionLink = function(sDir) {
92	var s = window.location.search.substring(window.location.search.indexOf('IdS'), window.location.search.length);
93	if (sDir.indexOf('?') != -1)
94		window.location = sDir + '&' + s;
95	else
96		window.location = sDir + '?' + s;
97}
98
99smile.UI = function() {}
100smile.UI.CategoryHover = function(o) {
101	var o2 = o.getElementsByTagName("ul");
102	if (o2[0]) {
103		var i = document.body.scrollTop;
104		if (i == 0) i = document.documentElement.scrollTop;
105
106		var iHeight = 0;
107		try {
108			iHeight = o2[0].clientHeight;
109		}
110		catch (ex) {
111			if (iHeight == 0) iHeight = o2[0].offsetHeight;
112		}
113
114		var iTop = ((iHeight / 2) - 65) * -1;
115		o2[0].style.top = iTop + 'px';
116	}
117}
118
119smile.Validate = function() {}
120smile.Validate.IsDate = function(s) {
121	//Thanks to http://jquerybyexample.blogspot.com/2011/12/validate-date-using-jquery.html
122    var currVal = s;
123    if(currVal == '')
124        return false;
125    
126    var rxDatePattern = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/; //Declare Regex
127    var dtArray = currVal.match(rxDatePattern); // is format OK?
128    
129    if (dtArray == null) 
130        return false;
131    
132    //Checks for mm/dd/yyyy format.
133    dtMonth = dtArray[1];
134    dtDay= dtArray[3];
135    dtYear = dtArray[5];        
136    
137    if (dtMonth < 1 || dtMonth > 12) 
138        return false;
139    else if (dtDay < 1 || dtDay> 31) 
140        return false;
141    else if ((dtMonth==4 || dtMonth==6 || dtMonth==9 || dtMonth==11) && dtDay ==31) 
142        return false;
143    else if (dtMonth == 2) 
144    {
145        var isleap = (dtYear % 4 == 0 && (dtYear % 100 != 0 || dtYear % 400 == 0));
146        if (dtDay> 29 || (dtDay ==29 && !isleap)) 
147                return false;
148    }
149    return true;
150}
151smile.Validate.IsBirthDate = function(s) {
152	//Thanks to http://jquerybyexample.blogspot.com/2011/12/validate-date-using-jquery.html
153	var currVal = s;
154	if (currVal == '')
155   		return false;
156
157	var rxDatePattern = /^(\d{1,2})(\/|-)(\d{1,2})$/; //Declare Regex
158	var dtArray = currVal.match(rxDatePattern); // is format OK?
159
160	if (dtArray == null)
161   		return false;
162
163	//Checks for mm/dd/yyyy format.
164	dtMonth = dtArray[1];
165	dtDay = dtArray[3];
166	dtYear = dtArray[5];
167
168	if (dtMonth < 1 || dtMonth > 12)
169   		return false;
170	else if (dtDay < 1 || dtDay > 31)
171   		return false;
172	return true;
173}
174smile.Validate.IsNumeric = function(s) {
175	s = smile.String.Trim(s);
176	if ((s-0) == s && s.length > 0) return true;
177	else return false;
178}
179smile.Validate.IsEmail = function(s) {
180	s = smile.String.Trim(s);
181	if (s.indexOf('@') > 0 && s.indexOf('.') > 0) return true;
182	else return false;
183}
184smile.Validate.IsPhone = function(s) {
185	s = smile.String.Trim(s);
186	var chars = /^\+?[0-9 ()-]+[0-9]$/;
187
188	if (!chars.test(s)) return false;
189	else if (s.length < 6) return false;
190	else if (s.length > 18) return false;
191	else return true;
192}
193
194smile.Cookies = function () {}
195smile.Cookies.Get =  function (cname) {
196    var name = cname + "=";
197    var decodedCookie = decodeURIComponent(document.cookie);
198    var ca = decodedCookie.split(';');
199    for(var i = 0; i <ca.length; i++) {
200        var c = ca[i];
201        while (c.charAt(0) == ' ') {
202            c = c.substring(1);
203        }
204        if (c.indexOf(name) == 0) {
205            return c.substring(name.length, c.length);
206        }
207    }
208    return "";
209}
210smile.Cookies.Set = function(cname, cvalue, exdays) {
211    var d = new Date();
212    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
213    var expires = "expires="+d.toUTCString();
214    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
215}
216
217
218//JMW: These old JS functions are replaced in the smile JS class, but we need to keep them around for old content support.
219function fnSafeSMSLink(sDir) {smile.Link.SessionLink(sDir);}
220function fnMnuCategories_Hover(o) {smile.UI.CategoryHover(o);}
221function fnIsDate(txtDate) {return smile.Validate.IsDate(txtDate);}
222function fnIsBirthDate(txtDate) {return smile.Validate.IsBirthDate(txtDate);}
223function Trim(st) {return smile.String.Trim(st);}
224function FormatPhone(field) {field.value = smile.String.FormatPhone(field.value);}
225
226//- Console_AddRemove -//
227function Console_AddRemove(oFromSet, oToSet, bIsAll) {
228	//+ unselect
229	for (var hOption = 0; hOption < oToSet.length; hOption++) {
230		oToSet.options[hOption].selected = false;
231	}
232	//+ move
233	for (hOption = oFromSet.length; hOption != 0; hOption--) {
234		if ((bIsAll == true) || (oFromSet.options[hOption - 1].selected == true)) {
235			oToSet.options[oToSet.length] = new Option(oFromSet.options[hOption - 1].text, oFromSet.options[hOption - 1].value, false, true);
236			oFromSet.options[hOption - 1] = null;
237		}
238	}
239}
240//- Console_Pack -//
241function Console_Pack(oSet, oField) {
242	var cPack = '';
243	for (var hOption = 0; hOption < oSet.length; hOption++) {
244		cPack += ',' + oSet.options[hOption].value;
245	}
246	oField.value = cPack.substring(1);
247}
248
249//- DecodeZip -//
250function DecodeZip(xZip) {
251	var cZip = xZip.replace(/\?/g, '');
252	return cZip;
253}
254
255//- DecodeFon -//
256function DecodeFon(xFon) {
257	var cFon = '';
258	if (xFon.length >= 10) {
259		cFon = xFon.substr(0, 3) + '-' + xFon.substr(3, 3) + '-' + xFon.substr(6, 4)
260		if ((xFon.length == 15) && (xFon.substr(10, 5) != '?????')) {
261			cFon += ' x' + xFon.substr(10, 5).replace(/\?/g, '');
262		}
263	}
264	return cFon;
265}
266
267//- ToggleImage -//
268function SetImage(oImage, cImage) {
269	oImage.src = cImage;
270}
271
272//- SelectOption -//
273function SelectOption(oSelect, cValue) {
274	if ((oSelect == null) || (oSelect.options == null)) {
275		return;
276	}
277	for (hOption = 0; hOption < oSelect.options.length; hOption++) {
278		if (oSelect.options[hOption].value == cValue) {
279			oSelect.options[hOption].selected = true;
280			return;
281		}
282	}
283	oSelect.selectedIndex = 0;
284}
285
286//- String -//
287//- Right -//
288function Right(cStream, nLength) {
289	if (nLength > cStream.length) {
290		return '';
291	} else {
292		return cStream.substr(cStream.length - nLength, nLength);
293	}
294}
295
296//- ProductPopup -//
297function ProductPopup(cIds, nProductKey) {
298	var hWindow = window.open('/Product/Brief.asp?Id=' + nProductKey, 'Product', 'width=516,height=500,scrollbars=1');
299	hWindow.focus();
300}
301
302//- openWindow -//
303function openWindow(url, width, height) {
304	var hWindow = window.open(url, 'wndRPlus', 'width=' + width + ',height=' + height + ',scrollbars=1');
305	hWindow.focus();
306}
307
308//- CopyBillingToBillingCard -//
309function CopyBillingToBillingCard(oForm) {
310	oForm['BillingCardHolder'].value = oForm.BillingName.value;
311	oForm['BillingCardStreet'].value = oForm.BillingStreet.value;
312	oForm['BillingCardStreet2'].value = oForm.BillingStreet2.value;
313	oForm['BillingCardCity'].value = oForm.BillingCity.value;
314	var cState = oForm.BillingState.value;
315	var o = oForm['BillingCardState'];
316	for (var h = 0; h < o.options.length; h++) {
317		if (o.options[h].value == cState) {
318			oForm['BillingCardState'].selectedIndex = h;
319		}
320	}
321	oForm['BillingCardZip'].value = oForm.BillingZip.value;
322}
323
324//- CopyBillingToShipping -//
325function CopyBillingToShipping(oForm) {
326	oForm['ShippingName'].value = oForm.BillingName.value;
327	oForm['ShippingAttention'].value = oForm.BillingAttention.value;
328	oForm['ShippingStreet'].value = oForm.BillingStreet.value;
329	oForm['ShippingStreet2'].value = oForm.BillingStreet2.value;
330	oForm['ShippingCity'].value = oForm.BillingCity.value;
331	var cState = oForm.BillingState.value;
332	var o = oForm['ShippingState'];
333	for (var h = 0; h < o.options.length; h++) {
334		if (o.options[h].value == cState) {
335			oForm['ShippingState'].selectedIndex = h;
336		}
337	}
338	oForm['ShippingZip'].value = oForm.BillingZip.value;
339	//	oForm['ShippingPhone'].value = null;
340}
341
342//- CopyShippingToBilling -//
343function CopyShippingToBilling(oForm) {
344	oForm['BillingName'].value = oForm.ShippingName.value;
345	oForm['BillingAttention'].value = oForm.ShippingAttention.value;
346	oForm['BillingStreet'].value = oForm.ShippingStreet.value;
347	oForm['BillingStreet2'].value = oForm.ShippingStreet2.value;
348	oForm['BillingCity'].value = oForm.ShippingCity.value;
349	var cState = oForm.ShippingState.value;
350	var o = oForm['BillingState'];
351	for (var h = 0; h < o.options.length; h++) {
352		if (o.options[h].value == cState) {
353			oForm['BillingState'].selectedIndex = h;
354		}
355	}
356	oForm['BillingZip'].value = oForm.ShippingZip.value;
357	//	oForm['BillingEmail'].value = null;
358}
359
360
361function ShowOverlay(id, callback) {
362	try {
363		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
364			$("body", "html").css({ height: "100%", width: "100%" });
365			$("html").css("overflow", "hidden");
366			if (document.getElementById("RP_HideSelect") === null) {//iframe to hide select elements in ie6
367				$("body").append("<iframe id='RP_HideSelect'></iframe><div id='RP_overlay' style='display: none;'></div>");
368				$("#RP_overlay").click(function () { HideOverlay(id); });
369			}
370		} else { //all others
371			if (document.getElementById("RP_overlay") === null) {
372				$("body").append("<div id='RP_overlay'></div>");
373				//					$("#RP_overlay").click(function() { HideOverlay(id); });
374			}
375		}
376		$("#RP_overlay").css("opacity", "0");
377		$("#RP_overlay").fadeTo(250, .25, function () {
378			$("#RP_overlay").css("opacity", ".25");
379			$("#" + id).css({ display: "block" });
380			if (callback) {
381				callback();
382			}
383		});
384	} catch (o) {
385	}
386}
387
388function HideOverlay(id) {
389	try {
390		$("#RP_overlay").unbind("click");
391		if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
392			$("body", "html").css({ height: "auto", width: "auto" });
393			$("html").css("overflow", "");
394		}
395		document.onkeydown = "";
396		$("#RP_overlay").fadeTo(250, 0, function () { $('#RP_overlay,#RP_HideSelect').remove(); });
397		$("#" + id).css({ display: "none" });
398	} catch (o) {
399	}
400}
401
402function MessageBox(msg, delay) {
403	if (g_isMessageBoxVisible == true) {
404		return;
405	}
406	document.getElementById('MessageBoxDiv_Content').innerHTML = msg;
407	try {
408		var closeDelay = (delay || delay == 0) ? delay : 2000;
409		g_isMessageBoxVisible = true;
410		var wndSize = GetWindowSize();
411		var offsetY = ScrollOffset();
412		var posX = ($(document).width() / 2) - ($('#MessageBoxDiv').width() / 2);
413		var posY = ((wndSize.height) / 2) - ($('#MessageBoxDiv').height() / 2) + offsetY;
414		$('#MessageBoxDiv').css({ top: posY + 'px', left: posX + 'px' });
415		ShowOverlay('MessageBoxDiv', function () {
416			if (closeDelay > 0) {
417				$(document).bind('click', CloseMessageBox);
418				g_mbTimeoutId = setTimeout(function () {
419					CloseMessageBox();
420				}, closeDelay);
421			}
422		});
423	} catch (e) {
424	}
425}
426
427function CloseMessageBox() {
428	window.clearTimeout(g_mbTimeoutId);
429	$(document).unbind('click', CloseMessageBox);
430	HideOverlay('MessageBoxDiv');
431	g_isMessageBoxVisible = false;
432}
433
434function ShowProcessingDiv() {
435	try {
436		var offsetY = ScrollOffset();
437		var nPosX = ($(document).width() / 2) - ($('#ProcessingDiv').width() / 2);
438		var nPosY = (($(document).height() - offsetY) / 2) - ($('#ProcessingDiv').height() / 2) + offsetY;
439		$('#ProcessingDiv').css({ top: nPosY + 'px', left: nPosX + 'px' });
440		ShowOverlay('ProcessingDiv');
441	} catch (e) {
442	}
443}
444
445function HideProcessingDiv() {
446	try {
447		HideOverlay('ProcessingDiv');
448	} catch (e) {
449	}
450}
451
452function ScrollOffset() {
453	var scrollTop = document.body.scrollTop;
454	if (scrollTop == 0) {
455		if (window.pageYOffset) {
456			scrollTop = window.pageYOffset;
457		} else {
458			scrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
459		}
460	}
461	return scrollTop;
462}
463
464//- MenuItem -//
465function MenuItem(id) {
466	this.id = id;
467	this.items = new Array();
468}
469
470MenuItem.prototype.addItem = function (objSubNav) {
471	this.items.push(objSubNav);
472}
473
474MenuItem.prototype.clear = function () {
475	this.items.length = 0;
476}
477
478//- SubMenuItem -//
479function SubMenuItem(name, uri) {
480	this.name = name;
481	this.uri = uri;
482}
483
484function getScrollBottomY() {
485	var ieDocBody = ((document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body);
486	var scrollTop = (document.all ? ieDocBody.scrollTop : window.pageYOffset);
487	var windowHeight = $(window).height();
488	return scrollTop + windowHeight;
489}
490
491//- Menu Functions -//
492function ShowMenu(id, obj, imgsrc) {
493	if (!g_menu[id]) {
494		return;
495	}
496	if (g_menu[id].items.length == 0) {
497		return;
498	}
499	var objSubNav = document.getElementById('SubNav_' + id);
500	$(objSubNav).stop();
501	//+
502	var height = $(obj).height();
503	var width = $(obj).width();
504	var html = '';
505	var pos = findPos(obj);
506	if (obj) {
507		obj.src = imgsrc;
508	}
509	//	if ($('#SubNavContent_' + id).height() < height + 24) {
510	//		$('#SubNavContent_' + id).css({height: (height + 24) + 'px'});
511	//	}
512	var subNavHeight = $(objSubNav).height();
513	var documentHeight = $(document).height();
514	var scrollHeight = getScrollBottomY();
515	var posTop = pos.y - 22;
516	if (pos.y + subNavHeight > scrollHeight) {
517		posTop = scrollHeight - $(objSubNav).height();
518	}
519	if (posTop + subNavHeight < pos.y + height + 10) {
520		posTop += 10;
521	}
522	$(objSubNav).css({ top: posTop + 'px', left: (pos.x + width + 11) + 'px', width: (175) + 'px' });
523	$('#SubNavLeftCap_' + id).css({ top: (pos.y - 11) + 'px', left: (pos.x + width) + 'px', display: 'block' });
524	$('#SubNavLeftCap_' + id + ' > div.SubNavEndCap_Filler').css({ height: (height - 2) + 'px' });
525	$(objSubNav).hover(function () {
526		$(objSubNav).stop();
527	}, function () {
528		//HideMenu(id);
529	}
530	);
531	$(objSubNav).css({ display: 'block' });
532}
533
534function HideMenu(id, obj, imgsrc) {
535	if (id == '') {
536		return;
537	}
538	$('#SubNavLeftCap_' + id).css({ display: 'none' });
539	var objSubNav = document.getElementById('SubNav_' + id);
540	$(objSubNav).stop();
541	if (obj) {
542		obj.src = imgsrc;
543	}
544	$(objSubNav).css({ display: 'none' });
545}
546
547function findPos(obj) {
548	var curleft = curtop = 0;
549	if (obj.offsetParent) {
550		curleft = obj.offsetLeft
551		curtop = obj.offsetTop
552		while (obj = obj.offsetParent) {
553			curleft += obj.offsetLeft
554			curtop += obj.offsetTop
555		}
556	}
557	return { x: curleft, y: curtop };
558}
559
560function ToggleFavorite(ids, productId) {
561	var imgRoot = '/_COMMON/_Atom/Survey/StarRating/';
562	var img = document.getElementById('FavoriteAction_' + productId);
563	var isFavorite = ((img.src.substring(img.src.length - 12) == 'GrayStar.gif') ? false : true);
564	img.src = imgRoot + ((isFavorite == true) ? "GrayStar.gif" : "OrangeStar.gif");
565	$.get('/Product/FavoriteData.asp?Request=ToggleFavorite&ProductId=' + productId + '&IdS=' + g_idS, function (data) {
566		if (data != '1') {
567			alert('An error occurred while trying to save your favorite. Please try again.');
568			img.src = imgRoot + ((isFavorite == false) ? "GrayStar.gif" : "OrangeStar.gif");
569		}
570	});
571}
572
573function editCurEx(productId) {
574	var curExInput = document.getElementById('CurExInput_' + productId);
575	document.getElementById('CurExEditAction_' + productId).style.display = 'none';
576	document.getElementById('CurExSaveAction_' + productId).style.display = '';
577	curExInput.style.display = 'block';
578	document.getElementById('CurExValue_' + productId).style.display = 'none';
579	curExInput.isSaving = false;
580	curExInput.select();
581}
582
583function saveCurEx(productId) {
584	var curExInput = document.getElementById('CurExInput_' + productId);
585	if (curExInput.isSaving == true) {
586		return;
587	}
588	curExInput.isSaving = true;
589	var value = curExInput.value;
590	curExInput.value = 'Saving...';
591	curExInput.className = 'CurExInputDisabled';
592	curExInput.disabled = true;
593	$.get('/Product/CurExData.asp?ProductId=' + productId + '&Value=' + value + '&IdS=' + g_idS, function (data) {
594		if (data != '1') {
595			alert('An error occurred while trying to save your ticket value. Please try again.');
596		} else {
597			document.getElementById('CurExValue_' + productId).innerHTML = value;
598			document.getElementById('CurExEditAction_' + productId).style.display = '';
599			document.getElementById('CurExSaveAction_' + productId).style.display = 'none';
600			document.getElementById('CurExInput_' + productId).style.display = 'none';
601			document.getElementById('CurExValue_' + productId).style.display = '';
602		}
603		curExInput.isSaving = false;
604		curExInput.value = value;
605		curExInput.disabled = false;
606		curExInput.className = 'CurExInput';
607	});
608}
609
610function showShippingAlert(o) {
611	var pos = findPos(o);
612	$('#ShippingAlert').css({ top: ((pos.y + $(o).height()) + 'px'), left: ((pos.x + $(o).width()) + 'px') });
613	$('#ShippingAlert').fadeIn(250, function () {
614		setTimeout(function () { $('#ShippingAlert').fadeOut(250); }, 3000);
615	});
616}
617
618function LargeImagePopup(id) {
619	var wnd = window.open('/Product/Image.asp?Id=' + id, 'wnd_LargeImage', 'width=600,height=550,scrollbars=1,resizable=1');
620	wnd.focus();
621}
622
623function selectAllCheckboxes(form) {
624	setCheckValue(form, true);
625}
626
627function clearAllCheckboxes(form) {
628	setCheckValue(form, false);
629}
630
631function setCheckValue(form, value) {
632	var i = 0;
633	for (i = 0; i < form.elements.length; i++) {
634		if (form.elements[i].type == 'checkbox') {
635			form.elements[i].checked = value;
636		}
637	}
638}
639
640$(document).ready(function() {
641	$('.quantityInput').focus(function() {
642		var input = $(this);
643		var callout = input.nextAll('.quantityCallout');
644		callout.show();
645	}).blur(function() {
646		var input = $(this);
647		var callout = input.nextAll('.quantityCallout');
648		callout.hide();
649	}).keyup(function() {
650		var input = $(this);
651		var callout = input.nextAll('.quantityCallout');
652		var conversion = parseInt(callout.attr('data-pcs'));
653		var quantity = parseInt(input.val(), 10);
654		console.log(conversion);
655		console.log(quantity);
656		if (isNaN(quantity)) {
657			callout.find('span').text('0 eaches');
658			return;
659		}
660		callout.find('span').text((quantity * conversion) + ' eaches');
661	});
662
663	if (g_idS === '' || !g_appendIdS)
664		return;
665
666	setTimeout(appendIdsToUrls, 50);
667});
668
669var domainPattern = new RegExp("http[s]?://" + document.domain + "/", "i");
670function appendIdsToUrls() {
671	$('a').each(function() {
672		var self = $(this);
673		var onclick = self.attr('onclick');
674		if (onclick && onclick != '')
675			return;
676		
677		var href = self.attr('href');
678		if (href.search(/IdS=[0-9A-Z\-]*/) > 0)
679			return;
680		if (href.search(domainPattern) < 0 && href.indexOf('/') != 0)
681			return;
682		self.attr('href', href + (href.indexOf('?') > 0 ? '&' : '?') + 'IdS=' + g_idS);
683	});
684}

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.