PageSourceSearch

https://www.grifolsinclusiv.com/o/statics/html/common/themes/goog_…=js&languageId=en_US&t=1790753134000

js grifolsinclusiv.com collected 2026-10-04 23:34:24 UTC 42,844 bytes, 1,316 lines download raw bytes

1/*1705925424000*/
2var cookieName = 'ACCEPTS_COOKIES';
3var cookieMessageId = 'cookie-warning';
4
5function checkAnalyticsCookie(){
6	if (jQuery.cookie(cookieName) != 'false'){
7		if (jQuery.cookie(cookieName) === 'true'){
8			addGoogleAnalytics();
9			loadIFrames();
10			//setBCSTagging();
11			setAnalytics();
12		} else {
13			if (jQuery('#' + cookieMessageId).length > 0){
14				showCookieWarning();
15			} else {
16				addGoogleAnalytics();
17				loadIFrames();
18				//setBCSTagging();
19				setAnalytics();
20			}
21		}
22	}
23}
24
25function showCookieWarning() {
26
27	//Change button value in case it's different from "close". This method and reference should
28	//be removed once all themes get upgraded and "close" value is defined in template.
29	changeCookieWarningButtonValue();
30
31	jQuery('#' + cookieMessageId).slideDown();
32	jQuery('body').bind('click', function(e) {
33		// There is no modal popup on the screen
34		if (jQuery("#interstitial-modal").length == 0) {
35			// The click is not on the modal
36			if (e.target.id != 'closemodal' && e.target.id != 'closethick') {
37				// The click is not on the cookie message
38				if (!(jQuery(e.target).parents('#' + cookieMessageId + ', .grifols-popup').length > 0 || jQuery(e.target).attr('id') == cookieMessageId)) {
39					acceptCookiePolicy();
40				}
41			}
42		}
43	});
44	window.location.hash = "";
45}
46
47function changeCookieWarningButtonValue() {
48
49	var currentLiteral = $('#cookie-warning .btnHolder input[type="button"]').val();
50	var newLiteral = Liferay.closeString;
51
52	if ((typeof currentLiteral != "undefined") && (typeof newLiteral != "undefined")) {
53		if (currentLiteral.toUpperCase() != newLiteral.toUpperCase()) {
54			$('#cookie-warning .btnHolder input[type="button"]').val(newLiteral.toUpperCase());
55		}
56	}
57
58}
59
60function acceptCookiePolicy(){
61	jQuery('body').unbind('click');
62	jQuery.cookie(cookieName, 'true', {expires: 365, path: '/'});
63	addGoogleAnalytics();
64	loadIFrames();
65	//setBCSTagging();
66	setAnalytics();
67	jQuery('#'+cookieMessageId).slideUp();
68}
69
70function rejectCookiePolicy(){
71	jQuery('body').unbind('click');
72	jQuery.cookie(cookieName, 'false', {expires: 365, path: '/'});
73	jQuery('#'+cookieMessageId).slideUp();
74}
75
76function addGoogleAnalytics() {
77	Grifols.common.analytics.enable();
78//	
79//	
80//	
81//	if (typeof ga == 'undefined'){
82//		if (typeof analyticsId != "undefined" && analyticsId != null && analyticsId != ""){
83//			(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
84//				(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
85//				m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
86//			})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
87//			ga('create', analyticsId, document.location.hostname);  // Replace with your property ID.
88//
89//			if(anonimize) {
90//				ga('set', 'anonymizeIp', true);
91//			}
92//			if (typeof userContext != "undefined" && userContext != null && userContext != ""){
93//				ga('set', 'dimension3', userContext.company);
94//				ga('set', 'dimension4', userContext.companycode);
95//				ga('set', 'dimension5', userContext.sapHrArea);
96//				ga('set', 'dimension6', userContext.department);
97//				ga('set', 'dimension7', userContext.city);
98//				ga('set', 'dimension8', userContext.buildingName);
99//				ga('set', 'dimension9', userContext.country);
100//			}
101//
102//			ga('send', 'pageview');
103//		}
104//	}
105};
106
107function pushKeyword(){
108	var keyword = jQuery('input[name$="keywords"]').val();
109	if(!(keyword === "")){
110		var _url = addParameterToURL('q='+keyword, document.location.pathname);
111		// Corregido error cuando no había GA disponible
112		sendSearchKeyword(keyword);
113	}
114}
115
116function addParameterToURL(param, url){
117	_url = url;
118	_url += (_url.split('?')[1] ? '&':'?') + param;
119	return _url;
120};
121
122function blockIFrames (){
123	jQuery('iframe').each(function(){
124		jQuery(this).attr('src1',jQuery(this).attr('src'));
125		jQuery(this).attr('src','about:blank');
126	});
127};
128
129function loadIFrames(){
130	jQuery('iframe').each(function(){
131		if(typeof(jQuery(this).attr('src1')) != 'undefined' && jQuery(this).attr('src1') != ""){
132			jQuery(this).attr('src', jQuery(this).attr('src1'));
133			jQuery(this).removeAttr('src1');
134		}
135	});
136}
137
138if (typeof jQuery != 'undefined') {
139	$(window).on('load', function () {
140		if($('#cookie-intro').length > 0){
141			Grifols.BCS.cookies.checkCookiesManagement();
142		} else {
143			checkAnalyticsCookie();
144		}
145	});
146
147	jQuery(document).ready(function(){
148		if (jQuery('#'+cookieMessageId).length >0){
149			if (jQuery.cookie(cookieName) != 'true'){
150				blockIFrames();
151			}
152		}
153	});
154}
155
156/* Google Analytics events */
157var analyticsDebug = false;
158
159/* Generic event */
160function sendAnalyticsEvent(section, event, object){
161	Grifols.common.analytics.sendEvent(section, event, object);
162}
163
164function sendSearchKeyword(keyword){
165	if (keyword === ""){
166		keyword = '(Empty)';
167	}
168	sendAnalyticsEvent('Search', 'click', keyword);
169}
170
171var submitted = false;
172
173function sendSubmitEvent(formName){
174	submitted = true;
175
176	// Checkboxes
177	$('.aui-field-input-choice').parent('span').find('input[type=hidden]').each(function(){
178		if ($(this).val() == "true"){
179			// For checkboxes inside checkbox-list
180			if ($(this).parents('.checkbox-list').length > 0){
181				var parentItem = $(this).parents('.item');
182				if (parentItem.length > 0){
183					sendAnalyticsEvent('Checkbox', formName, parentItem.find('.checkbox-right .description').text());
184				}
185			}
186		}
187	});
188	sendAnalyticsEvent('Form', 'submit', formName);
189}
190
191function addLeavePageEvent(formName){
192	window.onbeforeunload = function(e){
193		if (!submitted){
194			var inputList = [];
195			var isContactForm = true;
196
197			var fieldList = [];
198
199			// Genetic COPD Test
200			if ($(".body-fieldset .col-resp-12").length > 0){
201				$(".body-fieldset .col-resp-12").each(function(){
202					inputList.push($(this));
203				});
204			}
205
206			if ($(".field-row").length > 0){
207				isContactForm = false;
208				$(".field-row").each(function(){
209					inputList.push($(this));
210				});
211			} else {
212				$(".aui-field").each(function(){
213					inputList.push($(this));
214				});
215			}
216
217			for (var index = 0; index < inputList.length; index++ ){
218				var thisInput = $(inputList[index]);
219				var thisField = thisInput.find("input[type='text']");
220				if (thisField.length == 0){
221					thisField = thisInput.find("textarea");
222				}
223				if (thisField.length == 0){
224					thisField = thisInput.find("select");
225				}
226				if (thisField.length > 0){
227					var fieldLabel;
228					if (isContactForm){
229						fieldLabel = $.trim(thisInput.find("label.aui-field-label-inline-label").text());
230					} else {
231						fieldLabel = $.trim(thisInput.find(".field-label h4").text());
232					}
233
234					// For other HTML structures - like Gamunex Opt In
235					if((fieldLabel == "") && thisInput.find("label").length > 0){
236						fieldLabel = $.trim(thisInput.find("label").text());
237					}
238					var fieldStatus;
239					if (thisInput.hasClass("ocu")){
240						fieldStatus = "H";
241					} else {
242						if (thisField.val() != "" && thisField.val() != thisField.attr("placeholder")){
243							if (thisField.hasClass("aui-form-validator-error")){
244								fieldStatus = "E";
245							} else {
246								fieldStatus = "X";
247							}
248						} else {
249							fieldStatus = " ";
250						}
251					}
252					if (fieldLabel.length > 0){
253						fieldList.push("[" + fieldStatus + "] " + fieldLabel);
254					}
255				}
256			}
257			if (analyticsDebug){
258				console.log("Fields to send -> " + fieldList);
259			}
260			sendAnalyticsEvent('Not submitted form', formName, fieldList.toString());
261		}
262	};
263}
264
265function addOnClick(objects, section, eventName){
266	var eventsAdded = 0;
267	if (objects.length > 0){
268		objects.each(function(){
269			if ($(this).attr('onClick') == undefined){
270				var eventText = $(this).attr('alt');
271				if (eventText == undefined){
272					eventText = $(this).attr('title');
273				}
274
275				// For document links
276				if (eventText == undefined && $(this).attr('href') != undefined && $(this).attr('href').indexOf('/documents/') != -1){
277					eventText = $(this).attr('href').substring($(this).attr('href').indexOf('/documents/'));
278					eventText = eventText.split('/')[4];
279				}
280
281				if (eventText == undefined){
282					eventText = $(this).attr('href');
283				}
284
285
286				if (eventText != undefined){
287					if ($(this).children('img').length > 0){
288						eventText = "Image link: " + eventText;
289					}
290					eventText = eventText.replace(/'/g, "\\x27");
291
292					$(this).attr('onclick','sendAnalyticsEvent(\'' + section + '\',\'' + eventName + '\',\'' + eventText + '\');');
293					$(this).attr('oncontextmenu', 'sendAnalyticsEvent(\'' + section + '\',\'right-click\',\'' + eventText + '\');')
294
295					eventsAdded++;
296				}
297			}
298		});
299		if (analyticsDebug){
300			console.log(eventsAdded + " " + eventName + " events added for section -> " + section);
301		}
302	}
303}
304
305function fixVirtualhostLinks(){
306	//If some links get to live with /web/friendly, they are fixed
307	if(typeof siteUrl != "undefined"){
308		if(location.href.indexOf('/web' + siteUrl + '/') < 0 && location.href.indexOf('/group' + siteUrl + '/')){
309			$('#wrapper a, #footer a').each(function(){
310				if ($(this).attr('href') != undefined && ($(this).attr('href').indexOf('/web' + siteUrl + '/') >= 0 || $(this).attr('href').endsWith('/web' + siteUrl))){
311					$(this).attr('href',$(this).attr('href').replace('/web' + siteUrl,''));
312				}
313			});
314		}
315	}
316}
317
318function fixStagingLinks(){
319	//If some internal links are created on staging without /web/friendly, they are fixed
320	if(typeof siteUrl != "undefined"){
321		if(location.href.indexOf('/web' + siteUrl + '/') >= 0 || location.href.endsWith('/web' + siteUrl)){
322			$('#wrapper a, #footer a').each(function(){
323				var thisHref = $(this).attr('href');
324				if (typeof thisHref != "undefined"){
325					if(thisHref.indexOf('/') == 0 && thisHref.indexOf('/documents/') < 0 && thisHref.indexOf('/web' + siteUrl) < 0 && thisHref.indexOf('/group/') < 0 && thisHref.indexOf('/c/') < 0){
326						if(thisHref.charAt(3) == '/'){
327							$(this).attr('href',thisHref.substring(0,3) + '/web' + siteUrl + thisHref.substring(3));
328						} else {
329							$(this).attr('href','/web' + siteUrl + thisHref);
330						}
331					}
332				}
333			});
334		}
335	}
336}
337
338function rewriteInternalLinks(){
339//	fixVirtualhostLinks();
340//	fixStagingLinks();
341}
342
343function setBCSTagging(){
344	rewriteInternalLinks();
345
346	// BCS events
347	// Header links (grey bar)
348	addOnClick($('#grifols-link').find('a'), 'Header', 'click');
349	addOnClick($('#pheader .pheader-menu').find('a'), 'Header', 'click');
350	addOnClick($('#pheader .custom-pages').find('a'), 'Header', 'click');
351	addOnClick($('#pheader .contactus').find('a'), 'Header', 'click');
352
353	// Header ISI
354	addOnClick($('.important-safety-link').find('a'), 'ISI', 'click');
355
356	// Top Nav
357	addOnClick($('#header-menu .lvl1>a'), 'Top Nav', 'click');
358
359	// Sub Nav
360	addOnClick($('#header-menu .lvl2').find('a'), 'Sub Nav', 'click');
361
362	// Phone number Link
363	addOnClick($("a[href^='tel:']"), 'Telephone Number', 'Click-to-call');
364
365	// Mailto Link
366	addOnClick($("a[href^='mailto:']"), 'Mailto Link', 'click');
367
368	// Footer links
369	addOnClick($('#footer').find('a'), 'Footer', 'click');
370
371	// Forgot password
372	addOnClick($("a[href$='forgot_password']"), 'Change password link', 'click');
373
374	// Document Link
375	addOnClick($("a[href*='/documents/']"), 'Document', 'download');
376
377	// Internal Link
378	addOnClick($("a[href^='/']"), 'Internal Link', 'click');
379	addOnClick($("a[href^='" + location.protocol + '//' + location.hostname + "'"), 'Internal Link', 'click');
380
381	// Outgoing Link
382	addOnClick($("a[href^='http']"), 'Outgoing Link', 'click');
383
384	setVideoEvents();
385
386	setScrollEvents();
387}
388
389function updateQueryStringParameter(uri, key, value) {
390	var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
391	var separator = uri.indexOf('?') !== -1 ? "&" : "?";
392	if (uri.match(re)) {
393		return uri.replace(re, '$1' + key + "=" + value + '$2');
394	}
395	else {
396		return uri + separator + key + "=" + value;
397	}
398}
399
400
401function createChangeLanguageStrutsActionURL(plid, action) {
402
403	var t = new Date();
404
405	var url = action;
406	url += "?" + "plid=" + plid;
407	url += "&" + "p_auth=" + Liferay.authToken;
408
409	var redirect = location.pathname + location.search;
410//	redirect = updateQueryStringParameter(redirect, "t", t.getTime());
411	url += "&" + "currentLanguage=" + Liferay.ThemeDisplay.getLanguageId();
412	url += "&" + "redirect=" + encodeURIComponent(redirect);
413
414//	url += "&" + "t=" + t.getTime();
415
416	return url;
417
418}
419
420
421
422
423
424if (typeof $ != 'undefined'){
425	$(document).ready(function() {
426
427		AUI().ready('liferay-portlet-url', function(A) {
428
429			var url = createChangeLanguageStrutsActionURL(themeDisplay.getPlid(), "/c/portal/change_language")
430
431			var currentLanguageId = Liferay.ThemeDisplay.getLanguageId();
432
433			$('#languageselect option').each(function() {
434
435				var value = $(this).val();
436				var languageIdParam = getUrlParameter(value, "languageId");
437				if(languageIdParam!=null || languageIdParam!= "undefined"){
438                   languageIdParam = languageIdParam.substring(0,2);
439                }
440				if (value != "" && value.indexOf("/") == 0 ) {
441                    if(typeof languageIdParam == "undefined" || currentLanguageId==languageIdParam){
442                        var languageCode = value.substring(1,3);
443                        var languageId = "";
444
445                        //Look for the language code in available locales
446                        var locale = Liferay.availableLocales[languageCode];
447
448                        //We have found the right locale
449                        if (typeof locale != "undefined") {
450                            languageId = locale.languageId;
451                        }
452
453                        var localeUrl = url + "&languageId=" + languageId;
454
455                        if (currentLanguageId == languageId) {
456                            if(languageIdParam==null || languageIdParam== "undefined" || currentLanguageId==languageIdParam){
457                                //In case it's the current language, no action
458                                localeUrl = "javascript:void(0)";
459                            }
460                        }
461
462                        //Inject the new value
463                        $(this).val(localeUrl)
464                    }
465				}
466
467			});
468
469
470			$('li.languageli .languagelist div a').each(function() {
471
472				var value = $(this).attr("href");
473				var languageIdParam = getUrlParameter(value, "languageId");
474                if(languageIdParam!=null || languageIdParam!= "undefined"){
475                   languageIdParam = languageIdParam.substring(0,2);
476                }
477				if (value != "" && value.indexOf("/") == 0 ) {
478                    if(typeof languageIdParam == "undefined" || currentLanguageId==languageIdParam){
479                        var languageCode = value.substring(1,3);
480                        var languageId = "";
481
482                        //Look for the language code in available locales
483                        var locale = Liferay.availableLocales[languageCode];
484
485                        //We have found the right locale
486                        if (typeof locale != "undefined") {
487                            languageId = locale.languageId;
488                        }
489
490                        var localeUrl = url + "&languageId=" + languageId;
491
492                        if (currentLanguageId == languageId) {
493                                //In case it's the current language, no action
494                                localeUrl = "javascript:void(0)";
495
496                        }
497
498                        //Inject the new value
499                        $(this).attr("href", localeUrl);
500                    }
501				}
502
503			});
504
505			$('ul.menu-movil li#menu-more ul li a').each(function() {
506
507				var value = $(this).attr("href");
508				if (value != "" && value.indexOf("/") == 0) {
509                    if(typeof languageIdParam == "undefined" || currentLanguageId==languageIdParam){
510
511                        var languageCode = value.substring(1,3);
512                        var languageId = "";
513
514                        //Look for the language code in available locales
515                        var locale = Liferay.availableLocales[languageCode];
516
517                        //We have found the right locale
518                        if (typeof locale != "undefined") {
519                            languageId = locale.languageId;
520
521                            //Check if it's a language tag
522                            var languageNodeName = $(this).text();
523                            var languageRealName = Liferay.Language.get(locale.languageId);
524
525                            if (languageNodeName == languageRealName) {
526
527                                //This is a real language name
528                                var localeUrl = url + "&languageId=" + languageId;
529
530                                if (currentLanguageId == languageId) {
531                                    //In case it's the current language, no action
532                                    localeUrl = "javascript:void(0)";
533                                }
534
535                                //Inject the new value
536                                $(this).attr("href", localeUrl);
537                            }
538						}
539					}
540
541				}
542
543			});
544
545		});
546	});
547}
548
549
550// Brightcove tagging
551var BCTagging = {};
552BCTagging.debug = false;
553BCTagging.players = [];
554BCTagging.videos = [];
555BCTagging.progress = {};
556BCTagging.progressPc = {};
557BCTagging.lastPositionSent = {};
558
559BCTagging.onTemplateLoad = function (experienceID){
560	if(BCTagging.debug){
561		console.log('ontemplateload');
562	}
563	BCTagging.player = brightcove.api.getExperience(experienceID);
564	BCTagging.modVP = BCTagging.player.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
565	BCTagging.players.push(experienceID);
566}
567
568BCTagging.onTemplateReady = function (event){
569	if(BCTagging.debug){
570		console.log("templateready");
571	}
572	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.BEGIN, function(event) {BCTagging.startVideo(event); });
573	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.PROGRESS, function(event) {BCTagging.progressVideo(event); });
574	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.PLAY, function(event) {BCTagging.playVideo(event); });
575//	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.STOP, function(event) {BCTagging.stopVideo(event); });
576//	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.SEEK_NOTIFY, function(event) {BCTagging.seekVideo(event); });
577	BCTagging.modVP.addEventListener(brightcove.api.events.MediaEvent.COMPLETE, function(event) {BCTagging.finishVideo(event); });
578}
579
580BCTagging.startVideo = function(event) {
581	if(BCTagging.debug){
582		console.log("Play -> " + event.media.displayName);
583	}
584	sendVideoAnalyticsEvent('Play', event.media.displayName);
585
586	var found = false;
587	for (var i = 0; i< BCTagging.videos.length; i++){
588		if (BCTagging.videos[i] == event.media.displayName){
589			found = true;
590			break;
591		}
592	}
593	if (!found){
594		BCTagging.videos.push(event.media.displayName);
595	}
596
597	window.onbeforeunload = function(e){
598		for (var i = 0; i< BCTagging.videos.length; i++){
599			var videoTitle = BCTagging.videos[i];
600			var lastTimeStamp = parseInt(BCTagging.progress[videoTitle]);
601			var minutes = Math.round(Math.floor(lastTimeStamp / 60));
602			var seconds = lastTimeStamp % 60;
603			var timestamp = ('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2);
604
605			if(BCTagging.debug){
606				console.log('Leave page -> ' + BCTagging.progressPc[videoTitle] + '%, ' + timestamp + ' -> ' + videoTitle);
607			}
608			sendVideoAnalyticsEvent('Leave page -> ' + BCTagging.progressPc[videoTitle] + '%, ' + timestamp, videoTitle);
609		}
610	};
611}
612
613BCTagging.progressVideo = function(event){
614	var partThreshold = 25;
615
616	if (typeof BCTagging.lastPositionSent[event.media.displayName] === "undefined"){
617		BCTagging.lastPositionSent[event.media.displayName] = 0;
618	}
619
620	BCTagging.progress[event.media.displayName] = event.position;
621	BCTagging.progressPc[event.media.displayName] = parseInt(BCTagging.progress[event.media.displayName]/event.duration * 100);
622
623	// Events for 25%, 50% and 75%;
624	var currentPosition = parseInt(BCTagging.progressPc[event.media.displayName] / partThreshold);
625	if (currentPosition != BCTagging.lastPositionSent[event.media.displayName]){
626		if(BCTagging.debug){
627			console.log(currentPosition * partThreshold + '% of video reached -> ' + event.media.displayName);
628		}
629		sendVideoAnalyticsEvent('Progress -> ' + currentPosition * partThreshold + '%', event.media.displayName);
630		BCTagging.lastPositionSent[event.media.displayName] = currentPosition;
631	}
632}
633
634BCTagging.finishVideo = function(event){
635	if(BCTagging.debug){
636		console.log("Video finished -> " + event.media.displayName);
637	}
638	sendVideoAnalyticsEvent('Progress -> 100%', event.media.displayName);
639}
640
641
642BCTagging.playVideo = function(event) {
643	/*
644	if(BCTagging.debug){
645		console.log("Play -> " + BCTagging.progress + '% -> ' + BCTagging.videoTitle);
646	}
647	sendVideoAnalyticsEvent('Play -> ' + BCTagging.progress + '%');
648	var id = event.target.experience.id;
649	*/
650	for (var i = 0; i < BCTagging.players.length; i++){
651		if (players[i] != id){
652			var player = brightcove.api.getExperience(BCTagging.players[i]);
653			var videoPlayer = player.getModule(brightcove.api.modules.APIModules.VIDEO_PLAYER);
654			videoPlayer.pause(true);
655		}
656	}
657}
658
659/*
660BCTagging.stopVideo = function(event) {
661	if(BCTagging.debug){
662		console.log("Pause -> " + BCTagging.progress + '% -> ' + BCTagging.videoTitle);
663	}
664	sendVideoAnalyticsEvent('Pause -> ' + BCTagging.progress + '%');
665}
666
667BCTagging.seekVideo = function(event) {
668	BCTagging.progress = parseInt(event.position/event.duration * 100);
669	if(BCTagging.debug){
670		console.log("Seek -> " + BCTagging.progress + '% -> ' + BCTagging.videoTitle);
671	}
672	sendVideoAnalyticsEvent('Seek -> ' + BCTagging.progress + '%');
673} */
674
675
676
677function sendVideoAnalyticsEvent(eventText, videoTitle){
678	sendAnalyticsEvent('Video', eventText, videoTitle);
679}
680
681function setAnalytics(){
682	Grifols.common.analytics.setAnalytics();
683//	if($('body.mobile').length > 0) {
684//
685//		var countrycodes = "1"
686//		var delimiters = "-|\\.|—|–|&nbsp;"
687//		var phonedef = "\\+?(?:(?:(?:" + countrycodes + ")(?:\\s|" + delimiters + ")?)?\\(?[2-9]\\d{2}\\)?(?:\\s|" + delimiters + ")?[2-9]\\d{2}(?:" + delimiters + ")?[0-9a-z]{4})"
688//		var spechars = new RegExp("([- \(\)\.:]|\\s|" + delimiters + ")","gi") //Special characters to be removed from the link
689//		var phonereg = new RegExp("((^|[^0-9])(href=[\"']tel:)?((?:" + phonedef + ")[\"'][^>]*?>)?(" + phonedef + ")($|[^0-9]))","gi")
690//
691//		function replacePhoneNumbers(oldhtml) {
692//			var newhtml = oldhtml.replace(/href=['"]callto:/gi,'href="tel:')
693//			newhtml = newhtml.replace(phonereg, function ($0, $1, $2, $3, $4, $5, $6) {
694//				if ($3) return $1;
695//				else if ($4) return $2+$4+$5+$6;
696//				else return $2+"<a href='tel:"+$5.replace(spechars,"")+"'>"+$5+"</a>"+$6; });
697//			return newhtml;
698//		}
699//
700//		$("#page").html(replacePhoneNumbers($("#page").html()));
701//	}
702//	if (typeof ga != 'undefined'){
703//		setBCSTagging();
704//	}
705//	return true;
706}
707
708var videoTagging = {};
709videoTagging.videos = [];
710videoTagging.progress = {};
711videoTagging.progressPc = {};
712videoTagging.lastPositionSent = {};
713
714var nombreVideos = "";
715
716function setVideoEvents(){
717	$('video').each(function(e){
718		var video = this;
719		var videoId = $(video).parent().attr('id');
720
721		videojs(videoId).on('play', function(){
722			var myPlayer = this;
723			playHandler(myPlayer);
724		});
725		videojs(videoId).on('timeupdate', function(){
726			var myPlayer = this;
727			timeupdateHandler(myPlayer);
728		});
729		videojs(videoId).on('ended', function(){
730			var myPlayer = this;
731			sendVideoAnalyticsEvent('Progress -> 100%', myPlayer.mediainfo.name)
732			videoTagging.progressPc[myPlayer.mediainfo.name] = 100;
733		});
734	});
735
736	function playHandler(myPlayer){
737
738		if (typeof videoTagging.lastPositionSent[myPlayer.mediainfo.name] === "undefined"){
739			videoTagging.lastPositionSent[myPlayer.mediainfo.name] = 0;
740		}
741		if (typeof videoTagging.progress[myPlayer.mediainfo.name] === "undefined"){
742			videoTagging.progress[myPlayer.mediainfo.name] = 0;
743		}
744		if (typeof videoTagging.progressPc[myPlayer.mediainfo.name] === "undefined"){
745			videoTagging.progressPc[myPlayer.mediainfo.name] = 0;
746		}
747		var found = false;
748		for (var i=0; i<videoTagging.videos.length; i++){
749			if(videoTagging.videos[i] == myPlayer.mediainfo.name){
750				found = true;
751				break;
752			}
753		}
754		if (!found) {
755			videoTagging.videos.push(myPlayer.mediainfo.name);
756			if(BCTagging.debug){
757				console.log('Play ' + myPlayer.mediainfo.name);
758			}
759			sendVideoAnalyticsEvent('Play ', myPlayer.mediainfo.name);
760
761			window.onbeforeunload = function(e){
762				for (var i = 0; i< videoTagging.videos.length; i++){
763					var videoTitle = videoTagging.videos[i];
764					if (videoTitle != "undefined"){
765						var lastTimeStamp = parseInt(videoTagging.progress[videoTitle]);
766						var minutes = Math.round(Math.floor(lastTimeStamp / 60));
767						var seconds = lastTimeStamp % 60;
768						var timestamp = ('0' + minutes).slice(-2) + ':' + ('0' + seconds).slice(-2);
769
770						if(BCTagging.debug){
771							console.log('Leave page -> ' + videoTagging.progressPc[videoTitle] + '%, ' + timestamp + ' -> ' + videoTitle);
772						}
773						sendVideoAnalyticsEvent('Leave page -> ' + videoTagging.progressPc[videoTitle] + '%, ' + timestamp, videoTitle);
774					}
775				}
776			}
777		}
778	}
779
780	function timeupdateHandler(myPlayer){
781
782		var partThreshold = 25;
783
784		if (typeof videoTagging.lastPositionSent[myPlayer.mediainfo.name] === "undefined"){
785			videoTagging.lastPositionSent[myPlayer.mediainfo.name] = 0;
786		}
787
788		if (typeof videoTagging.progress[myPlayer.mediainfo.name] === "undefined"){
789			videoTagging.progress[myPlayer.mediainfo.name] = 0;
790		} else {
791			videoTagging.progress[myPlayer.mediainfo.name] = myPlayer.currentTime();
792		}
793		if (typeof videoTagging.progressPc[myPlayer.mediainfo.name] === "undefined" || isNaN(myPlayer.mediainfo.duration)){
794			videoTagging.progressPc[myPlayer.mediainfo.name] = 0;
795		} else {
796			videoTagging.progressPc[myPlayer.mediainfo.name] = Math.ceil(parseInt(videoTagging.progress[myPlayer.mediainfo.name]/myPlayer.mediainfo.duration * 100));
797		}
798
799		// Events for 25%, 50% and 75%;
800		var currentPosition = parseInt(videoTagging.progressPc[myPlayer.mediainfo.name] / partThreshold);
801		if (currentPosition != videoTagging.lastPositionSent[myPlayer.mediainfo.name]){
802			if(BCTagging.debug){
803				console.log(currentPosition * partThreshold + '% of video reached -> ' + myPlayer.mediainfo.name);
804			}
805			sendVideoAnalyticsEvent('Progress -> ' + currentPosition * partThreshold + '%', myPlayer.mediainfo.name);
806			videoTagging.lastPositionSent[myPlayer.mediainfo.name] = currentPosition;
807		}
808	}
809}
810
811
812var scrollArray = [];
813var scrolledArray = [];
814var scroll = $(window).scrollTop() + $(window).height();
815
816function setScrollEvents() {
817	var counter = 0;
818	$(".bcs-scroll").each(function() {
819		scrollArray[counter] = $(this).attr("id");
820		scrolledArray[counter] = scroll > $(this).offset().top;
821		counter++;
822	});
823
824	if(scrollArray.length > 0) {
825		$(window).scroll(function() {
826			var scroll = $(window).scrollTop() + $(window).height();
827			// Scroll down
828			for(var i = 0; i < scrollArray.length; i++) {
829				if(scroll > $("#"+scrollArray[i]).offset().top && !scrolledArray[i]) {
830					if($("#"+scrollArray[i]).data("noninteraction") === true){
831						if (typeof ga != 'undefined'){
832							ga('send', 'event', 'Page Scroll', 'Scroll '+$("#"+scrollArray[i]).data("scrollvalue")+'%', $("title").text(), {nonInteraction: true});
833						}
834					} else {
835						sendAnalyticsEvent('Page Scroll', 'Scroll '+$("#"+scrollArray[i]).data("scrollvalue")+'%', $("title").text());
836					}
837					scrolledArray[i] = true;
838				}
839			}
840			// Scroll up
841			for(var i = 0; i < scrollArray.length; i++) {
842				if(scrolledArray[i] && scroll < $("#"+scrollArray[i]).offset().top) {
843					scrolledArray[i] = false;
844				}
845			}
846		});
847	}
848}
849
850
851// New BCS Cookie Management
852
853if (typeof Grifols === 'undefined') {
854	var Grifols = {};
855}
856
857if (typeof Grifols.BCS === 'undefined') {
858	Grifols.BCS = {};
859}
860
861if (typeof Grifols.BCS.cookies === 'undefined') {
862	Grifols.BCS.cookies = {};
863}
864
865Grifols.BCS.cookies.cookieConsentName = 'COOKIES_CONSENT';
866
867Grifols.BCS.cookies.checkCookiesManagement = function(){
868	if (typeof(jQuery.cookie(Grifols.BCS.cookies.cookieConsentName)) === 'undefined'){
869		/* Block iframes if no cookie choice was made */
870		blockIFrames();
871		if (typeof Grifols.BCS.cookies.policyPage != 'undefined' && location.href.indexOf(Grifols.BCS.cookies.policyPage) < 0){
872			/* Show the cookie introduction if user is not accessing the Cookies Policy page */
873			Grifols.BCS.cookies.openCookiesSettings();
874		}
875	} else {
876	 	var cookieString = jQuery.cookie(Grifols.BCS.cookies.cookieConsentName);
877
878		//Decode (Base64) cookie value
879	 	try {
880	 		var decodedCookie = atob(cookieString);	 		
881	 		var cookieJSON = JSON.parse(decodedCookie);
882	 		//COMPARE DATES CONSENT COOKIES with essentials and analytics
883	 		var consentDateInt = parseInt(cookieJSON.cookiesconsentdate);
884	 		
885	 		//VALIDATE DATES CONSENT COOKIES vs LAST MODIFIED COOKIES CONTENTS
886	 		var needToAcceptCookiesAgain = false;
887	 		
888	 		if (typeof(essentialsCookiesContext) !== 'undefined') {
889	 			var essentialsDateInt = parseInt(essentialsCookiesContext.cookie_last_modified_date);
890	 			if (consentDateInt<=essentialsDateInt) {
891	 				needToAcceptCookiesAgain = true;
892	 			}
893	 		}
894	 		if (typeof(analyticsCookiesContext) !== 'undefined') {
895	 			var analyticsDateInt = parseInt(analyticsCookiesContext.cookie_last_modified_date);
896	 			if (consentDateInt<=analyticsDateInt) {
897	 				needToAcceptCookiesAgain = true;
898	 			}
899	 		}
900	 		if (typeof(marketingCookiesContext) !== 'undefined') {
901	 			var analyticsDateInt = parseInt(marketingCookiesContext.cookie_last_modified_date);
902	 			if (consentDateInt<=analyticsDateInt) {
903	 				needToAcceptCookiesAgain = true;
904	 			}
905	 		}
906	 		
907	 		if (needToAcceptCookiesAgain) {
908	 			if (typeof Grifols.BCS.cookies.policyPage != 'undefined' && location.href.indexOf(Grifols.BCS.cookies.policyPage) < 0){
909	 				/* Show the cookie introduction if user is not accessing the Cookies Policy page */
910	 				Grifols.BCS.cookies.openCookiesSettings();
911	 			}
912	 		}
913	 		else {
914	 			/* If a choice was made, load only the required cookies */
915	 			if(cookieJSON.preferences.analytic == "true"){
916	 				addGoogleAnalytics();
917	 				loadIFrames();
918	 				setAnalytics();
919	 			}
920	 			else {
921	 				Grifols.BCS.cookies.removeAnalyticsCookies();
922	 			}
923	 			if (typeof cookieJSON.preferences.marketing != 'undefined') {
924	 				if(cookieJSON.preferences.marketing == "true"){
925	 					//TODO: ALLOW MARKETING COOKIES
926	 					Grifols.BCS.cookies.addMarketingCookies();
927	 				}
928	 				else {
929	 					//TODO: DENY MARKETING COOKIES
930	 					Grifols.BCS.cookies.removeMarketingCookies();
931	 				}
932	 			}
933	 		}
934	 	} catch(e) {
935	 		$.removeCookie(Grifols.BCS.cookies.cookieConsentName, { path: '/' });
936	 	}
937	}
938};
939
940Grifols.BCS.cookies.validateCreatedCookiesAreDefined = function() {
941	var currentCookies = "";
942	var unknownCookies = "";
943	$.each(document.cookie.split(/; */), function()  {
944		var splitCookie = this.split('=');
945		var cookieKey = splitCookie[0];
946		var cookieValue = splitCookie[1];
947		if (typeof(cookieValue) != 'undefined' && cookieValue !== null && cookieValue !== "") {
948			var exists = false;
949			var ignore = false;
950			var legacy = false;
951			if (typeof(essentialsCookiesContext) !== 'undefined') {
952				for (var iter = 0; iter < essentialsCookiesContext.cookie_names.length; iter++) {
953					var essentialCookieName = essentialsCookiesContext.cookie_names[iter];
954
955					if (essentialCookieName.indexOf("#") == essentialCookieName.length - 1) {
956						//if cookie key ends with #
957						//example -> LFR_SESSION_STATE_#
958						essentialCookieName = essentialCookieName.substring(0, essentialCookieName.length - 1);
959						if (cookieKey.indexOf(essentialCookieName) == 0) {
960							exists = true;
961						}
962					}
963					else if (cookieKey === essentialCookieName) {
964						exists = true;
965					}
966				}
967			}
968			if (typeof(analyticsCookiesContext) !== 'undefined') {
969				for (var iter = 0; iter < analyticsCookiesContext.cookie_names.length; iter++) {
970					var analyticsCookieName = analyticsCookiesContext.cookie_names[iter];
971
972					if (analyticsCookieName.indexOf("#") == analyticsCookieName.length - 1) {
973						//if cookie key ends with #
974						//example -> LFR_SESSION_STATE_#
975						analyticsCookieName = analyticsCookieName.substring(0, analyticsCookieName.length - 1);
976						if (cookieKey.indexOf(analyticsCookieName) == 0) {
977							exists = true;
978						}
979					}
980					else if (cookieKey === analyticsCookieName) {
981						exists = true;
982					}
983				}
984			}
985			if (typeof(marketingCookiesContext) !== 'undefined') {
986				for (var iter = 0; iter < marketingCookiesContext.cookie_names.length; iter++) {
987					var marketingCookieName = marketingCookiesContext.cookie_names[iter];
988
989					if (marketingCookieName.indexOf("#") == marketingCookieName.length - 1) {
990						//if cookie key ends with #
991						//example -> LFR_SESSION_STATE_#
992						marketingCookieName = marketingCookieName.substring(0, marketingCookieName.length - 1);
993						if (cookieKey.indexOf(marketingCookieName) == 0) {
994							exists = true;
995						}
996					}
997					else if (cookieKey === marketingCookieName) {
998						exists = true;
999					}
1000				}
1001			}
1002			if (typeof(ignoreCookiesContext) !== 'undefined') {
1003				for (var iter = 0; iter < ignoreCookiesContext.cookie_names.length; iter++) {
1004					var ignoreCookieName = ignoreCookiesContext.cookie_names[iter];
1005
1006					if (ignoreCookieName.indexOf("#") == ignoreCookieName.length - 1) {
1007						//if cookie key ends with #
1008						//example -> LFR_SESSION_STATE_#
1009						ignoreCookieName = ignoreCookieName.substring(0, ignoreCookieName.length - 1);
1010						if (cookieKey.indexOf(ignoreCookieName) == 0) {
1011							ignore = true;
1012						}
1013					}
1014					else if (cookieKey === ignoreCookieName) {
1015						ignore = true;
1016					}
1017				}
1018			}
1019			if (typeof(legacyCookiesContext) !== 'undefined') {
1020				for (var iter = 0; iter < legacyCookiesContext.cookie_names.length; iter++) {
1021					var legacyCookieName = legacyCookiesContext.cookie_names[iter];
1022
1023					if (legacyCookieName.indexOf("#") == legacyCookieName.length - 1) {
1024						//if cookie key ends with #
1025						//example -> LFR_SESSION_STATE_#
1026						legacyCookieName = legacyCookieName.substring(0, legacyCookieName.length - 1);
1027						if (cookieKey.indexOf(legacyCookieName) == 0) {
1028							legacy = true;
1029						}
1030					}
1031					else if (cookieKey === legacyCookieName) {
1032						legacy = true;
1033					}
1034				}
1035			}
1036
1037			if (!ignore && !legacy) {
1038				if (!exists) {
1039					if (unknownCookies==="") {
1040						unknownCookies = cookieKey;
1041					}
1042					else {
1043						unknownCookies = unknownCookies + "," + cookieKey;
1044					}
1045					Grifols.BCS.cookies.removeCookieNameGettingDomain(cookieKey);
1046				} else {
1047					if (currentCookies==="") {
1048						currentCookies = cookieKey;
1049					}
1050					else {
1051						currentCookies = currentCookies + "," + cookieKey;
1052					}
1053				}
1054			}
1055			if (legacy) {
1056				Grifols.BCS.cookies.removeCookieNameGettingDomain(cookieKey);
1057				if (Grifols.BCS.cookies.getCookie(cookieKey)!==null) {
1058					Grifols.BCS.cookies.removeCookieName(cookieKey);
1059				}
1060			}
1061		}
1062	});
1063
1064
1065	$.ajax({
1066		async: false,
1067		type: "POST",
1068		data: {
1069			siteGroupId: parseInt(Liferay.ThemeDisplay.getScopeGroupId()),
1070			currentCookies: currentCookies,
1071			unknownCookies: unknownCookies
1072		},
1073		url: '/c/portal/cookies/cookies_validation',
1074		dataType: 'json',
1075		success: function() { }
1076	});
1077}
1078
1079Grifols.BCS.cookies.showCookieManagement = function(){
1080	if($("#cookie-intro-modal").length > 0){
1081		$("#cookie-intro-modal").removeClass("modal-dialog-open");
1082		$("#cookie-intro-modal").addClass("modal-dialog-hidden");
1083	}
1084
1085	var bodyContentHtml = AUI().one('#cookie-settings').html();
1086
1087	if (typeof(jQuery.cookie(Grifols.BCS.cookies.cookieConsentName)) != 'undefined'){
1088		var cookieString = jQuery.cookie(Grifols.BCS.cookies.cookieConsentName);
1089
1090		//Decode (Base64) cookie value
1091		var decodedCookie = atob(cookieString);
1092
1093		var cookieJSON = JSON.parse(decodedCookie);
1094		if(cookieJSON.preferences.analytic == "true"){
1095			bodyContentHtml = bodyContentHtml.replace('<input id="analytic-preference"', '<input id="analytic-preference" checked');
1096		}
1097	}
1098
1099	AUI().use('aui-modal', function(A) {
1100		new A.Modal({
1101			bodyContent : bodyContentHtml,
1102			id : "cookie-settings-modal",
1103			cssClass : "grifols-popup",
1104			centered : true,
1105			draggable : false,
1106			resizable : false,
1107			title : '',
1108			modal : true,
1109			constrain2view : true,
1110			destroyOnClose : true,
1111			zIndex: Liferay.zIndex.OVERLAY
1112		}).render();
1113	});
1114};
1115
1116Grifols.BCS.cookies.saveCookiesPreferences = function(preferences){
1117	var cookieJSON = JSON.parse(JSON.stringify(preferences));
1118	if(cookieJSON.analytic == "false"){
1119		Grifols.BCS.cookies.removeAnalyticsCookies();
1120	}
1121	if (typeof(cookieJSON.marketing) != 'undefined' && cookieJSON.marketing == "false") {
1122		Grifols.BCS.cookies.removeMarketingCookies();
1123	}
1124	Grifols.BCS.cookies.validateCreatedCookiesAreDefined();
1125
1126	$.ajax({
1127		async: false,
1128		type: "POST",
1129		data: {
1130			preferences: preferences
1131		},
1132		url: '/c/portal/cookies/cookies_consent',
1133		dataType: 'json',
1134		error: function(e) {
1135			console.log("Error:");
1136			console.log(e);
1137		},
1138		success: function() { location.reload(); }
1139	});
1140}
1141
1142Grifols.BCS.cookies.acceptAllCookies = function(cookieTypes){
1143	var jsonCookies = '{"essential":"true"';
1144	if(typeof cookieTypes != 'undefined' && cookieTypes != ""){
1145		var types = cookieTypes.split(',');
1146		for (var i = 0; i < types.length; i++){
1147			jsonCookies = jsonCookies + ',"' + types[i] + '":"true"';
1148		}
1149	}
1150	jsonCookies = jsonCookies + '}';
1151
1152	Grifols.BCS.cookies.saveCookiesPreferences(jsonCookies);
1153}
1154
1155Grifols.BCS.cookies.refuseAllCookies = function(cookieTypes){
1156	var jsonCookies = '{"essential":"true"';
1157	if(typeof cookieTypes != 'undefined' && cookieTypes != ""){
1158		var types = cookieTypes.split(',');
1159		for (var i = 0; i < types.length; i++){
1160			jsonCookies = jsonCookies + ',"' + types[i] + '":"false"';
1161		}
1162	}
1163	jsonCookies = jsonCookies + '}';
1164
1165	Grifols.BCS.cookies.saveCookiesPreferences(jsonCookies);
1166}
1167
1168Grifols.BCS.cookies.updateCookiePreferences = function(cookieTypes){
1169	var jsonCookies = '{essential:"true"';
1170	if(typeof cookieTypes != 'undefined' && cookieTypes != ""){
1171		var types = cookieTypes.split(',');
1172		for (var i = 0; i < types.length; i++){
1173			jsonCookies = jsonCookies + ',' + types[i] + ':"'+ $('#' + types[i] + '-preference').prop('checked') +'"';
1174		}
1175	}
1176	jsonCookies = jsonCookies + '}';
1177
1178	Grifols.BCS.cookies.saveCookiesPreferences(jsonCookies);
1179}
1180
1181Grifols.BCS.cookies.removeAnalyticsCookies = function() {
1182	if(typeof analyticsCookiesContext != 'undefined' && analyticsCookiesContext != ""){
1183		var domainCookie = "";
1184		for(var iter = 0; iter < analyticsCookiesContext.cookie_names.length; iter++) {
1185			if (Grifols.BCS.cookies.getCookie(analyticsCookiesContext.cookie_names[iter])!==null) {
1186				Grifols.BCS.cookies.removeCookieNameGettingDomain(analyticsCookiesContext.cookie_names[iter]);
1187			}
1188		}
1189	}
1190}
1191
1192Grifols.BCS.cookies.addMarketingCookies = function() {
1193	//TODO
1194}
1195
1196Grifols.BCS.cookies.removeMarketingCookies = function() {
1197	//TODO
1198}
1199
1200Grifols.BCS.cookies.openCookiesSettings = function() {
1201	AUI().use('aui-modal', function(A) {
1202		new A.Modal({
1203			bodyContent : A.one('#cookie-intro').html(),
1204			id : "cookie-intro-modal",
1205			cssClass : "grifols-popup",
1206			centered : true,
1207			draggable : false,
1208			resizable : false,
1209			title : '',
1210			modal : true,
1211			constrain2view : true,
1212			destroyOnClose : true,
1213			zIndex: Liferay.zIndex.OVERLAY
1214		}).render();
1215		setTimeout(Grifols.BCS.cookies.initCompany(), 500);
1216	});
1217}
1218
1219Grifols.BCS.cookies.removeCookieNameGettingDomain = function (cookieKey) {
1220	var domainCookie = "";
1221	if (Grifols.BCS.cookies.getCookie(cookieKey)!==null) {
1222		var continueLoop = 1;
1223		domainCookie = location.hostname;
1224		// while (continueLoop==1) {
1225		//Elimino cookie
1226		Grifols.BCS.cookies.removeCookieName(cookieKey, domainCookie);
1227
1228		//si la cookie ha sido eliminada o el dominio ya es vacío acabo el bucle
1229		if (Grifols.BCS.cookies.getCookie(cookieKey)===null || domainCookie==="") {
1230			continueLoop = 0;
1231		}
1232
1233		//reduzco dominio en cada iteración
1234		//	  if (domainCookie.indexOf('.')===-1) {
1235		//			  domainCookie = "";
1236//			  } else {
1237		//  domainCookie = domainCookie.substring(domainCookie.indexOf('.')+1);
1238		//  }
1239		//}
1240	}
1241}
1242
1243Grifols.BCS.cookies.removeCookieName = function (name) {
1244	Grifols.BCS.cookies.removeCookieName(name, "");
1245}
1246
1247Grifols.BCS.cookies.removeCookieName = function (name, domainCookie) {
1248	jQuery.removeCookie(name, { path: '/', domain: domainCookie });
1249}
1250
1251
1252Grifols.BCS.cookies.getCookie = function (name) {
1253	if (typeof(name) != 'undefined' && name !== "") {
1254		var nameValue = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
1255		return nameValue ? nameValue[2] : null;
1256	}
1257}
1258
1259Grifols.BCS.cookies.createCookieName = function (name, value, expiry) {
1260	var expires = new Date();
1261	expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000));
1262	document.cookie = name + '=' + value + ';path=/;expires=' + expires.toUTCString();
1263}
1264
1265Grifols.BCS.cookies.initCompany = function(){
1266	$('.grifols-company').mouseenter(function(){
1267		Grifols.BCS.cookies.showCompany(false);
1268	});
1269	$('.grifols-company').mouseleave(function(){
1270		$('.grifols-company-detail:not(.open)').fadeOut();
1271	});
1272	$('.grifols-company').click(function(){
1273		Grifols.BCS.cookies.showCompany(true);
1274	});
1275	$('.grifols-company-detail .close').click(function(){
1276		$('.grifols-company-detail').removeClass('open');
1277		$('.grifols-company-detail').fadeOut();
1278	});
1279}
1280
1281Grifols.BCS.cookies.showCompany = function(isClick){
1282	var minMargin = 26;
1283	var topPosition = $('.grifols-company').position().top + parseInt($('.grifols-company').css('line-height')) + 5;
1284	var leftPosition = $('.grifols-company').position().left + $('.grifols-company').outerWidth()/2 - $('.grifols-company-detail').outerWidth()/2;
1285	var pageStartLeft = minMargin;
1286	var pageStartRight = $('#cookie-intro-modal').outerWidth() - $('.grifols-company-detail').outerWidth() - minMargin;
1287	var arrowUpLeft = $('.grifols-company-detail').outerWidth()/2 - 10;
1288
1289	/* Too left */
1290	if(leftPosition < pageStartLeft){
1291		arrowUpLeft = arrowUpLeft + leftPosition - pageStartLeft;
1292		leftPosition = pageStartLeft;
1293	}
1294
1295	/* Too right */
1296	if(leftPosition > pageStartRight) {
1297		arrowUpLeft = arrowUpLeft + leftPosition - pageStartRight;
1298		leftPosition = pageStartRight;
1299	}
1300
1301	$('.grifols-company-detail').css('top', topPosition + 'px');
1302	$('.grifols-company-detail').css('left', leftPosition + 'px');
1303	$('.grifols-company-detail').find('.arrow-up').css('left', arrowUpLeft + 'px');
1304
1305	$('.grifols-company-detail').fadeIn();
1306	if(isClick){
1307		$('.grifols-company-detail').addClass('open');
1308	}
1309}
1310
1311function getUrlParameter(url, name) {
1312    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1313    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
1314    var results = regex.exec(url);
1315    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1316};

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.