const currentUrl = new URL(window.location.href);
if(currentUrl.host == 'shop4d.com') {
var roid = "";
var ronumber = "";
var usertype = "repairorder";
} else {
var usertype = 'websitechat';
var pathname = encodeURIComponent(currentUrl.pathname);
}
var html = '
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAAAsTAAALEwEAmpwYAAADZklEQVR4nO2aSWgUQRSGPxOXRE9x3yHichAPgmJEFG9iUA/qySgigihBRTxEI3ry7EEvIu6JegkSox5MAsbElRzU4MU1ARXEDZeMxC2RB69haCYz3T3V3ZXYPzwYJt31+st0Vb36qyBRokSJEv0/mgpsAI4CjcBL4DPwG/ijn18AzXpNBTCFAaYSYA/wAOgF+nyG3NMO7Na2rNV44BjQHQCyv0gBR4AJWKRCYC/wzSCoO77qLy65YtV04HaIoO5oibOPlwHvIoR1QnIuiBp2ueG+6jck99KoYBfqYBIXbHq/nh827CTgjQWwTnQBY8MEvm4BpDuuhgVbYQFcf7HeNOxwLQv7LI1nwDCTwFstgMoVG00Ct1sAlCukADKiWRbAeF10TDMBvNMCGK+xzQTwhRge/LtON/uAcmCOLhWHapTod/K3auCaVl+nTAA/ivCVvAGsBYoDPOdIYJEJ4A8RwDYAc7FEPSGCSpm6EsvUExJsEzA6S97JwGagFrgHvNJFS0o/3wVq9Bq51pjehwB7Rgcft4YAqwOaCm3AKm0jLz00DHsWKMiQZwnQYaD9x8DifIBrDFs07ppXfKpDat2ayiNtHQzqgVUaeohPGfqavNaXQ+gyTtT103WyqtRQ8i2uduW1Ph8irBPngvTr+3km7cjQb6sjgHWiyi/wpjwTyv3pmgH8iBA4pW+qZ8lA8zyPvlvkaq8hQlgn6vGpdQETXXS1MzvgnlO+8ReY6Re6LkAicUvSdSAGWCf2+wUeA3T6TCI+drqaYwRuJIBkVfPFR5Jxrvvfxgj8moCSvZ2PHpOI45munzEC95CHvE5VoyJcbnrZngmsWo9JSi16pZ8EhZ3no9iXbdV0NQ20bZkRuiD3mkRcz7hKSnfs8AtbkGO5KAXFcbVLW3Wyr8/gc8dReMipIV9nRYpzFB5dapu65+0VGdq6EgPwJb+/7q0soNszTD/ZVBrxpnoqyK5Em5rdMsreBA5rFRXUQ6qKEFhOGcUu+UedjAD2BBapMOCCxI+hF/vZLrcKdQVl0sRz4pcuR61UWQiWcJ8a9r6NvCj7dbnO4b1xG3lRa6IuUMTZvKNnTLp1iunUau+0HnUQ+3eNTpHZnJciBplky3RXlgM4LQxSyUC4TGsFqRme6iZ7a9wPlihRIozqH3h7dIlBBTXkAAAAAElFTkSuQmCC)
Chat with us!
';
document.body.insertAdjacentHTML('beforeend', html);
let chatbutton = document.getElementById('shop4d-chat');
chatbutton.onclick = function(){
window.open('https://shop4d.com/common/chat.php?usertype=websitechat&cid=MTA2&meta='+currentUrl,'s4dchat',"popup,left=100,top=100,width=420,height=620")
}