(function() {

    var css = '.ac-widget {position:fixed; top: 50%; right: -50px; display: block;width: 150px;height: 40px;transform: rotate(-90deg); background-image: url("https://assurance.sysnetgs.com/img/thumb.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://assurance.sysnetgs.com/assurancecard/be8e7fbc4499573fa53e78c6934cbf6452e914ce6478be1898447800452f22f1/assurancecard/",
        PreviousUrl;

    <!--Insert CSS-->

    style.type = 'text/css';
    if (style.styleSheet){
        style.styleSheet.cssText = css;
    } else {
        style.appendChild(document.createTextNode(css));
    }

    head.appendChild(style);

     <!--Insert widget HTML element-->

    preview.id = 'widget-preview';
    preview.className = 'ac-widget';
    if (lang.indexOf('fr') == 0) preview.className += ' ac-widget-french';
    document.body.appendChild(preview);

    <!--Create a new window or re-use an already opened one-->

    console.log(assuranceCardUrl);

    preview.onclick = function() {
        if(windowObjectReference == null || windowObjectReference.closed) {
            windowObjectReference = window.open(assuranceCardUrl, 'assurance_card', 'width=500,height=535, menubar=no, resizable, scrollbars, location=no, top=100, left=100');
        } else if(PreviousUrl != assuranceCardUrl) {
            windowObjectReference = window.open(assuranceCardUrl, 'assurance_card', 'width=500,height=535, menubar=no, resizable, scrollbars, location=no, top=100, left=100');
        <!--if the resource to load is different,-->
        <!--then we load it in the already opened secondary window and then-->
        <!--we bring such window back on top/in front of its parent window.-->
            windowObjectReference.focus();
        } else {
            windowObjectReference.focus();
        };

        PreviousUrl = assuranceCardUrl;
    };
})();