var PluginUrl='//www.ganleyvillagechryslerdodgeram.com'; var couponLauncher=false; if (activateDealerOnC==1) { window.onresize=function(){try{document.getElementById('DealeronBlackOverlay').style.height = DealeronDocHeight() + 'px';}catch(err){}} window.addEventListener ? window.addEventListener("load",loadCoupon,false) : window.attachEvent && window.attachEvent("onload",loadCoupon); } function loadCoupon(){ var couponDiv = document.createElement('div'); couponDiv.setAttribute('id', 'DealeronCoupon'); couponDiv.style.position = 'fixed'; couponDiv.style.top = '25%'; couponDiv.style.left = '25%'; couponDiv.style.zIndex = '99999'; couponDiv.style.backgroundColor = '#fff'; couponDiv.style.fontFamily = 'Frutiger,Verdana,Arial'; var overlayDiv = document.createElement('div'); overlayDiv.setAttribute('id', 'DealeronBlackOverlay'); overlayDiv.style.display = 'block'; overlayDiv.style.position = 'absolute'; overlayDiv.style.top = '0'; overlayDiv.style.left = '0'; overlayDiv.style.width = '100%'; overlayDiv.style.height = DealeronDocHeight() + 'px'; overlayDiv.style.backgroundColor = '#000'; overlayDiv.style.zIndex = '9999'; overlayDiv.style.opacity = '0.8'; overlayDiv.style.filter = 'alpha(opacity=80)'; document.body.appendChild(overlayDiv); document.body.appendChild(couponDiv); DealeronLoadJsCss(PluginUrl + "/resources/components/coupon/eas/css/dealeronLauncher.css", "css", "head"); DealeronUpdateCoupon(); DealeronCouponBoxEvents(); DealeronCouponFormat(); } function DealeronUpdateCoupon() { var html = ''; html = '
'; html += '
'; html += '
Special Offer
'; html += '
close window
'; html += '
'; html += '
'; html += '
'; html += 'Auto Show Super Store Savings'; html += 'New or Used Vehicles $250 Off With This Coupon'; html += 'Lowest  Auto Show Pricing on New '; html += 'Complete This Form and One Our Specialist Will Be in Touch!'; html += '
'; html += '
'; html += '
'; html += '
Get the Special Offer
'; html += '
close window
'; html += '
'; html += '
'; document.getElementById('DealeronCoupon').innerHTML = html; } function DealeronCouponFormat() { var elm = document.getElementById('DealeronOffersFirst'); var charLength = elm.innerHTML.length; if ((parseInt(charLength) >= 15 && parseInt(charLength) < 20)) { elm.style.fontSize = '28px'; elm.style.lineHeight = '28px'; } else if ((parseInt(charLength) >= 20 && parseInt(charLength) < 35)) { elm.style.fontSize = '26px'; elm.style.lineHeight = '26px'; } else if ((parseInt(charLength) >= 35)) { elm.style.fontSize = '20px'; elm.style.lineHeight = '20px'; } elm = document.getElementById('DealeronOffersSecond'); charLength = elm.innerHTML.length; if ((parseInt(charLength) >= 18 && parseInt(charLength) < 40)) { elm.style.fontSize = '12px'; elm.style.fontWeight = 'bold'; } else if ((parseInt(charLength) >= 40)) { elm.style.fontSize = '16px'; elm.style.fontWeight = 'bold'; } elm = document.getElementById('DealeronCouponOfferExp'); charLength = elm.innerHTML.length; if ((parseInt(charLength) >= 101 && parseInt(charLength) < 160)) elm.style.fontSize = '12px'; else if ((parseInt(charLength) >= 160)) elm.style.fontSize = '10px'; elm = document.getElementById('DealeronCouponCertificate'); charLength = elm.innerHTML.length; if ((parseInt(charLength) >= 30 && parseInt(charLength) < 100)) elm.style.fontSize = '16px'; else if ((parseInt(charLength) >= 100 && parseInt(charLength) < 130)) elm.style.fontSize = '14px'; else if ((parseInt(charLength) >= 130 && parseInt(charLength) < 160)) elm.style.fontSize = '12px'; else if ((parseInt(charLength) >= 160)) elm.style.fontSize = '10px'; } function DealeronCouponBoxEvents() { var c = document.getElementById('DealeronCouponClose'); var ob = document.getElementById('DealeronCouponOfferButton'); var obNissan = document.getElementById('DealeronCouponOfferButtonNissan'); var cb = document.getElementById('DealeronCouponCloseButton'); var bo = document.getElementById('DealeronBlackOverlay'); if (c) { DealeronAddClickEvents(c, DealeronHideCoupon); } if (ob) { DealeronAddClickEvents(ob, DealeronOpenCoupon); } if (obNissan) { DealeronAddClickEvents(obNissan, DealeronOpenCoupon); } if (cb) { DealeronAddClickEvents(cb, DealeronHideCoupon); } if (bo) { DealeronAddClickEvents(bo, DealeronHideCoupon); } } function DealeronAddClickEvents(elm, fn) { if (window.addEventListener) { elm.addEventListener('click', fn, false); } else if (window.attachEvent) { elm.attachEvent('onclick', fn); } else { alert("Please contact the site administrator!"); } } function DealeronOpenCoupon() { var generator = window.open(PluginUrl + '/coupon/eas/', 'EAS', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,height=600,width=840'); DealeronRemove('DealeronCoupon'); DealeronRemove('DealeronBlackOverlay'); } function DealeronHideCoupon() { if (nothxid == 2) { DealeronRemove('DealeronCoupon'); DealeronRemove('DealeronBlackOverlay'); } else { var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase()); if (is_chrome) { if (!window.isCouponOpened) { var a = document.createElement("a"); a.href = PluginUrl + '/coupon/eas/'; var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null); a.dispatchEvent(evt); window.isCouponOpened = true; } } else { var DealeronEAS = window.open(PluginUrl + '/coupon/eas/', 'EAS', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,height=600,width=840'); window.setTimeout(window.focus, 500); if ((DealeronEAS != 'undefined') && (DealeronEAS != null)) { DealeronEAS.blur(); } window.open("", "_self", ""); } DealeronRemove('DealeronCoupon'); DealeronRemove('DealeronBlackOverlay'); } } function DealeronDocHeight() { var D = document; return Math.max( Math.max(D.body.scrollHeight, D.documentElement.scrollHeight), Math.max(D.body.offsetHeight, D.documentElement.offsetHeight), Math.max(D.body.clientHeight, D.documentElement.clientHeight) ); } function DealeronRemove(id) { return (elem = document.getElementById(id)).parentNode.removeChild(elem); } function DealeronLoadJsCss(filename, filetype, where) { var fileref; if (filetype == "js") { fileref = document.createElement("script"); fileref.setAttribute("src", filename); } else if (filetype == "css") { fileref = document.createElement("link"); fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("href", filename); } if (typeof fileref != "undefined") { if (where == "head") { document.getElementsByTagName("head")[0].appendChild(fileref); } else { document.getElementsByTagName("body")[0].appendChild(fileref); } } } function DealerOnCoupnStatusCheck() { var dCouponValue = 'dealerOnCoupon'; if (gup('do_copn') == dCouponValue) { activateDealerOnC = 0; } } function gup(name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexS = "[\\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href); if (results == null) return ""; else return results[1]; }