var PluginUrl='//dealer3174.dealeron.com';
function readCookie(name){
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++)
{
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function ParameterByName(name){
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return ";
else
return decodeURIComponent(results[1].replace(/\+/ g, " "));
}
function isBlank(str) {
return (!str || /^\s*$/.test(str));
}
function isEmpty(str) {
return (!str || 0 === str.length);
}
function hasValue(str) {
return (!this.isBlank(str) && !this.isEmpty(str));
}
var DealerOn_Coupon = {
couponName: 'dealerOn_coupon_3174',
createCookie:function(name, value){
document.cookie = name + "=" + value + "; path=/";
},
setCouponCookie:function(){
this.createCookie(this.couponName, '1');
},
couponCookie:function(){
var value = readCookie(this.couponName);
if (value == null || value == 0) {
this.setCouponCookie();
return false;
}
else {
return true;
}
},
activateCoupon:function(){
return !this.couponCookie();
}
}
function loadjscssfile(filename, filetype, where) {
var fileref;
if (filetype == "js") {
fileref = document.createElement("script");
fileref.setAttribute("type", "text/javascript");
fileref.setAttribute("src", filename);
}
else if (filetype == "css") {
fileref = document.createElement("link");
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", filename);
}
if (typeof fileref != "undefined") {
if (where == "head") {
document.getElementsByTagName("head")[0].appendChild(fileref);
}
else {
document.getElementsByTagName("body")[0].appendChild(fileref);
}
}
}
var couponLauncher=false;
if (DealerOn_Coupon.activateCoupon()){
couponLauncher=true;
var activateDealerOnC=1;
}
var nothxid = 1;
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 += '
';
html += '
';
html += '$200.00 off';
html += '';
html += 'As a token of our appreciation we would like to offer you a';
html += '$200.00 Instant Savings Certificate';
html += '
';
html += '
';
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];
}