console.log('utilitychoice: valid key for Eisenbach Inc.');
var head = document.getElementsByTagName('head')[0];
var fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", "https://utilitychoice.com/affiliate_styles");
head.appendChild(fileref);
window.onload = function () {
var residentialEvent = function () {
window.innerWidth > 1000
? document.body.insertAdjacentHTML('beforeEnd', '')
: window.open('https://utilitychoice.com/residential_shopping_mobile/ede6e3a')
};
var residential = document.getElementById('utilitychoice_residential');
if(residential) {
residential.onclick = residentialEvent;
}
Array.prototype.forEach.call(document.querySelectorAll('.utilitychoice_residential'), function (element) {
element.onclick = residentialEvent;
});
/** Commercial **/
var commercialEvent = function () {
window.innerWidth > 1000
? document.body.insertAdjacentHTML('beforeEnd', '')
: window.open('https://utilitychoice.com/commercial_shopping_mobile/ede6e3a')
};
var commercial = document.getElementById('utilitychoice_commercial');
if(commercial) {
commercial.onclick = commercialEvent
}
Array.prototype.forEach.call(document.querySelectorAll('.utilitychoice_commercial'), function (element) {
element.onclick = commercialEvent;
});
};
window.addEventListener('message', utilitychoice_close, false);
function utilitychoice_close(){
var iframe = document.getElementById('eisenbach_iframe');
if(iframe != null){
iframe.remove();
}
return true;
}