window.ipe121907 = window.ipe121907 || window.ipe;
ipe121907.rtl = (ipe121907.b == 21 || ipe121907.b == 25 ? "direction: rtl;" : "");
ipe121907.rtlAlign = (ipe121907.b == 21 || ipe121907.b == 25 ? "text-align:right;" : "text-align:left;");
ipe121907.isEvo = true;
ipe121907.siteId = (function () {
var rndNum = Math.floor((Math.random() * 100));
if (rndNum < 50) {
return "1";
} else {
return "2";
}
}());
//invitation text
ipe121907.e = ["Thank you! After your visit", "please tap the icon to provide feedback"];
//div (true) or image (false) at step 2
ipe121907.h = !0;
//invitation position: top 1, center 2, bottom 3
ipe121907.v = 2;
//protocol
ipe121907.w = document.location.protocol;
ipe121907.populateAutoFillQuestion = function (objs) {
function inArray(arr, str) {
if (!arr || !arr.length) {
return false;
}
for (var i = 0; i < arr.length; i++) {
if (arr[i] === str)
return true;
}
return false;
}
function trim(str) {
return str.replace(/^\s*(\S*(?:\s+\S+)*)\s*$/, "$1");
};
function startsWith(text, value) {
return text.indexOf(value) == 0;
}
function getMappedValues(key, map, undefinedValues, otherValues) {
if (typeof key === "undefined" || key === null || key === "") {
return undefinedValues;
}
for (var i = 0; i < map.length; i++) {
if (map[i][0] === key) {
return map[i].slice(1);
}
}
return otherValues;
}
function trim(str) {
return str.replace(/^\s*(\S*(?:\s+\S+)*)\s*$/, "$1");
};
var params = {};
function getURLHostname(url) {
if (typeof url === "undefined" || url === null) {
return "";
}
var m = url.match(/:\/\/(.[^/?]+)/);
if (m == null)
return url;
return m[1];
}
function handleReferrer(obj) {
var key = trim(obj['initRef']).toLowerCase();
/**
* Question: 26445, Referrer Type
* 232817: oem
* 232819: search engine
* 232820: third party
* 54492: Other
* 232821: N/A
*
* Question: 26447, Referrer Sub-Type
* 232862: accessories
* 232863: brand site
* 232864: classifieds
* 232865: cpo
* 232866: fleet
* 232867: maps
* 232868: organic
* 232869: owner marketing
* 232870: owners site
* 232872: service and parts
* 232873: third party
* 232871: paid
* 232874: N/A
*/
var referrers = [['www.automart.com', 54492, 232872],
['ads.autotrader.com', 232820, 232864],
['adserving.autotrader.com', 232820, 232864],
['edmunds.autotrader.com', 232820, 232864],
['images.autotrader.com', 232820, 232864],
['inventory.autotrader.com', 232820, 232864],
['preview.autotrader.com', 232820, 232864],
['www.autotrader.com', 232820, 232864],
['www.bing.com', 232819, 232868],
['search.bing.com', 232819, 232868],
['www.msn.com', 232819, 232868],
['search.msn.com', 232819, 232868],
['www.yahoo.com', 232819, 232868],
['search.yahoo.com', 232819, 232868],
['www.aol.com', 232819, 232868],
['search.aol.com', 232819, 232868],
['www.google.com', 232819, 232868],
['search.google.com', 232819, 232868],
['www.blackbookusa.com', 54492, 232872],
['www.carfax.com', 54492, 232872],
['acc.cars.com', 232820, 232864],
['ads.cars.com', 232820, 232864],
['ask.cars.com', 232820, 232864],
['beta.cars.com', 232820, 232864],
['blogs.cars.com', 232820, 232864],
['consumerguide.cars.com', 232820, 232864],
['extranet.cars.com', 232820, 232864],
['inventoryeditor.cars.com', 232820, 232864],
['newcars.cars.com', 232820, 232864],
['research.cars.com', 232820, 232864],
['sitesearch.cars.com', 232820, 232864],
['siy.cars.com', 232820, 232864],
['ww.cars.com', 232820, 232864],
['www.cars.com', 232820, 232864],
['motors.shop.ebay.com', 54492, 232872],
['www.edmunds.com', 54492, 232872],
['www.gm.com', 232817, 232863],
['gmaccessories.dealertrack.com', 232817, 232862],
['gmaccessorieszone.com', 232817, 232862],
['www.gmaccessorieszone.com', 232817, 232862],
['www.buick.com', 232817, 232863],
['m.buick.com', 232817, 232863],
['www.gmbuypower.com', 232817, 232863],
['www.cadillac.com', 232817, 232863],
['m.cadillac.com', 232817, 232863],
['www.gmcertified.com', 232817, 232865],
['www.chevrolet.com', 232817, 232863],
['m.chevrolet.com', 232817, 232863],
['www.gmfleet.com', 232817, 232866],
['www.gmc.com', 232817, 232863],
['m.gmc.com', 232817, 232863],
['m.gm.com', 232817, 232863],
['www.onstar.com', 232817, 232869],
['gmownercenter.yahoo.com', 232817, 232870],
['www.gmgoodwrench.com', 232817, 232871],
['www.goodwrench.com', 232817, 232871],
['maps.google.com', 232819, 232867],
['www.kbb.com', 54492, 232872],
['autos.yahoo.com', 54492, 232872]
];
var undefinedValues = [232821, 232874];
var otherValues = [54492, 54492];
var result = getMappedValues(getURLHostname(key), referrers, undefinedValues, otherValues);
//We did not find a match in the URL, try removing the '.com' (e.g. www.google.ca should still match www.google)
if (result == otherValues) {
var k = key.split('.').slice(0, 2).join('.');
for (var i = 0; i < referrers.length; i++) {
if (startsWith(referrers[i][0], k)) {
result = referrers[i].slice(1);
break;
}
}
}
//If referrer sub-type is organic and channel (cs:e) is set, then sub-type should be paid
if (result[1] == 232868) {
var channel = obj['channel'];
if (channel !== "") {
result[1] = 232873;
}
}
params["hc"] = result[0];
params["hc3"] = result[1];
//We are also given a list of top 30 domains to look for. Now the URLs containing only the last two parts (e.g. google.com; no www.)
key = getURLHostname(key).split('.').slice(-2).join('.');
/**
* Question ID: 26448 Referring Domain
*/
referrers = [['google.com', 232875],
['yahoo.com', 232876],
['bing.com', 232877],
['chevrolet.com', 232878],
['aol.com', 232879],
['admission.net', 232880],
['gmc.com', 232881],
['comcast.net', 232882],
['ask.com', 232883],
['autotrader.com', 232884],
['cadillac.com', 232885],
['mywebsearch.com', 232886],
['avg.com', 232887],
['mycertifiedservice.com', 232888],
['buick.com', 232889],
['ebay.com', 232890],
['doubleclick.net', 232891],
['gmcertified.com', 232892],
['live.com', 232893],
['facebook.com', 232894],
['google.ca', 232895],
['fusz.com', 232896],
['cars.com', 232897],
['gm.com', 232898],
['craigslist.org', 232899],
['cobaltnitra.com', 232900],
['mccoshgm.com', 232901],
['rr.com', 232902],
['auto-price-finder.com', 232903],
['search-results.com', 232904]];
undefinedValues = [232905];
otherValues = [54492];
var result = getMappedValues(key, referrers, undefinedValues, otherValues);
params["hc4"] = result[0];
}
function handleProgramChannelCode(obj) {
var channel = obj['channel'];
var program = obj['program'];
channel = trim(channel).toLowerCase();
program = trim(program).toLowerCase();
if (channel === "") {
channel = "na"; //Not applicable
var ref = trim(obj['initRef']).toLowerCase();
var searchEngines = [".aol.", ".bing.", ".google.", ".msn.", ".yahoo."];
for (var i = 0; i < searchEngines.length; i++) {
if (ref.indexOf(searchEngines[i]) !== -1) {
channel = 's_org'; //Organic search
break;
}
}
} else if (channel === "gdc") {
channel = "d_con"; //display - contextual
} else if (inArray(['ydr', 'sdr', 'vcr', 'par', 'cvnw', 'cmr', 'canw', 'cmdr', 'gmcnw',
'bnw', 'apnr', 'adbr', 'rsdr', 'bldr', 'msnr'], channel)) {
channel = "d_ret"; //display - retargeting
} else if (inArray(['tr', 'cdn', 'js', 'siim', 'mni', 'bp', 'msnn', 'bmn', 'sim', 'cent', 'kbb', 'rsdp', 'cmd', 'd', 'rsd',
'a', 'edm', 'adpep', 'sl', 'time', 'imdb', 'rd', 'invm', 'cs', 'tf'], channel)) {
channel = "d_ron"; //display - ron
} else if (channel === "mx") {
channel = "d_vid"; //display - video
} else if (inArray(['ae', 'o'], channel)) {
channel = "email"; //E-mail - owner marketing
} else if (inArray(['bmwt2', 'hyunt2', 'cvt2', 'pt2', 'gmct2', 'ht2', 'sbt2', 'cat2', 'bt2', 'snt2', 'bpgd'], channel)) {
channel = "oem"; //Oem - tier 2
} else if (inArray(['b', 'l', 'x', 'q', 'y', 'g', 'rp', 'm', 'oo'], channel)) {
channel = "s_paid"; //Paid search
}
var key = "";
if (channel.length > 0 || program.length > 0) {
key = program + ";;" + channel;
}
/**
* Question 26446: Combined Program Code and Channel Code
* 232822: Buick/GMC Ad Pack Subscription - display - contextual
* 232823: Buick/GMC Ad Pack Subscription - display - retargeting
* 232824: Buick/GMC Ad Pack Subscription - email - owner marketing
* 232825: Buick/GMC Ad Pack Subscription - not applicable - not applicable
* 232826: Buick/GMC Ad Pack Subscription - search engine - paid
* 232827: Cadillac Ad Pack Subscription - display - contextual
* 232828: Cadillac Ad Pack Subscription - display - retargeting
* 232829: Cadillac Ad Pack Subscription - email - owner marketing
* 232830: Cadillac Ad Pack Subscription - not applicable - not applicable
* 232831: Cadillac Ad Pack Subscription - search engine - paid
* 232832: Chevy Ad Pack Subscription - display - contextual
* 232833: Chevy Ad Pack Subscription - display - retargeting
* 232834: Chevy Ad Pack Subscription - display - video
* 232835: Chevy Ad Pack Subscription - email - owner marketing
* 232836: Chevy Ad Pack Subscription - not applicable - not applicable
* 232837: Chevy Ad Pack Subscription - search engine - paid
* 232838: Cobalt Digital Package GM Used - display - retargeting
* 232839: Cobalt Digital Package GM Used - not applicable - not applicable
* 232840: Cobalt Digital Package GM Used - search engine - organic
* 232841: Cobalt Digital Package GM Used - search engine - paid
* 232842: Cobalt GM Tier 2 - display - retargeting
* 232843: Cobalt GM Tier 2 - display - ron
* 232844: Cobalt GM Tier 2 - not applicable - not applicable
* 232845: Cobalt GM Tier 2 - oem - tier 2
* 232846: Cobalt GM Tier 2 - search engine - organic
* 232847: Cobalt GM Tier 2 - search engine - paid
* 232848: GM CCA Digital Launch Package - display - retargeting
* 232849: GM CCA Digital Launch Package - not applicable - not applicable
* 232850: GM CCA Digital Launch Package - search engine - paid
* 232851: Chevy DAP New Core - display - contextual
* 232852: Chevy DAP New Core - search engine - paid
* 232853: Chevy DAP New Flex - display - retargeting
* 232854: Chevy DAP New Flex - display - video
* 232855: Chevy DAP New Flex - search engine - paid
* 232856: GM DAP Used Flex - display - retargeting
* 232857: GM DAP Used Flex - search engine - paid
* 232858: Chevy DAP New Email - email - owner marketing
* 232859: GM DAP S&P Flex - display - retargeting
* 232860: GM DAP S&P Flex - search engine - paid
* 54492: Other
* 232861: N/a
*/
var cCode = [
["cbgds;;d_con", 232822],
["cbgds;;d_ret", 232823],
["cbgds;;email", 232824],
["cbgds;;na", 232825],
["cbgds;;s_paid", 232826],
["ccadds;;d_con", 232827],
["ccadds;;d_ret", 232828],
["ccadds;;email", 232829],
["ccadds;;na", 232830],
["ccadds;;s_paid", 232831],
["cchvds;;d_con", 232832],
["cchvds;;d_ret", 232833],
["cchvds;;d_vid", 232834],
["cchvds;;email", 232835],
["cchvds;;na", 232836],
["cchvds;;s_paid", 232837],
["ucdpgm;;d_ret", 232838],
["ucdpgm;;na", 232839],
["ucdpgm;;s_org", 232840],
["ucdpgm;;s_paid", 232841],
["cgt;;d_ret", 232842],
["cgt;;d_ron", 232843],
["cgt;;na", 232844],
["cgt;;oem", 232845],
["cgt;;s_org", 232846],
["cgt;;s_paid", 232847],
["ccadlp;;d_ret", 232848],
["ccadlp;;na", 232849],
["ccadlp;;s_paid", 232850],
["chedapnc;;d_con", 232851],
["chedapnc;;s_paid", 232852],
["chedapnf;;d_ret", 232853],
["chedapnf;;d_vid", 232854],
["chedapnf;;s_paid", 232855],
["gmdapuf;;d_ret", 232856],
["gmdapuf;;s_paid", 232857],
["chedapne;;email", 232858],
["gmdapsf;;d_ret", 232859],
["gmdapsf;;s_paid", 232860]
];
var undefinedValues = [232861];
var otherValues = [54492];
var result = getMappedValues(key, cCode, undefinedValues, otherValues);
params["hc2"] = result[0];
}
function handleWebId(obj) {
var key = trim(obj['webId']).toLowerCase();
/**
* Question: 26449, Web-Id
*/
var webId = [
['gmps-bobbrown-chev', 232906],
['gmps-dan-cummins', 232907],
['gmps-laura', 232908],
['gmps-george-white', 232909],
['gmps-shottenkirk-waukee', 232910],
['gmps-classic', 232911],
['gmps-deery-chevrolet', 232912],
['gmps-bobbrown-gmc', 232913],
['gmps-kerbeck-subaru', 232914],
['gmps-courtesy-az', 232915],
['gmps-morrison-stuart', 232916],
['gmps-mac-mulkin', 232917],
['gmps-sugarland', 232918],
['gmps-stingray', 232919],
['gmps-beckmasten', 232920],
['gmps-kendall-fl', 232921],
['gmps-christopher-chevy', 232922],
['gmps-sundance-chev', 232923],
['gmps-henna-austin', 232924],
['gmps-king-longmont', 232925],
['gmps-thorobred', 232926],
['gmps-service-la', 232927],
['gmps-jim-glover', 232928],
['gmps-john-megel', 232929],
['gmps-bob-johnson', 232930],
['gmps-central-norwood', 232931],
['gmps-moritz-chevrolet', 232932],
['gmps-sinclair-mo', 232933],
['gmps-rydell-auto-ca', 232934],
['gmps-marvin', 232935]]
var undefinedValues = [232936];
var otherValues = [54492];
var result = getMappedValues(getURLHostname(key), webId, undefinedValues, otherValues);
params["hc5"] = result[0];
}
function handleDealerMakes(obj) {
var key = trim(obj['makes']).toLowerCase();
var dealerMakes = [
['chevrolet', 232937],
['buick:gmc', 232938],
['buick:chevrolet:gmc', 232939],
['cadillac:chevrolet', 232940],
['buick:cadillac:chevrolet:gmc', 232941],
['buick:chevrolet', 232942],
['cadillac', 232943],
['buick:cadillac:gmc', 232944],
['buick:cadillac:chevrolet', 232945],
['gmc', 232946],
['cadillac:gmc', 232947],
['buick', 232948],
['chevrolet:gmc', 232949],
['cadillac:chevrolet:gmc', 232950],
['buick:cadillac', 232951]]
var undefinedValues = [232952];
var otherValues = [54492];
var result = getMappedValues(getURLHostname(key), dealerMakes, undefinedValues, otherValues);
params["hc6"] = result[0];
}
function handleSurveyVersion() {
params["hc7"] = 232953;
}
handleReferrer(objs);
handleProgramChannelCode(objs);
handleWebId(objs);
handleDealerMakes(objs);
handleSurveyVersion();
var strParams = "";
for (var param in params) {
if (params.hasOwnProperty(param)) {
strParams += "&" + param + "=" + params[param];
}
}
return strParams;
};
// start the survey
ipe121907.r = function () {
var a = "";
ipe121907.o.a(ipe121907.k, 0, ipe121907.c)
var IPEURL = { 'sOrgan': iPerceptions.organicSearchPhrase, 'sPaid': iPerceptions.paidSearchPhrase, 'bidKW': iPerceptions.bidKeyword, 'webTier': iPerceptions.websiteTier, 'channel': iPerceptions.channel, 'program': iPerceptions.program, 'initRef': iPerceptions.referringDomain, 'keywordTemplate': iPerceptions.keywordTemplate, 'makes': iPerceptions.listMakes, 'adcode': iPerceptions.adcode, 'promocode': iPerceptions.promocode, 'webId': iPerceptions.webId, 'sessionId': iPerceptions.sessionId && iPerceptions.sessionId.toLowerCase(), 'pageName': ContextManager.pageName, 'visitorId': iPerceptions.visitorId,'intent': iPerceptions.intent.toLowerCase()};
var hc8="&hc8=233039";
if(window.IPEbrand=='Buick'){
hc8="&hc8=233040";
}
// link to the survey
if (ipe121907.isEvo && this.f2) {
a = this.f2 + "?rn=" + this.a + "&lID=" + this.b + "&cd=" + this.c + "&hv1=invitation~" + ipe121907.siteId + '&hv2=Cobalt_Channel~' + IPEURL['channel'] + '&hv3=Cobalt_Program~' + IPEURL['program'] + '&hv4=Colbalt_Keyword_Template~' + IPEURL['keywordTemplate'] + '&hv5=Colbalt_Referrer~' + IPEURL['initRef'] + '&hv6=Ad_Code~' + IPEURL['adcode'] + '&hv7=Promo_Code~' + IPEURL['promocode'] + '&hv8=Colbalt_WebId~' + IPEURL['webId'] + '&hv9=Cobalt_Session_ID~' + IPEURL['sessionId'] + '&hv10=Cobalt_Visitor_ID~' + IPEURL['visitorId'] + "&referrer=" + escape(this.j || window.location.href) + "&res=1280x1024" + ipe121907.ps + ipe121907.populateAutoFillQuestion(IPEURL)+hc8+"&brandname="+window.IPEbrand;
} else {
a = this.f + "/Default.aspx?rn=" + this.a + "&lID=" + this.b + "&cd=" + this.c + "&hv1=invitation~" + ipe121907.siteId + '&hv2=Cobalt_Channel~' + IPEURL['channel'] + '&hv3=Cobalt_Program~' + IPEURL['program'] + '&hv4=Colbalt_Keyword_Template~' + IPEURL['keywordTemplate'] + '&hv5=Colbalt_Referrer~' + IPEURL['initRef'] + '&hv6=Ad_Code~' + IPEURL['adcode'] + '&hv7=Promo_Code~' + IPEURL['promocode'] + '&hv8=Colbalt_WebId~' + IPEURL['webId'] + '&hv9=Cobalt_Session_ID~' + IPEURL['sessionId'] + '&hv10=Cobalt_Visitor_ID~' + IPEURL['visitorId'] + "&referrer=" + escape(this.j || window.location.href) + "&res=1280x1024" + ipe121907.ps + ipe121907.populateAutoFillQuestion(IPEURL)+hc8+"&brandname="+window.IPEbrand;
}
var ga_param = ipe121907.o.b("IPE_" + ipe121907.a + "_ga") || "";
window.location.href = a + ga_param;
};
////////////////////////////////////////
// Step 1: invitation
////////////////////////////////////////
ipe121907.s = {
// background div
"n": null,
"o": "IPEB" + ipe121907.a,
"p": "IPEBS" + ipe121907.a,
"q": 10
};
// inject the div and the styles for the invitation
ipe121907.s.a = function () {
// the div to be injected
//padding:' + this.q + 'px;
var logoBackgroundColor = "#FFFFFF";
var IPEimgUrl = window.location.protocol + ipe121907.y + '/uploads/wValLogos/' + Math.floor(ipe121907.a / 1000) + '/logo' + ipe121907.a + '_' + ipe121907.b + '.jpg';
var textHeader = "We value your feedback!";
var textHeaderColor = "#666666";
var textContent = ipe121907.siteId === "1"? "Would you please answer a few short questions to help us improve our website?" : "By participating in our short survey (less than 2 minutes),you can help us improve our website.";
var textContentColor = "#808080";
var buttonColor = "#A4A9AC";
var bodyBackground = "#ffffff";
var buttonTextColor = "#000000";
//
var a = '
' +
'
' +
'
' +
'
' +
'
' +
'' +
'
' + textContent +
'
' +
'
' +
'
';
this.n = ipe121907.q.b(this.o, this.o, a);
// styles
var b = 'body{padding:0;margin:0;}.' + this.o + '{background-color:rgba(0, 0, 0, 0.5);display:none;z-index:' + ipe121907.g + ';' + 'position:' + (ipe121907.isFixed ? 'fixed' : 'absolute') + ';top:0;left:0;}';
ipe121907.t.b.j(false);
ipe121907.q.c(this.p, b)
//setTimeout('ipe121907.s1.showInvt();', 1000);
this.e();
// total invites
ipe121907.u.a(ipe121907.a, ipe121907.siteId, ipe121907.b, 2, this.n);
this.g();
this.i();
};
// when choosing "Yes"
ipe121907.s.b = function () {
if (ipe121907.sGA) {
ipe121907.o.a("IPE_" + ipe121907.a + "_ga", ipe121907.setupGA(""), ipe121907.c);
}
this.f();
this.d();
// ipe121907.o.a("1");
ipe121907.o.a(ipe121907.k, 1, ipe121907.c)
// total yes, inject the counter image into body
ipe121907.u.a(ipe121907.a, ipe121907.siteId, ipe121907.b, "3", document.body);
// with instructions
ipe121907.t.d(true);
};
// when choosing "No"
ipe121907.s.c = function () {
this.f();
this.d();
ipe121907.o.a(ipe121907.k, 0, ipe121907.c)
ipe121907.t.b.k();
};
// deject the div and the styles for Step 1
ipe121907.s.d = function () {
this.h();
if (this.n) {
document.body.removeChild(this.n);
this.n = null;
}
var a = document.getElementsByTagName("head")[0];
var b = document.getElementById(this.p);
if (b) {
a.removeChild(b);
}
};
// show the invitation
ipe121907.s.e = function () {
if (this.n) {
this.k(!0);
this.m();
}
};
// hide the invitaion
ipe121907.s.f = function () {
if (this.n) {
this.k(!1);
}
};
// add the event listeners for Step 1
ipe121907.s.g = function () {
if (window.addEventListener) {
window.addEventListener("orientationchange", ipe121907.s.i, !1);
window.addEventListener("scroll", ipe121907.s.j, !1);
}
else if (window.attachEvent) {
window.attachEvent("onorientationchange", ipe121907.s.i);
window.attachEvent("onscroll", ipe121907.s.j);
}
};
// remove the event listeners for Step 1
ipe121907.s.h = function () {
if (window.removeEventListener) {
window.removeEventListener("orientationchange", ipe121907.s.i, !1);
window.removeEventListener("scroll", ipe121907.s.j, !1);
}
else if (window.detachEvent) {
window.detachEvent("onorientationchange", ipe121907.s.i);
window.detachEvent("onscroll", ipe121907.s.j);
}
};
// when the orientation changed in Step 1
ipe121907.s.i = function () {
if (ipe121907.s.l()) {
//ipe121907.s.k(!1);
ipe121907.p.p();
ipe121907.s.m();
setTimeout('ipe121907.s.m();', 500);
setTimeout('ipe121907.s.m();', 1000);
//ipe121907.s.k(!0);
}
};
// when scroll in Step 1
ipe121907.s.j = function () {
if (ipe121907.s.l()) {
ipe121907.p.p();
ipe121907.s.m();
setTimeout('ipe121907.s.m();', 150);
setTimeout('ipe121907.s.m();', 400);
setTimeout('ipe121907.s.m();', 750);
}
};
// show or hide the invitation div
ipe121907.s.k = function (a) {
this.n.style.display = a ? "block" : "none";
};
// return if the invitation div is shown
ipe121907.s.l = function () {
return this.n.style.display == "block";
};
// set the size and the position of the invitationdiv
ipe121907.s.m = function () {
var a = "px";
//Scale font sizes
ipe121907.p.l();
//Invitation size is based on smaller dimension
var baseSize = Math.min(ipe121907.p.a.a, ipe121907.p.a.b);
if (baseSize < 480) { //Smallest screens -- 5% margin on all sides
baseSize = baseSize * 0.9;
} else if (baseSize < 800) { //Medium screens -- 10% margin
baseSize = baseSize * 0.8;
} else { //Larger screens -- 15% margin
baseSize = baseSize * 0.7;
}
//Resize and center the invitation
var d2 = document.getElementById('mobileInvite121907');
d2.style.width = baseSize + "px";
d2.style.height = baseSize + "px";
d2.style.left = ((ipe121907.p.a.a - baseSize) / 2) + "px";
if (ipe121907.v == 1) { //top
d2.style.top = "0%"
d2.style.bottom = "";
} else if (ipe121907.v == 3) { //bottom
d2.style.top = "";
d2.style.bottom = "0%"
} else { //center
d2.style.top = ((ipe121907.p.a.b - baseSize) / 2) + "px";
d2.style.bottom = "";
}
var scale = 0.07;
var fs = baseSize * scale;
var div = document.getElementById('IPEinvm121907');
div.style.fontSize = fs + "px";
//Resize and center shadow
this.n.style.width = ipe121907.p.a.a + a;
this.n.style.height = ipe121907.p.a.b + a;
if (!ipe121907.isFixed) {
this.n.style.left = ipe121907.p.b.a + a;
this.n.style.top = ipe121907.p.b.b + a;
}
};
////////////////////////////////////////
// Step 2: the icon
////////////////////////////////////////
ipe121907.t = {};
ipe121907.t.a = function () {
ipe121907.t.c.d();
ipe121907.t.b.l();
};
ipe121907.t.b = {
"a": "IPEI" + ipe121907.a,
"b": "IPEIS" + ipe121907.a,
"c": 69,
"d": 69,
"c2": 42,
"c3": 21
};
// add the event listeners for Step 2
ipe121907.t.b.e = function () {
if (window.addEventListener) {
window.addEventListener("orientationchange", ipe121907.t.b.g, !1);
if (!ipe121907.isFixed) {
window.addEventListener("scroll", ipe121907.t.b.h, !1);
}
}
else if (window.attachEvent) {
window.attachEvent("onorientationchange", ipe121907.t.b.g);
if (!ipe121907.isFixed) {
window.attachEvent("onscroll", ipe121907.t.b.h);
}
}
};
ipe121907.t.b.f = function () {
if (window.removeEventListener) {
window.removeEventListener("orientationchange", ipe121907.t.b.g, !1);
if (!ipe121907.isFixed) {
window.removeEventListener("scroll", ipe121907.t.b.h, !1);
}
}
else if (window.detachEvent) {
window.detachEvent("onorientationchange", ipe121907.t.b.g);
if (!ipe121907.isFixed) {
window.detachEvent("onscroll", ipe121907.t.b.h);
}
}
};
// when the orientation changed in Step 2
ipe121907.t.b.g = function () {
ipe121907.t.b.i();
setTimeout('ipe121907.t.b.i();', 500);
setTimeout('ipe121907.t.b.i();', 1000);
};
// when scroll in Step 2
ipe121907.t.b.h = function () {
ipe121907.p.p();
ipe121907.t.b.i();
};
ipe121907.t.b.i = function () {
ipe121907.p.l();
var a = document.getElementById(this.a);
if (a) {
var lift = (document.getElementById(ipe121907.t.c.a) ? ipe121907.t.b.c3 : 0);
if (!ipe121907.isFixed) {
a.style.top = ipe121907.p.a.b + ipe121907.p.b.b - ipe121907.t.b.d - lift + "px";
a.style.left = ipe121907.p.a.a + ipe121907.p.b.a - ipe121907.t.b.d + "px";
}
}
};
ipe121907.t.b.j = function (canDisplay) {
if (document.getElementById(this.a)) {
if (canDisplay) {
document.getElementById(this.a).style.display = "block";
}
} else {
// deject the icon and the instruction before start the survey
var a = '';
ipe121907.q.b(this.a, this.a, a);
var b = '.' + this.a + '{display:' + (canDisplay ? "block " : "none") + ';position:' + (ipe121907.isFixed ? "fixed;bottom:0;right:0" : "absolute") + ';width:' + this.c + 'px;height:' + this.d + 'px;z-index:' + ipe121907.g + ';}';
ipe121907.q.c(this.b, b);
}
};
ipe121907.t.b.k = function () {
var a = document.getElementById(this.a);
if (a) {
document.body.removeChild(a);
}
var b = document.getElementById(this.b);
if (b) {
var c = document.getElementsByTagName("head")[0];
c.removeChild(b);
}
};
ipe121907.t.b.l = function () {
this.f();
this.k();
};
// bar
ipe121907.t.c = {
"a": "IPEB" + ipe121907.a,
"b": "IPEBS" + ipe121907.a
};
ipe121907.t.c.c = function () {
this.e();
this.g();
this.j();
setTimeout('ipe121907.t.c.d();', 6000);
};
ipe121907.t.c.d = function () {
this.k();
this.f();
ipe121907.t.b.i();
};
ipe121907.t.c.e = function () {
var a = "" + ipe121907.e[0] + " |
" + ipe121907.e[1] + " |
";
ipe121907.q.b(this.a, this.a, a);
var b = '.' + this.a + '{background:#666666;left:0px;height: ' + ipe121907.t.b.c2 + 'px;display:block;z-index:' + (ipe121907.g - 100) + ';position:' + (ipe121907.isFixed ? "fixed;bottom:0" : "absolute") + ';}';
ipe121907.q.c(this.b, b);
};
ipe121907.t.c.f = function () {
var a = document.getElementById(this.a);
if (a) {
document.body.removeChild(a);
}
var b = document.getElementById(this.b);
if (b) {
var c = document.getElementsByTagName("head")[0];
c.removeChild(b);
}
};
ipe121907.t.c.g = function () {
ipe121907.p.l();
var a = document.getElementById(this.a);
if (a) {
if(!ipe121907.isFixed) {
a.style.top = ipe121907.p.a.b + ipe121907.p.b.b - ipe121907.t.b.c2 + "px";
}
a.style.width = ipe121907.p.a.a + ipe121907.p.b.a + "px";
}
};
ipe121907.t.c.h = function () {
ipe121907.t.c.g();
setTimeout('ipe121907.t.c.g();', 500);
setTimeout('ipe121907.t.c.g();', 1000);
};
ipe121907.t.c.i = function () {
ipe121907.p.p();
ipe121907.t.c.g();
};
ipe121907.t.c.j = function () {
if (window.addEventListener) {
window.addEventListener("orientationchange", this.h, !1);
if (!ipe121907.isFixed) {
window.addEventListener("scroll", this.i, !1);
}
}
else if (window.attachEvent) {
window.attachEvent("onorientationchange", this.h);
if (!ipe121907.isFixed) {
window.attachEvent("onscroll", this.i);
}
}
};
ipe121907.t.c.k = function () {
if (window.removeEventListener) {
window.removeEventListener("orientationchange", this.h, !1);
if (!ipe121907.isFixed) {
window.removeEventListener("scroll", this.i, !1);
}
}
else if (window.detachEvent) {
window.detachEvent("onorientationchange", this.h);
if (!ipe121907.isFixed) {
window.detachEvent("onscroll", this.i);
}
}
};
// inject the image and the styles for Step 2
ipe121907.t.d = function (a) {
if (ipe121907.p.k) {
ipe121907.t.b.j(true);
ipe121907.t.b.e();
if (a) {
ipe121907.t.c.c();
}
ipe121907.t.b.i();
}
else {
if (ipe121907.l) {
var b = document.getElementById(ipe121907.l);
if (b) {
if (ipe121907.h) { //div
b.innerHTML = "" + ipe121907.e[0] + " |
" + ipe121907.e[1] + " |
";
b.style.background = "#666666";
b.style.textAlign = "center";
}
else { //image
// var c = document.createElement("a");
// // remove the link before start the survey
// c.href = "javascript:ipe121907.t.e();ipe121907.r();";
// var d = document.createElement("img");
// d.src = ipe121907.f + "/images/btn_multy_ln/en-US/banner.png";
// c.appendChild(d);
// b.appendChild(c);
//b.innerHTML = "";
}
}
else {
ipe121907.r();
}
}
else {
ipe121907.r();
}
}
};
ipe121907.t.e = function () {
var a = document.getElementById(ipe121907.l);
while (a.hasChildNodes()) {
a.removeChild(a.firstChild);
}
};
//////////////////////////////////////////
//// Cookie related functions
//////////////////////////////////////////
/*
* Do not use this one.
ipe121907.o = {};
//set cookie
ipe121907.o.a = function (a) {
var b = document.createElement('img');
b.src = ipe121907.w + ipe121907.y + '/wValidatorSC.aspx?cN=IPE106262&cV=' + a;
b.style.display = 'none';
document.body.appendChild(b);
};
*/
//////////////////////////////////////////
//// Browser related functions
//////////////////////////////////////////
ipe121907.p = {
"a": {},
"b": {},
"c": {},
"d": document.body,
"e": document.documentElement
};
ipe121907.p.g = navigator.userAgent.toLowerCase();
ipe121907.p.k = (function () {
return true;
})();
ipe121907.p.l = function () {
this.m();
this.n();
this.o();
};
// how far it has scrolled
ipe121907.p.m = function () {
this.b.a = Math.max(window.pageXOffset, this.d.scrollLeft, this.e.scrollLeft);
this.b.b = Math.max(window.pageYOffset, this.d.scrollTop, this.e.scrollTop);
};
// get the size of the browser window
ipe121907.p.n = function () {
if (typeof (window.innerWidth) == 'number') {
this.a.a = window.innerWidth;
this.a.b = window.innerHeight;
} else if (this.d && this.d.clientWidth) {
this.a.a = this.d.clientWidth;
this.a.b = this.d.clientHeight;
} else if (this.e && this.e.clientWidth) {
this.a.a = this.e.clientWidth;
this.a.b = this.e.clientHeight;
}
};
// get the size of the document
ipe121907.p.o = function () {
this.c.a = Math.max(Math.max(this.d.scrollWidth, this.e.scrollWidth), Math.max(this.d.offsetWidth, this.e.offsetWidth), Math.max(this.d.clientWidth, this.e.clientWidth));
this.c.b = Math.max(Math.max(this.d.scrollHeight, this.e.scrollHeight), Math.max(this.d.offsetHeight, this.e.offsetHeight), Math.max(this.d.clientHeight, this.e.clientHeight));
};
// fix the infinite scroll problem
ipe121907.p.p = function () {
var a = Math.max(this.d.scrollHeight, this.e.scrollHeight);
var b = Math.max(this.d.offsetHeight, this.e.offsetHeight);
var c = a - b;
if (c >= 1) {
this.d.scrollTop -= c;
this.e.scrollTop -= c;
}
};
////////////////////////////////////////
// Some common functions
////////////////////////////////////////
ipe121907.q = {};
// inject a div
ipe121907.q.b = function (a, b, c) {
var d = document.createElement("div");
d.id = a;
d.setAttribute("class", b);
d.innerHTML = c;
document.body.appendChild(d);
return d;
};
// inject styles
ipe121907.q.c = function (a, b) {
var c = document.createElement('style');
c.id = a;
c.type = 'text/css';
var d = document.createTextNode(b);
c.appendChild(d);
var e = document.getElementsByTagName("head")[0];
e.appendChild(c);
};
////////////////////////////////////////
// Counter function
////////////////////////////////////////
ipe121907.u = {};
ipe121907.u.a = function (a, b, c, d, e) {
var f = document.createElement("div");
var g = document.createElement("img");
g.src = ipe121907.w + "//ips-img.iperceptions.com/Counter/counter_N.png?surveyID=" + a + "&siteID=" + b + "&langID=" + c + "&traceID=" + d;
g.alt = " ";
f.appendChild(g);
f.style.display = "none";
f.style.visibility = "hidden";
e.appendChild(f);
};
////////////////////////////////////////
// run the anonymous function
////////////////////////////////////////
ipe121907.customBlock = (function () {
var ua = navigator.userAgent.toLowerCase();
return ua.indexOf("gecko/") !== -1 && (ua.indexOf("mobile") !== -1 || ua.indexOf("tablet") !== -1);
})();
(function () {
if (!!ipe121907.ipe_loaded || !!ipe121907.customBlock) { return; }
ipe121907.ipe_loaded = true;
if (ipe121907.i == 1) {
ipe121907.s.a();
}
else if (ipe121907.i == 2) {
ipe121907.t.d(!1);
}
})();