var mobile_breakpoint = 610; var def_width = "100%"; var def_height = 726; var frame_url = "https://www.theglazingvault.com/sm2/designer/create/9415/09f8920571f4ff2c62e0561424eadc35"; var parent = document.getElementById("salesManager2").parentNode; var current_url = window.location.href; var vendor = 9415; var isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPod/i); }, ipad: function() { return navigator.userAgent.match(/iPad/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() ||isMobile.ipad() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } } var mobile = false; // The width of the current container var width = parent.clientWidth; if(width < 950) { def_height = 826; } var tfnw = isMobile.any() && vendor == 5009; // if we are mobile or under load the .m version if((width <= mobile_breakpoint) || (tfnw)){ var mobile_url = "//www.theglazingvault.com/sm2/designer/create-mobile/9415/09f8920571f4ff2c62e0561424eadc35?postback="+current_url; // inject a href tag. if(!tfnw) { parent.innerHTML = ''; } else { if(isMobile.ipad()) { parent.innerHTML = ''; }else{ parent.innerHTML = ''; } } } else if(!mobile) { var iframe = document.createElement('iframe'); // Get the sales manager 2 script tag // set the iframe source iframe.src = frame_url; // Inject the iFrame into the DOM iframe.width = def_width; iframe.height = def_height; iframe.style.border = 'none'; iframe.style.marginTop = '20px'; iframe.style.marginBottom = '20px'; var currentScript = document.currentScript || (function () { var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); currentScript.parentElement.appendChild(iframe); } else { var iframe = document.createElement('iframe'); // Get the sales manager 2 script tag // set the iframe source var mobile_url = "//www.theglazingvault.com/sm2/designer/create-mobile/9415/09f8920571f4ff2c62e0561424eadc35?postback="+current_url; iframe.src = mobile_url; // Inject the iFrame into the DOM iframe.width = def_width; iframe.height = def_height; iframe.style.border = 'none'; iframe.style.marginTop = '20px'; iframe.style.marginBottom = '20px'; var currentScript = document.currentScript || (function () { var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; })(); currentScript.parentElement.appendChild(iframe); }