(function() { var css = '.ac-widget {position:fixed; top: 50%; right: -50px; display: block;width: 150px;height: 40px;transform: rotate(-90deg); background-image: url("https://compliance.firstdatams.com/services/images/firstdata/theme/fd_uk/logo.png");background-size: contain; background-repeat: no-repeat; background-position: center; border-top-left-radius: 3px; border-top-right-radius: 3px; box-shadow: 0 1px 0 8px white,0 0 0 9px hsl(0, 0%, 90%),-2px -4px 12px rgba(0, 0, 0, 0.2); cursor: pointer;}', head = document.head, style = document.createElement('style'), preview = document.createElement('div'), lang = navigator.language || navigator.browserLanguage, windowObjectReference = null, assuranceCardUrl = 'https://compliance.firstdatams.com/services/api/sysnet-air/assuranceCard?p=bjjjcf', PreviousUrl; style.type = 'text/css'; if (style.styleSheet){ style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } head.appendChild(style); preview.id = 'widget-preview'; preview.className = 'ac-widget'; if (lang.indexOf('fr') == 0) preview.className += ' ac-widget-french'; document.body.appendChild(preview); console.log(assuranceCardUrl); preview.onclick = function() { if(windowObjectReference == null || windowObjectReference.closed) { windowObjectReference = window.open(assuranceCardUrl, 'assurance_card', 'width=600,height=320, menubar=no, resizable, scrollbars, location=no, top=100, left=100'); } else if(PreviousUrl != assuranceCardUrl) { windowObjectReference = window.open(assuranceCardUrl, 'assurance_card', 'width=600,height=320, menubar=no, resizable, scrollbars, location=no, top=100, left=100'); windowObjectReference.focus(); } else { windowObjectReference.focus(); }; PreviousUrl = assuranceCardUrl; }; })();