/* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\wt.js */ (function($) { $.wt = (function() { return { // Pass a string of values WebTrends values i.e WT.cg_n=A_CarConfig&WT.dl=0&WT.ModelID=... and call dcsTag() to fire the tagging dcsTag: function(val) { if (typeof _tag !== "undefined") { _tag.others = val; _tag.dcsTag(); } } }; })(); })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\wt.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\webtrends.js */ // WebTrends SmartSource Data Collector Tag // Version: 9.4.0 // Tag Builder Version: 4.1 // Created: 5/28/2012 4:13:18 PM // ################################################### // MODIFIED BY TME - NOW HAS DEPENDANCY ON JQUERY!! // ################################################### function WebTrends() { var that = this; // begin: user modifiable this.dcsid = "dcsdxdjhbcnto74shk0uyf5en_1j3m"; this.domain = "statse.webtrendslive.com"; this.timezone = 0; this.onsitedoms = "forms.lexus.co.uk,www.lexus.co.uk,apps.lexus.co.uk,forms.toyota-europe.com,usedcars.lexus.co.uk"; this.ingoreExtLinksClasses = "gallery-link,video-link,twtr-hashtag,twtr-hyperlink,source"; // can be comma seperated... this.downloadtypes = "xls,doc,pdf,txt,csv,zip,docx,xlsx"; this.navigationtag = "div,table"; this.trackevents = true; this.trimoffsiteparams = true; this.enabled = true; this.i18n = false; this.paidsearchparams = "gclid"; this.splitvalue = ""; this.preserve = true; this.cookieTypes = "all"; this.others = ""; this.slvOr = ""; this.redirectURI = ""; this.dcsURIOverride = ""; this.requestProcessedCallbackFN = false; this.FPCConfig = { enabled: (this.cookieTypes === "all" || this.cookieTypes == "firstPartyOnly"), name: "WT_FPC", domain: ".amaze.com", expires: 63113851500 }; this.TPCConfig = { enabled: (this.cookieTypes === "all"), cfgType: (this.cookieTypes === "all") ? "" : "1" }; // end: user modifiable this.DCS = {}; this.WT = {}; this.DCSext = {}; this.images = []; this.index = 0; this.referrerCookie = "LexusV10Referrer"; this.exre = (function() { return (window.RegExp ? new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)", "i") : ""); })(); this.re = (function() { return (window.RegExp ? (that.i18n ? { "%25": /\%/g, "%26": /\&/g} : { "%09": /\t/g, "%20": / /g, "%23": /\#/g, "%26": /\&/g, "%2B": /\+/g, "%3F": /\?/g, "%5C": /\\/g, "%22": /\"/g, "%7F": /\x7F/g, "%A0": /\xA0/g }) : ""); })(); } WebTrends.prototype.dcsGetId = function() { if (this.enabled && (document.cookie.indexOf(this.FPCConfig.name + "=") == -1) && (document.cookie.indexOf("WTLOPTOUT=") == -1) && this.TPCConfig.enabled) { document.write("<\/scr" + "ipt>"); } } WebTrends.prototype.setCookieTypes = function(types) { this.FPCConfig.enabled = (types === "all" || types == "firstPartyOnly"); this.TPCConfig.enabled = (types === "all"); this.TPCConfig.cfgType = (types === "all") ? "" : "1" } WebTrends.prototype.dcsGetCookie = function(name) { var cookies = document.cookie.split("; "); var cmatch = []; var idx = 0; var i = 0; var namelen = name.length; var clen = cookies.length; for (i = 0; i < clen; i++) { var c = cookies[i]; if ((c.substring(0, namelen + 1)) == (name + "=")) { cmatch[idx++] = c; } } var cmatchCount = cmatch.length; if (cmatchCount > 0) { idx = 0; if ((cmatchCount > 1) && (name == this.FPCConfig.name)) { var dLatest = new Date(0); for (i = 0; i < cmatchCount; i++) { var lv = parseInt(this.dcsGetCrumb(cmatch[i], "lv")); var dLst = new Date(lv); if (dLst > dLatest) { dLatest.setTime(dLst.getTime()); idx = i; } } } return unescape(cmatch[idx].substring(namelen + 1)); } else { return null; } } WebTrends.prototype.dcsGetCrumb = function(cval, crumb, sep) { var aCookie = cval.split(sep || ":"); for (var i = 0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (crumb == aCrumb[0]) { return aCrumb[1]; } } return null; } WebTrends.prototype.dcsGetIdCrumb = function(cval, crumb) { var id = cval.substring(0, cval.indexOf(":lv=")); var aCrumb = id.split("="); for (var i = 0; i < aCrumb.length; i++) { if (crumb == aCrumb[0]) { return aCrumb[1]; } } return null; } WebTrends.prototype.dcsIsFpcSet = function(name, id, lv, ss) { var c = this.dcsGetCookie(name); if (c) { return ((id == this.dcsGetIdCrumb(c, "id")) && (lv == this.dcsGetCrumb(c, "lv")) && (ss == this.dcsGetCrumb(c, "ss"))) ? 0 : 3; } return 2; } WebTrends.prototype.dcsFPC = function() { if (document.cookie.indexOf("WTLOPTOUT=") != -1) { return; } if (!this.FPCConfig.enabled) { this.WT["vt_f"] = 4; return; } var WT = this.WT; var name = this.FPCConfig.name; var dCur = new Date(); var adj = (dCur.getTimezoneOffset() * 60000) + (this.timezone * 3600000); dCur.setTime(dCur.getTime() + adj); var dExp = new Date(dCur.getTime() + 315360000000); var dSes = new Date(dCur.getTime()); WT.co_f = WT.vtid = WT.vtvs = WT.vt_f = WT.vt_f_a = WT.vt_f_s = WT.vt_f_d = WT.vt_f_tlh = WT.vt_f_tlv = ""; if (document.cookie.indexOf(name + "=") == -1) { if ((typeof (gWtId) != "undefined") && (gWtId != "")) { WT.co_f = gWtId; } else if ((typeof (gTempWtId) != "undefined") && (gTempWtId != "")) { WT.co_f = gTempWtId; WT.vt_f = "1"; } else { WT.co_f = "2"; var curt = dCur.getTime().toString(); for (var i = 2; i <= (32 - curt.length); i++) { WT.co_f += Math.floor(Math.random() * 16.0).toString(16); } WT.co_f += curt; WT.vt_f = "1"; } if (typeof (gWtAccountRollup) == "undefined") { WT.vt_f_a = "1"; } WT.vt_f_s = WT.vt_f_d = "1"; WT.vt_f_tlh = WT.vt_f_tlv = "0"; } else { var c = this.dcsGetCookie(name); var id = this.dcsGetIdCrumb(c, "id"); var lv = parseInt(this.dcsGetCrumb(c, "lv")); var ss = parseInt(this.dcsGetCrumb(c, "ss")); if ((id == null) || (id == "null") || isNaN(lv) || isNaN(ss)) { return; } WT.co_f = id; var dLst = new Date(lv); WT.vt_f_tlh = Math.floor((dLst.getTime() - adj) / 1000); dSes.setTime(ss); if ((dCur.getTime() > (dLst.getTime() + 1800000)) || (dCur.getTime() > (dSes.getTime() + 28800000))) { WT.vt_f_tlv = Math.floor((dSes.getTime() - adj) / 1000); dSes.setTime(dCur.getTime()); WT.vt_f_s = "1"; } if ((dCur.getDay() != dLst.getDay()) || (dCur.getMonth() != dLst.getMonth()) || (dCur.getYear() != dLst.getYear())) { WT.vt_f_d = "1"; } } WT.co_f = escape(WT.co_f); WT.vtid = (typeof (this.vtid) == "undefined") ? WT.co_f : (this.vtid || ""); WT.vtvs = (dSes.getTime() - adj).toString(); var expiry = (this.FPCConfig.expires) ? "; expires=" + new Date(new Date().getTime() + (this.FPCConfig.expires)).toGMTString() : ""; var cur = dCur.getTime().toString(); var ses = dSes.getTime().toString(); document.cookie = name + "=" + "id=" + WT.co_f + ":lv=" + cur + ":ss=" + ses + expiry + "; path=/" + (((this.FPCConfig.domain != "")) ? ("; domain=" + this.FPCConfig.domain) : ("")); var rc = this.dcsIsFpcSet(name, WT.co_f, cur, ses); if (rc != 0) { WT.co_f = WT.vtvs = WT.vt_f_s = WT.vt_f_d = WT.vt_f_tlh = WT.vt_f_tlv = ""; if (typeof (this.vtid) == "undefined") { WT.vtid = ""; } WT.vt_f = WT.vt_f_a = rc; } } WebTrends.prototype.dcsIsOnsite = function(host) { if (host.length > 0) { host = host.toLowerCase(); if (host == window.location.hostname.toLowerCase()) { return true; } if (typeof (this.onsitedoms.test) == "function") { return this.onsitedoms.test(host); } else if (this.onsitedoms.length > 0) { var doms = this.dcsSplit(this.onsitedoms); var len = doms.length; for (var i = 0; i < len; i++) { if (host == doms[i]) { return true; } } } } return false; } WebTrends.prototype.dcsTypeMatch = function(pth, typelist) { var type = pth.toLowerCase().substring(pth.lastIndexOf(".") + 1, pth.length); var types = this.dcsSplit(typelist); var tlen = types.length; for (var i = 0; i < tlen; i++) { if (type == types[i]) { return true; } } return false; } WebTrends.prototype.dcsEvt = function(evt, tag) { var e = evt.target || evt.srcElement; while (e && e.tagName && (e.tagName.toLowerCase() != tag.toLowerCase())) { e = e.parentElement || e.parentNode; } return e; } WebTrends.prototype.dcsNavigation = function(evt) { var id = ""; var cname = ""; var elems = this.dcsSplit(this.navigationtag); var elen = elems.length; var i, e, elem; for (i = 0; i < elen; i++) { elem = elems[i]; if (elem.length) { e = this.dcsEvt(evt, elem); id = (e.getAttribute && e.getAttribute("id")) ? e.getAttribute("id") : ""; cname = e.className || ""; if (id.length || cname.length) { break; } } } return id.length ? id : cname; } WebTrends.prototype.dcsBind = function(event, func) { if ((typeof (func) == "function") && document.body) { if (document.body.addEventListener) { document.body.addEventListener(event, func.wtbind(this), true); } else if (document.body.attachEvent) { document.body.attachEvent("on" + event, func.wtbind(this)); } } } WebTrends.prototype.dcsET = function() { var e = (navigator.appVersion.indexOf("MSIE") != -1) ? "click" : "mousedown"; //this.dcsBind(e, this.dcsDownload); //this.dcsBind(e, this.dcsOffsite); this.dcsBind("contextmenu", this.dcsRightClick); } WebTrends.prototype.dcsMultiTrack = function() { var args = dcsMultiTrack.arguments ? dcsMultiTrack.arguments : arguments; if (args.length % 2 == 0) { this.removeCustomParams(); this.dcsSaveProps(args); this.dcsSetProps(args); var dCurrent = new Date(); this.DCS.dcsdat = dCurrent.getTime(); this.dcsFPC(); this.dcsTag(); this.dcsRestoreProps(); } } WebTrends.prototype.dcsCleanUp = function() { this.DCS = {}; this.WT = {}; this.DCSext = {}; if (arguments.length % 2 == 0) { this.dcsSetProps(arguments); } } WebTrends.prototype.dcsSetProps = function(args) { for (var i = 0; i < args.length; i += 2) { if (args[i].indexOf('WT.') == 0) { this.WT[args[i].substring(3)] = args[i + 1]; } else if (args[i].indexOf('DCS.') == 0) { this.DCS[args[i].substring(4)] = args[i + 1]; } else if (args[i].indexOf('DCSext.') == 0) { this.DCSext[args[i].substring(7)] = args[i + 1]; } } } WebTrends.prototype.dcsSaveProps = function(args) { var i, x, key, param; if (this.preserve) { this.args = []; for (i = 0, x = 0; i < args.length; i += 2) { param = args[i]; if (param.indexOf('WT.') == 0) { key = param.substring(3); this.args[x] = param; this.args[x + 1] = this.WT[key] || ""; x += 2; } else if (param.indexOf('DCS.') == 0) { key = param.substring(4); this.args[x] = param; this.args[x + 1] = this.DCS[key] || ""; x += 2; } else if (param.indexOf('DCSext.') == 0) { key = param.substring(7); this.args[x] = param; this.args[x + 1] = this.DCSext[key] || ""; x += 2; } } } } WebTrends.prototype.dcsRestoreProps = function() { if (this.preserve) { this.dcsSetProps(this.args); this.args = []; } } WebTrends.prototype.dcsSplit = function(list) { var items = list.toLowerCase().split(","); var len = items.length; for (var i = 0; i < len; i++) { items[i] = items[i].replace(/^\s*/, "").replace(/\s*$/, ""); } return items; } // Code section for Track clicks to download links. WebTrends.prototype.dcsDownload = function(evt) { evt = evt || (window.event || ""); if (evt && ((typeof (evt.which) != "number") || (evt.which == 1))) { var e = this.dcsEvt(evt, "A"); if (e.href) { var hn = e.hostname ? (e.hostname.split(":")[0]) : ""; if (this.dcsIsOnsite(hn) && this.dcsTypeMatch(e.pathname, this.downloadtypes)) { var qry = e.search ? e.search.substring(e.search.indexOf("?") + 1, e.search.length) : ""; var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname : e.pathname) : "/"; var ttl = ""; var text = document.all ? e.innerText : e.text; var img = this.dcsEvt(evt, "IMG"); // get the deep link address for this section var currentPath = ""; var currentSection = ""; function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } try { currentPath = window.location.pathname.replace(/index.tmex|index.htm|index.html/gi, ""); if (!endsWith(currentPath, "/")) { currentPath += "/"; } var parentSection = $(e).parents("section.ca-section").first(); if (parentSection.length) { currentSection = parentSection.data("id"); currentPath += currentSection + "/"; } } catch (err) { } // Amend to use pth for ttl if (pth) { ttl = pth; } else if (img.alt) { ttl = img.alt; } else if (text) { ttl = text; } else if (e.innerHTML) { ttl = e.innerHTML; } //this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsuri", pth, "DCS.dcsqry", e.search || "", "WT.ti", "Download:" + ttl, "WT.dl", "20", "WT.nv", this.dcsNavigation(evt)); // Amended for V10 - remove DCS.dscsURL param as is set by override this.removeCustomParam("dcsuri"); this.removeCustomParam("WT.pn"); var wtEsVal = window.location.host + currentPath; this.dcsMultiTrack("DCS.dcssip", hn, "WT.es", wtEsVal, "DCS.dcsuri", ttl, "WT.pn", currentSection, "DCS.dcsqry", e.search || "", "WT.ti", "Download:" + ttl, "WT.dl", "20", "WT.nv", this.dcsNavigation(evt)); } } } } // Code section for Track right clicks to download links. WebTrends.prototype.dcsRightClick = function(evt) { evt = evt || (window.event || ""); if (evt) { var btn = evt.which || evt.button; if ((btn != 1) || (navigator.userAgent.indexOf("Safari") != -1)) { var e = this.dcsEvt(evt, "A"); if ((typeof (e.href) != "undefined") && e.href) { if ((typeof (e.protocol) != "undefined") && e.protocol && (e.protocol.indexOf("http") != -1)) { if ((typeof (e.pathname) != "undefined") && this.dcsTypeMatch(e.pathname, this.downloadtypes)) { var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname : e.pathname) : "/"; var hn = e.hostname ? (e.hostname.split(":")[0]) : ""; this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsuri", pth, "DCS.dcsqry", "", "WT.ti", "RightClick:" + pth, "WT.dl", "25"); } } } } } } // Code section for Track clicks to links leading offsite. WebTrends.prototype.dcsOffsite = function(evt) { evt = evt || (window.event || ""); if (evt && ((typeof (evt.which) != "number") || (evt.which == 1))) { var e = this.dcsEvt(evt, "A"); if (e.href) { var hn = e.hostname ? (e.hostname.split(":")[0]) : ""; var pr = e.protocol || ""; var ignoreLink = false; if (typeof (_tag) != "undefined") { $(_tag.ingoreExtLinksClasses.split(",")).each(function(i, cssClass) { if ($(e).hasClass(cssClass)) { ignoreLink = true; } }); _tag.removeCustomParam("WT.ev_val"); // fix for footer social media links } if ((hn.length > 0) && (pr.indexOf("http") == 0) && !this.dcsIsOnsite(hn) && !ignoreLink) { var qry = e.search ? e.search.substring(e.search.indexOf("?") + 1, e.search.length) : ""; var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname : e.pathname) : "/"; //this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsuri", pth, "DCS.dcsqry", this.trimoffsiteparams ? "" : qry, "DCS.dcsref", window.location, "WT.ti", "Offsite:" + hn + pth + (qry.length ? ("?" + qry) : ""), "WT.dl", "24", "WT.nv", this.dcsNavigation(evt)); // Amended for V10 - remove DCS.dscsURL param as is set by override this.removeCustomParams(); this.dcsMultiTrack("DCS.dcssip", hn, "DCS.dcsqry", this.trimoffsiteparams ? "" : qry, "DCS.dcsref", window.location, "WT.ref_page", window.location, "WT.ti", "Offsite:" + hn + pth + (qry.length ? ("?" + qry) : ""), "WT.dl", "24", "WT.nv", this.dcsNavigation(evt)); } } } } WebTrends.prototype.dcsAdv = function() { if (this.trackevents && (typeof (this.dcsET) == "function")) { if (window.addEventListener) { window.addEventListener("load", this.dcsET.wtbind(this), false); } else if (window.attachEvent) { window.attachEvent("onload", this.dcsET.wtbind(this)); } } this.dcsFPC(); } WebTrends.prototype.dcsVar = function() { var dCurrent = new Date(); var WT = this.WT; var DCS = this.DCS; WT.tz = parseInt(dCurrent.getTimezoneOffset() / 60 * -1) || "0"; WT.bh = dCurrent.getHours() || "0"; WT.ul = navigator.appName == "Netscape" ? navigator.language : navigator.userLanguage; if (typeof (screen) == "object") { WT.cd = navigator.appName == "Netscape" ? screen.pixelDepth : screen.colorDepth; WT.sr = screen.width + "x" + screen.height; } if (typeof (navigator.javaEnabled()) == "boolean") { WT.jo = navigator.javaEnabled() ? "Yes" : "No"; } if (document.title) { if (window.RegExp) { var tire = new RegExp("^" + window.location.protocol + "//" + window.location.hostname + "\\s-\\s"); WT.ti = document.title.replace(tire, ""); } else { WT.ti = document.title; } } WT.js = "Yes"; WT.jv = (function() { var agt = navigator.userAgent.toLowerCase(); var major = parseInt(navigator.appVersion); var mac = (agt.indexOf("mac") != -1); var ff = (agt.indexOf("firefox") != -1); var ff0 = (agt.indexOf("firefox/0.") != -1); var ff10 = (agt.indexOf("firefox/1.0") != -1); var ff15 = (agt.indexOf("firefox/1.5") != -1); var ff20 = (agt.indexOf("firefox/2.0") != -1); var ff3up = (ff && !ff0 && !ff10 & !ff15 & !ff20); var nn = (!ff && (agt.indexOf("mozilla") != -1) && (agt.indexOf("compatible") == -1)); var nn4 = (nn && (major == 4)); var nn6up = (nn && (major >= 5)); var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var ie4 = (ie && (major == 4) && (agt.indexOf("msie 4") != -1)); var ie5up = (ie && !ie4); var op = (agt.indexOf("opera") != -1); var op5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1); var op6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1); var op7up = (op && !op5 && !op6); var jv = "1.1"; if (ff3up) { jv = "1.8"; } else if (ff20) { jv = "1.7"; } else if (ff15) { jv = "1.6"; } else if (ff0 || ff10 || nn6up || op7up) { jv = "1.5"; } else if ((mac && ie5up) || op6) { jv = "1.4"; } else if (ie5up || nn4 || op5) { jv = "1.3"; } else if (ie4) { jv = "1.2"; } return jv; })(); WT.ct = "unknown"; if (document.body && document.body.addBehavior) { try { document.body.addBehavior("#default#clientCaps"); WT.ct = document.body.connectionType || "unknown"; document.body.addBehavior("#default#homePage"); WT.hp = document.body.isHomePage(location.href) ? "1" : "0"; } catch (e) { } } if (document.all) { WT.bs = document.body ? document.body.offsetWidth + "x" + document.body.offsetHeight : "unknown"; } else { WT.bs = window.innerWidth + "x" + window.innerHeight; } WT.fv = (function() { var i, flash; if (window.ActiveXObject) { for (i = 15; i > 0; i--) { try { flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i); return i + ".0"; } catch (e) { } } } else if (navigator.plugins && navigator.plugins.length) { for (i = 0; i < navigator.plugins.length; i++) { if (navigator.plugins[i].name.indexOf('Shockwave Flash') != -1) { return navigator.plugins[i].description.split(" ")[2]; } } } return "Not enabled"; })(); WT.slv = (function() { var slv = "Not enabled"; try { if (navigator.userAgent.indexOf('MSIE') != -1) { var sli = new ActiveXObject('AgControl.AgControl'); if (sli) { slv = "Unknown"; } } else if (navigator.plugins["Silverlight Plug-In"]) { slv = "Unknown"; } } catch (e) { } if (slv != "Not enabled") { var i, m, M, F; if ((typeof (Silverlight) == "object") && (typeof (Silverlight.isInstalled) == "function")) { for (i = 9; i > 0; i--) { M = i; if (Silverlight.isInstalled(M + ".0")) { break; } if (slv == M) { break; } } for (m = 9; m >= 0; m--) { F = M + "." + m; if (Silverlight.isInstalled(F)) { slv = F; break; } if (slv == F) { break; } } } } return slv; })(); if (this.i18n) { if (typeof (document.defaultCharset) == "string") { WT.le = document.defaultCharset; } else if (typeof (document.characterSet) == "string") { WT.le = document.characterSet; } else { WT.le = "unknown"; } } WT.tv = "9.4.0"; WT.sp = this.splitvalue; if (this.others.indexOf("WT.dl") < 0) { //alert(this.others + " - " + this.others.indexOf("WT.dl")); WT.dl = "0"; } WT.ssl = (window.location.protocol.indexOf('https:') == 0) ? "1" : "0"; DCS.dcsdat = dCurrent.getTime(); DCS.dcssip = window.location.hostname; WT.es = window.location.hostname + this.dcsURIOverride; if (window.location.search) { DCS.dcsqry = window.location.search; } if (DCS.dcsqry) { var dcsqry = DCS.dcsqry.toLowerCase(); var params = this.paidsearchparams.length ? this.paidsearchparams.toLowerCase().split(",") : []; for (var i = 0; i < params.length; i++) { if (dcsqry.indexOf(params[i] + "=") != -1) { WT.srch = "1"; break; } } } var refCookie; if (typeof ($.getCookie) == "function") { refCookie = $.getCookie(this.referrerCookie); } if (refCookie) { DCS.dcsref = refCookie; $.deleteCookie(this.referrerCookie); } else if ((window.document.referrer != "") && (window.document.referrer != "-")) { if (!(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) { DCS.dcsref = window.document.referrer; } } if (DCS.dcsref) { WT.ref_page = DCS.dcsref; } DCS["dcscfg"] = this.TPCConfig.cfgType; } WebTrends.prototype.dcsEscape = function(S, REL) { if (REL != "") { S = S.toString(); for (var R in REL) { if (REL[R] instanceof RegExp) { S = S.replace(REL[R], R); } } return S; } else { return escape(S); } } WebTrends.prototype.dcsA = function(N, V) { if (this.i18n && (this.exre != "") && !this.exre.test(N)) { if (N == "dcsqry") { var newV = ""; var params = V.substring(1).split("&"); for (var i = 0; i < params.length; i++) { var pair = params[i]; var pos = pair.indexOf("="); if (pos != -1) { var key = pair.substring(0, pos); var val = pair.substring(pos + 1); if (i != 0) { newV += "&"; } newV += key + "=" + this.dcsEncode(val); } } V = V.substring(0, 1) + newV; } else { V = this.dcsEncode(V); } } return "&" + N + "=" + this.dcsEscape(V, this.re); } WebTrends.prototype.dcsEncode = function(S) { return (typeof (encodeURIComponent) == "function") ? encodeURIComponent(S) : escape(S); } WebTrends.prototype.dcsCreateImage = function(dcsSrc) { if (document.images) { this.images[this.index] = new Image(); var trkObj = this; var self = this; // Call back options added, allows redirection for hyperlink clicks after tracking complete if (self.requestProcessedCallbackFN) { $(this.images[this.index]).load(function() { self.requestProcessedCallbackFN.apply(); }).error(function() { self.requestProcessedCallbackFN.apply(); }); } this.images[this.index].src = dcsSrc; this.index++; } } WebTrends.prototype.dcsMeta = function() { var elems; if (document.documentElement) { elems = document.getElementsByTagName("meta"); } else if (document.all) { elems = document.all.tags("meta"); } if (typeof (elems) != "undefined") { var length = elems.length; for (var i = 0; i < length; i++) { var name = elems.item(i).name; var content = elems.item(i).content; var equiv = elems.item(i).httpEquiv; if (name.length > 0) { if (name.toUpperCase().indexOf("WT.") == 0) { this.WT[name.substring(3)] = content; } else if (name.toUpperCase().indexOf("DCSEXT.") == 0) { this.DCSext[name.substring(7)] = content; } else if (name.toUpperCase().indexOf("DCS.") == 0) { this.DCS[name.substring(4)] = content; } } } } } // v10 addition, just removes WT.nav && WT.dl from 'others' for now to prevent it appearing when multitrack called but could be extended WebTrends.prototype.removeCustomParams = function() { if (this.others) { var newOthers = ""; var othersArray = this.others.split("&"); $(othersArray).each(function(i, val) { var queryArray = val.split("="); if (queryArray.length = 2) { if (queryArray[0] != "WT.nav" && queryArray[0] != "WT.dl") { newOthers += val + "&"; } else { //console.log("WT: " + val + " REMOVED"); } } }); this.others = newOthers; } } WebTrends.prototype.removeCustomParam = function(paramName) { if (this.others) { var newOthers = ""; var othersArray = this.others.split("&"); $(othersArray).each(function(i, val) { var queryArray = val.split("="); if (queryArray.length = 2) { if (queryArray[0] != paramName) { newOthers += val + "&"; } else { //console.log("WT: " + val + " REMOVED"); } } }); this.others = newOthers; } } WebTrends.prototype.dcsTag = function() { if (document.cookie.indexOf("WTLOPTOUT=") != -1) { return; } var WT = this.WT; var DCS = this.DCS; var DCSext = this.DCSext; var others = this.others; var i18n = this.i18n; var P = "http" + (window.location.protocol.indexOf('https:') == 0 ? 's' : '') + "://" + this.domain + (this.dcsid == "" ? '' : '/' + this.dcsid) + "/dcs.gif?"; if (i18n) { WT.dep = ""; } if (others) { P += others; } //if (this.slvOr.length > 0) { // WT.slv = this.slvOr; //} // ensure we have a dcsuri value... if (!DCS.dcsuri && P.indexOf('dcsuri') < 0) { var dcsUriVal = ""; if (!this.dcsURIOverride) { // get the path minus the pagename dcsUriVal = window.location.pathname.replace(/[^./]+\.tmex/g, ''); var hash = window.location.hash; if (hash) { // append the hash if we have it dcsUriVal += hash.replace('#/', ''); } } else { // use dcsuriOverride value if specified dcsUriVal = this.dcsURIOverride; } P += "&dcsuri=" + dcsUriVal; } WT.es = window.location.hostname + this.dcsURIOverride; for (var N in DCS) { if (DCS[N] && (typeof DCS[N] != "function")) { P += this.dcsA(N, DCS[N]); } } for (N in WT) { if (WT[N] && (typeof WT[N] != "function")) { P += this.dcsA("WT." + N, WT[N]); } } for (N in DCSext) { if (DCSext[N] && (typeof DCSext[N] != "function")) { if (i18n) { WT.dep = (WT.dep.length == 0) ? N : (WT.dep + ";" + N); } P += this.dcsA(N, DCSext[N]); } } if (i18n && (WT.dep.length > 0)) { P += this.dcsA("WT.dep", WT.dep); } if (P.length > 2048 && navigator.userAgent.indexOf('MSIE') >= 0) { P = P.substring(0, 2040) + "&WT.tu=1"; } this.dcsCreateImage(P); this.WT.ad = ""; } WebTrends.prototype.dcsDebug = function() { var t = this; var i = t.images[0].src; var q = i.indexOf("?"); var r = i.substring(0, q).split("/"); var m = "Protocol
" + r[0] + "
"; m += "Domain
" + r[2] + "
"; m += "Path
/" + r[3] + "/" + r[4] + "
"; m += "Query Params" + i.substring(q + 1).replace(/\&/g, "
") + "
"; m += "
Cookies
" + document.cookie.replace(/\;/g, "
") + "
"; if (t.w && !t.w.closed) { t.w.close(); } t.w = window.open("", "dcsDebug", "width=500,height=650,scrollbars=yes,resizable=yes"); t.w.document.write(m); t.w.focus(); } WebTrends.prototype.dcsCollect = function() { if (this.enabled) { this.dcsVar(); this.dcsMeta(); this.dcsAdv(); if (typeof (this.dcsCustom) == "function") { this.dcsCustom(); } this.dcsTag(); } } function dcsMultiTrack() { if (typeof (_tag) != "undefined") { return (_tag.dcsMultiTrack()); } } function dcsTrk() { return (dcsTrack.apply(_tag, arguments)); } function dcsTrack() { if (typeof (_tag) != "undefined") { _tag.others = ""; // Assume query string style format if (arguments.length == 1) { var wtArgs = arguments[0]; // Push in browser type data if its missing // ## Removed as this is always set in the tracking handler //if (typeof ($.fn.GetBrowserData) === "function" && wtArgs.indexOf("WT.sp") < 0) { // wtArgs += "&WT.sp=" + $(window).GetBrowserData().device_type; //} _tag.others = wtArgs _tag.dcsTag(); } else { // Else assume key pair system and pass to multitrack return (_tag.dcsMultiTrack.apply(_tag, arguments)); } } } function dcsDebug() { if (typeof (_tag) != "undefined") { return (_tag.dcsDebug()); } } Function.prototype.wtbind = function(obj) { var method = this; var temp = function() { return method.apply(obj, arguments); }; return temp; }; /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\webtrends.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.AddressManager.js */ ;(function($) { // global settings var settings = { isDebug: false, webTrendsCategory: "Component", isMobileMode: false }; // Global menu data var menuData = { PathData: [], previousPaths: null, addressesTracked: [] }; var silentUpdateInProgress = false; var methods = { init: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { var $this = $(this); $.address.tracker(null); // disable address manager built in GA tracking... $.address.change(function(event) { if (!silentUpdateInProgress) { // This is fired on page load aswell as load, we know its page load if 'menuData.previousPaths' == null var isPageLoad = (menuData.previousPaths == null); // if first load set previous path data to empty array for convenience if (isPageLoad) { menuData.previousPaths = []; } // Check for root if (event.pathNames.length == 1) { // First load, fire root change function if (isPageLoad) { RootPathChange(event.pathNames[0], isPageLoad); } // Change of top level menu item, fire root change function else if (menuData.previousPaths.length > 0) { if (menuData.previousPaths[0] != event.pathNames[0]) RootPathChange(event.pathNames[0], isPageLoad); } else { RootPathChange(event.pathNames[0], isPageLoad); } // has a section been removed? if (menuData.previousPaths.length > 1 && !isPageLoad) { // Call section changed function with previous root data SectionChanged(GetRootPathData(menuData.previousPaths[0]), true); } } // Or section change? else if (event.pathNames.length > 1) { // if first load also fire the root callback if (isPageLoad) { RootPathChange(event.pathNames[0], isPageLoad); } else { if (menuData.previousPaths.length > 1) { // Call section changed function with previous root data if (menuData.previousPaths[0] != event.pathNames[0]) { SectionChanged(GetRootPathData(menuData.previousPaths[0]), true); } else { if (event.pathNames.length === 2 && event.pathNames[0] == "NewsEvents") { //dirty hack to make NewsEvents gallery close work SectionChanged(GetRootPathData(menuData.previousPaths[0]), true); } } } SectionChanged(GetRootPathData(event.pathNames[0]), false); } } // Or section removed? else if (menuData.previousPaths.length > 1) { // Call section changed function with previous root data if (!isPageLoad) { SectionChanged(GetRootPathData(menuData.previousPaths[0]), true); } } else if (isPageLoad) { // No deep links so fire default page tracker call... $.analyticsEmitter.trackEvent({ additionalData: { eventType: 'PageLoad' } }); } } else { silentUpdateInProgress = false; } function GetRootPathData(PathName) { var RootPathData; // Find this item in the menuData.PathData $.each(menuData.PathData, function(i, value) { if (value.ID == PathName) { RootPathData = value; return false; } }); return RootPathData; } function RootPathChange(PathName, isPageLoad) { var RootPathData = GetRootPathData(PathName); // Mobile page load tracking if (ls.isMobileMode) { // mobile scroll to section... //if (isPageLoad) { // $this.ccMenu('deepLinkTo', PathName); //} else { if (typeof RootPathData.callbackFunction === 'function') { RootPathData.callbackFunction.apply($this, [[PathName], isPageLoad]); } //} } else { // Full site mode if (!ls.isMobileMode && RootPathData != undefined && RootPathData != null) { if (typeof RootPathData.callbackFunction === 'function') { RootPathData.callbackFunction.apply($this, [[PathName], isPageLoad]); } else { if (isPageLoad) { $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': PathName, 'NavigatedMethodType': 'Deep Linked', additionalData: { eventType: 'PageLoad' } }); $this.secondaryNav('scrollToSection', PathName); } } } else { $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': PathName, 'NavigatedMethodType': 'Deep Linked', additionalData: { eventType: 'PageLoad' } }); $this.secondaryNav('scrollToSection', PathName); } } } function SectionChanged(parentData, isRemoved) { if (ls.isDebug) { console.log("Address Manager, SectionChanged FN called, parentData.SubSections.length: " + parentData.SubSections.length + " parentdata.ID: " + parentData.ID + " isremoved? " + isRemoved); } var pathData = (isRemoved) ? menuData.previousPaths : event.pathNames; // Function to sort subsections, largest first so we can match accuratly on startswith / indexof function orderBySectionPathString(a, b) { return b.sectionPath.length - a.sectionPath.length; } // Sort the menu section data if (parentData) { parentData.SubSections.sort(orderBySectionPathString); $.each(parentData.SubSections, function(i, SubSection) { // Starts with... if (pathData.slice(1).join("/").indexOf(SubSection.sectionPath) == 0) { var addressParentRemoved = true; if (event.pathNames.length > 0) { addressParentRemoved = event.pathNames[0] != parentData.ID; } var params = pathData.slice(1).join("/"); if (SubSection.sectionPath != "") { params = params.replace(SubSection.sectionPath + "/", ""); } if (params.indexOf("/") >= 0) { params = params.split('/'); } else if (typeof params === 'string') { params = new Array(params); } if (isRemoved) { SubSection.removedFunction.apply($this, [params, addressParentRemoved]); } else { SubSection.changedFunction.apply($this, [params]); } return false; } }); } } // Update the previous path data menuData.previousPaths = event.pathNames; }); }); }, silentUpdate: function(value) { // This is a bit messy at the moment - might need to remove use if this method and update a propery in tracking handlers instead to record the correct section URL // Dont update if already set to same if ($.address.value() != value && $.address.value() != "/" + value) { // Dont update if we're viewing sub-content as can break close methods of sub-content... if ($.address.pathNames().length <= 1) { silentUpdateInProgress = true; $.address.value(value); } } }, addRootSection: function(PathID, callbackFN) { var rootMenuData; // Search for an exising item with same name $.each(menuData.PathData, function(i, value) { if (value.ID == PathID) { rootMenuData = value; return false; } }); // If found existing root path update it if (rootMenuData != null) { rootMenuData.ID = PathID; if (typeof callbackFN === 'function') { rootMenuData.callbackFunction = callbackFN; } } // Else create a new item... else { menuData.PathData.push({ ID: PathID, callbackFunction: callbackFN, SubSections: [] }); } }, SetSectionCallback: function(sectionPaths, changedCallBackFN, removedCallBackFN) { // Quit if no section paths provided if (sectionPaths.length < 1) return false; // Find the root section var rootSection; $.each(menuData.PathData, function(i, value) { if (value.ID == sectionPaths[0]) { rootSection = value; } }); // sometime (e.g. non long pages or mobile) there is no parent added, so we'll add an dummy one to allow the section callbacks to funciton... if (rootSection == null) { methods.addRootSection.apply(this, [sectionPaths[0], null]); $.each(menuData.PathData, function(i, value) { if (value.ID == sectionPaths[0]) { rootSection = value; } }); } // Define the subsection path for this section callback, empty string is fine if first level section... var sectionPathString = ""; if (sectionPaths.length > 1) { sectionPathString = sectionPaths.slice(1).join("/"); } // Do we already have a sub section for this modulepath? var subSection; $.each(rootSection.SubSections, function(i, value) { if (value.sectionPath == sectionPathString) { subSection = value; return false; } }); // if empty then must be a new section if (subSection == null) { subSection = { sectionPath: sectionPathString, changedFunction: changedCallBackFN, removedFunction: removedCallBackFN } rootSection.SubSections.push(subSection); } else { subSection.sectionPath = sectionPathString; subSection.changedFunction = changedCallBackFN; subSection.removedFunction = removedCallBackFN; } }, getModulePaths: function(moduleParents, ModulePath) { var returnArray = []; var pagePaths = $.address.pathNames(); var fullModulePath = $.merge(moduleParents.slice(), ModulePath); if (fullModulePath[fullModulePath.length - 1] == "") fullModulePath = fullModulePath.slice(0, fullModulePath.length - 1); $.each(fullModulePath, function(i, value) { if (pagePaths.length >= (i + 1)) { if (fullModulePath[i] == pagePaths[i]) { if (pagePaths.length > (i + 1) && fullModulePath.length == (i + 1)) { returnArray = pagePaths.slice(i + 1); return false; } } else { return false; } } }); return returnArray; } }; $.fn.AddressManager = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.plugin'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.AddressManager.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.LexusV10Configurations.js */ (function($) { // global settings var settings = { debug: false, enableCTAdeepLinking: true, closeButtonAnimationSpeed: 400, webTrendsDefaultInteractionType: "ContentInteraction", headerCTAAnalyticsID: "Top Level CTA Block", footerAnalyticsID: "Footer", webTrendsCategory: "Component", ignoreExternalLinkClasses: "gallery-link,video-link,external,gmap-link,colorbox,iframe,cboxElement,iframe-slide-down,cta-tab-link", onSiteDomains: "" }; var pageData = { translations: {}, configurationObjects: [] }; var methods = { init: function(options) { var ls = $.extend({}, settings, options); // local settings settings.onSiteDomains = ls.onSiteDomains; // store this so its avalible to other items calling sub functions return this.each(function() { var $this = $(this); // Some browser sniffing... // We disable JS in IE6 so add the no-js class for CSS reasons if ($('html').hasClass("ie6")) { $('html').addClass("no-js") return false; } // Need to identify mobile safari to place video close button outside of iframe $.browser.mobileSafari = /webkit.*mobile/i.test(navigator.userAgent); if ($.browser.mobileSafari) { $('html').addClass("mobileSafari"); } else { $('html').addClass("notMobileSafari"); } // Detect IE9 as moderiser returns true for CSS 2d transforms but there is a bug when setting the values dynamically $.browser.msie9 = /msie.*9.0/i.test(navigator.userAgent); if ($.browser.msie9) { $('html').addClass("ie9"); } // COMMON CONTENT BINDINGS (BUTTONS, LIGHTBOXES ETC) methods.commonContentBindings.apply($this, ["Introduction"]); switch (ls.pageType) { case "standardPage": // HEADER & FOOTER & NAVIGATION BINDS if ($(".cp-primarynav", $this).length) { $(".cp-primarynav", $this).primaryNav({ ajaxResponseContentFilter: ".ajaxable", menuItemSelector: "li", translations: pageData.translations, AddressParents: [$(".cp-primarynav", $this).data("id")] }); } else { $(".ch-header").primaryNav({ menuItemSelector: "li.primary-nav-jump", menuItemAnchorSelector: ".ajaxed-menu", appendCloseLink: true, AddressParents: ["Menu"], translations: pageData.translations }); } // Header Search if (typeof ($.fn.searchContent) === "function") { $(".cta-list .search-link", $this).searchContent({ AddressParents: ["Search"], translations: pageData.translations }); } // Footer slide $(".cf-footer .primary", $this).footerSlide({ translations: pageData.translations }); // Secondary nav with menu mode if ($(".cs-secondary-nav", $this).length) { $(".cs-secondary-nav", $this).secondaryNav({ headers: ".ca-section", translations: pageData.translations }); } else { // Secondary nav no-menu mode $(window).secondaryNav({ noNavMode: true, ajaxContent: false, headers: ".ca-section", translations: pageData.translations }); } // Is the view changer present? if ($(".cl-view-switcher", $this).length) { var configurationDlID = ""; if (/BuildYour[^/]*\/\d+/.test(window.location.hash)) { configurationDlID = window.location.hash.replace(/#\/BuildYour[^/]*\//, ""); } var miniCCSettings = $.extend(true, {}, methods.getPageData.apply($this, ["jqLexV10marlonMiniCCsettings"]), { preconfig: { savedConfigurationID: configurationDlID } }); var fullCCSettings = methods.getPageData.apply($this, ["jqLexV10marlonCCsettings"]); pageData.configurationObjects["jqLexV10marlonMiniCCsettings"] = miniCCSettings; // View changer manager $('#main', $this).ViewChanger({ AddressParents: ["Introduction"], translations: pageData.translations, contentBindings: { carConfig: { cssClass: "cc-carconfig-header", defaultBindingFunction: function() { this.ChapterInteractiveLoader({ marlonMiniCCsettings: miniCCSettings, marlonCCsettings: fullCCSettings }); }, nonDefaultBindingFunction: function() { this.ChapterInteractiveLoader('loadMiniCarConfig', { marlonMiniCCsettings: miniCCSettings, marlonCCsettings: fullCCSettings }); } } } }); // View changer tooltip $(".view-switcher-container", $this).toolTip(); } // Analytics event $(window).on("AnalyticsEvent", function(event, TrackingData) { // Maket specific tracking example...... }); break; // AJAXED PAGE - BIND MODULE(S) case "ajaxedPage": // Nothing specific yet break; } // Generic bindings for all page types $('.ajaxable').each(function(i, item) { var itemID = $(item).data('id'); $this.AddressManager('addRootSection', itemID); if ($(item).data('bindingtypes')) { var bindingGroups = $(item).data('bindingtypes').split(","); $.each(bindingGroups, function(index, value) { if (value.length > 0) { methods.moduleBindings.apply($(item), [value, itemID]); } }); } }); // CTA & FOOTER WEBTRENDS BINDINGS HERE AS THEY DONT HAVE THEIR OWN PLUGIN $('.ch-header .cta-list a', $this).bind("click", function(evt) { var $theLink = $(this); if ($theLink.data("isAutoClick")) { // Is a hack where click is triggered to open header CTA from footer link, dont log the click... $theLink.data("isAutoClick", false); } else { // this FN returns false and performs the window.location change itself if link is not a popup/ajax return $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': ls.headerCTAAnalyticsID, 'InteractionList': [$theLink.attr('href')], additionalData: { eventType: ls.webTrendsDefaultInteractionType, redirectOnTrack: !$theLink.hasClass('iframe') && !$theLink.hasClass('ajax') && $theLink.attr('href').indexOf("#") != 0 && !($theLink.attr("target") && $theLink.attr("target") == "_blank"), redirectOnTrackURL: $theLink.attr('href'), useBlankDeepLinkValue: true } }); } }); $('.cf-footer a', $this).bind("click", function(evt) { var $theLink = $(this); // this FN returns false and performs the window.location change itself if link is not a popup/ajax return $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': ls.footerAnalyticsID, 'InteractionList': [$theLink.attr('href')], additionalData: { eventType: ls.webTrendsDefaultInteractionType, redirectOnTrack: !$theLink.hasClass('iframe') && !$theLink.hasClass('ajax') && $theLink.attr('href').indexOf("#") != 0 && !($theLink.attr("target") && $theLink.attr("target") == "_blank"), redirectOnTrackURL: $theLink.attr('href') } }); }); // Bind Iframe Dropdowns in header & footer if ($.fn.iframeV2) { $(".ch-header .form-slide-down.iframe", $this).iframeV2({ 'iframeElementPosition': 'header', 'sectionID': ls.headerCTAAnalyticsID }); $(".cf-footer .form-slide-down.iframe", $this).iframeV2({ 'iframeElementPosition': 'footer', 'sectionID': ls.footerAnalyticsID }); } else { $(".ch-header .form-slide-down.iframe", $this).iframe('create', { 'iframeElementPosition': 'header', 'sectionID': ls.headerCTAAnalyticsID }); $(".cf-footer .form-slide-down.iframe", $this).iframe('create', { 'iframeElementPosition': 'footer', 'sectionID': ls.footerAnalyticsID }); } // Deep linking for top level CTAs if (ls.enableCTAdeepLinking) { // Add deep link for CTA, needs refactoring (hack) var ctaChangedOrAddedFunction = function(sections) { if (sections.length == 1) { $('.ch-header .cta-list a', $this).each(function() { var $theLink = $(this); if ($theLink.data("id")) { if ($theLink.data("id").toLowerCase() == sections[0].toLowerCase()) { $theLink.data("isAutoClick", true); if ($(window).scrollTop() > 0) { var callbackProcessed = false; $("html:not(:animated),body:not(:animated)").animate({ scrollTop: 0 }, 500, "swing", function(evt) { if (!callbackProcessed) { callbackProcessed = true; $theLink.click(); } }); } else { $theLink.click(); } } } }); } }; var ctaRemovedFunction = function(sections, addressParentRemoved) { // Nothing... } // Add required callbacks to address manager $this.AddressManager('SetSectionCallback', ["CTA"], ctaChangedOrAddedFunction, ctaRemovedFunction); // Is there a deep link for this form? var ModuleCommands = $this.AddressManager('getModulePaths', ["CTA"], [""]); if (ModuleCommands.length == 1) { ctaChangedOrAddedFunction(ModuleCommands); } } if (typeof ($.fn.GetBrowserData) == 'function' && $.fn.GetBrowserData().device_type == 'Mobile') { $('.cf-footer .footer-site-links .mobile-site-link').show(); } // MUST BE BOUND LAST $(window).AddressManager(); }); }, commonContentBindings: function(sectionID) { return this.each(function() { var $this = $(this); // BACK TO TOP LINKS $this.secondaryNav('BindBackToTopLinks'); // BUTTON HOVER BINDING $(".cf-read-more-container a, .c-b-button:not(.iframe-tabs .c-b-button)", $this).colorTransition({ useCSS3: true }); // LIGHTBOX BINDING $(".colorbox.iframe", $this).colorbox({ iframe: true, innerWidth: 881, innerHeight: 667, close: pageData.translations.CloseCAPS, scrolling: false }); // GENERIC EXTERNAL LINK BINDING $('a', $this).each(function() { var $link = $(this); if ($link.data("istracked")) return false; // prevent double bindings if common content bindings called more than once... $link.data("istracked", true); var href = $link.attr('href'); // Ignore if #bang, relative or JS href if (href && href.length > 0 && href.indexOf('#') != 0 && href.indexOf('javascript') != 0) { // Remove the protocol href = href.toLowerCase(); var regex = /^(https?|ftp|):\/\//; href = href.replace(regex, ""); // Check if internal var isInternal; if (href.indexOf('/') == 0) { isInternal = true; } else { if (settings.onSiteDomains) { isInternal = $.grep(settings.onSiteDomains.split(','), function(n, i) { return href.indexOf(n) != 0; }, true).length > 0; } else { isInternal = false; } } // Check ignore classes var ignoreLink = false; $.each(settings.ignoreExternalLinkClasses.split(','), function(index, value) { if ($link.hasClass(value)) { ignoreLink = true; return; } }); if (ignoreLink) return false; // Downloads if (isInternal) { var rgxDocsRegex = /^.+\.((doc)|(docx)|(pdf))$/; if (href.match(rgxDocsRegex)) { $link.bind("click", function(evt) { var resourceType = href.substring(href.lastIndexOf(".") + 1); var fileName = href.substring(href.lastIndexOf("/") + 1); return $.analyticsEmitter.trackEvent({ 'ModuleCategory': "Component", 'PageModuleName': $link.closest('.ca-section').data('id'), 'InteractionList': [fileName], 'ResourceLocation': fileName, 'ResourceType': resourceType, additionalData: { eventType: "DownloadInteration" } }); }); } // External links } else if (!isInternal) { $link.bind("click", function(evt) { // this FN returns false and performs the window.location change itself if link is not a popup/ajax return $.analyticsEmitter.trackEvent({ 'ModuleCategory': "Component", 'PageModuleName': $link.closest('.ca-section').data('id'), 'InteractionList': [href], additionalData: { eventType: "ContentInteraction", redirectOnTrack: !($link.attr("target") && $link.attr("target") == "_blank"), redirectOnTrackURL: $link.attr("href"), linkIsExternal: true } }); }); } } }); // HERO CAROUSEL BINDINGS $('.ch-hero-slider', $this).each(function() { var $slider = $(this); if (Modernizr.flash && $slider.hasClass("ch-flash-hero")) { $slider.flashCarousel({ flashId: $slider.data('id'), configxml: $slider.data('configxml'), contentxml: $slider.data('contentxml'), AddressParents: [$slider.data('id')], translations: pageData.translations }); } else { $slider.ContentSlideSwapper({ AddressParents: [$slider.data('id')], carouselMode: true, carouselModeItems: $('.item', $slider), pageMaxWidth: 1400, translations: pageData.translations, carouselContentRender: function() { // nothing... } }); } }); // REEVOO INLINE REVIEWS if (typeof ($.fn.reevoo) === "function") { $('.cc-reevooinline', $this).each(function() { $(".cc-reevooinline", $this).reevoo({ instanceType: "inline" }); }); $('.reevoo-ribbon', $this).each(function() { $(".reevoo-ribbon", $this).reevoo({ instanceType: "badge" }); }); } // INTRO VIDEOS BINDING $(".cc-expanding-video", $this).expansionVideo({ AddressParents: [sectionID], translations: pageData.translations, enableAnalytics: true }); if (typeof ($.fn.sectionVideo) === "function") { $(".cs-section-video", $this).sectionVideo({ AddressParents: [sectionID], translations: pageData.translations, enableAnalytics: true }); } if (typeof ($.fn.inlineVideo) === "function") { $(".cc-inline-video", $this).inlineVideo({ AddressParents: [sectionID], translations: pageData.translations, enableAnalytics: true }); } if (typeof ($.fn.iframePromo) === "function") { // console.log("WAT", $(".cb-iframe-promo", $this)); $(".cb-iframe-promo", $this).iframePromo({ AddressParents: [sectionID] }); } // SIMPLE TABS BINDING $('.tab-data-area', $this).each(function() { var $simpleTabs = $(this); tabsDefaults = { enableScrollableTabs: true } methods.bindPlugin.apply($($simpleTabs), ["SimpleTabs", tabsDefaults]); }); //TIMELINE BINDING if (typeof ($.fn.timeline) === "function") { $(".acad-timeline", $this).timeline(); } //DOWNLOAD LIST BINDING if (typeof ($.fn.downloadList) === "function") { $(".multiDownloadDDL", $this).downloadList(); } //APPRENTICE SEARCH if (typeof ($.fn.apprenticeshipFinder) === "function") { $(".apprentice-search", $this).each(function() { var $apprenticeShipFinder = $(this); var finderDefaults = { pageSection: $this } methods.bindPlugin.apply($($apprenticeShipFinder), ["apprenticeshipFinder", finderDefaults]); }); } // IN PAGE SECONDARY NAV LINKS $('.jqab-inpage-section-link', $this).secondaryNav('bindInPageLink', { headers: ".ca-section" }); $('.c-b-close-slide-button', $this).unbind("mouseenter").bind("mouseenter", function(evt) { var tWidth = parseInt($('.close-button', $(this)).outerWidth(), 10); $(this).stop().animate({ width: tWidth }, settings.closeButtonAnimationSpeed); }); $('.c-b-close-slide-button', $this).unbind("mouseleave").bind("mouseleave", function(evt) { $(this).stop().animate({ width: 61 }, settings.closeButtonAnimationSpeed); }); // remove items which require flash if (!Modernizr.flash && typeof be.marlon.ui == "undefined") { $('.remove-when-flash-unavailable', $this).remove(); $('.hide-when-flash-unavailable', $this).hide(); } //bind to default carousel instances - all are passed with the standard settings (carousdefaults) $('.simple-carousel.default-carousel', $this).each(function() { var $simpleCarousel = $(this); carousDefaults = { sliderWidth: 475, numberOfPages: 'auto', carouselNavListStyle: 'blue', carouselNavListPosition: 'center' } methods.bindPlugin.apply($($simpleCarousel), ["SimpleCarousel", carousDefaults]); }); //bind to default carousel instances - all are passed with the standard settings (carousdefaults) $('.simple-carousel.default-carousel', $this).each(function() { var $defaultCarousel = $(this); carousDefaults = { sliderWidth: 475, numberOfPages: 'auto', carouselNavListStyle: 'blue', carouselNavListPosition: 'center' } methods.bindPlugin.apply($($defaultCarousel), ["SimpleCarousel", carousDefaults]); }); //bind to simple carousel for blog listing. $('.lexus-blog .blog-carousel', $this).each(function() { var $simpleCarousel = $(this); carousDefaults = { carouselNavListStyle: 'blue', carouselNavListPosition: 'center', enableArrows: true, arrowPosition: 2, dynamicSliderWidth: true, arrowPosition: 3, numberOfPages: 'auto', multiItemDisplay: 3 } methods.bindPlugin.apply($($simpleCarousel), ["SimpleCarousel", carousDefaults]); }); // Inline CTA's $(".cc-cta-inline", $this).inlineCTAs(); // RSB if (typeof ($.fn.rsbMap) === "function") { $(".dealer-map-container", $this).rsbMap(); } if (typeof ($.fn.heroVideo) === "function") { $(".hero-video", $this).heroVideo({ translations: pageData.translations, enableAnalytics: true }); } if (typeof $.fn.expandingHero === "function") { $(".ch-full-hero-expand .hero-video").expandingHero(); } // Popups (i.e MMTD) $("a.popup", $this).popup(); // flash embeds if (Modernizr.flash && typeof ($.fn.flashEmbed) === "function") { $(".flash-embed", $this).flashEmbed(); } // Generic self binding... $('.jq-auto-bind').each(function() { var $autoBindElement = $(this); // AWAITING IMPLEMENTATION }); }); }, moduleBindings: function(moduleName, id, options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { var $this = $(this); switch (moduleName) { // Experiences case "Experiences": $('.simple-carousel', $this).each(function() { var $simpleCarousel = $(this); carousDefaults = { sliderWidth: 475, numberOfPages: 'auto', carouselNavListStyle: 'blue', carouselNavListPosition: 'center' } methods.bindPlugin.apply($($simpleCarousel), ["SimpleCarousel", carousDefaults]); }); break; case "BenefitsPrivileges": $('.simple-carousel', $this).each(function() { var $simpleCarousel = $(this); carousDefaults = { sliderWidth: 475, numberOfPages: 'auto', carouselNavListStyle: 'blue', carouselNavListPosition: 'center' } methods.bindPlugin.apply($($simpleCarousel), ["SimpleCarousel", carousDefaults]); }); break; // ArticleItems case "ArticleItems": methods.bindPlugin.apply($(".article-item-detail", $this), ["mosaicWithContent", { AddressParents: [id] }, "bindArticleContent"]); break; // NAV case "PrimaryNav": methods.bindPlugin.apply($(".cm-mosaic", $this), ["primaryNav", { AddressParents: [id] }, "swappableContent", { AddressParents: [id]}]); methods.bindPlugin.apply($(".cm-mosaic", $this), ["mosaicWithContent", { AddressParents: [id], autoTrackLinkClicks: false, defaultFilterOnLoad: true}]); break; // VIDEO SCRUB case "VideoScrub": methods.bindPlugin.apply($(".video-scrub", $this), ["Scrubber", { AddressParents: [id]}]); break; // CHART WITH IN-VIEW INIT case "ExploreRange": methods.bindPlugin.apply($(".explore-our-range", $this), ["Explore", { AddressParents: [id]}]); break; // COUNTRY SELECTOR... case "MapWithLinks": // Bind the Lexus Europe / Portal buttons $('header a.c-b-button', $this).bind("click", function(evt) { var $theLink = $(this); // this FN returns false and performs the window.location change itself if link is not a popup/ajax return $.analyticsEmitter.trackEvent({ 'ModuleCategory': "Component", 'PageModuleName': id, 'InteractionList': [$theLink.text()], // always in English so use text in this case 'LinkType': "Promo Link", 'LinkValue': $theLink.text(), additionalData: { eventType: "ContentInteraction", redirectOnTrack: !$theLink.hasClass('iframe') && !$theLink.hasClass('ajax') && $theLink.attr('href').indexOf("#") != 0 && !($theLink.attr("target") && $theLink.attr("target") == "_blank"), redirectOnTrackURL: $theLink.attr('href') } }); }); var $mapContainer = $('.cm-googlemap', $this); methods.bindPlugin.apply($("nav.country-list a", $mapContainer), ["GmapNav", { AddressParents: [id], enableAnalytics: true, map: $('.map', $mapContainer)}]); break; // VEHICLE HIGHLIGHTS case "VehicleHighlights": methods.bindPlugin.apply($(".highlight", $this), ["sectionMenu", { AddressParents: [id]}]); methods.bindPlugin.apply($this, ["vehicleHighlights", { AddressParents: [id]}]); break; // PRICES AND SPECS case "PricesAndSpecifications": methods.bindPlugin.apply($('.cc-prices-specs', $this), ["PricesAndSpecs", { AddressParents: [id]}]); break; // NEWS EVENTS MOSIAC case "MosaicExpanding": //$('.news-events').Articles({ AddressParents: ["NewsEvents"] }); methods.bindPlugin.apply($(".cm-mosaic", $this), ["mosaicWithContent", { AddressParents: [id], readMoreThreshold: 99999}]); if ($("#twitterSettings", $this).length) { methods.bindPlugin.apply($(".cm-mosaic", $this), ["twitterPanel", { config: $('
').html($("#twitterSettings", $this).val()).text(), AddressParents: [id]}]); methods.bindPlugin.apply($(".cm-mosaic", $this), ["twitterShare"]); } break; // NEWS EVENTS MOSIAC case "NewsEventsMosaic": //$('.news-events').Articles({ AddressParents: ["NewsEvents"] }); methods.bindPlugin.apply($(".cm-mosaic", $this), ["mosaicWithContent", { AddressParents: [id], moveOpenItemsToTop: false, readMoreThresholdIsPixels: false, readMoreThreshold: 10, ajaxLoadIconOnly: false}]); break; // GALLERY MOSIAC case "GalleryMosaic": var galleryOptions = { AddressParents: [id], autoTrackLinkClicks: false, readMoreThreshold: $this.data('readmorethreshold'), masonryColWidth: $this.data('masonrycolwidth'), masonryCols: $this.data('masonrycols') }; methods.bindPlugin.apply($(".cm-mosaic[data-active='true']", $this), ["mosaic", galleryOptions]); methods.bindPlugin.apply($(".image-pushdown", $this), ["imagePushDown", { AddressParents: [id]}]); if ($.fn.galleryV2) { methods.bindPlugin.apply($this, ["galleryV2", { AddressParents: [id]}]); } else { methods.bindPlugin.apply($(".image-pushdown", $this), ["gallery", { AddressParents: [id]}]); } break; // CHART WITH IN-VIEW INIT case "ChartInView": methods.bindPlugin.apply($(".circular-chart .in-view", $this), ["circularchart"]); break; // A MOSIC OF SOCIAL CONTENT case "SocialMosaic": // SOCIAL CONTENT BINDS STARTS methods.bindPlugin.apply($(".cm-mosaic[data-active='true']", $this), ["mosaicWithContent", { AddressParents: [id], autoTrackLinkClicks: false}]); methods.bindPlugin.apply($(".cm-mosaic .yt-social-item", $this), ["gallery", { AddressParents: [id]}]); if ($("#twitterSettings", $this).length) { methods.bindPlugin.apply($(".cm-mosaic", $this), ["twitterPanel", { config: $('
').html($("#twitterSettings", $this).val()).text(), AddressParents: [id]}]); methods.bindPlugin.apply($(".cm-mosaic", $this), ["twitterShare"]); } // SOCIAL CONTENT BINDS ENDS break; // F SPORT CC MODULE case "FSport": methods.bindPlugin.apply($(".ch-hero", $this), ["animateHero", { AddressParents: [id]}]); break; // THE CAR CONFIG case "CarConfigurator": PubSub.publish("load.fullcc5"); var miniCCSettings = methods.getPageData.apply($this, ["jqLexV10marlonMiniCCsettings"]); var fullCCSettings = methods.getPageData.apply($this, ["jqLexV10marlonCCsettings"]); methods.bindPlugin.apply($(".cc-carconfig-full .flash", $this), ["LoadingOverlay", { AddressParents: [id], iconOnly: false, loadingText: pageData.translations.LoadingContent, loaderTopOffset: 100}]); $this.ChapterInteractiveLoader('loadFullCarConfig', { marlonMiniCCsettings: miniCCSettings, marlonCCsettings: fullCCSettings }); if ($('.cc-carconfig-header', $this).length > 0) { $this.ChapterInteractiveLoader('loadMiniCarConfig', { marlonMiniCCsettings: miniCCSettings, marlonCCsettings: fullCCSettings }); } break; // A SATIC MOSIC LAYOUT, WITH NO GALLERY OR SOCIAL FUNCTIONALITY case "StaticMosaic": methods.bindPlugin.apply($(".cm-mosaic[data-active='true']", $this), ["mosaic", { AddressParents: [id]}]); break; // GENERIC MOSIC WITH CONTENT case "MosaicWithContent": methods.bindPlugin.apply($(".cm-mosaic[data-active='true']", $this), ["mosaicWithContent", { AddressParents: [id]}]); break; // SIMPLE ACCORDION case "ContentAccordion": $('.simple-accordion-default-style', $this).each(function() { var $simpleAccordionDefault = $(this); var $theAccordionItems = $(".accordion-item", $simpleAccordionDefault); var bolOpenFirst = false; if ($simpleAccordionDefault.attr('data-openfirstitem') != undefined && $simpleAccordionDefault.attr('data-openfirstitem') == 'true') { bolOpenFirst = true; } methods.bindPlugin.apply($simpleAccordionDefault, ["SimpleAccordion", { AddressParents: [id], openFirstItem: bolOpenFirst, $accordionItems: $theAccordionItems}]); }); break; // LS 360 SPIN case "LSSpin": methods.bindPlugin.apply($(".cc-spin-trigger"), ["parallaxSpinLauncher", { AddressParents: [id], translations: pageData.translations}]); break; // Ratings & Reviews case "RatingReviews": if (typeof $.fn.BVWrapper === "function") { $(document).BVWrapper({ translations: pageData.translations }); } break; case "SignUp400A": window.$iframe = $("iframe.400a-iframe"); break; case "Carousel": methods.bindPlugin.apply($(".cc-carousel"), ["carousel", { AddressParents: [id], translations: pageData.translations}]) break; case "CardFlip": methods.bindPlugin.apply($(".cl-flip"), ["flip", { AddressParents: [id], translations: pageData.translations}]) } }); }, bindPlugin: function(pluginName, settings, methodName) { var $context = $(this); var mergedSettings = methods.mergeAttributeSettings.apply($context, [settings]); mergedSettings.translations = methods.mergeAttributeTranslations.apply($context); if (methodName === undefined) { $.fn[pluginName].apply($context, [mergedSettings]); } else { $.fn[pluginName].apply($context, [methodName, mergedSettings]); } }, mergeAttributeSettings: function(settings) { return $.extend({}, settings, $(this).data('settings')) }, mergeAttributeTranslations: function() { return $.extend({}, pageData.translations, $(this).data('translations')) }, addTranslateData: function(translationData) { pageData.translations = $.extend({}, pageData.translations, translationData); }, getTranslateData: function() { return pageData.translations; }, addPageData: function(dataItemKey, itemData) { // Spefific module settings switch (dataItemKey) { // Mini spin setting adjustments case "jqLexV10marlonMiniCCsettings": // Add in user-data itemData["user-agent"] = $(window).GetBrowserData(); // Add in WT callback itemData["wtcallback"] = dcsTrack; // Remove flash setting if not supported if (!Modernizr.flash) { if (itemData["flashFile"]) { delete itemData["flashFile"]; } } break; // Full car jqLexV10marlonCCsettings case "jqLexV10marlonCCsettings": // Add in WT callback itemData["wtcallback"] = dcsTrack; break; } pageData.configurationObjects[dataItemKey] = itemData; }, getPageData: function(dataItemKey) { if (pageData.configurationObjects[dataItemKey] != undefined) { return pageData.configurationObjects[dataItemKey]; } else { return false; } } }; $.fn.LexusV10Configuration = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.plugin'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.LexusV10Configurations.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\hammer.min.js */ /*! Hammer.JS - v1.0.3 - 2013-03-02 * http://eightmedia.github.com/hammer.js * * Copyright (c) 2013 Jorik Tangelder ; * Licensed under the MIT license */ (function(t){"use strict";function e(){if(!n.READY){n.event.determineEventTypes();for(var t in n.gestures)n.gestures.hasOwnProperty(t)&&n.detection.register(n.gestures[t]);n.event.onTouch(document,n.EVENT_MOVE,n.detection.detect),n.event.onTouch(document,n.EVENT_END,n.detection.endDetect),n.READY=!0}}var n=function(t,e){return new n.Instance(t,e||{})};n.defaults={stop_browser_behavior:{userSelect:"none",touchCallout:"none",touchAction:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}},n.HAS_POINTEREVENTS=navigator.pointerEnabled||navigator.msPointerEnabled,n.HAS_TOUCHEVENTS="ontouchstart"in t,n.EVENT_TYPES={},n.DIRECTION_DOWN="down",n.DIRECTION_LEFT="left",n.DIRECTION_UP="up",n.DIRECTION_RIGHT="right",n.POINTER_MOUSE="mouse",n.POINTER_TOUCH="touch",n.POINTER_PEN="pen",n.EVENT_START="start",n.EVENT_MOVE="move",n.EVENT_END="end",n.plugins={},n.READY=!1,n.Instance=function(t,i){var r=this;return e(),this.element=t,this.enabled=!0,this.options=n.utils.extend(n.utils.extend({},n.defaults),i||{}),this.options.stop_browser_behavior&&n.utils.stopDefaultBrowserBehavior(this.element,this.options.stop_browser_behavior),n.event.onTouch(t,n.EVENT_START,function(t){r.enabled&&n.detection.startDetect(r,t)}),this},n.Instance.prototype={on:function(t,e){for(var n=t.split(" "),i=0;n.length>i;i++)this.element.addEventListener(n[i],e,!1);return this},off:function(t,e){for(var n=t.split(" "),i=0;n.length>i;i++)this.element.removeEventListener(n[i],e,!1);return this},trigger:function(t,e){var n=document.createEvent("Event");return n.initEvent(t,!0,!0),n.gesture=e,this.element.dispatchEvent(n),this},enable:function(t){return this.enabled=t,this}};var i=null,r=!1,o=!1;n.event={bindDom:function(t,e,n){for(var i=e.split(" "),r=0;i.length>r;r++)t.addEventListener(i[r],n,!1)},onTouch:function(t,e,s){var a=this;this.bindDom(t,n.EVENT_TYPES[e],function(c){var u=c.type.toLowerCase();return u.match(/mouseup/)&&o?(o=!1,void 0):((u.match(/touch/)||u.match(/mouse/)&&1===c.which||n.HAS_POINTEREVENTS&&u.match(/down/))&&(r=!0),u.match(/touch|pointer/)&&(o=!0),!r||o&&u.match(/mouse/)||(n.HAS_POINTEREVENTS&&e!=n.EVENT_END&&n.PointerEvent.updatePointer(e,c),e===n.EVENT_END&&null!==i?c=i:i=c,s.call(n.detection,a.collectEventData(t,e,c)),n.HAS_POINTEREVENTS&&e==n.EVENT_END&&n.PointerEvent.updatePointer(e,c)),u.match(/up|cancel|end/)&&(r=!1,i=null,n.PointerEvent.reset()),void 0)})},determineEventTypes:function(){var t;t=n.HAS_POINTEREVENTS?n.PointerEvent.getEvents():["touchstart mousedown","touchmove mousemove","touchend touchcancel mouseup"],n.EVENT_TYPES[n.EVENT_START]=t[0],n.EVENT_TYPES[n.EVENT_MOVE]=t[1],n.EVENT_TYPES[n.EVENT_END]=t[2]},getTouchList:function(t){return n.HAS_POINTEREVENTS?n.PointerEvent.getTouchList():t.touches?t.touches:[{identifier:1,pageX:t.pageX,pageY:t.pageY,target:t.target}]},collectEventData:function(t,e,i){var r=this.getTouchList(i,e),o=n.POINTER_TOUCH;return(i.type.match(/mouse/)||n.PointerEvent.matchType(n.POINTER_MOUSE,i))&&(o=n.POINTER_MOUSE),{center:n.utils.getCenter(r),timestamp:i.timestamp||(new Date).getTime(),target:i.target,touches:r,eventType:e,pointerType:o,srcEvent:i,preventDefault:function(){this.srcEvent.preventManipulation&&this.srcEvent.preventManipulation(),this.srcEvent.preventDefault&&this.srcEvent.preventDefault()},stopPropagation:function(){this.srcEvent.stopPropagation()},stopDetect:function(){return n.detection.stopDetect()}}}},n.PointerEvent={pointers:{},getTouchList:function(){var t=this.pointers,e=[];return Object.keys(t).sort().forEach(function(n){e.push(t[n])}),e},updatePointer:function(t,e){t==n.EVENT_END?delete this.pointers[e.pointerId]:(e.identifier=e.pointerId,this.pointers[e.pointerId]=e)},matchType:function(t,e){if(!e.pointerType)return!1;var i={};return i[n.POINTER_MOUSE]=e.pointerType==e.MSPOINTER_TYPE_MOUSE||e.pointerType==n.POINTER_MOUSE,i[n.POINTER_TOUCH]=e.pointerType==e.MSPOINTER_TYPE_TOUCH||e.pointerType==n.POINTER_TOUCH,i[n.POINTER_PEN]=e.pointerType==e.MSPOINTER_TYPE_PEN||e.pointerType==n.POINTER_PEN,i[t]},getEvents:function(){return["pointerdown MSPointerDown","pointermove MSPointerMove","pointerup pointercancel MSPointerUp MSPointerCancel"]},reset:function(){this.pointers={}}},n.utils={extend:function(t,e){for(var n in e)t[n]=e[n];return t},getCenter:function(t){for(var e=[],n=[],i=0,r=t.length;r>i;i++)e.push(t[i].pageX),n.push(t[i].pageY);return{pageX:(Math.min.apply(Math,e)+Math.max.apply(Math,e))/2,pageY:(Math.min.apply(Math,n)+Math.max.apply(Math,n))/2}},getVelocity:function(t,e,n){return{x:Math.abs(e/t)||0,y:Math.abs(n/t)||0}},getAngle:function(t,e){var n=e.pageY-t.pageY,i=e.pageX-t.pageX;return 180*Math.atan2(n,i)/Math.PI},getDirection:function(t,e){var i=Math.abs(t.pageX-e.pageX),r=Math.abs(t.pageY-e.pageY);return i>=r?t.pageX-e.pageX>0?n.DIRECTION_LEFT:n.DIRECTION_RIGHT:t.pageY-e.pageY>0?n.DIRECTION_UP:n.DIRECTION_DOWN},getDistance:function(t,e){var n=e.pageX-t.pageX,i=e.pageY-t.pageY;return Math.sqrt(n*n+i*i)},getScale:function(t,e){return t.length>=2&&e.length>=2?this.getDistance(e[0],e[1])/this.getDistance(t[0],t[1]):1},getRotation:function(t,e){return t.length>=2&&e.length>=2?this.getAngle(e[1],e[0])-this.getAngle(t[1],t[0]):0},isVertical:function(t){return t==n.DIRECTION_UP||t==n.DIRECTION_DOWN},stopDefaultBrowserBehavior:function(t,e){var n,i=["webkit","khtml","moz","ms","o",""];if(e&&t.style){for(var r=0;i.length>r;r++)for(var o in e)e.hasOwnProperty(o)&&(n=o,i[r]&&(n=i[r]+n.substring(0,1).toUpperCase()+n.substring(1)),t.style[n]=e[o]);"none"==e.userSelect&&(t.onselectstart=function(){return!1})}}},n.detection={gestures:[],current:null,previous:null,stopped:!1,startDetect:function(t,e){this.current||(this.stopped=!1,this.current={inst:t,startEvent:n.utils.extend({},e),lastEvent:!1,name:""},this.detect(e))},detect:function(t){if(this.current&&!this.stopped){t=this.extendEventData(t);for(var e=this.current.inst.options,n=0,i=this.gestures.length;i>n;n++){var r=this.gestures[n];if(!this.stopped&&e[r.name]!==!1&&r.handler.call(r,t,this.current.inst)===!1){this.stopDetect();break}}this.current&&(this.current.lastEvent=t)}},endDetect:function(t){this.detect(t),this.stopDetect()},stopDetect:function(){this.previous=n.utils.extend({},this.current),this.current=null,this.stopped=!0},extendEventData:function(t){var e=this.current.startEvent;if(e&&(t.touches.length!=e.touches.length||t.touches===e.touches)){e.touches=[];for(var i=0,r=t.touches.length;r>i;i++)e.touches.push(n.utils.extend({},t.touches[i]))}var o=t.timestamp-e.timestamp,s=t.center.pageX-e.center.pageX,a=t.center.pageY-e.center.pageY,c=n.utils.getVelocity(o,s,a);return n.utils.extend(t,{deltaTime:o,deltaX:s,deltaY:a,velocityX:c.x,velocityY:c.y,distance:n.utils.getDistance(e.center,t.center),angle:n.utils.getAngle(e.center,t.center),direction:n.utils.getDirection(e.center,t.center),scale:n.utils.getScale(e.touches,t.touches),rotation:n.utils.getRotation(e.touches,t.touches),startEvent:e}),t},register:function(t){var e=t.defaults||{};return e[t.name]===void 0&&(e[t.name]=!0),n.utils.extend(n.defaults,e),t.index=t.index||1e3,this.gestures.push(t),this.gestures.sort(function(t,e){return t.indexe.index?1:0}),this.gestures}},n.gestures=n.gestures||{},n.gestures.Hold={name:"hold",index:10,defaults:{hold_timeout:500,hold_threshold:1},timer:null,handler:function(t,e){switch(t.eventType){case n.EVENT_START:clearTimeout(this.timer),n.detection.current.name=this.name,this.timer=setTimeout(function(){"hold"==n.detection.current.name&&e.trigger("hold",t)},e.options.hold_timeout);break;case n.EVENT_MOVE:t.distance>e.options.hold_threshold&&clearTimeout(this.timer);break;case n.EVENT_END:clearTimeout(this.timer)}}},n.gestures.Tap={name:"tap",index:100,defaults:{tap_max_touchtime:250,tap_max_distance:10,doubletap_distance:20,doubletap_interval:300},handler:function(t,e){if(t.eventType==n.EVENT_END){var i=n.detection.previous;if(t.deltaTime>e.options.tap_max_touchtime||t.distance>e.options.tap_max_distance)return;n.detection.current.name=i&&"tap"==i.name&&t.timestamp-i.lastEvent.timestamp0&&t.touches.length>e.options.swipe_max_touches)return;(t.velocityX>e.options.swipe_velocity||t.velocityY>e.options.swipe_velocity)&&(e.trigger(this.name,t),e.trigger(this.name+t.direction,t))}}},n.gestures.Drag={name:"drag",index:50,defaults:{drag_min_distance:10,drag_max_touches:1,drag_block_horizontal:!1,drag_block_vertical:!1,drag_lock_to_axis:!1},triggered:!1,handler:function(t,e){if(n.detection.current.name!=this.name&&this.triggered)return e.trigger(this.name+"end",t),this.triggered=!1,void 0;if(!(e.options.drag_max_touches>0&&t.touches.length>e.options.drag_max_touches))switch(t.eventType){case n.EVENT_START:this.triggered=!1;break;case n.EVENT_MOVE:if(t.distancet.deltaY?n.DIRECTION_UP:n.DIRECTION_DOWN:0>t.deltaX?n.DIRECTION_LEFT:n.DIRECTION_RIGHT),this.triggered||(e.trigger(this.name+"start",t),this.triggered=!0),e.trigger(this.name,t),e.trigger(this.name+t.direction,t),(e.options.drag_block_vertical&&n.utils.isVertical(t.direction)||e.options.drag_block_horizontal&&!n.utils.isVertical(t.direction))&&t.preventDefault();break;case n.EVENT_END:this.triggered&&e.trigger(this.name+"end",t),this.triggered=!1}}},n.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(t,e){if(n.detection.current.name!=this.name&&this.triggered)return e.trigger(this.name+"end",t),this.triggered=!1,void 0;if(!(2>t.touches.length))switch(e.options.transform_always_block&&t.preventDefault(),t.eventType){case n.EVENT_START:this.triggered=!1;break;case n.EVENT_MOVE:var i=Math.abs(1-t.scale),r=Math.abs(t.rotation);if(e.options.transform_min_scale>i&&e.options.transform_min_rotation>r)return;n.detection.current.name=this.name,this.triggered||(e.trigger(this.name+"start",t),this.triggered=!0),e.trigger(this.name,t),r>e.options.transform_min_rotation&&e.trigger("rotate",t),i>e.options.transform_min_scale&&(e.trigger("pinch",t),e.trigger("pinch"+(1>t.scale?"in":"out"),t));break;case n.EVENT_END:this.triggered&&e.trigger(this.name+"end",t),this.triggered=!1}}},n.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1},handler:function(t,e){e.options.prevent_default&&t.preventDefault(),t.eventType==n.EVENT_START&&e.trigger(this.name,t)}},n.gestures.Release={name:"release",index:1/0,handler:function(t,e){t.eventType==n.EVENT_END&&e.trigger(this.name,t)}},"object"==typeof module&&"object"==typeof module.exports?module.exports=n:(t.Hammer=n,"function"==typeof t.define&&t.define.amd&&t.define("hammer",[],function(){return n}))})(this),function(t){"use strict";t&&(Hammer.event.bindDom=function(e,n,i){t(e).on(n,function(t){var e=t.originalEvent;e.pageX||(e.pageX=t.pageX,e.pageY=t.pageY),e.target||(e.target=t.target),e.which||(e.which=e.button),e.preventDefault||(e.preventDefault=t.preventDefault),e.stopPropagation||(e.stopPropagation=t.stopPropagation),i.call(this,e)})},Hammer.Instance.prototype.on=function(e,n){return t(this.element).on(e,n)},Hammer.Instance.prototype.off=function(e,n){return t(this.element).off(e,n)},Hammer.Instance.prototype.trigger=function(e,n){return t(n.srcEvent.target).trigger({type:e,gesture:n})},t.fn.hammer=function(e){return this.each(function(){var n=t(this),i=n.data("hammer");i?i&&e&&Hammer.utils.extend(i.options,e):n.data("hammer",Hammer(this,e||{}))})})}(window.jQuery||!1); /* * Hammer.JS jQuery plugin * version 0.3 * author: Eight Media * https://github.com/EightMedia/hammer.js */ jQuery.fn.hammer = function(options) { return this.each(function() { var hammer = new Hammer(this, options); var $el = jQuery(this); $el.data("hammer", hammer); var events = ['hold','tap','doubletap','transformstart','transform','transformend','dragstart','drag','dragend','swipe','release']; for(var e=0; e 0 && tree._listeners.length > m) { tree._listeners.warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', tree._listeners.length); console.trace(); } } } return true; } name = type.shift(); } return true; }; // By default EventEmitters will print a warning if more than // 10 listeners are added to it. This is a useful default which // helps finding memory leaks. // // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. EventEmitter.prototype.delimiter = '.'; EventEmitter.prototype.setMaxListeners = function(n) { this._events || init.call(this); this._events.maxListeners = n; if (!this._conf) this._conf = {}; this._conf.maxListeners = n; }; EventEmitter.prototype.event = ''; EventEmitter.prototype.once = function(event, fn) { this.many(event, 1, fn); return this; }; EventEmitter.prototype.many = function(event, ttl, fn) { var self = this; if (typeof fn !== 'function') { throw new Error('many only accepts instances of Function'); } function listener() { if (--ttl === 0) { self.off(event, listener); } fn.apply(this, arguments); }; listener._origin = fn; this.on(event, listener); return self; }; EventEmitter.prototype.emit = function() { this._events || init.call(this); var type = arguments[0]; if (type === 'newListener' && !this.newListener) { if (!this._events.newListener) { return false; } } // Loop through the *_all* functions and invoke them. if (this._all) { var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; for (i = 0, l = this._all.length; i < l; i++) { this.event = type; this._all[i].apply(this, args); } } // If there is no 'error' event listener then throw. if (type === 'error') { if (!this._all && !this._events.error && !(this.wildcard && this.listenerTree.error)) { if (arguments[1] instanceof Error) { throw arguments[1]; // Unhandled 'error' event } else { throw new Error("Uncaught, unspecified 'error' event."); } return false; } } var handler; if(this.wildcard) { handler = []; var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); searchListenerTree.call(this, handler, ns, this.listenerTree, 0); } else { handler = this._events[type]; } if (typeof handler === 'function') { this.event = type; if (arguments.length === 1) { handler.call(this); } else if (arguments.length > 1) switch (arguments.length) { case 2: handler.call(this, arguments[1]); break; case 3: handler.call(this, arguments[1], arguments[2]); break; // slower default: var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; handler.apply(this, args); } return true; } else if (handler) { var l = arguments.length; var args = new Array(l - 1); for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; var listeners = handler.slice(); for (var i = 0, l = listeners.length; i < l; i++) { this.event = type; listeners[i].apply(this, args); } return (listeners.length > 0) || this._all; } else { return this._all; } }; EventEmitter.prototype.on = function(type, listener) { if (typeof type === 'function') { this.onAny(type); return this; } if (typeof listener !== 'function') { throw new Error('on only accepts instances of Function'); } this._events || init.call(this); // To avoid recursion in the case that type == "newListeners"! Before // adding it to the listeners, first emit "newListeners". this.emit('newListener', type, listener); if(this.wildcard) { growListenerTree.call(this, type, listener); return this; } if (!this._events[type]) { // Optimize the case of one listener. Don't need the extra array object. this._events[type] = listener; } else if(typeof this._events[type] === 'function') { // Adding the second element, need to change to array. this._events[type] = [this._events[type], listener]; } else if (isArray(this._events[type])) { // If we've already got an array, just append. this._events[type].push(listener); // Check for listener leak if (!this._events[type].warned) { var m = defaultMaxListeners; if (typeof this._events.maxListeners !== 'undefined') { m = this._events.maxListeners; } if (m > 0 && this._events[type].length > m) { this._events[type].warned = true; console.error('(node) warning: possible EventEmitter memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length); console.trace(); } } } return this; }; EventEmitter.prototype.onAny = function(fn) { if(!this._all) { this._all = []; } if (typeof fn !== 'function') { throw new Error('onAny only accepts instances of Function'); } // Add the function to the event listener collection. this._all.push(fn); return this; }; EventEmitter.prototype.addListener = EventEmitter.prototype.on; EventEmitter.prototype.off = function(type, listener) { if (typeof listener !== 'function') { throw new Error('removeListener only takes instances of Function'); } var handlers,leafs=[]; if(this.wildcard) { var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); } else { // does not use listeners(), so no side effect of creating _events[type] if (!this._events[type]) return this; handlers = this._events[type]; leafs.push({_listeners:handlers}); } for (var iLeaf=0; iLeaf 0) { fns = this._all; for(i = 0, l = fns.length; i < l; i++) { if(fn === fns[i]) { fns.splice(i, 1); return this; } } } else { this._all = []; } return this; }; EventEmitter.prototype.removeListener = EventEmitter.prototype.off; EventEmitter.prototype.removeAllListeners = function(type) { if (arguments.length === 0) { !this._events || init.call(this); return this; } if(this.wildcard) { var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); for (var iLeaf=0; iLeaf= 0) { var fromOsName = $.trim(rightFrom(loweredUserAgent, "version/")); clientData.device_OS_version = fromOsName.substring(0, fromOsName.indexOf(" ")); } // older UA format else { var fromOsName = $.trim(rightFrom(loweredUserAgent, "/")); clientData.device_OS_version = fromOsName.substring(0, fromOsName.indexOf(" ")); } } //alert("clientData.device_type: " + clientData.device_type + "\n clientData.device_OS: " + clientData.device_OS + "\n clientData.device_OS_version: " + clientData.device_OS_version); // Some string extensions re-written as JS functions, not currently used function rightFrom(inString, matchString) { var pos = inString.indexOf(matchString); if (pos >= 0) { inString = inString.substring(pos + matchString.length); } return inString; } function rightFromLast(inString, matchString) { var pos = inString.lastIndexOf(matchString); if (pos >= 0) { inString = inString.substring(pos + matchString.length); } return inString; } function leftFrom(inString, matchString) { var pos = inString.indexOf(matchString); if (pos >= 0) { inString = inString.substring(0, pos); } return inString; } cachedBrowserData = clientData; return clientData; }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.functions.browserDetect.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.Emitter.js */ (function($) { $.analyticsEmitter = (function() { var settings = { debug: false, EnableLegacyWindowEvent: true, indexPageName: /index.tmex|index.htm|index.html/gi, // regex or string - used to clean default page names from analytics DynamicValuesDelimiterSymbol: "##", isMobileMode: false, redirectOnTrack: false, redirectLocation: "", MobileSiteName: 'Mobile Site', DesktopSiteName: 'Full Site', trackingSuccessTimeoutLimit: 1500, // msec... - If redirectOnTrack == true will redirect even if subscribed modules have not resolved... // Data format of tracking Args supplied TrackingArgs: { "PageModuleName": "", // e.g. "ExploreRange" "PageType": "", // e.g. "A_CarChapter" "ModelName": "", // e.g. "GS" "ModuleCategory": "", // e.g. "Component" "PageName": "", // e.g. the Browser title "Interaction1": "", "Interaction2": "", "Interaction3": "", "InteractionList": [], // Array used to populate interations for convinence "LinkType": "", // e.g. "Promo link" "LinkValue": "", // e.g. "http://..." "ContentType": "", // e.g. Image "SocialChannel": "", // e.g. Facebook "SocialAction": "", // e.g. "Share", "Like" "FormName": "", // e.g. Brochure request "FormStep": "", // int "FormComplete": false, // true if on the success page... "FormModelsSelected": [], // e.g. ["GS", "IS"] "FormProductDeliveryMethod": "", "FormDealerDistance": null, // null or int "FormConversionStep": "", // int "NavigatedMethodType": "", // e.g. Clicked, Scrolled "NavigatedSectionName": "", // e.g. ImagesAndVideo "DeviceType": "", // e.g. PC, Mobile or Tablet "ContentFilter": "", // e.g. Hybrid "DeepLinkValue": "", // overrides the auto generated deep link path, e.g. /CarModels_Top/GS "ResourceLocation": "", // Includes deep link first level but with hash removed, e.g./car-models/gs/gs-450h/FinanceOffers "ResourceType": "", "URL": "", // base Uri of the current page (Without deep linking hash bang...) "DateTimeStamp": "", // Date Time stamp "InteractionCode": "", // 0 = PageView, 22 inpage click "FormOutFlow1": "", // Forms additional info "FormOutFlow2": "", // Forms additional info "DealerName": "", // Retailer Finder additional info "SearchMethod": "", // Retailer Finder additional info "SearchValue": "", // Retailer Finder additional info "InsiteSearch": "", // Insite Search action "InsiteSearchTerm": "", // Insite Search term "InsiteSearchUrl": "", // Insite Search URL "InsiteSearchPage": "", // Insite Search Page additionalData: { eventType: "", // Additional field to categorise event to aid mapping to API's // Possible values: // - PageLoad // - Navigation // - TopMenu // - ViewChange // - FilterInteraction // - ContentInteraction // - SocialInteration // - ImageInteraction // - VideoInteraction // - DownloadInteration // - FormInteraction // - SearchInteraction // - CountrySelection redirectOnTrack: false, redirectOnTrackURL: "", useBlankDeepLinkValue: false, linkIsExternal: false, isNotInternalNavigation: false } }, // Previously tracking args were in Web Trends type fields names, this object is used to // translate back to the previous values to support a legacy tracking function (window AnalyticsEvent) LegacyTrackingArgsTranslations: { // CurrentArgKey : LegacyArgKey "PageModuleName": "wtPn", "PageType": "wtCgN", "ModelName": "wtCgS", "ModuleCategory": "wtPc", "PageName": "wtTi", "Interaction1": "wtInteraction1", "Interaction2": "wtInteraction2", "Interaction3": "wtInteraction3", "ContentType": "wtContenttype", "SocialChannel": "wtSocialName", "FormName": "wtSiN", "FormStep": "wtSiX", "FormConversionStep": "wtSiCs", "NavigatedMethodType": "wtNav", "NavigatedSectionName": "wtSvl", "DeviceType": "wtSp", "ContentFilter": "wtFilter", "ResourceLocation": "dcsuri", "URL": "wtUrl", "DateTimeStamp": "wtDts", "InteractionCode": "wtDl", "FormOutFlow1": "wtFormOutFlow1", "FormOutFlow2": "wtFormOutFlow2", "DealerName": "wtDealername", "SearchMethod": "searchMethod", "SearchValue": "searchValue", "InsiteSearch": "wtInsiteSearch", "InsiteSearchTerm": "wtInsiteSearchTerm", "InsiteSearchUrl": "wtInsiteSearchUrl", "InsiteSearchPage": "wtInsiteSearchPage", "additionalData": "definition" }, inlineDataAttribureTranslations: { // InlineDataAttribureKey : NormalisedDataKey "wtPn": "PageModuleName", "wtCgN": "PageType", "wtCgS": "ModelName", "wtPc": "ModuleCategory" } } // Static variables var trackingEventEmitter = new EventEmitter2(); var deviceData = $(window).GetBrowserData(); var isMobileMode = deviceData.device_type == "Mobile"; if ($.address && typeof $.address.tracker === "function") { // Turn of GA if jquery.adress is present $.address.tracker(null); } // Track first request // PageLoad event type is now no really required.... var initialRequestsStarted = false; return { on: function(event, callback) { return trackingEventEmitter.on(event, callback); }, // Called by UI modules to track an analytics event, // returns false if redirectOnTrack=true, else returns true trackEvent: function(trackingArgs, options) { // Do nothing if user has opted out of analytics if (typeof $.Cookies === "function" && !$.Cookies.check('analytics')) { // Analytics are disabled, just redirect if required... if (trackingArgs["additionalData"] && trackingArgs.additionalData.redirectOnTrack && trackingArgs.additionalData.redirectOnTrackURL) { document.location.href = trackingArgs.additionalData.redirectOnTrackURL; return !(trackingArgs.additionalData.redirectOnTrack); } else { return true; } } // We dont emit the event as we call the subscribed methods directly //trackingEventEmitter.emit("trackingEvent", [options]); var ls = $.extend({}, settings, options); // local settings var $this = $(this); var AnalyticsEventData = $.extend(true, {}, ls.TrackingArgs); // Clone it var isPageLoad = !initialRequestsStarted; initialRequestsStarted = true; var cleanedPath = window.location.pathname.replace(ls.indexPageName, ""); // Get any analytics data of the body tag, convert the JSON Keys to the normalised key's var inlineNormalisedData = {}; $.each($('body').data(), function(key, value) { if (ls.inlineDataAttribureTranslations[key]) { inlineNormalisedData[ls.inlineDataAttribureTranslations[key]] = value; } }); // Merge supplied data with in line translated values AnalyticsEventData = $.extend({}, AnalyticsEventData, inlineNormalisedData); // Add device type AnalyticsEventData = $.extend({}, AnalyticsEventData, { "DeviceType": deviceData.device_type }); // add unique timestamp to avoid caching AnalyticsEventData = $.extend({}, AnalyticsEventData, { "DateTimeStamp": (+new Date).toString() }); // Add current Base URL value, stripping out default page names AnalyticsEventData = $.extend({}, AnalyticsEventData, { "URL": cleanedPath }); // Populate NavigatedSectionName with PageModuleName if NavigatedSectionName is empty & is navigation event... if ((!AnalyticsEventData.NavigatedSectionName || AnalyticsEventData.NavigatedSectionName == "") && AnalyticsEventData.PageModuleName && AnalyticsEventData.NavigatedMethodType) { AnalyticsEventData.NavigatedSectionName = AnalyticsEventData.PageModuleName.toString(); } // Merge in supplied event specific analytics AnalyticsEventData = $.extend(true, {}, AnalyticsEventData, trackingArgs); // Remove any empty items.... AnalyticsEventData.InteractionList = $.grep(AnalyticsEventData.InteractionList, function(n, i) { return n && n != ""; }); // If an auto Interaction field has been supplied select the next avalible empty interaction slot $.each(AnalyticsEventData.InteractionList, function(index, value) { var eventFieldData; if (FieldIsNullOrEmpty(AnalyticsEventData, "Interaction1")) { eventFieldData = { "Interaction1": value }; } else if (FieldIsNullOrEmpty(AnalyticsEventData, "Interaction2")) { eventFieldData = { "Interaction2": value }; } else if (FieldIsNullOrEmpty(AnalyticsEventData, "Interaction3")) { eventFieldData = { "Interaction3": value }; } else if (ls.debug) { console.log("analyticsEmmiter, not all values in InteractionList recorderd, all slots full"); return false; // end loop } AnalyticsEventData = $.extend({}, AnalyticsEventData, eventFieldData); }); // Popualte some defaults if (isPageLoad) { AnalyticsEventData.InteractionCode = "0"; // 0 = pageview // Set navigation type to Entry if user has come from a different domain var currentHostAndPort = window.location.protocol + "//" + window.location.host; if (document.referrer.indexOf(currentHostAndPort) != 0) { AnalyticsEventData.NavigatedMethodType = "Entry"; } } else { // Catch for empty NavigatedMethodType - Questionable.... Should this always be defined on the module call? if (!AnalyticsEventData.NavigatedMethodType) { AnalyticsEventData.NavigatedMethodType = "Content clicked"; // Catch for empty Interaction code if (!AnalyticsEventData.InteractionCode) { AnalyticsEventData.InteractionCode = "22"; // 22 = inpage event } // Catch for empty Interaction code } else if (!AnalyticsEventData.InteractionCode) { AnalyticsEventData.InteractionCode = "0"; // 0 = pageview } } // If Resource location has not been overridded in supplied args auto generate it if (!AnalyticsEventData.ResourceLocation) { var PageURL = cleanedPath; if (PageURL == "/") PageURL = "/home/"; // Homepage needs to be identified as '/home/' in reports if (!endsWith(PageURL, "/")) PageURL += "/"; // Must end with '/' if (AnalyticsEventData.ResourceLocation.indexOf('/') != -1) PageURL = "/" + PageURL; // Must start with '/' if (AnalyticsEventData.DeepLinkValue || AnalyticsEventData.additionalData.useBlankDeepLinkValue) { // use supplied has value or blank override AnalyticsEventData.ResourceLocation = PageURL + AnalyticsEventData.DeepLinkValue; if (!endsWith(AnalyticsEventData.ResourceLocation, "/")) AnalyticsEventData.ResourceLocation += "/"; // again must end with '/' } else if (AnalyticsEventData.PageModuleName) { // else just use section name if we have one AnalyticsEventData.ResourceLocation = PageURL + AnalyticsEventData.PageModuleName + "/"; } } else { // Just ensure the homepage is prefixed with '/home/' var PageURL = cleanedPath; if (PageURL == "/" && AnalyticsEventData.ResourceLocation.indexOf('/home/') != 0) { AnalyticsEventData.ResourceLocation += (AnalyticsEventData.ResourceLocation.indexOf('/') != 0) ? "/home/" : "/home"; } } // Mobile device checks if (isMobileMode && typeof ($.getCookie) == "function") { // append either 'Mobile Site' or 'Full Site' to WT.cg_n if this is a mobile device var wtCgNVal = (AnalyticsEventData.wtCgN) ? AnalyticsEventData.wtCgN + ';' : ''; var layoutCookie = $.getCookie('mobileLayoutOverride'); // Mobile device viewing the fullsite? if (layoutCookie != null && layoutCookie == "False") { wtCgNVal += settings.DesktopSiteName; } else { wtCgNVal += settings.MobileSiteName; AnalyticsEventData.ResourceLocation = "/mobile" + AnalyticsEventData.ResourceLocation; } AnalyticsEventData = $.extend({}, AnalyticsEventData, { "PageType": wtCgNVal }); } // If we are in the car configurator we need to append another content group name of A_CarConfigurator if (AnalyticsEventData.PageModuleName) { var cgnVal = AnalyticsEventData.PageType ? AnalyticsEventData.PageType + ";" : ""; if (!$.isArray(AnalyticsEventData.PageModuleName) && AnalyticsEventData.PageModuleName.indexOf("BuildYour") === 0) { AnalyticsEventData.PageType = cgnVal + "A_CarConfig"; } else if ($.isArray(AnalyticsEventData.PageModuleName) && AnalyticsEventData.PageModuleName[0].indexOf("BuildYour") === 0) { AnalyticsEventData.PageType = cgnVal + "A_CarConfig"; } } // Legacy function to support modeuls tied to the old window event and field keys if (ls.EnableLegacyWindowEvent) { var LegacyData = {}; $.each(AnalyticsEventData, function(key, value) { if (ls.LegacyTrackingArgsTranslations[key]) { LegacyData[ls.LegacyTrackingArgsTranslations[key]] = value; } }); $(window).trigger("AnalyticsEvent", [LegacyData]); } // get all subscribed events var subscribedEvents = trackingEventEmitter.listeners('trackingEvent'); var callbackArray = []; //console.log("firing tracking event, data: ", AnalyticsEventData); // Directly call each subscribed function so we can get its return (a deferred obj) $.each(subscribedEvents, function(index, functionItem) { callbackArray.push(functionItem.apply(this, [AnalyticsEventData])); }); // Fired when all deferred objects have been resolved $.when.apply(window, callbackArray).always( function() { //console.log("$.analyticsModule.trackEvent all objects done"); if (AnalyticsEventData.additionalData.redirectOnTrack && AnalyticsEventData.additionalData.redirectOnTrackURL) { //console.log("$.analyticsModule.trackEvent redirected set, going to: " + AnalyticsEventData.additionalData.redirectOnTrackURL); document.location.href = AnalyticsEventData.additionalData.redirectOnTrackURL; } } ); // If configured redirect without object resovled after timeout limit... if (AnalyticsEventData.additionalData.redirectOnTrack && AnalyticsEventData.additionalData.redirectOnTrackURL) { setTimeout(function() { document.location.href = AnalyticsEventData.additionalData.redirectOnTrackURL; }, ls.trackingSuccessTimeoutLimit); } //console.log("emitter return val: " + !AnalyticsEventData.additionalData.redirectOnTrack); return !AnalyticsEventData.additionalData.redirectOnTrack; } }; // Private helper functions function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } function FieldIsNullOrEmpty(data, fieldName) { if (data[fieldName]) { if ($.trim(data[fieldName]) != "") { return false; } else { return true; } } else { return true; } } function checkForDynamicValues(theValue, eventJSON) { if (theValue && typeof theValue == "string") { var returnVal = theValue; $.each(settings.TrackingArgs, function(key, value) { var searchString = settings.DynamicValuesDelimiterSymbol + key + settings.DynamicValuesDelimiterSymbol; if (theValue.indexOf(searchString) >= 0) { returnVal = theValue.replace(searchString, eventJSON[key]); return false; } }); return returnVal; } else { return theValue; } } })(); })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.Emitter.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.webtrends.js */ (function($) { $.analyticsWT = (function() { var settings = { debug: false, // Used for key translations - keys represent data attribute + JSON safe names, // values are the true WT param names sent to WT WebTrendsTranslations: { "PageModuleName": "WT.pn", "PageType": "WT.cg_n", "ModelName": "WT.cg_s", "ModuleCategory": "WT.pc", "PageName": "WT.ti", "Interaction1": "WT.ev_val", "Interaction2": "WT.ev_act", "Interaction3": "WT.ev_act2", "ContentType": "WT.Contenttype", "SocialChannel": "WT.socialname", "FormName": "WT.si_n", "FormStep": "WT.si_x", "FormConversionStep": "WT.si_cs", "NavigatedMethodType": "WT.nav", "NavigatedSectionName": "WT.svl", "DeviceType": "WT.sp", "ContentFilter": "WT.filter", "ResourceLocation": "dcsuri", "URL": "WT.URL", "DateTimeStamp": "WT.dts", "InteractionCode": "WT.dl", "FormOutFlow1": "WT.formoutflow1", "FormOutFlow2": "WT.formoutflow2", "DealerName": "WT.dealername", "SearchMethod": "SearchMethod", "SearchValue": "SearchValue", "InsiteSearch": "WT.InsiteSearch", "InsiteSearchTerm": "WT.InsiteSearchTerm", "InsiteSearchUrl": "WT.InsiteSearchURL", "InsiteSearchPage": "WT.InsiteSearchPage" } }; var dcsCollectCalled = false; $.analyticsEmitter.on('trackingEvent', function myFunc(AnalyticsData) { var defferedObject = $.Deferred(); // Ensure WT API is included on the page if (typeof _tag === 'undefined') { console.log("could not log WebTrends data, _tag object not avalible") defferedObject.reject(); return defferedObject; } // Ignore downloads - they are auto tracked by WT if (AnalyticsData.additionalData.eventType == "DownloadInteration") { if (AnalyticsData["ResourceLocation"]) { AnalyticsData["ResourceLocation"] = "/img/" + AnalyticsData["ResourceLocation"]; } AnalyticsData = $.extend({}, AnalyticsData, { 'wtEs': 'wtEs' }); } // Map values to WebTrends fields var WebTrendsData = {}; $.each(AnalyticsData, function(key, value) { if (settings.WebTrendsTranslations[key]) { WebTrendsData[settings.WebTrendsTranslations[key]] = value; } }); // Build the query string var WebtrendsQuery = ""; $.each(WebTrendsData, function(key, value) { if (value && value != "") { WebtrendsQuery += key + "=" + encodeURIComponent(value) + "&"; } }); // Popualte WT field with query string data _tag.others = WebtrendsQuery; // Will be called once webtrends has confirmed tracking the event _tag.requestProcessedCallbackFN = function() { defferedObject.resolve(); }; // Call required method, dcsCollect only used on initial page load if (!dcsCollectCalled) { dcsCollectCalled = true; _tag.dcsCollect(); } else { _tag.dcsTag(); } return defferedObject; }); // Public methods return { // Pass a string of values WebTrends values i.e WT.cg_n=A_CarConfig&WT.dl=0&WT.ModelID=... and call dcsTag() to fire the tagging dcsTag: function(val) { if (typeof _tag !== "undefined") { _tag.others = val; _tag.dcsTag(); } } }; })(); })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.webtrends.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.google.js */ (function($) { $.analyticsGA = (function() { var settings = { debug: false, trackingIds: { 'default': 'UA-0000001-0', 'www.lexus.eu': 'UA-39581429-1' } }; var GlobalPageTracker = null; var queuedAnalyticsRequests = []; var lastFormStepRecorded = 0; var Uid = settings.trackingIds[location.host] || settings.trackingIds['default']; $.ga.load(Uid, function(_pageTracker) { GlobalPageTracker = _pageTracker; // Set pageTracker defaults. GlobalPageTracker._setDomainName(document.domain); GlobalPageTracker._addIgnoredRef(document.domain); // Resolve any queued calls... //console.log("analyticsGA: ga loaded, queued events count: " + queuedAnalyticsRequests.length); $.each(queuedAnalyticsRequests, function(index, value) { value.apply(this); }); queuedAnalyticsRequests = []; return true; }); var gaMethods = { trackInitialPageView: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); // Remove page track - we just need the Top Level URL event on page load as I understand it GlobalPageTracker._trackPageview(eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); if (eventData.URL == "/") { eventData.URL = "/home/"; if (eventData.ResourceLocation.indexOf("/mobile/home/") == 0) eventData.URL = "/mobile/home/"; } GlobalPageTracker._trackEvent("Top Level URL", eventData.URL, "", null, true); GlobalPageTracker._setAllowLinker(true); return defferedObject.promise(); }, trackVirtualPageView: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackPageview(eventData.ResourceLocation); return defferedObject.promise(); }, trackAdditionalLinkEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackEvent("Additional Links", eventData.InteractionList.join(' - '), eventData.PageModuleName, null, true); return defferedObject.promise(); }, trackExternalLinkEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackEvent("External Link Click", eventData.InteractionList.join(' - '), eventData.PageModuleName, null, true); return defferedObject.promise(); }, trackClickThroughLinkEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackEvent("In-page Navigation", eventData.InteractionList.join(' - '), eventData.PageModuleName, null, true); return defferedObject.promise(); }, trackCountrySelection: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackEvent("Country Selector", eventData.InteractionList[0], eventData.InteractionList[1], null, true); return defferedObject.promise(); }, trackFormEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); if (lastFormStepRecorded == eventData.FormStep) { // we're only intested if the form has progress - dont record the same step twice... defferedObject.resolve(); return defferedObject.promise(); } GlobalPageTracker._set("page", eventData.ResourceLocation); // Fire an event on form complete if we have any userful data if (eventData.FormComplete) { // Unsure if this should be before or after the event GlobalPageTracker._setCustomVar(1, "Form Submissions", eventData.FormName, 1); if (eventData.FormProductDeliveryMethod) { // e.g. Brochure GlobalPageTracker._trackEvent(eventData.FormName, eventData.FormModelsSelected.join('>'), eventData.FormProductDeliveryMethod, null, false); } else if (eventData.DealerName) { // e.g test driver or find a retailer var dealerName = eventData.DealerName; if (eventData.FormDealerDistance) dealerName += " - " + eventData.FormDealerDistance; if (eventData.FormModelsSelected.length > 0) { // e.g. test drive GlobalPageTracker._trackEvent(eventData.FormName, eventData.FormModelsSelected.join('>'), dealerName, null, false); } else { // e.g. find a retailer GlobalPageTracker._trackEvent(eventData.FormName, eventData.SearchMethod + ": " + eventData.SearchValue, dealerName, null, false); } } } GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackPageview(eventData.ResourceLocation); lastFormStepRecorded = eventData.FormStep; return defferedObject.promise(); }, trackFilterEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackEvent("Filter", eventData.ContentFilter, eventData.PageModuleName, null, true); return defferedObject.promise(); }, trackVideoEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackEvent("Video", eventData.InteractionList.join(' - '), eventData.PageModuleName, null, true); return defferedObject.promise(); }, trackDownload: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackEvent("Download", eventData.ResourceType, eventData.ResourceLocation, null, true); return defferedObject.promise(); }, trackSearchEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackEvent("SiteSearch", eventData.InsiteSearch, eventData.InsiteSearchUrl || eventData.InsiteSearchTerm, 4, true); return defferedObject.promise(); }, trackSocialEvent: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackSocial(eventData.SocialChannel, eventData.SocialAction, null, eventData.ResourceLocation); return defferedObject.promise(); }, trackNavigation: function(eventData, deferredObject) { var defferedObject = deferredObject || $.Deferred(); GlobalPageTracker._set("page", eventData.ResourceLocation); GlobalPageTracker._trackPageview(eventData.ResourceLocation); GlobalPageTracker._set("hitCallback", function() { defferedObject.resolve(); }); GlobalPageTracker._trackEvent("Navigation Tracking", eventData.NavigatedMethodType, eventData.NavigatedSectionName, null, true); return defferedObject.promise(); }, parseEventType: function(eventData, deferredObject) { switch (eventData.additionalData.eventType) { case "PageLoad": return gaMethods.trackInitialPageView(eventData, deferredObject); break; case "TopMenu": case "ContentInteraction": if (eventData.additionalData.linkIsExternal) { return gaMethods.trackExternalLinkEvent(eventData, deferredObject); } else if (eventData.additionalData.redirectOnTrack && !eventData.additionalData.isNotInternalNavigation) { return gaMethods.trackClickThroughLinkEvent(eventData, deferredObject); } else { return gaMethods.trackAdditionalLinkEvent(eventData, deferredObject); } break; case "FormInteraction": return gaMethods.trackFormEvent(eventData, deferredObject); break; case "FilterInteraction": return gaMethods.trackFilterEvent(eventData, deferredObject); break; case "VideoInteraction": return gaMethods.trackVideoEvent(eventData, deferredObject); break; case "SocialInteration": return gaMethods.trackSocialEvent(eventData, deferredObject); break; case "Navigation": // Long page navigation return gaMethods.trackNavigation(eventData, deferredObject); break; case "SearchInteraction": return gaMethods.trackSearchEvent(eventData, deferredObject); break; case "CountrySelection": return gaMethods.trackCountrySelection(eventData, deferredObject); break; case "DownloadInteration": return gaMethods.trackDownload(eventData, deferredObject); break; default: return gaMethods.trackAdditionalLinkEvent(eventData, deferredObject); } } }; $.analyticsEmitter.on('trackingEvent', function myFunc(eventData) { // If ga has not loaded then queue it if (!GlobalPageTracker) { //console.log("analyticsGA: event recieved before ga loaded, queuing"); var defferedObject = $.Deferred(); queuedAnalyticsRequests.push(function() { gaMethods.parseEventType(eventData, defferedObject); }); return defferedObject; } //console.log("analyticsGA: trackingEvent, eventData: ", eventData); return gaMethods.parseEventType(eventData); }); // Public methods return { someFunction: function(argument) { return true; } }; })(); })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\analytics\analytics.google.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\_LexusV10SearchSuggestions_GLEN.js */ $(function() { $(document).LexusV10Configuration('addPageData', 'searchTermsSuggestList', [ "GS 250", "GS 350", "GS 450h", "IS 200", "IS 220d", "IS 250c", "RX 350", "RX 450h", "LS 460", "LS 600h", "LS 600h L", "CT 200h", "LFA", "LEXUS", // "Paris", // "Moscow", "Motorshow", "Hybrid", "Range" ]); }); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\_LexusV10SearchSuggestions_GLEN.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\_LexusV10Translations.js */ $(function() { $(document).LexusV10Configuration('addTranslateData', { LoadingContent: "LOADING CONTENT...", CompareToAnotherVarient: "COMPARE TO ANOTHER VARIANT", HideSubModels: "Hide sub models", ShowSubModels: "Show sub models", BackToMainFeatures: "Back to Main Features", ShowMore: "Show more", ShowLess: "Show less", Download: "Download", Share: "Share", Like: "Like", Close: "Close", CloseCAPS: "CLOSE", More: "More", previous: "Previous", next: "Next", NoResultsCAPS: "NO RESULTS FOUND", ShortErrorMsg: "Sorry, an error has occured", ShortErrorMsgCAPS: "SORRY, AN ERROR HAS OCCURED", searchResultsInfo: "

Search results {0} to {1} of ({2})

" }); }); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\_LexusV10Translations.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.timer.js */ /** * jquery.timer.js * * Copyright (c) 2011 Jason Chavannes * * http://jchavannes.com/jquery-timer * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ ;(function($) { $.timer = function(func, time, autostart) { this.set = function(func, time, autostart) { this.init = true; if(typeof func == 'object') { var paramList = ['autostart', 'time']; for(var arg in paramList) {if(func[paramList[arg]] != undefined) {eval(paramList[arg] + " = func[paramList[arg]]");}}; func = func.action; } if(typeof func == 'function') {this.action = func;} if(!isNaN(time)) {this.intervalTime = time;} if(autostart && !this.active) { this.active = true; this.setTimer(); } return this; }; this.once = function(time) { var timer = this; if(isNaN(time)) {time = 0;} window.setTimeout(function() {timer.action();}, time); return this; }; this.play = function(reset) { if(!this.active) { if(reset) {this.setTimer();} else {this.setTimer(this.remaining);} this.active = true; } return this; }; this.pause = function() { if(this.active) { this.active = false; this.remaining -= new Date() - this.last; this.clearTimer(); } return this; }; this.stop = function() { this.active = false; this.remaining = this.intervalTime; this.clearTimer(); return this; }; this.toggle = function(reset) { if(this.active) {this.pause();} else if(reset) {this.play(true);} else {this.play();} return this; }; this.reset = function() { this.active = false; this.play(true); return this; }; this.clearTimer = function() { window.clearTimeout(this.timeoutObject); }; this.setTimer = function(time) { var timer = this; if(typeof this.action != 'function') {return;} if(isNaN(time)) {time = this.intervalTime;} this.remaining = time; this.last = new Date(); this.clearTimer(); this.timeoutObject = window.setTimeout(function() {timer.go();}, time); }; this.go = function() { if(this.active) { this.action(); this.setTimer(); } }; if(this.init) { return new $.timer(func, time, autostart); } else { this.set(func, time, autostart); return this; } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.timer.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.primaryNav.js */ (function($) { var settings = { debug: false, animationSpeed: 400, animationEasing: "swing", ajaxResponseContentFilter: ".ajaxable", menuItemSelector: '.primary li', menuItemAnchorSelector: 'a', menuContentSelector: '.ajaxable', appendCloseLink: false, closeOnNonAjaxClick: false, concurrentRequestLimit: 2, perRequestDelay: 100, linkPathRegex: /\/|\.|\?|\=|\&/gi, // Used to clean hashbangs to make them valid data attrs etc... AddressParents: [], ModuleAddress: "", webTrendsCategory: "Component", webTrendsDefaultInteractionType: "TopMenu", itemsPerSubModelRow: 5 // used for convience to identify rows and equalise title heights }; var menuOpen = false; var ajaxContentCache = []; var methods = { init: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { var $this = $(this); var $a = $("a", $this); var open = false; var topLinksLocked = false; // Set height of each nav items and the container $(window).load(function() { $this.height($this.height()); var $firstMenuItem = $(ls.menuItemAnchorSelector, $this).first(); // So we can gets its padding... var anchorYOffset = parseInt($firstMenuItem.css("padding-top"), 10) + parseInt($firstMenuItem.css("padding-bottom"), 10) + parseInt($firstMenuItem.css("margin-top"), 10) + parseInt($firstMenuItem.css("margin-bottom"), 10); $(ls.menuItemAnchorSelector, $this).height($this.height() - anchorYOffset); }); var $inlineMenu = $("
"); $inlineMenu.insertAfter($this); // Functions to change asset on URL change var ChangedOrAddedFunction = function(sections) { if (sections.length > 0) { var $topLevelMenuLink = $this.find("a[data-id^=" + sections[0] + "]").parent(); // find top level link via starts with var $menuContent; // Find the inline menu items, should already be in page as ChangedOrAddedFunction triggered after ajax done $(ls.menuContentSelector, $inlineMenu).each(function() { var $inlineMenuItem = $(this); if ($inlineMenuItem.data("id") == sections.join("/")) { $menuContent = $inlineMenuItem; return false; } }); // Menu content can be null if the deep linked to a second level menu item if ($menuContent == null) { topLinksLocked = false; } else { $topLevelMenuLink.data("current-menu-path", $menuContent.data('id')); // we've found this section so update the current menu path for this top link if (menuOpen) { var $currentOpenMenuLink = $(ls.menuItemSelector + '.active', $this); var $currentOpenMenuItem = $(ls.menuContentSelector + '.active', $inlineMenu); $currentOpenMenuItem.data('height', $currentOpenMenuItem.outerHeight(true)); $menuContent.css('height', 'auto'); if ($topLevelMenuLink.length) { $currentOpenMenuLink.removeClass('active'); } $topLevelMenuLink.addClass('active'); ChangeMenuContent($currentOpenMenuItem, $menuContent); } else { $menuContent.addClass('active').show(); menuOpen = true; $topLevelMenuLink.addClass('active'); $inlineMenu.stop().animate({ "height": $menuContent.data('height') }, ls.animationSpeed, ls.animationEasing, function(evt) { $menuContent.css('height', 'auto'); $inlineMenu.css('height', 'auto'); topLinksLocked = false; }); } } } }; var RemovedFunction = function(sections, addressParentRemoved) { //if (!addressParentRemoved) { menuOpen = false; $inlineMenu.stop().animate({ "height": 0 }, ls.animationSpeed, ls.animationEasing, function(evt) { $(ls.menuContentSelector, $inlineMenu).removeClass('active').hide(); $(ls.menuItemSelector + '.active', $this).removeClass('active'); topLinksLocked = false; }); //} } if (ls.appendCloseLink) { function getCloseButtonRightCSS() { var rTarget = (($(window).width() - 680) / 2); return rTarget >= 0 ? rTarget : 0; } var $closeLink = $(''); $closeLink.css({ "right": getCloseButtonRightCSS() }); $closeLink.bind("click", function(evt) { evt.preventDefault(); $(ls.menuItemSelector + '.active', $this).trigger("click"); }); $(window).resize(function() { $closeLink.css({ "right": getCloseButtonRightCSS() }); }); $inlineMenu.append($closeLink); } // Prevent default while is loading for ajax tabs, add tracking for non ajax links $(ls.menuItemAnchorSelector, $this).bind("click", function(evt) { if (!$(this).hasClass("external")) { evt.preventDefault(); } else { var $externalLink = $(this); return $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': $externalLink.data('id').split('/')[0], 'PageType': $externalLink.data('pagetype'), 'InteractionList': [$externalLink.attr('href')], // Changed to track href instead if name 'InteractionList': [getLinkTitle($externalLink)], additionalData: { eventType: ls.webTrendsDefaultInteractionType, redirectOnTrack: !($externalLink.attr("target") && $externalLink.attr("target") == "_blank"), redirectOnTrackURL: $externalLink.attr('href') } }); } }); // Start menu ajax calls var deferedMenuItems = $this.AjaxMenu(ls); $.each(deferedMenuItems, function(index, value) { var deferedMenuItem = value; deferedMenuItem.done(function($menuContent, isLocal) { if ($menuContent == undefined) { return false; } var $topLevelMenuLink = $(this); var $menuMosaic = $(".cm-mosaic", $menuContent); var $menuItemAchor = $(ls.menuItemAnchorSelector, $topLevelMenuLink); var linkHrefStr = $menuItemAchor.attr("href").replace(ls.linkPathRegex, "").toLowerCase(); // For cache retreval $menuContent.attr('data-link-path', linkHrefStr); ajaxContentCache.push([linkHrefStr]); $topLevelMenuLink.data("current-menu-path", $menuContent.data("id")); // Add the content to the menu $inlineMenu.append($menuContent); // Primary nav specific bindings menuContentBespokeBindings($menuContent); // Bind any modules present in menu $menuContent.each(function(i, item) { if ($(item).data('bindingtypes')) { var bindingGroups = $(item).data('bindingtypes').split(","); $.each(bindingGroups, function(index, value) { if (value.length > 0) { $(item).LexusV10Configuration("moduleBindings", value, $menuItemAchor.data("id")); } }); } }); $menuContent.LexusV10Configuration("commonContentBindings"); // Set height on menu item explicitly $menuContent.css('height', $menuContent.outerHeight(true)); // Persist menu height $menuContent.data('height', $menuContent.outerHeight(true)); $menuContent.hide(); // Bind sub-menus var $ajaxLinks = $('a.ajax', $menuContent); BindAjaxLinks($ajaxLinks, $menuContent, true); // Tracks non-ajax links in top level menu (currently there are none) $('a', $menuContent).not($ajaxLinks).bind("click", function(evt) { // Exclude filter links as there are tracked via the mosaic plugin if (!$(this).hasClass('filter-link')) { var $externalLink = $(this); var linkAnaliticsName = $externalLink.attr('href'); var MenuIDs = $menuContent.data('id').split('/'); var FilterValue = ($menuMosaic.length) ? $menuMosaic.data("analyticsFilterValue") : ""; var InteractionValues = []; $.each(MenuIDs, function(index, value) { if (index > 0) { // ignore first... InteractionValues.push(value); } }); InteractionValues.push(linkAnaliticsName); // returns false if tracking emitter return $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': MenuIDs[0], 'InteractionList': InteractionValues, 'ContentFilter': FilterValue, additionalData: { eventType: ls.webTrendsDefaultInteractionType, redirectOnTrack: !($externalLink.attr("target") && $externalLink.attr("target") == "_blank"), redirectOnTrackURL: $externalLink.attr('href') } }); } }); if (ls.closeOnNonAjaxClick) { var $nonAjaxLinks = $('a', $menuContent).not($ajaxLinks); $nonAjaxLinks.bind("click", function(evt) { $topLevelMenuLink.trigger("click"); }); } // Bind click to top level menu $topLevelMenuLink.bind("click", function(evt) { evt.preventDefault(); if (topLinksLocked) return false; topLinksLocked = true; var MenuIDs = $topLevelMenuLink.data('current-menu-path').split('/'); var FilterValue = ($menuMosaic.length && $topLevelMenuLink.hasClass('active')) ? $menuMosaic.data("analyticsFilterValue") : ""; var InteractionValues = []; $.each(MenuIDs, function(index, value) { if (index > 0) { // ignore first, we just want the sub page ID's, first IT is in PageModuleName... InteractionValues.push(value); } }); // open or switch menu if (!$topLevelMenuLink.hasClass('active')) { // Open the menu using its current-menu-path data atrr $.address.value(ls.AddressParents.join("/") + "/" + $topLevelMenuLink.data("current-menu-path")); InteractionValues.push("Menu opened"); } else { // close menu // Menu will only close via address manager if value is set to /menu/, if its no just call the close FN directly if ($.address.value().indexOf("/" + ls.AddressParents.join("/") + "/") != 0) { RemovedFunction.apply($this, ["", false]); } else { $.address.value(ls.AddressParents.join("/") + "/"); } InteractionValues.push("Menu closed"); } $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': MenuIDs[0], 'InteractionList': InteractionValues, 'ContentFilter': FilterValue, 'additionalData': { eventType: ls.webTrendsDefaultInteractionType } }); }); }); }); // Callback fired when all nav items have finished loading $.when.apply($, deferedMenuItems).done(function() { // Check for deep link for this section... var ModuleCommands = $this.AddressManager('getModulePaths', ls.AddressParents.slice(), [ls.ModuleAddress]); //if (ModuleCommands.length == 1) { ChangedOrAddedFunction(ModuleCommands); //} // Add required callbacks to address manager $this.AddressManager('SetSectionCallback', $.merge(ls.AddressParents.slice(), [ls.ModuleAddress]), ChangedOrAddedFunction, RemovedFunction); }); // Hides menu content blocks so they can be faded in one by one on reveal function HideMenuContentBlocks($menuContent) { var $menuContentBlocks = $('.sub-model-info, .eco-label-content, .item:not(.isotope-hidden)', $menuContent); $menuContentBlocks.ApplyCSSTransitionRules("0", "all", "linear"); $menuContentBlocks.stop().css({ "opacity": 0 }); $menuContentBlocks.ResetCSSTransitionRules(); } // Shows menu items 1by one function ShowMenuContentBlocks($menuContent) { $('.sub-model-info, .eco-label-content, .item:not(.isotope-hidden)', $menuContent).each(function(i) { var $theMenuContentBlock = $(this); var timoutFadeIn = setTimeout(function() { if (Modernizr.csstransitions && $theMenuContentBlock.hasClass('isotope-item')) { $theMenuContentBlock.css({ "opacity": 1 }); } else { $theMenuContentBlock.stop().animate({ "opacity": 1 }, 800, "linear", function(evt) { /* callback */ }); } }, i * 80); }); } function ChangeMenuContent($currentOpenMenuItem, $newMenuItem) { $inlineMenu.css('height', $currentOpenMenuItem.outerHeight(true)); $currentOpenMenuItem.removeClass('active').hide(); HideMenuContentBlocks($newMenuItem); $newMenuItem.addClass('active').css({ "display": "" }); ShowMenuContentBlocks($newMenuItem); // if new items is taller snap to new height - otherwise animate the transition //if ($newMenuItem.outerHeight(true) > $currentOpenMenuItem.outerHeight(true)) { // $inlineMenu.css('height', 'auto'); // topLinksLocked = false; //} else { // Animate to new menu height $inlineMenu.stop().animate({ "height": $newMenuItem.outerHeight(true) }, ls.animationSpeed, ls.animationEasing, function(evt) { $inlineMenu.css('height', 'auto'); topLinksLocked = false; }); //} } function getLinkTitle($theLink) { if ($theLink.data('analytics-name')) { return $theLink.data('analytics-name'); } var $parentItem = $theLink.closest(".item"); var innerText = $.trim($theLink.text()); var contentFound = false; var linkAnaliticsName; // Modified so its its just a plain hyperlink (with no children) return the href... if (!$theLink.children().length) { return $theLink.attr("href"); } if ($theLink.children().length) { linkAnaliticsName = $.trim($('h1, h2, h3, h4, h5, .source', $theLink).first().text()); if (linkAnaliticsName.length > 0) contentFound = true; if ($parentItem.length && !contentFound) { linkAnaliticsName = $.trim($('h1, h2, h3, h4, h5, .source', $parentItem).first().text()) + " - " + linkAnaliticsName; } } if (!contentFound && innerText.length) { linkAnaliticsName = innerText; if ($parentItem.length && innerText.length < 1) { linkAnaliticsName = $.trim($('h1, h2, h3, h4, h5, .source', $parentItem).first().text()) + " - " + linkAnaliticsName; } contentFound = true; } if (!contentFound && $parentItem.length) { linkAnaliticsName = $.trim($('h1, h2, h3, h4, h5, .source', $parentItem).first().text()); } return linkAnaliticsName; } function BindAjaxLinks($linksToBind, $linksMenuItem, isFirstLevel) { $linksToBind.each(function() { var $ajaxLink = $(this); var linkAnaliticsName = getLinkTitle($ajaxLink); var $menuMosaic = $(".cm-mosaic", $linksMenuItem); $ajaxLink.bind("click", function(evt) { evt.preventDefault(); var $currentOpenMenuLink = $(ls.menuItemSelector + '.active ' + ls.menuItemAnchorSelector, $this); // Ajax links are cached a multiple links to the same content are present... var isCached = false; // We dont know the data ID of the menu content yet as the ajax links dont cotain it, so select on cleaned href var ajaxLinkHrefStr = $ajaxLink.attr('href').replace(ls.linkPathRegex, "").toLowerCase(); $(ajaxContentCache).each(function(i) { if (this[i, 0] == ajaxLinkHrefStr) { isCached = true; var $cachedItem = $(ls.menuContentSelector + "[data-link-path=" + ajaxLinkHrefStr + "]", $inlineMenu); // Set data on the top level link to persist which second level section we're in $currentOpenMenuLink.data("active-link-path", ajaxLinkHrefStr); $.address.value(ls.AddressParents.join("/") + "/" + $cachedItem.data("id")); trackAjaxLinkClick($cachedItem); return false; } }); if (!isCached) { $inlineMenu.LoadingOverlay({ iconTypeCSSClass: "loader-dark-bg", "overlayBackgroundColor": "#FFF", "loaderTopOffset": 115 }); var $deferredMenuObject = $ajaxLink.AjaxMenu('loadLink', ls); $deferredMenuObject.done(function($menuContent) { if ($menuContent == undefined) { return false; } // add menu content to page - hide it while bindings $menuContent.css({ "opacity": 0, "position": "absolute" }).insertAfter($linksMenuItem); $menuContent.data("height", $menuContent.height()); // Add href data attr to this element to aid future selection $menuContent.attr("data-link-path", ajaxLinkHrefStr); // Add this item to menu data cache ajaxContentCache.push([ajaxLinkHrefStr]); // Primary nav specific bindings menuContentBespokeBindings($menuContent); // Bind any modules present in menu $menuContent.each(function(i, item) { if ($(item).data('bindingtypes')) { var bindingGroups = $(item).data('bindingtypes').split(","); $.each(bindingGroups, function(index, value) { if (value.length > 0) { $(item).LexusV10Configuration("moduleBindings", value); } }); } }); // Common content bindings $menuContent.LexusV10Configuration("commonContentBindings"); // Bind any further links var $subAjaxLinks = $('a.ajax', $menuContent); BindAjaxLinks($subAjaxLinks, $menuContent, false); // Track clicks on non-ajax links $('a', $menuContent).not($subAjaxLinks).bind("click", function(evt) { if (!$(this).hasClass('filter-link')) { var $externalLink = $(this); var SublinkAnaliticsName = getLinkTitle($(this)); var MenuIDs = $menuContent.data('id').split('/'); var FilterValue = ($menuMosaic.length) ? $menuMosaic.data("analyticsFilterValue") : ""; var InteractionValues = []; $.each(MenuIDs, function(index, value) { if (index > 0) { // ignore first... InteractionValues.push(value); } }); InteractionValues.push(SublinkAnaliticsName); // returns false if tracking emitter return $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': MenuIDs[0], 'InteractionList': InteractionValues, 'ContentFilter': FilterValue, additionalData: { eventType: ls.webTrendsDefaultInteractionType, redirectOnTrack: !($externalLink.attr("target") && $externalLink.attr("target") == "_blank"), redirectOnTrackURL: $externalLink.attr('href') } }); } }); // unhide item $menuContent.css({ "opacity": 1, "position": "" }); // Swap over the content $.address.value(ls.AddressParents.join("/") + "/" + $menuContent.data("id")); trackAjaxLinkClick($menuContent); // Remove loading overlay $inlineMenu.LoadingOverlay('removeLoadingOverlay'); }); } }); // Function to call tracking handler when ajax link clicked function trackAjaxLinkClick($menuContentItem) { // We dont add the menu items ID if its first level var MenuIDs = $menuContentItem.data("id").split('/'); var FilterValue = ($menuMosaic.length) ? "filter-" + $menuMosaic.data("analyticsFilterValue") : ""; InteractionValues = []; $.each(MenuIDs, function(index, value) { if (index > 0) { // ignore first... InteractionValues.push(value); } }); $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': MenuIDs[0], 'InteractionList': InteractionValues, 'ContentFilter': FilterValue, additionalData: { eventType: ls.webTrendsDefaultInteractionType } }); } }); } function menuContentBespokeBindings($menuContent) { // if sub model menu equalise heights of items and titles if ($('.cm-sub-model-menu', $menuContent).length) { var $subModelItems = $('.item ', $menuContent); var minItemHeight = 0; var minTitleHeight = 0; var currentItemGroup = []; var TcRow = 0; // Have to loop through and set titles first and this can impact ovarall item height... $subModelItems.each(function(i) { var $theItem = $(this); currentItemGroup.push($theItem); // push item to array for this row // Check if this is the tallest item & title if ($('h3', $theItem).height() > minTitleHeight) { minTitleHeight = $('h3', $theItem).height(); } // on end of row apply values and reset var checks + row array if (i == ls.itemsPerSubModelRow - 1 || i == $subModelItems.length - 1) { $(currentItemGroup).each(function(i) { $('h3', $(this)).css({ "min-height": minTitleHeight }); }); minTitleHeight = 0; currentItemGroup = []; } }); // Now loop and set overall item height... $subModelItems.each(function(i) { var $theItem = $(this); currentItemGroup.push($theItem); // push item to array for this row // Check if this is the tallest item & title if ($theItem.height() > minItemHeight) { minItemHeight = $theItem.height(); } // on end of row apply values and reset var checks + row array if (i == ls.itemsPerSubModelRow - 1 || i == $subModelItems.length - 1) { $(currentItemGroup).each(function(i) { $(this).css({ "min-height": minItemHeight }); }); minItemHeight = 0; currentItemGroup = []; } }); } } }); }, swappableContent: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { var swapPosition = true; // bool to persist state var $this = $(this); var $toggle = $('.cl-selectors-toggle', $this); var $sliders = $('.thumb-specs-inner', $this); var filterName = "images"; $toggle.SelectorsToggle().on("ToggleChange", function(event, selectedItem) { if (swapPosition) { swapPosition = false; $sliders.stop().animate({ "left": -225 }, 300, "linear", function(evt) { /* Callback */ }); filterName = "specs"; } else { swapPosition = true; $sliders.stop().animate({ "left": 0 }, 300, "linear", function(evt) { /* Callback */ }); filterName = "images"; } $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': ls.AddressParents[0], 'ContentFilter': filterName, additionalData: { eventType: "FilterInteraction" } }); }); }); } }; $.fn.primaryNav = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.primaryNav'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.primaryNav.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.ajaxMenu.js */ (function($) { // global settings var settings = { debug: false, preloadAjaxImages: true, indexPageName: /index.tmex|index.htm|index.html/gi, // regex or string itemLoadingClass: 'loading', itemLoadedClass: 'loaded', itemLoadFailedClass: 'failed', ajaxResponseContentFilter: '.ajax', menuItemSelector: 'li', menuItemAnchorSelector: 'a', concurrentRequestLimit: 5, storeResponseData: false, menuContentDataKey: 'content', deferredObjectContextKey: 'context', deferredObjectDataKey: 'data', anchorContext: false, ignoreAnchorClass: "external", ajaxRequestQueryStringID: "ajax=true", perRequestDelay: 2500 // artificial delay to help with local testing }; var methods = { defaultMethod: function(options) { var ls = $.extend({}, settings, options); // local settings var $menuContainer = $(this); var $tabsToLoad = []; var deferredObjectArray = []; // Loop through each menu item, create deferred objects for each menu item $(ls.menuItemSelector, $menuContainer).each(function(val, i) { var $theTab = $(this); // Ignore if tab has no href if ($(ls.menuItemAnchorSelector, $theTab).attr('href') === undefined) return; else if ($(ls.menuItemAnchorSelector, $theTab).hasClass(ls.ignoreAnchorClass)) return; if (ls.debug) { console.log('Loading section: ' + $('a', $theTab).data('id')); } // Create a deferred object to be returned var deferredMenuObject = $.Deferred(); deferredMenuObject[ls.deferredObjectContextKey] = $theTab; // Check if link is for a different page to the current if ($(ls.menuItemAnchorSelector, deferredMenuObject[ls.deferredObjectContextKey]).attr('href').toLowerCase().replace(ls.indexPageName, "") != window.location.pathname.toLowerCase().replace(ls.indexPageName, "")) { if ($(ls.menuItemAnchorSelector, deferredMenuObject[ls.deferredObjectContextKey]).length) { // Add class so CSS can apply a loading state to the tab deferredMenuObject[ls.deferredObjectContextKey].addClass(ls.itemLoadingClass); // add an extra property to track which requets have been started deferredMenuObject.AjaxRequestStarted = false; } // if link is for current page select content from $doc and trigger done event } else { // Filter content from this page var $tabContent = $(ls.ajaxResponseContentFilter, $(document)); // Add data to this tab if (ls.storeResponseData) deferredMenuObject[ls.deferredObjectContextKey].data(ls.menuContentDataKey, $tabContent); // Set ajax request as started so this item is ignored for ajax requests deferredMenuObject.AjaxRequestStarted = true; // Assign loaded class deferredMenuObject[ls.deferredObjectContextKey].addClass(ls.itemLoadedClass); // Resolve the object immediatly deferredMenuObject.resolveWith(deferredMenuObject[ls.deferredObjectContextKey], [$tabContent, true]); } deferredObjectArray.push(deferredMenuObject); }); // Fire of initial ajax requests, respecting the concurrentRequestLimit var startedRequests = 0; $.each(deferredObjectArray, function(index, value) { // Get handle to specific object var thisDeferedObject = value; if (startedRequests == ls.concurrentRequestLimit || startedRequests == deferredObjectArray.length) return false; // end loop if we've started enough (or all!) requests // Ensure this request is not already done (e.g. the defualt page) if (!value.AjaxRequestStarted) { // Increment requests count startedRequests++; // Mark object as started thisDeferedObject.AjaxRequestStarted = true; // Wrapped in a function allow delay var startRequests = setTimeout(function() { // Start request var deferredReq = methods.loadTab.apply(thisDeferedObject[ls.deferredObjectContextKey], [ls]); deferredReq.done(function($menuContent) { // On request complete resolve with context the menu item deferred object thisDeferedObject.resolveWith(thisDeferedObject[ls.deferredObjectContextKey], [$menuContent, false]); ContinueLoading(); }); }, (ls.perRequestDelay * (index + 1))); } }); function ContinueLoading() { // Check if there are more tabs to be loaded var nextDeferredObject = null; $.each(deferredObjectArray, function(index, value) { //alert(value.AjaxRequestStarted); if (!value.AjaxRequestStarted) { nextDeferredObject = value; return false; // exit loop } }); if (nextDeferredObject != null) { // Load next tab nextDeferredObject.AjaxRequestStarted = true; var startRequests = setTimeout(function() { // Start request var deferredReq = methods.loadTab.apply(nextDeferredObject[ls.deferredObjectContextKey], [ls]); deferredReq.done(function($menuContent) { nextDeferredObject.resolveWith(nextDeferredObject[ls.deferredObjectContextKey], [$menuContent, false]); ContinueLoading(); }); }, ls.perRequestDelay); } } return deferredObjectArray; }, loadLink: function(options) { var ls = $.extend({}, settings, options); // local settings ls.anchorContext = true; return methods.loadTab.apply(this, [ls]); }, loadTab: function(options) { var ls = $.extend({}, settings, options); // local settings // Create a deferd object to be returned var defferedMenuObject = $.Deferred(); var callContext = { $theTab: $(this) // Context to track tab being loaded }; var urlToLoad = $(ls.menuItemAnchorSelector, callContext.$theTab).attr('href'); if (ls.anchorContext) { urlToLoad = callContext.$theTab.attr('href'); } if (urlToLoad.indexOf("?") >= 0) { urlToLoad += ("&" + ls.ajaxRequestQueryStringID) + "&request_src=" + window.location.pathname.toLowerCase().replace(ls.indexPageName, ""); } else { urlToLoad += ("?" + ls.ajaxRequestQueryStringID) + "&request_src=" + window.location.pathname.toLowerCase().replace(ls.indexPageName, ""); } if (ls.debug) { console.log("loadTab, urlToLoad: " + urlToLoad); } $.ajax({ url: urlToLoad, dataType: 'html', context: callContext, success: function(data) { // Filter the ajax response var $filteredResponse = $(ls.ajaxResponseContentFilter, data); // Store the filtered return data against the tab if required if (ls.storeResponseData) { callContext.$theTab.data(ls.menuContentDataKey, $filteredResponse) } // Set CSS classes to indicate loaded status and then trigger load event callContext.$theTab.removeClass(ls.itemLoadingClass).addClass(ls.itemLoadedClass); // Should we pre-load images? if (ls.preloadAjaxImages) { var $imagesToLoad = $('img[src]', $filteredResponse); if ($imagesToLoad.length > 0) { var iImagesLoaded = 0; function checkIfAllImagesLoaded() { if (iImagesLoaded == $imagesToLoad.length) { resolveObject(defferedMenuObject, $filteredResponse); } } $imagesToLoad.each(function(i, val) { $(this).load(function() { iImagesLoaded++; checkIfAllImagesLoaded(); }).error(function() { iImagesLoaded++; checkIfAllImagesLoaded(); }); $(this).load(); }); } else { resolveObject(defferedMenuObject, $filteredResponse); } } else { resolveObject(defferedMenuObject, $filteredResponse); } }, error: function(xhr, ajaxOptions, thrownError) { if (ls.debug) { console.log("AjaxMenu Error, " + xhr.status + " " + thrownError); } // remove loading class and add failed class callContext.$theTab.removeClass(ls.itemLoadingClass).addClass(ls.itemLoadFailedClass); // Resolve return object, despite it failing, failed case defalt with above defferedMenuObject.resolve(); } }); // Resolve returned object function resolveObject(dObj, $context) { if (ls.anchorContext) { var resolveWithDelay = setTimeout(function() { dObj.resolve($context); }, ls.perRequestDelay); } else { dObj.resolve($context); } } return defferedMenuObject.promise(); }, getAllTabsData: function() { var $menuContainer = $(this); var tabDataCollection = []; $(ls.menuItemSelector, $menuContainer).each(function(val, i) { tabDataCollection.push($(this).data(ls.menuContentDataKey)); }); return $(tabDataCollection); } }; $.fn.AjaxMenu = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.defaultMethod.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.plugin'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.ajaxMenu.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.footerSlide.js */ (function($) { // global settings var settings = { translations: {} }; var methods = { init: function(options) { return this.each(function() { var ls = $.extend({}, settings, options); // local settings var $this = $(this); $(".submodel-header", $this).css({ "cursor": "pointer" }).toggle(function() { var $a = $('a', $(this)); $a.addClass("open").text(ls.translations.ShowSubModels).blur(); $("ul", $this).slideUp(); }, function() { var $a = $('a', $(this)); $a.removeClass("open").text(ls.translations.HideSubModels).blur(); $("ul", $this).slideDown(); }); }); } }; $.fn.footerSlide = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.footerSlide'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.footerSlide.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.loadingOverlay.js */ (function($) { // global settings var settings = { isDebug: false, loadEffectCSSClass: "cl-loadeffect", loadingText: "Loading", overlayOppacity: 0.65, maskElement: true, iconOnly: true, iconTypeCSSClass: "", overlayBackgroundColor: "", loaderTopOffset: 'auto', // auto, or an int loaderRightOffset: 'auto', // auto, or an int loaderBottomOffset: 'auto', // auto, or an int loaderLeftOffset: 'auto', // auto, or an int darkStyle : false }; var loadingTimer, loadingIntervalActive = false, loadingFrame = 1; var methods = { init: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { $this = $(this); $elementToMask = $(this); // Is the loading text the plugin default - if so try to get from the translate data if (ls.loadingText == settings.loadingText) { // Needs refactoring as can be used on sites where LexusV10Configuration does not exist try { var translations = $this.LexusV10Configuration('getTranslateData'); if (translations["LoadingContent"]) { ls.loadingText = translations["LoadingContent"]; } } catch (err) { } } var $backgroundDiv = $('
'); if (ls.overlayBackgroundColor.length > 0) { $backgroundDiv.css({ "background-color": ls.overlayBackgroundColor }); } var $updateProgressDiv = $('
'); var $IconContainer = $('
'); var $IconSprite = $('
'); var $messageContainer $IconSprite.addClass(ls.iconTypeCSSClass); $updateProgressDiv.append($IconContainer.append($IconSprite)); if (!ls.iconOnly) { $messageContainer = $('

' + ls.loadingText + '...

') $updateProgressDiv.append($messageContainer).addClass('withcontent'); } // Searchs for an element within the '$this' with a class of loadEffectCSSClass (default "loadeffect") // Applys loading overlay to that div if found, otherwise applies to '$this' itself (legacy code for another project if ($('.' + ls.loadEffectCSSClass, $this).length) { $elementToMask = $('.' + ls.loadEffectCSSClass, $this); } else { $elementToMask.addClass(ls.loadEffectCSSClass).addClass('cl-removeLFClass'); } // By default the CSS will center loader, can be overridden if (ls.loaderTopOffset != 'auto') { $updateProgressDiv.css({ "top": ls.loaderTopOffset + "px", "margin-top": 0 }); } if (ls.loaderRightOffset != 'auto') { $updateProgressDiv.css({ "right": ls.loaderRightOffset + "px", "left": "auto" }); } if (ls.loaderBottomOffset != 'auto') { $updateProgressDiv.css({ "bottom": ls.loaderBottomOffset + "px", "top": "", "margin-bottom": "" }); } if (ls.loaderLeftOffset != 'auto') { $updateProgressDiv.css({ "left": ls.loaderLeftOffset + "px", "margin-top": 0 }); } // Switch mode based on settings, dont apply mask if icon only is true if (ls.maskElement) { // Apply styles to mask $backgroundDiv.css({ "opacity": ls.overlayOppacity, "height": $elementToMask.outerHeight(), "width": $elementToMask.outerWidth() }); // Insert load mask and spinner $elementToMask.prepend($updateProgressDiv).prepend($backgroundDiv); } else { // Insert spinner $elementToMask.prepend($updateProgressDiv); } if ( ls.darkStyle ) { $IconContainer.add($messageContainer).css("background-color", "#474747") $messageContainer.find("p").css("color", "#fff") } // spin up the spinner if its not already running for another elements if (!loadingIntervalActive) { loadingIntervalActive = true; loadingTimer = setInterval(function() { animatedLoading(); }, 66); } function animatedLoading() { // Selects and updates all loaders on page var $loadIcons = $('.cl-updateProgressLoader .iconContainer .iconSprite'); if ($loadIcons.length) { $loadIcons.css('background-position', '0 ' + (loadingFrame * -40) + 'px'); loadingFrame = (loadingFrame + 1) % 12; } else { //loadingIntervalActive = false; //clearInterval(loadingTimer); } } }); }, removeLoadingOverlay: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { $this = $(this); // Remove all the inserted elements $('.tidyAfterLoad', $this).remove(); // Remove all loading applied classes $('.cl-removeLFClass', $this).removeClass('cl-removeLFClass').removeClass(ls.loadEffectCSSClass); $this.removeClass('cl-removeLFClass').removeClass(ls.loadEffectCSSClass); // Clear the interval if no more loaders present in the whole page if ($('.tidyAfterLoad').length < 1) { loadingIntervalActive = false; clearInterval(loadingTimer); } }); }, preloadIcon: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { $dummyElement = $('
').hide(); $('body').append($dummyElement); methods.init.apply($dummyElement, [ls]); //var imagePath = $('.iconSprite', $dummyElement).css('background-*i*mage'); //alert(imagePath); methods.removeLoadingOverlay.apply($(this), [ls]); $dummyElement.remove(); }); } } $.fn.LoadingOverlay = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.plugin'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.loadingOverlay.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.secondaryNav.js */ (function($) { var originalPos = 0; var settings = { debug: false, noNavMode: false, headers: "", ajaxContent: true, contentAppendSelector: "#main", menuScrollToOffset: 0, menuLoadDelay: 200, scrollSpeed: 500, sectionScrollAnaliticsDelay: 2000, // msec, Time a user must be in a section before scroll analytics triggered footerID: "Footer", footerSelector: ".cf-footer", headerID: "Introduction", headerSelector: ".ch-header", webTrendsCategory: "Component", webTrendsDefaultInteractionType: "Navigation" }; var systemIsScrolling = false; var contentLoading = false; var userHasScolled = false; var ajaxCallsStarted = false; // Timer for 2 second delay on analitics scroll to and required analitics vars var timer; var lastSectionLogged = ""; var CurrentSectionID = "Introduction"; var userChosenSectionID = ""; // Timer to unlock 'systemIsScrolling' after scroll complete var unlockTimer; // Placeholder template for sections while ajax in progress.. var $ContentPlaceholderTemplate = $('
').append( $('
').append( $('
').append( $('

') ) ) ).append( $('
') ); var methods = { init: function(options) { return this.each(function(i) { var ls = $.extend({}, settings, options); var $this = $(this); $(window).scroll(function(e) { if (!userHasScolled) { if (!systemIsScrolling) { userHasScolled = true; } } }); var $moreContainer; var $moreLink; var $a = $("a", $this); if (!ls.noNavMode) { var $navLogoContainer = $('.cs-nav-intrologo', $this); var $topLinkContainer = $('.cs-nav-toplink', $this); var $topLink = $('.cs-nav-toplink a', $this); var $navLogoAnchor = $('a', $navLogoContainer); var $mlinks = $('li[data-more="true"]', $this); var $moreLinks = $mlinks.clone(true); $mlinks.hide(); $topLinkContainer.css({ "top": -50 }); $topLinkContainer.ApplyCSSTransitionRules("0.3", "top", "linear"); $topLink.ApplyCSSTransitionRules("0.3", "color", "linear"); var navIsFixed = false; // Switch view changed and nav around to fit on screen if required... var $viewSwitcher = $('.cl-view-switcher'); if ($viewSwitcher.length) { var secNavCuttOff = $this.position().top + $this.outerHeight(); var vpH = $(window).height(); var isSecondaryNavHidden = secNavCuttOff > vpH; if (isSecondaryNavHidden) { $viewSwitcher.insertAfter($this); } } originalPos = $('.inner-container', $this).position().top; posAfter = originalPos + ($this.height()); // Create placeholder to maintain page height when nav goes fixed var $navPlaceholder = $('
'); $navPlaceholder.hide().css({ 'height': $this.outerHeight(), 'margin-top': $this.css('margin-top'), 'margin-bottom': $this.css('margin-bottom'), 'width': '100%' }); $navPlaceholder.insertAfter($this); $(window).scroll(function(e) { CheckNavPos(); }); CheckNavPos(); if ($moreLinks.length) { var moreTranslation = "More"; if ($(document).LexusV10Configuration("getTranslateData").More != undefined) { moreTranslation = $(document).LexusV10Configuration("getTranslateData").More; } $("li:last", $this).after("
  • " + moreTranslation + "
    ...
  • "); $this.after("
      "); $moreContainer = $(".cs-secondary-nav-more"); $moreLink = $this.find("a.more"); $moreContainer.css({ "left": $moreLink.offset().left }); var moreVisible = false; var hovered = false; $moreContainer.hover(function() { hovered = true; }, function() { hovered = false; if ($moreContainer.is(":visible")) { $moreContainer.slideUp("fast"); } }); $this.hover(function() { }, function() { setTimeout(function() { if ($moreContainer.is(":visible") && !hovered) { $moreContainer.slideUp("fast"); } }, 200) }); $moreLink.click(function() { if ($moreContainer.is(":visible")) { $moreContainer.slideUp("fast"); } else { $moreContainer.slideDown("fast"); if (!navIsFixed) { $moreContainer.css({ "top": $moreLink.offset().top + 53, "position": "absolute", "left": $moreLink.offset().left }); } else { $moreContainer.css({ "top": 53, "position": "fixed", "left": $moreLink.offset().left }); } } return false; }); $moreContainer.find("ul").append($moreLinks); $a = $a.add($moreContainer.find("a")); } } function CheckNavPos() { var scrollTop = $(window).scrollTop(); if (ls.debug) { console.log("CheckNavPos, scrollTop: " + scrollTop + " originalPos: " + originalPos); } // Update the nav position to account for primary nav opening etc... if (!navIsFixed) { originalPos = $('.inner-container', $this).position().top; } if ((scrollTop >= originalPos) && !navIsFixed) { navIsFixed = true; $this.addClass("fixed"); $navPlaceholder.show(); $this.removeAttr('style'); fadeInLogo(); $topLinkContainer.css({ "top": "0" }); if ($moreContainer != undefined) { $moreContainer.css({ "top": 53, "position": "fixed" }); if ($moreContainer.is(":visible")) { $moreContainer.slideUp("fast"); } } } else if (scrollTop < originalPos && navIsFixed) { navIsFixed = false; $this.removeAttr('style'); $this.removeClass("fixed"); $navPlaceholder.hide(); fadeOutLogo(); $topLinkContainer.css({ "top": "-50px" }); if ($moreContainer != undefined) { $moreContainer.css({ "top": $moreLink.offset().top + 53, "position": "absolute" }); if ($moreContainer.is(":visible")) { $moreContainer.slideUp("fast"); } } } } function fadeInLogo() { if (navIsFixed) { $navLogoContainer.animate({ "width": 155 }, 'fast', function() { $navLogoAnchor.fadeIn('fast'); }); } } function fadeOutLogo() { if (!navIsFixed) { $navLogoAnchor.fadeOut('fast', function() { $navLogoContainer.animate({ "width": 0 }, 'fast'); }); } } $a.each(function() { var $anchor = $(this); var SectionID = $anchor.attr('data-id'); var ScrollToMenuFunction = function(navigationValue, isPageLoad) { if (ls.debug) { console.log("Address manager root section function called, navigationValue: " + navigationValue + " systemIsScrolling: " + systemIsScrolling + " contentLoading: " + contentLoading); } // If page load record WT deep linking call... if (isPageLoad) { userChosenSectionID = navigationValue; var dealayForSmoothScroll = setTimeout(function() { $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': navigationValue, 'NavigatedMethodType': 'Deep Linked', 'NavigatedSectionName': navigationValue, additionalData: { eventType: 'PageLoad' } }); }, ls.scrollSpeed); } CurrentSectionID = navigationValue; if (!systemIsScrolling) { methods.scrollToSection.apply($this, [navigationValue, null, null, ls]); } }; $(window).AddressManager('addRootSection', SectionID, ScrollToMenuFunction); // animate to section on click $anchor.click(function(evt) { evt.preventDefault(); userHasScolled = true; if ($moreContainer != undefined && $moreContainer.is(":visible") && !$anchor.parent().data("more")) { $moreContainer.slideUp("fast"); } if (!systemIsScrolling) { var $thisLink = $(this); userChosenSectionID = SectionID; CurrentSectionID = SectionID; // If allready set to this section just scroll to it if ($.address.value().indexOf(SectionID) == 1) { //ScrollToMenuFunction.call(); $.address.value(SectionID); methods.scrollToSection.apply($this, [SectionID, null, null, ls]); // Otherwise set the address and let load manager take care of it } else { $.address.value(SectionID); } var dealayForSmoothScroll = setTimeout(function() { $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': $thisLink.attr('data-id'), 'NavigatedMethodType': 'Clicked', 'NavigatedSectionName': $thisLink.attr('data-id'), additionalData: { eventType: ls.webTrendsDefaultInteractionType } }); }, ls.scrollSpeed); } }); }); // remove any menu items which require flash if flash not enabled if (!Modernizr.flash) { $('.flash-content-link', $this).parent().remove(); } // Ajax in menu content... if (ls.ajaxContent) { // Create placeholder section for each ajaxable menu item var $ajaxLinks = $("a.ajax-load", $this); $ajaxLinks.each(function() { $ajaxLink = $(this); $placeholder = $ContentPlaceholderTemplate.clone(); $placeholder.attr('data-id', $ajaxLink.attr('data-id')); $('h2', $placeholder).text($ajaxLink.attr('data-placeholder-title')); var $contentBlockPH = $('.article-inner', $placeholder); $contentBlockPH.css('height', ($ajaxLink.attr('data-placeholder-height'))); // Add the placeholder to the page $(ls.contentAppendSelector).append($placeholder); // Apply loading overlay $contentBlockPH.LoadingOverlay({ iconOnly: false, loadingText: ls.translations.LoadingContent, loaderTopOffset: 100 }); }); function checkVisibleSections() { // add visible class to (the nav links of) sections that are within the viewport var clientScrollY = $(window).scrollTop(); var clientViewHeight = $(window).height(); var clientLowerViewY = clientScrollY + clientViewHeight; $('.ca-section.placeholder').each(function() { var $this = $(this); var sectionID = $this.data('id'); var sectionTop = $this.position().top; // if the section falls within the current view if (sectionTop > clientScrollY && sectionTop <= clientLowerViewY) { $('.cs-secondary-nav a.ajax-load[data-id="' + sectionID + '"]').addClass('visible'); } }); } function startCurrentAjaxCall() { if (ls.debug) { console.log('Loading current section'); } var dlSection = $.address.value().replace("/", ""); startAjaxCalls('a.ajax-load[data-id="' + dlSection + '"], a.ajax-load.visible', false); } function startVisibleAjaxCalls() { if (ls.debug) { console.log('Loading visible sections'); } startAjaxCalls('a.ajax-load.visible', false); } function startAllAjaxCalls() { if (ls.debug) { onsole.log('Loading remaining sections'); } startAjaxCalls('a.ajax-load', true); } function startAjaxCalls(anchorSelector, scroll) { contentLoading = true; var deferedMenuItems = $this.AjaxMenu({ ajaxResponseContentFilter: '.ajaxable', menuItemSelector: 'li:not(.loaded, .loading)', menuItemAnchorSelector: anchorSelector, concurrentRequestLimit: 2, perRequestDelay: ls.menuLoadDelay }); var insertionInProgress = false; // Loop thorugh all items and bind done events... $.each(deferedMenuItems, function(index, value) { var deferedMenuItem = value; deferedMenuItem.done(function($menuContent, isLocal) { // get the data ID from the a inside this li var $MenuListItem = $(this); var $MenuLink = $('a', $(this)); var menuID = $MenuLink.attr("data-id"); if (ls.debug) { console.log("systemIsScrolling: " + systemIsScrolling + " insertionInProgress: " + insertionInProgress); } if (!systemIsScrolling && !insertionInProgress) { insertContent(); } else { var waitForScrollToComplete = setInterval(function() { if (ls.debug) { console.log("waitForScrollToComplete, systemIsScrolling: " + systemIsScrolling + " insertionInProgress: " + insertionInProgress); } if (!systemIsScrolling && !insertionInProgress) { insertContent(); clearInterval(waitForScrollToComplete); } }, ls.scrollSpeed); } function insertContent() { insertionInProgress = true; // Select the placeholder var $placeHolder = $(ls.headers + "[data-id=" + menuID + "]"); // Store page height to check after menu content inserted... var pageHeight = $(document).outerHeight(true); var scrollPosition = $(window).scrollTop(); if (!$menuContent) { console.log("Menu ID: " + menuID + " returned no content, removing placeholder and menu item"); $MenuListItem.remove(); $placeHolder.remove(); insertionInProgress = false; } // Remove loading icon front placeholder $placeHolder.LoadingOverlay('removeLoadingOverlay'); $placeHolder.after($menuContent); $placeHolder.remove(); // Bind specific modules $menuContent.each(function(i, item) { if ($(item).data('bindingtypes')) { var bindingGroups = $(item).data('bindingtypes').split(","); $.each(bindingGroups, function(index, value) { if (value.length > 0) { $(item).LexusV10Configuration("moduleBindings", value, menuID); } }); } }); // Bind generic modules $menuContent.LexusV10Configuration("commonContentBindings", menuID); // Get different of height now content is inserted and bound... var newContentHeight = $(document).outerHeight(true) - pageHeight; var adjustScrollPos = false; var $header; if (userChosenSectionID != "" && !userHasScolled) { $header = $(ls.headers + "[data-id=" + userChosenSectionID + "]"); if ($header.length) adjustScrollPos = true; } else { $header = $(ls.headers + "[data-id=" + CurrentSectionID + "]"); if ($header.length) adjustScrollPos = true; } if (adjustScrollPos) { systemIsScrolling = true; if (ls.debug) { console.log("Scroll Adjust info: menuID: " + menuID + " newContentHeight: " + newContentHeight + " $menuContent.height(): " + $menuContent.height() + " $header.index(): " + $header.index() + " $menuContent.index(): " + $menuContent.index()); } // If the user hasnt scroll jump them to their chosen section start if (!userHasScolled) { var newScroll = $header.position().top - ls.menuScrollToOffset; if (ls.debug) { console.log("User not scrolled: setting scrolltop to: " + newScroll); } window.scroll(0, newScroll); } else { // User has scroll so adjust their scroll position based on the difference between the // placeholder height and the ajaxed content height if ($menuContent.index() < $header.index()) { var newScroll = scrollPosition + newContentHeight; if (ls.debug) { console.log("User has scrolled: setting scrolltop to: " + newScroll); } window.scroll(0, newScroll); } } systemIsScrolling = false; } $(window).trigger("AjaxContentInserted", [$menuContent, menuID]); insertionInProgress = false; // unless we've just loaded all the sections, re-check what is visible if (!ajaxCallsStarted) { checkVisibleSections(); startVisibleAjaxCalls(); } } }); }); // Callback fired when all nav items have finished loading $.when.apply($, deferedMenuItems).done( function() { contentLoading = false; if (scroll) { $(window).trigger("scroll"); } //systemIsScrolling = false; //clearTimeout(unlockTimer); } ); } // Start menu ajax calls checkVisibleSections(); startCurrentAjaxCall(); $(window).scroll(function(e) { if (userHasScolled && !contentLoading && !ajaxCallsStarted) { ajaxCallsStarted = true; startCurrentAjaxCall(); startAllAjaxCalls(); } }); } // bind the event to the headers - exclude search, as it prevents introduction being detected $.activeSection(ls.headers + '[data-id!="Search"]'); // handle the event and pass it through to the secondaryNav $(window).activeSection(function(e, id) { if (id == CurrentSectionID) return false; if (ls.debug) { console.log("activeSection info: active section event event fired, id: " + id + " systemIsScrolling: " + systemIsScrolling + " contentLoading: " + contentLoading + " CurrentSectionID: " + CurrentSectionID + " lastSectionLogged: " + lastSectionLogged); } if (userHasScolled) { CurrentSectionID = id; methods.setSection.apply($this, [id, false]); clearTimeout(timer); if (id != lastSectionLogged) { lastActiveSection = id; timer = setTimeout(function() { if (id == CurrentSectionID) { if (id != undefined) { lastSectionLogged = id; $this.AddressManager("silentUpdate", id); // Dont track scroll section scroll if only 1 section (but always track footer scroll regardless) if ($(ls.headers).length > 1 || id == ls.footerID) { $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': id, 'NavigatedMethodType': 'Scrolled', 'NavigatedSectionName': id, additionalData: { eventType: ls.webTrendsDefaultInteractionType } }); } } } }, ls.sectionScrollAnaliticsDelay); } } else { methods.setSection.apply($this, [id, false]); } }); // Bind any top links already present methods.BindBackToTopLinks.apply($this, [ls]); }); }, setSection: function(id, overrideLock) { if (settings.debug) { console.log("setSection, systemIsScrolling: " + systemIsScrolling); } if (!systemIsScrolling || overrideLock) { var $this = $(this); var $a = $("a", $this); var $li = $("li", $this); $moreContainer = $(".cs-secondary-nav-more"); if ($moreContainer.length > 0) { $a = $a.add($moreContainer.find("a")); $li = $li.add($moreContainer.find("li")); } $a.removeClass("current"); $li.removeClass("current"); var $current = $this.find("a[data-id=" + id + "]").first(); if ($moreContainer.length > 0) { var $moreLink = $this.find("a.more"); var $moreCurrent = $moreContainer.find("a[data-id=" + id + "]").first(); if ($moreCurrent.length > 0) { $current = $moreCurrent; $moreLink.addClass("current").parent().addClass("current"); var $moreArrow = $('.arrow-sprite', $moreLink); if ($moreArrow.length == 0) { $moreLink.append(""); } } } if ($current.length) { var $currentLi = $current.parent('li'); $current.addClass("current"); $currentLi.addClass("current"); } } }, bindInPageLink: function(options) { var ls = $.extend({}, settings, options); return this.each(function() { var $autoBindElement = $(this); if ($autoBindElement.data('id')) { $autoBindElement.click(function(evt) { evt.preventDefault(); methods.scrollToSection.apply($('.cs-secondary-nav'), [$autoBindElement.data('id'), null, null, ls]); }); } else if ($autoBindElement.attr('href').indexOf('#') >= 0) { $autoBindElement.click(function(evt) { evt.preventDefault(); var SectionID = $autoBindElement.attr('href').substring(1); if ($.address.value().indexOf(SectionID) == 1) { methods.scrollToSection.apply($('.cs-secondary-nav'), [SectionID, null, null, ls]); // Otherwise set the address and let load manager take care of it } else { $.address.value("/" + SectionID); } }); } }); }, scrollToSection: function(SectionID, overrideScrollTo, callBackFN, options) { var ls = $.extend({}, settings, options); var $this = $(this); return this.each(function(i) { systemIsScrolling = true; clearTimeout(unlockTimer); CurrentSectionID = SectionID; lastSectionLogged = SectionID; var $header; if (SectionID == ls.headerID) { $header = $(ls.headerSelector); } else if (SectionID == ls.footerID) { $header = $(ls.footerSelector); } else { $header = $(ls.headers + "[data-id=" + SectionID + "]"); } methods.setSection.apply(this, [SectionID, true]); if (ls.debug) { console.log('scrollToSection called, found header section: ' + ($header.length > 0) + ' SectionID: ' + SectionID) } var callBackRecieved = false; var $animElem = $("html:not(:animated),body:not(:animated)"); if (($header.length > 0 || overrideScrollTo) && $animElem.length > 0) { var top = $header.position().top - ls.menuScrollToOffset; if (overrideScrollTo > 0) top = overrideScrollTo; $animElem.animate({ scrollTop: top }, settings.scrollSpeed, "swing", function(evt) { if (!callBackRecieved) { callBackRecieved = true; if (!overrideScrollTo) top = $header.position().top - ls.menuScrollToOffset; if (ls.debug) { console.log("Scroll complete, snapping to top: " + top); } unlockTimer = setTimeout(function() { systemIsScrolling = false; }, 25); // FIX FOR IPAD POSTION FIXED BUG - http://stackoverflow.com/questions/8752220/mobile-safari-bug-on-fixed-positioned-button-after-scrolltop-programmatically-ch $this.css({ "position": "relative" }); window.scroll(0, top); $this.css({ "position": "" }); if (typeof callBackFN === 'function') { callBackFN.apply(this); } } }); } else { systemIsScrolling = false; } }); }, BindBackToTopLinks: function(options) { return this.each(function(i) { var ls = $.extend({}, settings, options); var $this = $(this); $('.top-link', $this).click(function(evt) { var $topLink = $(this); var topLinkSectionID = $topLink.parents("section.ca-section").length ? $topLink.parents("section.ca-section").first().data("id") : CurrentSectionID; if (!topLinkSectionID) topLinkSectionID = CurrentSectionID; $.analyticsEmitter.trackEvent({ 'ModuleCategory': ls.webTrendsCategory, 'PageModuleName': CurrentSectionID, 'NavigatedMethodType': 'Back to top', 'NavigatedSectionName': CurrentSectionID, additionalData: { eventType: ls.webTrendsDefaultInteractionType } }); evt.preventDefault(); if ($.address.value() == ("/Introduction")) { $("html,body").stop().animate({ scrollTop: 0 }, settings.scrollSpeed, "swing", function(evt) { systemIsScrolling = false; }); } else { $.address.value("Introduction"); } }); }); }, GetActiveSectionID: function() { return CurrentSectionID; } }; $.fn.secondaryNav = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.secondaryNav'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.secondaryNav.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.activeSection.js */ (function($) { var settings = { debug: false, footerID: "Footer", headerID: "Introduction" }; // Create custom event to be bound/triggered $.fn["activeSection"] = function(fn) { return fn ? this.bind("activeSection", fn) : this.trigger("activeSection"); }; $.activeSection = function(selector) { var lastIDTriggered = settings.headerID; $(window).scroll(function(e) { foundId = null; var scrollTop = $(window).scrollTop(); var $this = $(selector); if (scrollTop > 100) { // Footer checks var footerInView = false; var $theFooter = $('.cf-footer'); // Is the footer more than 50% in view? if (scrollTop + ($(window).height() / 2) >= $theFooter.position().top) { footerInView = true; foundId = settings.footerID; // Or are we within 20px of the page bottom? } else if (scrollTop + $(window).height() >= $(document).height() - 20) { footerInView = true; foundId = settings.footerID; } if (settings.debug) { console.log("scrollTop: " + scrollTop + " $this.first().position().top: " + $this.first().position().top); } // introduction checks var introInView = false; if (scrollTop <= $this.first().position().top - 40) { introInView = true; foundId = settings.headerID; } if (settings.debug) { console.log("introInView: " + introInView + " footerInView " + footerInView); } if (!footerInView && !introInView) { $this.each(function(i, el) { var $el = $(el); if ($el.attr('data-id') && $el.attr('data-id') != "") { if (settings.debug) { console.log("$el.text(): " + $el.attr('data-id') + " $(window).scrollTop(): " + $(window).scrollTop().toString() + " $el.position().top - 40: " + ($el.position().top - 40).toString()); } //if (i == 0 && $(window).scrollTop() < $el.position().top) { // //return true; //} if (scrollTop >= $el.position().top - 80) { foundId = $el.data("id"); return true; } } }); } if (typeof foundId === undefined) { foundId = settings.headerID; } $(window).trigger("activeSection", foundId); } }); }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.activeSection.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.colorbox.js */ // ColorBox v1.3.19 - jQuery lightbox plugin // (c) 2011 Jack Moore - jacklmoore.com // License: http://www.opensource.org/licenses/mit-license.php (function($, document, window) { var // Default settings object. // See http://jacklmoore.com/colorbox for details. defaults = { transition: "elastic", speed: 300, width: false, initialWidth: "600", innerWidth: false, maxWidth: false, height: false, initialHeight: "450", innerHeight: false, maxHeight: false, scalePhotos: true, scrolling: true, inline: false, html: false, iframe: false, fastIframe: true, photo: false, href: false, title: false, rel: false, opacity: 0.9, preloading: true, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: false, returnFocus: true, reposition: true, loop: true, slideshow: false, slideshowAuto: true, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: false, onLoad: false, onComplete: false, onCleanup: false, onClosed: false, overlayClose: true, escKey: true, arrowKey: true, top: false, bottom: false, left: false, right: false, fixed: false, data: undefined }, // Abstracting the HTML and event identifiers for easy rebranding colorbox = 'colorbox', prefix = 'cbox', boxElement = prefix + 'Element', // Events event_open = prefix + '_open', event_load = prefix + '_load', event_complete = prefix + '_complete', event_cleanup = prefix + '_cleanup', event_closed = prefix + '_closed', event_purge = prefix + '_purge', // Special Handling for IE isIE = !$.support.opacity && !$.support.style, // IE7 & IE8 isIE6 = isIE && !window.XMLHttpRequest, // IE6 event_ie6 = prefix + '_IE6', // Cached jQuery Object Variables $overlay, $box, $wrap, $content, $topBorder, $leftBorder, $rightBorder, $bottomBorder, $related, $window, $loaded, $loadingBay, $loadingOverlay, $title, $current, $slideshow, $next, $prev, $close, $groupControls, // Variables for cached values or use across multiple functions settings, interfaceHeight, interfaceWidth, loadedHeight, loadedWidth, element, index, photo, open, active, closing, loadingTimer, publicMethod, div = "div", init; // **************** // HELPER FUNCTIONS // **************** // Convience function for creating new jQuery objects function $tag(tag, id, css) { var element = document.createElement(tag); if (id) { element.id = prefix + id; } if (css) { element.style.cssText = css; } return $(element); } // Determine the next and previous members in a group. function getIndex(increment) { var max = $related.length, newIndex = (index + increment) % max; return (newIndex < 0) ? max + newIndex : newIndex; } // Convert '%' and 'px' values to integers function setSize(size, dimension) { return Math.round((/%/.test(size) ? ((dimension === 'x' ? $window.width() : $window.height()) / 100) : 1) * parseInt(size, 10)); } // Checks an href to see if it is a photo. // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex. function isImage(url) { return settings.photo || /\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(url); } // Assigns function results to their respective properties function makeSettings() { var i; settings = $.extend({}, $.data(element, colorbox)); for (i in settings) { if ($.isFunction(settings[i]) && i.slice(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time. settings[i] = settings[i].call(element); } } settings.rel = settings.rel || element.rel || 'nofollow'; settings.href = settings.href || $(element).attr('href'); settings.title = settings.title || element.title; var indexOfQs = -1; if ($(element).attr('href')) indexOfQs = $(element).attr('href').indexOf('?'); var settingsObject = {}, hash, hashes, i; //Lexus UK - Pick up settings from href if(indexOfQs != -1) { hashes = $(element).attr('href').split('?')[1].split(/&/); for (i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); switch (hash[0]) { case 'width': settings.width = hash[1]; break; case 'height': settings.height = hash[1]; break; default: //not a setting we want to set via the link, feel free to } } } if (typeof settings.href === "string") { settings.href = $.trim(settings.href); } } function trigger(event, callback) { $.event.trigger(event); if (callback) { callback.call(element); } } // Slideshow functionality function slideshow() { var timeOut, className = prefix + "Slideshow_", click = "click." + prefix, start, stop, clear; if (settings.slideshow && $related[1]) { start = function() { $slideshow .text(settings.slideshowStop) .unbind(click) .bind(event_complete, function() { if (settings.loop || $related[index + 1]) { timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); } }) .bind(event_load, function() { clearTimeout(timeOut); }) .one(click + ' ' + event_cleanup, stop); $box.removeClass(className + "off").addClass(className + "on"); timeOut = setTimeout(publicMethod.next, settings.slideshowSpeed); }; stop = function() { clearTimeout(timeOut); $slideshow .text(settings.slideshowStart) .unbind([event_complete, event_load, event_cleanup, click].join(' ')) .one(click, function() { publicMethod.next(); start(); }); $box.removeClass(className + "on").addClass(className + "off"); }; if (settings.slideshowAuto) { start(); } else { stop(); } } else { $box.removeClass(className + "off " + className + "on"); } } function launch(target) { if (!closing) { element = target; makeSettings(); $related = $(element); index = 0; if (settings.rel !== 'nofollow') { $related = $('.' + boxElement).filter(function() { var relRelated = $.data(this, colorbox).rel || this.rel; return (relRelated === settings.rel); }); index = $related.index(element); // Check direct calls to ColorBox. if (index === -1) { $related = $related.add(element); index = $related.length - 1; } } if (!open) { open = active = true; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys. $box.show(); if (settings.returnFocus) { $(element).blur().one(event_closed, function() { $(this).focus(); }); } // +settings.opacity avoids a problem in IE when using non-zero-prefixed-string-values, like '.5' $overlay.css({ "opacity": +settings.opacity, "cursor": settings.overlayClose ? "pointer" : "auto" }).show(); // Opens inital empty ColorBox prior to content being loaded. settings.w = setSize(settings.initialWidth, 'x'); settings.h = setSize(settings.initialHeight, 'y'); publicMethod.position(); if (isIE6) { $window.bind('resize.' + event_ie6 + ' scroll.' + event_ie6, function() { $overlay.css({ width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft() }); }).trigger('resize.' + event_ie6); } trigger(event_open, settings.onOpen); $groupControls.add($title).hide(); $close.html(settings.close).show(); } publicMethod.load(true); } } // ColorBox's markup needs to be added to the DOM prior to being called // so that the browser will go ahead and load the CSS background images. function appendHTML() { if (!$box && document.body) { init = false; $window = $(window); $box = $tag(div).attr({ id: colorbox, 'class': isIE ? prefix + (isIE6 ? 'IE6' : 'IE') : '' }).hide(); $overlay = $tag(div, "Overlay", isIE6 ? 'position:absolute' : '').hide(); $wrap = $tag(div, "Wrapper"); $content = $tag(div, "Content").append( $loaded = $tag(div, "LoadedContent", 'width:0; height:0; overflow:hidden'), $loadingOverlay = $tag(div, "LoadingOverlay").add($tag(div, "LoadingGraphic")), $title = $tag(div, "Title"), $current = $tag(div, "Current"), $next = $tag(div, "Next"), $prev = $tag(div, "Previous"), $slideshow = $tag(div, "Slideshow").bind(event_open, slideshow), $close = $tag(div, "Close") ); $wrap.append( // The 3x3 Grid that makes up ColorBox $tag(div).append( $tag(div, "TopLeft"), $topBorder = $tag(div, "TopCenter"), $tag(div, "TopRight") ), $tag(div, false, 'clear:left').append( $leftBorder = $tag(div, "MiddleLeft"), $content, $rightBorder = $tag(div, "MiddleRight") ), $tag(div, false, 'clear:left').append( $tag(div, "BottomLeft"), $bottomBorder = $tag(div, "BottomCenter"), $tag(div, "BottomRight") ) ).find('div div').css({ 'float': 'left' }); $loadingBay = $tag(div, false, 'position:absolute; width:9999px; visibility:hidden; display:none'); $groupControls = $next.add($prev).add($current).add($slideshow); $(document.body).append($overlay, $box.append($wrap, $loadingBay)); } } // Add ColorBox's event bindings function addBindings() { if ($box) { if (!init) { init = true; // Cache values needed for size calculations interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(true) - $content.height(); //Subtraction needed for IE6 interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(true) - $content.width(); loadedHeight = $loaded.outerHeight(true); loadedWidth = $loaded.outerWidth(true); // Setting padding to remove the need to do size conversions during the animation step. $box.css({ "padding-bottom": interfaceHeight, "padding-right": interfaceWidth }); // Anonymous functions here keep the public method from being cached, thereby allowing them to be redefined on the fly. $next.click(function() { publicMethod.next(); }); $prev.click(function() { publicMethod.prev(); }); $close.click(function() { publicMethod.close(); }); $overlay.click(function() { if (settings.overlayClose) { publicMethod.close(); } }); // Key Bindings $(document).bind('keydown.' + prefix, function(e) { var key = e.keyCode; if (open && settings.escKey && key === 27) { e.preventDefault(); publicMethod.close(); } if (open && settings.arrowKey && $related[1]) { if (key === 37) { e.preventDefault(); $prev.click(); } else if (key === 39) { e.preventDefault(); $next.click(); } } }); $('.' + boxElement, document).live('click', function(e) { // ignore non-left-mouse-clicks and clicks modified with ctrl / command, shift, or alt. // See: http://jacklmoore.com/notes/click-events/ if (!(e.which > 1 || e.shiftKey || e.altKey || e.metaKey)) { e.preventDefault(); launch(this); } }); } return true; } return false; } // Don't do anything if ColorBox already exists. if ($.colorbox) { return; } // Append the HTML when the DOM loads $(appendHTML); // **************** // PUBLIC FUNCTIONS // Usage format: $.fn.colorbox.close(); // Usage from within an iframe: parent.$.fn.colorbox.close(); // **************** publicMethod = $.fn[colorbox] = $[colorbox] = function(options, callback) { var $this = this; options = options || {}; appendHTML(); if (addBindings()) { if (!$this[0]) { if ($this.selector) { // if a selector was given and it didn't match any elements, go ahead and exit. return $this; } // if no selector was given (ie. $.colorbox()), create a temporary element to work with $this = $(''); options.open = true; // assume an immediate open } if (callback) { options.onComplete = callback; } $this.each(function() { $.data(this, colorbox, $.extend({}, $.data(this, colorbox) || defaults, options)); }).addClass(boxElement); if (($.isFunction(options.open) && options.open.call($this)) || options.open) { launch($this[0]); } } return $this; }; publicMethod.position = function(speed, loadedCallback) { var top = 0, left = 0, offset = $box.offset(), scrollTop = $window.scrollTop(), scrollLeft = $window.scrollLeft(); $window.unbind('resize.' + prefix); // remove the modal so that it doesn't influence the document width/height $box.css({ top: -9e4, left: -9e4 }); if (settings.fixed && !isIE6) { offset.top -= scrollTop; offset.left -= scrollLeft; $box.css({ position: 'fixed' }); } else { top = scrollTop; left = scrollLeft; $box.css({ position: 'absolute' }); } // keeps the top and left positions within the browser's viewport. if (settings.right !== false) { left += Math.max($window.width() - settings.w - loadedWidth - interfaceWidth - setSize(settings.right, 'x'), 0); } else if (settings.left !== false) { left += setSize(settings.left, 'x'); } else { left += Math.round(Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2); } if (settings.bottom !== false) { top += Math.max($window.height() - settings.h - loadedHeight - interfaceHeight - setSize(settings.bottom, 'y'), 0); } else if (settings.top !== false) { top += setSize(settings.top, 'y'); } else { top += Math.round(Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2); } $box.css({ top: offset.top, left: offset.left }); // setting the speed to 0 to reduce the delay between same-sized content. speed = ($box.width() === settings.w + loadedWidth && $box.height() === settings.h + loadedHeight) ? 0 : speed || 0; // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly, // but it has to be shrank down around the size of div#colorbox when it's done. If not, // it can invoke an obscure IE bug when using iframes. $wrap[0].style.width = $wrap[0].style.height = "9999px"; function modalDimensions(that) { $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width; $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height; } $box.dequeue().animate({ width: settings.w + loadedWidth, height: settings.h + loadedHeight, top: top, left: left }, { duration: speed, complete: function() { modalDimensions(this); active = false; // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation. $wrap[0].style.width = (settings.w + loadedWidth + interfaceWidth) + "px"; $wrap[0].style.height = (settings.h + loadedHeight + interfaceHeight) + "px"; if (settings.reposition) { setTimeout(function() { // small delay before binding onresize due to an IE8 bug. $window.bind('resize.' + prefix, publicMethod.position); }, 1); } if (loadedCallback) { loadedCallback(); } }, step: function() { modalDimensions(this); } }); }; publicMethod.resize = function(options) { if (open) { options = options || {}; if (options.width) { settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth; } if (options.innerWidth) { settings.w = setSize(options.innerWidth, 'x'); } $loaded.css({ width: settings.w }); if (options.height) { settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight; } if (options.innerHeight) { settings.h = setSize(options.innerHeight, 'y'); } if (!options.innerHeight && !options.height) { $loaded.css({ height: "auto" }); settings.h = $loaded.height(); } $loaded.css({ height: settings.h }); publicMethod.position(settings.transition === "none" ? 0 : settings.speed); } }; publicMethod.prep = function(object) { if (!open) { return; } var callback, speed = settings.transition === "none" ? 0 : settings.speed; $loaded.remove(); $loaded = $tag(div, 'LoadedContent').append(object); function getWidth() { settings.w = settings.w || $loaded.width(); settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w; return settings.w; } function getHeight() { settings.h = settings.h || $loaded.height(); settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h; return settings.h; } $loaded.hide() .appendTo($loadingBay.show())// content has to be appended to the DOM for accurate size calculations. .css({ width: getWidth(), overflow: settings.scrolling ? 'auto' : 'hidden' }) .css({ height: getHeight() })// sets the height independently from the width in case the new width influences the value of height. .prependTo($content); $loadingBay.hide(); // floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width. //$(photo).css({'float': 'none', marginLeft: 'auto', marginRight: 'auto'}); $(photo).css({ 'float': 'none' }); // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay. if (isIE6) { $('select').not($box.find('select')).filter(function() { return this.style.visibility !== 'hidden'; }).css({ 'visibility': 'hidden' }).one(event_cleanup, function() { this.style.visibility = 'inherit'; }); } callback = function() { var preload, i, total = $related.length, iframe, frameBorder = 'frameBorder', allowTransparency = 'allowTransparency', complete, src, img; if (!open) { return; } function removeFilter() { if (isIE) { $box[0].style.removeAttribute('filter'); } } complete = function() { clearTimeout(loadingTimer); $loadingOverlay.hide(); trigger(event_complete, settings.onComplete); }; if (isIE) { //This fadeIn helps the bicubic resampling to kick-in. if (photo) { $loaded.fadeIn(100); } } $title.html(settings.title).add($loaded).show(); if (total > 1) { // handle grouping if (typeof settings.current === "string") { $current.html(settings.current.replace('{current}', index + 1).replace('{total}', total)).show(); } $next[(settings.loop || index < total - 1) ? "show" : "hide"]().html(settings.next); $prev[(settings.loop || index) ? "show" : "hide"]().html(settings.previous); if (settings.slideshow) { $slideshow.show(); } // Preloads images within a rel group if (settings.preloading) { preload = [ getIndex(-1), getIndex(1) ]; while (i = $related[preload.pop()]) { src = $.data(i, colorbox).href || i.href; if ($.isFunction(src)) { src = src.call(i); } if (isImage(src)) { img = new Image(); img.src = src; } } } } else { $groupControls.hide(); } if (settings.iframe) { iframe = $tag('iframe')[0]; if (frameBorder in iframe) { iframe[frameBorder] = 0; } if (allowTransparency in iframe) { iframe[allowTransparency] = "true"; } // give the iframe a unique name to prevent caching iframe.name = prefix + (+new Date()); if (settings.fastIframe) { complete(); } else { $(iframe).one('load', complete); } iframe.src = settings.href; if (!settings.scrolling) { iframe.scrolling = "no"; } $(iframe).addClass(prefix + 'Iframe').appendTo($loaded).one(event_purge, function() { iframe.src = "//about:blank"; }); } else { complete(); } if (settings.transition === 'fade') { $box.fadeTo(speed, 1, removeFilter); } else { removeFilter(); } }; if (settings.transition === 'fade') { $box.fadeTo(speed, 0, function() { publicMethod.position(0, callback); }); } else { publicMethod.position(speed, callback); } }; publicMethod.load = function(launched) { var href, setResize, prep = publicMethod.prep; active = true; photo = false; element = $related[index]; if (!launched) { makeSettings(); } trigger(event_purge); trigger(event_load, settings.onLoad); settings.h = settings.height ? setSize(settings.height, 'y') - loadedHeight - interfaceHeight : settings.innerHeight && setSize(settings.innerHeight, 'y'); settings.w = settings.width ? setSize(settings.width, 'x') - loadedWidth - interfaceWidth : settings.innerWidth && setSize(settings.innerWidth, 'x'); // Sets the minimum dimensions for use in image scaling settings.mw = settings.w; settings.mh = settings.h; // Re-evaluate the minimum width and height based on maxWidth and maxHeight values. // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead. if (settings.maxWidth) { settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth; settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw; } if (settings.maxHeight) { settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight; settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh; } href = settings.href; loadingTimer = setTimeout(function() { $loadingOverlay.show(); }, 100); if (settings.inline) { // Inserts an empty placeholder where inline content is being pulled from. // An event is bound to put inline content back when ColorBox closes or loads new content. $tag(div).hide().insertBefore($(href)[0]).one(event_purge, function() { $(this).replaceWith($loaded.children()); }); prep($(href)); } else if (settings.iframe) { // IFrame element won't be added to the DOM until it is ready to be displayed, // to avoid problems with DOM-ready JS that might be trying to run in that iframe. prep(" "); } else if (settings.html) { prep(settings.html); } else if (isImage(href)) { $(photo = new Image()) .addClass(prefix + 'Photo') .error(function() { settings.title = false; prep($tag(div, 'Error').text('This image could not be loaded')); }) .load(function() { var percent; photo.onload = null; //stops animated gifs from firing the onload repeatedly. if (settings.scalePhotos) { setResize = function() { photo.height -= photo.height * percent; photo.width -= photo.width * percent; }; if (settings.mw && photo.width > settings.mw) { percent = (photo.width - settings.mw) / photo.width; setResize(); } if (settings.mh && photo.height > settings.mh) { percent = (photo.height - settings.mh) / photo.height; setResize(); } } if (settings.h) { photo.style.marginTop = Math.max(settings.h - photo.height, 0) / 2 + 'px'; } if ($related[1] && (settings.loop || $related[index + 1])) { photo.style.cursor = 'pointer'; photo.onclick = function() { publicMethod.next(); }; } if (isIE) { photo.style.msInterpolationMode = 'bicubic'; } setTimeout(function() { // A pause because Chrome will sometimes report a 0 by 0 size otherwise. prep(photo); }, 1); }); setTimeout(function() { // A pause because Opera 10.6+ will sometimes not run the onload function otherwise. photo.src = href; }, 1); } else if (href) { $loadingBay.load(href, settings.data, function(data, status, xhr) { prep(status === 'error' ? $tag(div, 'Error').text('Request unsuccessful: ' + xhr.statusText) : $(this).contents()); }); } }; // Navigates to the next page/image in a set. publicMethod.next = function() { if (!active && $related[1] && (settings.loop || $related[index + 1])) { index = getIndex(1); publicMethod.load(); } }; publicMethod.prev = function() { if (!active && $related[1] && (settings.loop || index)) { index = getIndex(-1); publicMethod.load(); } }; // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close(); publicMethod.close = function() { if (open && !closing) { closing = true; open = false; trigger(event_cleanup, settings.onCleanup); $window.unbind('.' + prefix + ' .' + event_ie6); $overlay.fadeTo(200, 0); $box.stop().fadeTo(300, 0, function() { $box.add($overlay).css({ 'opacity': 1, cursor: 'auto' }).hide(); trigger(event_purge); $loaded.remove(); setTimeout(function() { closing = false; trigger(event_closed, settings.onClosed); }, 1); }); } }; // Removes changes ColorBox made to the document, but does not remove the plugin // from jQuery. publicMethod.remove = function() { $([]).add($box).add($overlay).remove(); $box = null; $('.' + boxElement) .removeData(colorbox) .removeClass(boxElement) .die(); }; // A method for fetching the current element ColorBox is referencing. // returns a jQuery object. publicMethod.element = function() { return $(element); }; publicMethod.settings = defaults; } (jQuery, document, this)); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.colorbox.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.inView.js */ /** * author Christopher Blum * - based on the idea of Remy Sharp, http://remysharp.com/2009/01/26/element-in-view-event-plugin/ * - forked from http://github.com/zuk/jquery.inview/ */ (function ($) { var inviewObjects = {}, viewportSize, viewportOffset, d = document, w = window, documentElement = d.documentElement, expando = $.expando; $.event.special.inview = { add: function (data) { inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) }; }, remove: function (data) { try { delete inviewObjects[data.guid + "-" + this[expando]]; } catch (e) { } } }; function getViewportSize() { var mode, domObject, size = { height: w.innerHeight, width: w.innerWidth }; // if this is correct then return it. iPad has compat Mode, so will // go into check clientHeight/clientWidth (which has the wrong value). if (!size.height) { mode = d.compatMode; if (mode || !$.support.boxModel) { // IE, Gecko domObject = mode === 'CSS1Compat' ? documentElement : // Standards d.body; // Quirks size = { height: domObject.clientHeight, width: domObject.clientWidth }; } } return size; } function getViewportOffset() { return { top: w.pageYOffset || documentElement.scrollTop || d.body.scrollTop, left: w.pageXOffset || documentElement.scrollLeft || d.body.scrollLeft }; } function checkInView() { var $elements = $(), elementsLength, i = 0; $.each(inviewObjects, function (i, inviewObject) { var selector = inviewObject.data.selector, $element = inviewObject.$element; $elements = $elements.add(selector ? $element.find(selector) : $element); }); elementsLength = $elements.length; if (elementsLength) { viewportSize = viewportSize || getViewportSize(); viewportOffset = viewportOffset || getViewportOffset(); for (; i < elementsLength; i++) { // Ignore elements that are not in the DOM tree if (!$.contains(documentElement, $elements[i])) { continue; } var $element = $($elements[i]), elementSize = { height: $element.height(), width: $element.width() }, elementOffset = $element.offset(), inView = $element.data('inview'), visiblePartX, visiblePartY, visiblePartsMerged; // Don't ask me why because I haven't figured out yet: // viewportOffset and viewportSize are sometimes suddenly null in Firefox 5. // Even though it sounds weird: // It seems that the execution of this function is interferred by the onresize/onscroll event // where viewportOffset and viewportSize are unset if (!viewportOffset || !viewportSize) { return; } if (elementOffset.top + elementSize.height > viewportOffset.top && elementOffset.top < viewportOffset.top + viewportSize.height && elementOffset.left + elementSize.width > viewportOffset.left && elementOffset.left < viewportOffset.left + viewportSize.width) { visiblePartX = (viewportOffset.left > elementOffset.left ? 'right' : (viewportOffset.left + viewportSize.width) < (elementOffset.left + elementSize.width) ? 'left' : 'both'); visiblePartY = (viewportOffset.top > elementOffset.top ? 'bottom' : (viewportOffset.top + viewportSize.height) < (elementOffset.top + elementSize.height) ? 'top' : 'both'); visiblePartsMerged = visiblePartX + "-" + visiblePartY; if (!inView || inView !== visiblePartsMerged) { $element.data('inview', visiblePartsMerged).trigger('inview', [true, visiblePartX, visiblePartY]); } } else if (inView) { $element.data('inview', false).trigger('inview', [false]); } } } } $(w).bind("scroll resize", function () { viewportSize = viewportOffset = null; }); // Use setInterval in order to also make sure this captures elements within // "overflow:scroll" elements or elements that appeared in the dom tree due to // dom manipulation and reflow // old: $(window).scroll(checkInView); // // By the way, iOS (iPad, iPhone, ...) seems to not execute, or at least delays // intervals while the user scrolls. Therefore the inview event might fire a bit late there setInterval(checkInView, 250); })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.inView.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.touchSwipe.js */ /* * touchSwipe - jQuery Plugin * http://plugins.jquery.com/project/touchSwipe * http://labs.skinkers.com/touchSwipe/ * * Copyright (c) 2010 Matt Bryson (www.skinkers.com) * Dual licensed under the MIT or GPL Version 2 licenses. * * $version: 1.2.5 * * Changelog * $Date: 2010-12-12 (Wed, 12 Dec 2010) $ * $version: 1.0.0 * $version: 1.0.1 - removed multibyte comments * * $Date: 2011-21-02 (Mon, 21 Feb 2011) $ * $version: 1.1.0 - added allowPageScroll property to allow swiping and scrolling of page * - changed handler signatures so one handler can be used for multiple events * $Date: 2011-23-02 (Wed, 23 Feb 2011) $ * $version: 1.2.0 - added click handler. This is fired if the user simply clicks and does not swipe. The event object and click target are passed to handler. * - If you use the http://code.google.com/p/jquery-ui-for-ipad-and-iphone/ plugin, you can also assign jQuery mouse events to children of a touchSwipe object. * $version: 1.2.1 - removed console log! * * $version: 1.2.2 - Fixed bug where scope was not preserved in callback methods. * * $Date: 2011-28-04 (Thurs, 28 April 2011) $ * $version: 1.2.4 - Changed licence terms to be MIT or GPL inline with jQuery. Added check for support of touch events to stop non compatible browsers erroring. * * $Date: 2011-27-09 (Tues, 27 September 2011) $ * $version: 1.2.5 - Added support for testing swipes with mouse on desktop browser (thanks to https://github.com/joelhy) * A jQuery plugin to capture left, right, up and down swipes on touch devices. * You can capture 2 finger or 1 finger swipes, set the threshold and define either a catch all handler, or individual direction handlers. * Options: * swipe Function A catch all handler that is triggered for all swipe directions. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. * swipeLeft Function A handler that is triggered for "left" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. * swipeRight Function A handler that is triggered for "right" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. * swipeUp Function A handler that is triggered for "up" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. * swipeDown Function A handler that is triggered for "down" swipes. Handler is passed 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. * swipeStatus Function A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start?, "move?, "end? or "cancel?. direction : The swipe direction, either "up?, "down?, "left " or "right?.distance : The distance of the swipe. * click Function A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not. * * fingers int Default 1. The number of fingers to trigger the swipe, 1 or 2. * threshold int Default 75. The number of pixels that the user must move their finger by before it is considered a swipe. * triggerOnTouchEnd Boolean Default true If true, the swipe events are triggered when the touch end event is received (user releases finger). If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically. * allowPageScroll String Default "auto". How the browser handles page scrolls when the user is swiping on a touchSwipe object. * "auto" : all undefined swipes will cause the page to scroll in that direction. * "none" : the page will not scroll when user swipes. * "horizontal" : will force page to scroll on horizontal swipes. * "vertical" : will force page to scroll on vertical swipes. * * This jQuery plugin will only run on devices running Mobile Webkit based browsers (iOS 2.0+, android 2.2+) */ (function($) { $.fn.swipe = function(options) { if (!this) return false; // Default thresholds & swipe functions var defaults = { fingers: 1, // int - The number of fingers to trigger the swipe, 1 or 2. Default is 1. threshold: 75, // int - The number of pixels that the user must move their finger by before it is considered a swipe. Default is 75. swipe: null, // Function - A catch all handler that is triggered for all swipe directions. Accepts 2 arguments, the original event object and the direction of the swipe : "left", "right", "up", "down". swipeLeft: null, // Function - A handler that is triggered for "left" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. swipeRight: null, // Function - A handler that is triggered for "right" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. swipeUp: null, // Function - A handler that is triggered for "up" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. swipeDown: null, // Function - A handler that is triggered for "down" swipes. Accepts 3 arguments, the original event object, the direction of the swipe : "left", "right", "up", "down" and the distance of the swipe. swipeStatus: null, // Function - A handler triggered for every phase of the swipe. Handler is passed 4 arguments: event : The original event object, phase:The current swipe face, either "start?, "move?, "end? or "cancel?. direction : The swipe direction, either "up?, "down?, "left " or "right?.distance : The distance of the swipe. click: null, // Function - A handler triggered when a user just clicks on the item, rather than swipes it. If they do not move, click is triggered, if they do move, it is not. triggerOnTouchEnd: true, // Boolean, if true, the swipe events are triggered when the touch end event is received (user releases finger). If false, it will be triggered on reaching the threshold, and then cancel the touch event automatically. allowPageScroll: "auto" /* How the browser handles page scrolls when the user is swiping on a touchSwipe object. "auto" : all undefined swipes will cause the page to scroll in that direction. "none" : the page will not scroll when user swipes. "horizontal" : will force page to scroll on horizontal swipes. "vertical" : will force page to scroll on vertical swipes. */ }; //Constants var LEFT = "left"; var RIGHT = "right"; var UP = "up"; var DOWN = "down"; var NONE = "none"; var HORIZONTAL = "horizontal"; var VERTICAL = "vertical"; var AUTO = "auto"; var PHASE_START = "start"; var PHASE_MOVE = "move"; var PHASE_END = "end"; var PHASE_CANCEL = "cancel"; var hasTouch = 'ontouchstart' in window, START_EV = hasTouch ? 'touchstart' : 'mousedown', MOVE_EV = hasTouch ? 'touchmove' : 'mousemove', END_EV = hasTouch ? 'touchend' : 'mouseup', CANCEL_EV = 'touchcancel'; var phase = "start"; if (options.allowPageScroll == undefined && (options.swipe != undefined || options.swipeStatus != undefined)) options.allowPageScroll = NONE; if (options) $.extend(defaults, options); /** * Setup each object to detect swipe gestures */ return this.each(function() { var that = this; var $this = $(this); var triggerElementID = null; // this variable is used to identity the triggering element var fingerCount = 0; // the current number of fingers being used. //track mouse points / delta var start = { x: 0, y: 0 }; var end = { x: 0, y: 0 }; var delta = { x: 0, y: 0 }; /** * Event handler for a touch start event. * Stops the default click event from triggering and stores where we touched */ function touchStart(event) { var evt = hasTouch ? event.touches[0] : event; phase = PHASE_START; if (hasTouch) { // get the total number of fingers touching the screen fingerCount = event.touches.length; } //clear vars.. distance = 0; direction = null; // check the number of fingers is what we are looking for if (fingerCount == defaults.fingers || !hasTouch) { // get the coordinates of the touch start.x = end.x = evt.pageX; start.y = end.y = evt.pageY; if (defaults.swipeStatus) triggerHandler(event, phase); } else { //touch with more/less than the fingers we are looking for touchCancel(event); } that.addEventListener(MOVE_EV, touchMove, false); that.addEventListener(END_EV, touchEnd, false); } /** * Event handler for a touch move event. * If we change fingers during move, then cancel the event */ function touchMove(event) { if (phase == PHASE_END || phase == PHASE_CANCEL) return; var evt = hasTouch ? event.touches[0] : event; end.x = evt.pageX; end.y = evt.pageY; direction = caluculateDirection(); if (hasTouch) { fingerCount = event.touches.length; } phase = PHASE_MOVE //Check if we need to prevent default evnet (page scroll) or not validateDefaultEvent(event, direction); if (fingerCount == defaults.fingers || !hasTouch) { distance = caluculateDistance(); if (defaults.swipeStatus) triggerHandler(event, phase, direction, distance); //If we trigger whilst dragging, not on touch end, then calculate now... if (!defaults.triggerOnTouchEnd) { // if the user swiped more than the minimum length, perform the appropriate action if (distance >= defaults.threshold) { phase = PHASE_END; triggerHandler(event, phase); touchCancel(event); // reset the variables } } } else { phase = PHASE_CANCEL; triggerHandler(event, phase); touchCancel(event); } } /** * Event handler for a touch end event. * Calculate the direction and trigger events */ function touchEnd(event) { event.preventDefault(); distance = caluculateDistance(); direction = caluculateDirection(); if (defaults.triggerOnTouchEnd) { phase = PHASE_END; // check to see if more than one finger was used and that there is an ending coordinate if ((fingerCount == defaults.fingers || !hasTouch) && end.x != 0) { // if the user swiped more than the minimum length, perform the appropriate action if (distance >= defaults.threshold) { triggerHandler(event, phase); touchCancel(event); // reset the variables } else { phase = PHASE_CANCEL; triggerHandler(event, phase); touchCancel(event); } } else { phase = PHASE_CANCEL; triggerHandler(event, phase); touchCancel(event); } } else if (phase == PHASE_MOVE) { phase = PHASE_CANCEL; triggerHandler(event, phase); touchCancel(event); } that.removeEventListener(MOVE_EV, touchMove, false); that.removeEventListener(END_EV, touchEnd, false); } /** * Event handler for a touch cancel event. * Clears current vars */ function touchCancel(event) { // reset the variables back to default values fingerCount = 0; start.x = 0; start.y = 0; end.x = 0; end.y = 0; delta.x = 0; delta.y = 0; } /** * Trigger the relevant event handler * The handlers are passed the original event, the element that was swiped, and in the case of the catch all handler, the direction that was swiped, "left", "right", "up", or "down" */ function triggerHandler(event, phase) { //update status if (defaults.swipeStatus) defaults.swipeStatus.call($this, event, phase, direction || null, distance || 0); if (phase == PHASE_CANCEL) { if (defaults.click && (fingerCount == 1 || !hasTouch) && (isNaN(distance) || distance == 0)) defaults.click.call($this, event, event.target); } if (phase == PHASE_END) { //trigger catch all event handler if (defaults.swipe) { defaults.swipe.call($this, event, direction, distance); } //trigger direction specific event handlers switch (direction) { case LEFT: if (defaults.swipeLeft) defaults.swipeLeft.call($this, event, direction, distance); break; case RIGHT: if (defaults.swipeRight) defaults.swipeRight.call($this, event, direction, distance); break; case UP: if (defaults.swipeUp) defaults.swipeUp.call($this, event, direction, distance); break; case DOWN: if (defaults.swipeDown) defaults.swipeDown.call($this, event, direction, distance); break; } } } /** * Checks direction of the swipe and the value allowPageScroll to see if we should allow or prevent the default behaviour from occurring. * This will essentially allow page scrolling or not when the user is swiping on a touchSwipe object. */ function validateDefaultEvent(event, direction) { if (defaults.allowPageScroll == NONE) { event.preventDefault(); } else { var auto = defaults.allowPageScroll == AUTO; switch (direction) { case LEFT: if ((defaults.swipeLeft && auto) || (!auto && defaults.allowPageScroll != HORIZONTAL)) event.preventDefault(); break; case RIGHT: if ((defaults.swipeRight && auto) || (!auto && defaults.allowPageScroll != HORIZONTAL)) event.preventDefault(); break; case UP: if ((defaults.swipeUp && auto) || (!auto && defaults.allowPageScroll != VERTICAL)) event.preventDefault(); break; case DOWN: if ((defaults.swipeDown && auto) || (!auto && defaults.allowPageScroll != VERTICAL)) event.preventDefault(); break; } } } /** * Calcualte the length / distance of the swipe */ function caluculateDistance() { return Math.round(Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2))); } /** * Calcualte the angle of the swipe */ function caluculateAngle() { var X = start.x - end.x; var Y = end.y - start.y; var r = Math.atan2(Y, X); //radians var angle = Math.round(r * 180 / Math.PI); //degrees //ensure value is positive if (angle < 0) angle = 360 - Math.abs(angle); return angle; } /** * Calcualte the direction of the swipe * This will also call caluculateAngle to get the latest angle of swipe */ function caluculateDirection() { var angle = caluculateAngle(); if ((angle <= 45) && (angle >= 0)) return LEFT; else if ((angle <= 360) && (angle >= 315)) return LEFT; else if ((angle >= 135) && (angle <= 225)) return RIGHT; else if ((angle > 45) && (angle < 135)) return DOWN; else return UP; } // Add gestures to all swipable areas if supported try { this.addEventListener(START_EV, touchStart, false); this.addEventListener(CANCEL_EV, touchCancel); } catch (e) { //touch not supported } }); }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.touchSwipe.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.selectorsToggle.js */ (function($) { // global settings var settings = { isDebug: false, animationSpeed: 300, animationEasing: "linear", defaultClass: "default", // Zero based... toggleChangeEventName: "ToggleChange", enableSwipe: true, swipeThreshold: 40, listContainerPadding: 2, // Used to adjust the absolute position of the sliding toggle mask useCSS3: Modernizr.borderradius && Modernizr.boxshadow, enabled: true }; var methods = { init: function(options) { var ls = $.extend({}, settings, options); // local settings return this.each(function() { var $toggleContainer = $(this); if ($toggleContainer.hasClass('active')) return false; // already bound... var $listItems = $('li', $toggleContainer); if ($listItems.length != 2) return false; // incorrect number if items // Add active class & ensure toggle is visible $toggleContainer.addClass('active').show(); // Ensure we have a default item if ($('li.' + ls.defaultClass, $toggleContainer).length < 1) { $('li:first', $toggleContainer).addClass(ls.defaultClass); } // Add the mask, set its positions & dimentions var $defaultItem = $('li.' + ls.defaultClass, $toggleContainer); var $maskItem = $defaultItem.clone().removeClass(ls.defaultClass).addClass('mask'); $maskItem.css({ "left": ($defaultItem.index() * $listItems.eq(0).width()) + ls.listContainerPadding }); $toggleContainer.append($maskItem); $defaultItem.addClass('active'); if (Modernizr.csstransitions) { $maskItem.ApplyCSSTransitionRules(ls.animationSpeed / 1000); } $toggleContainer.bind("click", function(evt) { evt.preventDefault(); if(settings.enabled && !$toggleContainer.hasClass('disabled')){ var $currentLinkListItem = $('.active', $toggleContainer); var $newActiveItem = ($currentLinkListItem.index() == 0) ? $listItems.eq(1) : $listItems.eq(0); $currentLinkListItem.removeClass('active'); $newActiveItem.addClass('active'); $maskItem.children('a').text($.trim($newActiveItem.children('a').text().replace(" ", "\xA0"))); var targetLeftPosition = ($newActiveItem.index() * $listItems.eq(0).width()) + ls.listContainerPadding; if (Modernizr.csstransitions) { $maskItem.css({ "left": targetLeftPosition + "px" }); } else { $maskItem.stop().animate({ "left": targetLeftPosition }, ls.animationSpeed, ls.animationEasing, function(evt) { /* no callback */ }); } $newActiveItem.trigger(ls.toggleChangeEventName, $('a', $newActiveItem)); } }); if (ls.enableSwipe) { function onSwipe(event, phase, direction, distance) { if (phase == "end") { $toggleContainer.trigger("click"); } } $toggleContainer.swipe({ swipeStatus: onSwipe, allowPageScroll: "none", threshold: ls.swipeThreshold }); } }); }, publicFunction: function(options) { }, disable: function() { settings.enabled = false; $('a',$(this)).css('cursor', 'default') }, enable: function() { settings.enabled = true; $('a',$(this)).css('cursor', 'pointer') } }; $.fn.SelectorsToggle = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.plugin'); } }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.selectorsToggle.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.functions.transitions.js */ (function($) { // Applies CSS3 transition to any CSS change on the supplied elements $.fn.ApplyCSSTransitionRules = function(durationInSeconds, ruleType, easingType) { if (ruleType == null || ruleType == "") { ruleType = "all"; } if (easingType == null || easingType == "") { easingType = "ease"; } if (durationInSeconds == null || durationInSeconds == "") { durationInSeconds = 1; } return this.each(function() { $(this).css({ "-moz-transition": ruleType + " " + durationInSeconds + "s " + easingType, /* FF4+ */ "-o-transition": ruleType + " " + durationInSeconds + "s " + easingType, /* Opera 10.5+ */ "-webkit-transition": ruleType + " " + durationInSeconds + "s " + easingType, /* Saf3.2+, Chrome */ "-ms-transition": ruleType + " " + durationInSeconds + "s " + easingType, /* IE10 */ "transition": ruleType + " " + durationInSeconds + "s " + easingType }); }); }; // Removes CSS3 transition on the supplied elements $.fn.RemoveCSSTransitionRules = function() { return this.each(function() { $(this).css({ "-moz-transition": "none", /* FF4+ */ "-o-transition": "none", /* Opera 10.5+ */ "-webkit-transition": "none", /* Saf3.2+, Chrome */ "-ms-transition": "none", /* IE10 */ "transition": "none" }); }); }; // Removes CSS3 transition on the supplied elements $.fn.ResetCSSTransitionRules = function() { return this.each(function() { $(this).css({ "-moz-transition": "", /* FF4+ */ "-o-transition": "", /* Opera 10.5+ */ "-webkit-transition": "", /* Saf3.2+, Chrome */ "-ms-transition": "", /* IE10 */ "transition": "" }); }); }; $.fn.ApplyTranslate3D = function(x, y, z) { return this.each(function() { $(this).css({ "-webkit-transform-style": "preserve-3d", "-webkit-backface-visibility": "hidden", "-webkit-transform": "translate3d(" + x + "px, " + y + "px, " + z + "px)", "-moz-transform": "translate3d(" + x + "px, " + y + "px, " + z + "px)" }); }); }; $.fn.ApplyTranslate = function(x, y) { return this.each(function() { $(this).css({ "-webkit-backface-visibility": "hidden", "-webkit-transform-style": "preserve-3d", "-webkit-backface-visibility": "hidden", "-moz-transform": "translate(" + x + "px, " + y + "px)", "-ms-transform": "translate(" + x + "px, " + y + "px)", "-o-transform": "translate(" + x + "px, " + y + "px)", "transform": "translate(" + x + "px, " + y + "px)" }); }); }; })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.functions.transitions.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.address-1.4.min.js */ /* * jQuery Address Plugin v1.4 * http://www.asual.com/jquery/address/ * * Copyright (c) 2009-2010 Rostislav Hristov * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Date: 2011-05-04 14:22:12 +0300 (Wed, 04 May 2011) */ (function(c){c.address=function(){var v=function(a){c(c.address).trigger(c.extend(c.Event(a),function(){for(var b={},e=c.address.parameterNames(),f=0,p=e.length;f"+n.title.replace("'","\\'")+"'); doc.close(); }; var _htmlLoad = function() { var win = _frame.contentWindow; var src = win.location.href; _value = (typeof win[ID] != UNDEFINED ? win[ID] : ''); if (_value != _getHash()) { _update.call(SWFAddress, false); _l.hash = _ieLocal(_value, TRUE); } }; var _load = function() { if (!_loaded) { _loaded = TRUE; if (_msie && _version < 8) { var frameset = _d.getElementsByTagName('frameset')[0]; _frame = _d.createElement((frameset ? '' : 'i') + 'frame'); if (frameset) { frameset.insertAdjacentElement('beforeEnd', _frame); frameset[frameset.cols ? 'cols' : 'rows'] += ',0'; _frame.src = 'javascript:false'; _frame.noResize = true; _frame.frameBorder = _frame.frameSpacing = 0; } else { _frame.src = 'javascript:false'; _frame.style.display = 'none'; _d.body.insertAdjacentElement('afterBegin', _frame); } _st(function() { _events.addListener(_frame, 'load', _htmlLoad); if (typeof _frame.contentWindow[ID] == UNDEFINED) _htmlWrite(); }, 50); } else if (_safari) { if (_version < 418) { _d.body.innerHTML += '
      '; _form = _d.getElementById(ID); } if (typeof _l[ID] == UNDEFINED) _l[ID] = {}; if (typeof _l[ID][_l.pathname] != UNDEFINED) _stack = _l[ID][_l.pathname].split(','); } _st(_functions.bind(function() { _jsInit.call(this); _jsChange.call(this); _track.call(this); }, this), 1); if (_msie && _version >= 8) { _d.body.onhashchange = _functions.bind(_listen, this); _si(_functions.bind(_titleCheck, this), 50); } else { _si(_functions.bind(_listen, this), 50); } } }; var ID = 'swfaddress', FUNCTION = 'function', UNDEFINED = 'undefined', TRUE = true, FALSE = false, _util = asual.util, _browser = _util.Browser, _events = _util.Events, _functions = _util.Functions, _version = _browser.getVersion(), _msie = _browser.isMSIE(), _mozilla = _browser.isMozilla(), _opera = _browser.isOpera(), _safari = _browser.isSafari(), _supported = FALSE, _t = _getWindow(), _d = _t.document, _h = _t.history, _l = _t.location, _si = setInterval, _st = setTimeout, _dc = decodeURI, _ec = encodeURI, _frame, _form, _url, _title = _d.title, _length = _h.length, _silent = FALSE, _loaded = FALSE, _justset = TRUE, _juststart = TRUE, _ref = this, _stack = [], _ids = [], _popup = [], _listeners = {}, _value = _getHash(), _opts = {history: TRUE, strict: TRUE}; if (_msie && _d.documentMode && _d.documentMode != _version) _version = _d.documentMode != 8 ? 7 : 8; _supported = (_mozilla && _version >= 1) || (_msie && _version >= 6) || (_opera && _version >= 9.5) || (_safari && _version >= 312); if (_supported) { if (_opera) history.navigationMode = 'compatible'; for (var i = 1; i < _length; i++) _stack.push(''); _stack.push(_getHash()); if (_msie && _l.hash != _getHash()) _l.hash = '#' + _ieLocal(_getHash(), TRUE); _searchScript(document); var _qi = _url ? _url.indexOf('?') : -1; if (_qi != -1) { var param, params = _url.substr(_qi + 1).split('&'); for (var i = 0, p; p = params[i]; i++) { param = p.split('='); if (/^(history|strict)$/.test(param[0])) { _opts[param[0]] = (isNaN(param[1]) ? /^(true|yes)$/i.test(param[1]) : (parseInt(param[1]) != 0)); } if (/^tracker$/.test(param[0])) _opts[param[0]] = param[1]; } } if (_msie) _titleCheck.call(this); if (window == _t) _events.addListener(document, 'DOMContentLoaded', _functions.bind(_load, this)); _events.addListener(_t, 'load', _functions.bind(_load, this)); } else if ((!_supported && _l.href.indexOf('#') != -1) || (_safari && _version < 418 && _l.href.indexOf('#') != -1 && _l.search != '')){ _d.open(); _d.write(''); _d.close(); } else { _track(); } this.toString = function() { return '[class SWFAddress]'; }; this.back = function() { _h.back(); }; this.forward = function() { _h.forward(); }; this.up = function() { var path = this.getPath(); this.setValue(path.substr(0, path.lastIndexOf('/', path.length - 2) + (path.substr(path.length - 1) == '/' ? 1 : 0))); }; this.go = function(delta) { _h.go(delta); }; this.href = function(url, target) { target = typeof target != UNDEFINED ? target : '_self'; if (target == '_self') self.location.href = url; else if (target == '_top') _l.href = url; else if (target == '_blank') window.open(url); else _t.frames[target].location.href = url; }; this.popup = function(url, name, options, handler) { try { var popup = window.open(url, name, eval(options)); if (typeof handler != UNDEFINED) eval(handler); } catch (ex) {} _popup = arguments; }; this.getIds = function() { return _ids; }; this.getId = function(index) { return _ids[0]; }; this.setId = function(id) { _ids[0] = id; }; this.addId = function(id) { this.removeId(id); _ids.push(id); }; this.removeId = function(id) { for (var i = 0; i < _ids.length; i++) { if (id == _ids[i]) { _ids.splice(i, 1); break; } } }; this.addEventListener = function(type, listener) { if (typeof _listeners[type] == UNDEFINED) _listeners[type] = []; _listeners[type].push(listener); }; this.removeEventListener = function(type, listener) { if (typeof _listeners[type] != UNDEFINED) { for (var i = 0, l; l = _listeners[type][i]; i++) if (l == listener) break; _listeners[type].splice(i, 1); } }; this.dispatchEvent = function(event) { if (this.hasEventListener(event.type)) { event.target = this; for (var i = 0, l; l = _listeners[event.type][i]; i++) l(event); return TRUE; } return FALSE; }; this.hasEventListener = function(type) { return (typeof _listeners[type] != UNDEFINED && _listeners[type].length > 0); }; this.getBaseURL = function() { var url = _l.href; if (url.indexOf('#') != -1) url = url.substr(0, url.indexOf('#')); if (url.substr(url.length - 1) == '/') url = url.substr(0, url.length - 1); return url; }; this.getStrict = function() { return _opts.strict; }; this.setStrict = function(strict) { _opts.strict = strict; }; this.getHistory = function() { return _opts.history; }; this.setHistory = function(history) { _opts.history = history; }; this.getTracker = function() { return _opts.tracker; }; this.setTracker = function(tracker) { _opts.tracker = tracker; }; this.getTitle = function() { return _d.title; }; this.setTitle = function(title) { if (!_supported) return null; if (typeof title == UNDEFINED) return; if (title == 'null') title = ''; title = _dc(title); _st(function() { _title = _d.title = title; if (_juststart && _frame && _frame.contentWindow && _frame.contentWindow.document) { _frame.contentWindow.document.title = title; _juststart = FALSE; } if (!_justset && _mozilla) _l.replace(_l.href.indexOf('#') != -1 ? _l.href : _l.href + '#'); _justset = FALSE; }, 10); }; this.getStatus = function() { return _t.status; }; this.setStatus = function(status) { if (!_supported) return null; if (typeof status == UNDEFINED) return; if (status == 'null') status = ''; status = _dc(status); if (!_safari) { status = _strictCheck((status != 'null') ? status : '', TRUE); if (status == '/') status = ''; if (!(/http(s)?:\/\//.test(status))) { var index = _l.href.indexOf('#'); status = (index == -1 ? _l.href : _l.href.substr(0, index)) + '#' + status; } _t.status = status; } }; this.resetStatus = function() { _t.status = ''; }; this.getValue = function() { if (!_supported) return null; return _dc(_strictCheck(_ieLocal(_value, FALSE), FALSE)); }; this.setValue = function(value) { if (!_supported) return null; if (typeof value == UNDEFINED) return; if (value == 'null') value = ''; value = _ec(_dc(_strictCheck(value, TRUE))); if (value == '/') value = ''; if (_value == value) return; _justset = TRUE; _value = value; _silent = TRUE; _update.call(SWFAddress, true); _stack[_h.length] = _value; if (_safari) { if (_opts.history) { _l[ID][_l.pathname] = _stack.toString(); _length = _h.length + 1; if (_version < 418) { if (_l.search == '') { _form.action = '#' + _value; _form.submit(); } } else if (_version < 523 || _value == '') { var evt = _d.createEvent('MouseEvents'); evt.initEvent('click', TRUE, TRUE); var anchor = _d.createElement('a'); anchor.href = '#' + _value; anchor.dispatchEvent(evt); } else { _l.hash = '#' + _value; } } else { _l.replace('#' + _value); } } else if (_value != _getHash()) { if (_opts.history) _l.hash = '#' + _dc(_ieLocal(_value, TRUE)); else _l.replace('#' + _dc(_value)); } if ((_msie && _version < 8) && _opts.history) { _st(_htmlWrite, 50); } if (_safari) _st(function(){ _silent = FALSE; }, 1); else _silent = FALSE; }; this.getPath = function() { var value = this.getValue(); if (value.indexOf('?') != -1) { return value.split('?')[0]; } else if (value.indexOf('#') != -1) { return value.split('#')[0]; } else { return value; } }; this.getPathNames = function() { var path = this.getPath(), names = path.split('/'); if (path.substr(0, 1) == '/' || path.length == 0) names.splice(0, 1); if (path.substr(path.length - 1, 1) == '/') names.splice(names.length - 1, 1); return names; }; this.getQueryString = function() { var value = this.getValue(), index = value.indexOf('?'); if (index != -1 && index < value.length) return value.substr(index + 1); }; this.getParameter = function(param) { var value = this.getValue(); var index = value.indexOf('?'); if (index != -1) { value = value.substr(index + 1); var p, params = value.split('&'), i = params.length, r = []; while(i--) { p = params[i].split('='); if (p[0] == param) r.push(p[1]); } if (r.length != 0) return r.length != 1 ? r : r[0]; } }; this.getParameterNames = function() { var value = this.getValue(); var index = value.indexOf('?'); var names = []; if (index != -1) { value = value.substr(index + 1); if (value != '' && value.indexOf('=') != -1) { var params = value.split('&'), i = 0; while(i < params.length) { names.push(params[i].split('=')[0]); i++; } } } return names; }; this.onInit = null; this.onChange = null; this.onInternalChange = null; this.onExternalChange = null; (function() { var _args; if (typeof FlashObject != UNDEFINED) SWFObject = FlashObject; if (typeof SWFObject != UNDEFINED && SWFObject.prototype && SWFObject.prototype.write) { var _s1 = SWFObject.prototype.write; SWFObject.prototype.write = function() { _args = arguments; if (this.getAttribute('version').major < 8) { this.addVariable('$swfaddress', SWFAddress.getValue()); ((typeof _args[0] == 'string') ? document.getElementById(_args[0]) : _args[0]).so = this; } var success; if (success = _s1.apply(this, _args)) _ref.addId(this.getAttribute('id')); return success; } } if (typeof swfobject != UNDEFINED) { var _s2r = swfobject.registerObject; swfobject.registerObject = function() { _args = arguments; _s2r.apply(this, _args); _ref.addId(_args[0]); } var _s2c = swfobject.createSWF; swfobject.createSWF = function() { _args = arguments; var swf = _s2c.apply(this, _args); if (swf) _ref.addId(_args[0].id); return swf; } var _s2e = swfobject.embedSWF; swfobject.embedSWF = function() { _args = arguments; if (typeof _args[8] == UNDEFINED) _args[8] = {}; if (typeof _args[8].id == UNDEFINED) _args[8].id = _args[1]; _s2e.apply(this, _args); _ref.addId(_args[8].id); } } if (typeof UFO != UNDEFINED) { var _u = UFO.create; UFO.create = function() { _args = arguments; _u.apply(this, _args); _ref.addId(_args[0].id); } } if (typeof AC_FL_RunContent != UNDEFINED) { var _a = AC_FL_RunContent; AC_FL_RunContent = function() { _args = arguments; _a.apply(this, _args); for (var i = 0, l = _args.length; i < l; i++) if (_args[i]== 'id') _ref.addId(_args[i+1]); } } })(); } /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\swfaddress.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.animate-enhanced.min.js */ /* jquery.animate-enhanced plugin v0.93 --- http://github.com/benbarnett/jQuery-Animate-Enhanced http://benbarnett.net @benpbarnett */ ;(function(a,I,J){function O(b,a,j,l,k,g,c,o,q){var p=!1,c=!0===c&&!0===o,a=a||{};a.original||(a.original={},p=!0);a.properties=a.properties||{};a.secondary=a.secondary||{};for(var o=a.meta,m=a.original,f=a.properties,P=a.secondary,z=r.length-1;0<=z;z--){var B=r[z]+"transition-property",C=r[z]+"transition-duration",d=r[z]+"transition-timing-function",j=c?r[z]+"transform":j;p&&(m[B]=b.css(B)||"",m[C]=b.css(C)||"",m[d]=b.css(d)||"");P[j]=c?(!0===q||!0===x&&!1!==q)&&L?"translate3d("+o.left+"px, "+o.top+ "px, 0)":"translate("+o.left+"px,"+o.top+"px)":g;f[B]=(f[B]?f[B]+",":"")+j;f[C]=(f[C]?f[C]+",":"")+l+"ms";f[d]=(f[d]?f[d]+",":"")+k}return a}function y(b){for(var a in b)return!1;return!0}function G(b){D=b.match(/\D+$/);return parseFloat(b.replace(/px/i,""))}var Q="top right bottom left opacity height width".split(" "),H=["top","right","bottom","left"],r=["","-webkit-","-moz-","-o-"],R=["avoidTransforms","useTranslate3d","leaveTransforms"],S=/^([+-]=)?([\d+-.]+)(.*)$/,T=/([A-Z])/g,U={secondary:{}, meta:{top:0,right:0,bottom:0,left:0}},D="px",M=null,E=!1,n=(document.body||document.documentElement).style,F=void 0!==n.WebkitTransition?"webkitTransitionEnd":void 0!==n.OTransition?"oTransitionEnd otransitionend transitionend":"transitionend",N=void 0!==n.WebkitTransition||void 0!==n.MozTransition||void 0!==n.OTransition||void 0!==n.transition,L="WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix,x=L;a.expr&&a.expr.filters&&(M=a.expr.filters.animated,a.expr.filters.animated=function(b){return a(b).data("events")&& a(b).data("events")[F]?!0:M.call(this,b)});a.extend({toggle3DByDefault:function(){return x=!x},toggleDisabledByDefault:function(){return E=!E}});a.fn.translation=function(){if(!this[0])return null;var b=window.getComputedStyle(this[0],null),a={x:0,y:0};if(b)for(var j=r.length-1;j>=0;j--){var l=b.getPropertyValue(r[j]+"transform");if(l&&/matrix/i.test(l)){b=l.replace(/^matrix\(/i,"").split(/, |\)$/g);a={x:parseInt(b[4],10),y:parseInt(b[5],10)};break}}return a};a.fn.animate=function(b,n,j,l){var b= b||{},k=!(typeof b.bottom!=="undefined"||typeof b.right!=="undefined"),g=a.speed(n,j,l),c=this,o=0,q=function(){o--;o===0&&typeof g.complete==="function"&&g.complete.apply(c[0],arguments)},p;if(!(p=(typeof b.avoidCSSTransitions!=="undefined"?b.avoidCSSTransitions:E)===true))if(!(p=!N))if(!(p=y(b))){var m;a:{for(m in b)if((m=="width"||m=="height")&&(b[m]=="show"||b[m]=="hide"||b[m]=="toggle")){m=true;break a}m=false}p=m||g.duration<=0||a.fn.animate.defaults.avoidTransforms===true&&b.avoidTransforms!== false}return p?I.apply(this,arguments):this[g.queue===true?"queue":"each"](function(){var f=a(this),c=a.extend({},g),l=function(){var a=f.data("jQe")||{original:{}},c={};if(b.leaveTransforms!==true){for(var d=r.length-1;d>=0;d--)c[r[d]+"transform"]="";if(k&&typeof a.meta!=="undefined")for(var d=0,e;e=H[d];++d)c[e]=a.meta[e+"_o"]+D}f.unbind(F).css(a.original).css(c).data("jQe",null);b.opacity==="hide"&&f.css({display:"none",opacity:""});q.call(f)},j={bounce:"cubic-bezier(0.0, 0.35, .5, 1.3)",linear:"linear", swing:"ease-in-out",easeInQuad:"cubic-bezier(0.550, 0.085, 0.680, 0.530)",easeInCubic:"cubic-bezier(0.550, 0.055, 0.675, 0.190)",easeInQuart:"cubic-bezier(0.895, 0.030, 0.685, 0.220)",easeInQuint:"cubic-bezier(0.755, 0.050, 0.855, 0.060)",easeInSine:"cubic-bezier(0.470, 0.000, 0.745, 0.715)",easeInExpo:"cubic-bezier(0.950, 0.050, 0.795, 0.035)",easeInCirc:"cubic-bezier(0.600, 0.040, 0.980, 0.335)",easeInBack:"cubic-bezier(0.600, -0.280, 0.735, 0.045)",easeOutQuad:"cubic-bezier(0.250, 0.460, 0.450, 0.940)", easeOutCubic:"cubic-bezier(0.215, 0.610, 0.355, 1.000)",easeOutQuart:"cubic-bezier(0.165, 0.840, 0.440, 1.000)",easeOutQuint:"cubic-bezier(0.230, 1.000, 0.320, 1.000)",easeOutSine:"cubic-bezier(0.390, 0.575, 0.565, 1.000)",easeOutExpo:"cubic-bezier(0.190, 1.000, 0.220, 1.000)",easeOutCirc:"cubic-bezier(0.075, 0.820, 0.165, 1.000)",easeOutBack:"cubic-bezier(0.175, 0.885, 0.320, 1.275)",easeInOutQuad:"cubic-bezier(0.455, 0.030, 0.515, 0.955)",easeInOutCubic:"cubic-bezier(0.645, 0.045, 0.355, 1.000)", easeInOutQuart:"cubic-bezier(0.770, 0.000, 0.175, 1.000)",easeInOutQuint:"cubic-bezier(0.860, 0.000, 0.070, 1.000)",easeInOutSine:"cubic-bezier(0.445, 0.050, 0.550, 0.950)",easeInOutExpo:"cubic-bezier(1.000, 0.000, 0.000, 1.000)",easeInOutCirc:"cubic-bezier(0.785, 0.135, 0.150, 0.860)",easeInOutBack:"cubic-bezier(0.680, -0.550, 0.265, 1.550)"},m={},j=j[c.easing||"swing"]?j[c.easing||"swing"]:c.easing||"swing",d;for(d in b)if(a.inArray(d,R)===-1){var p=a.inArray(d,H)>-1,h;var i=f,v=b[d],t=d,s=p&&b.avoidTransforms!== true;if(t=="d")h=void 0;else{var e=S.exec(v);h=i.css(t)==="auto"?0:i.css(t);h=typeof h=="string"?G(h):h;typeof v=="string"&&G(v);var s=s===true?0:h,n=i.is(":hidden"),u=i.translation();t=="left"&&(s=parseInt(h,10)+u.x);t=="right"&&(s=parseInt(h,10)+u.x);t=="top"&&(s=parseInt(h,10)+u.y);t=="bottom"&&(s=parseInt(h,10)+u.y);if(!e&&v=="show"){s=1;n&&i.css({display:"block",opacity:0})}else!e&&v=="hide"&&(s=0);if(e){i=parseFloat(e[2]);e[1]&&(i=(e[1]==="-="?-1:1)*i+parseInt(s,10));h=i}else h=s}if(e=b.avoidTransforms!== true){e=d;i=h;v=f;t=a.inArray(e,Q)>-1;if((e=="width"||e=="height")&&i===parseFloat(v.css(e)))t=false;e=t}if(e){e=f;i=d;v=c.duration;t=j;h=p&&b.avoidTransforms===true?h+D:h;var p=p&&b.avoidTransforms!==true,s=k,n=b.useTranslate3d===true,u=(u=e.data("jQe"))&&!y(u)?u:a.extend(true,{},U),w=h;if(a.inArray(i,H)>-1){var A=u.meta,K=G(e.css(i))||0,x=i+"_o",w=h-K;A[i]=w;A[x]=e.css(i)=="auto"?0+w:K+w||0;u.meta=A;if(s&&w===0){w=0-A[x];A[i]=w;A[x]=0}}e.data("jQe",O(e,u,i,v,t,w,p,s,n))}else m[d]=b[d]}f.unbind(F); if((d=f.data("jQe"))&&!y(d)&&!y(d.secondary)){o++;f.css(d.properties);var E=d.secondary;setTimeout(function(){f.bind(F,l).css(E)})}else c.queue=false;if(!y(m)){o++;I.apply(f,[m,{duration:c.duration,easing:a.easing[c.easing]?c.easing:a.easing.swing?"swing":"linear",complete:q,queue:c.queue}])}return true})};a.fn.animate.defaults={};a.fn.stop=function(b,n,j){if(!N)return J.apply(this,[b,n]);b&&this.queue([]);this.each(function(){var l=a(this),k=l.data("jQe");if(k&&!y(k)){var g,c={};if(n){c=k.secondary; if(!j&&typeof k.meta.left_o!==void 0||typeof k.meta.top_o!==void 0){c.left=typeof k.meta.left_o!==void 0?k.meta.left_o:"auto";c.top=typeof k.meta.top_o!==void 0?k.meta.top_o:"auto";for(g=r.length-1;g>=0;g--)c[r[g]+"transform"]=""}}else if(!y(k.secondary)){var o=window.getComputedStyle(l[0],null);if(o)for(var q in k.secondary)if(k.secondary.hasOwnProperty(q)){q=q.replace(T,"-$1").toLowerCase();c[q]=o.getPropertyValue(q);if(!j&&/matrix/i.test(c[q])){g=c[q].replace(/^matrix\(/i,"").split(/, |\)$/g); c.left=parseFloat(g[4])+parseFloat(l.css("left"))+D||"auto";c.top=parseFloat(g[5])+parseFloat(l.css("top"))+D||"auto";for(g=r.length-1;g>=0;g--)c[r[g]+"transform"]=""}}}l.unbind(F);l.css(k.original).css(c).data("jQe",null)}else J.apply(l,[b,n])});return this}})(jQuery,jQuery.fn.animate,jQuery.fn.stop); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\jquery.animate-enhanced.min.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.overlay.js */ /*jshint camelcase:true, curly:false, eqeqeq:true, forin:true, latedef:false, newcap:true, nonew:false, noarg:true, noempty: true, boss:true, plusplus:true, quotmark:true, unused:true, strict:true, asi:true, laxcomma:true, debug:true, smarttabs:true, supernew:true */ /*global jQuery, PubSub */ ;(function($, window) { "use strict"; // default options. var _options = { // hide and show animation speed. animationDuration: 500, // default view, if set overrides landscape and portrait settings. view: null, // view to show in landscape orientation. landscape: null, // view to show in portrait orientation. portrait: null, // if the value is truthy the overlay will be shown after initialisation has finished. // if autoshow is a function it will be used as a callback for the show method. autoshow: false, // if truthy, the overlay will be automatically rendered but not shown. autorender: false, // if this property is true the overlay will // perform some tricks to keep iOS happy. mobile: /mobile/i.test(navigator.userAgent), // if set to true, the overlay will be positioned abs contain: false } // base animation object to enable CSS3 animations. var animation = {} // stores overlay instances. var instances = {} , instanceCounter = 0 // delegate orientationchange to overlayOrientationChangeDelegate. $(window).bind("orientationchange", overlayOrientationChangeDelegate) /** * constructs an overlay on the current view. * @param options {Object} instance options. */ var Overlay = function(options) { var self = this options = this.options = $.extend({}, _options, options) var $this = options.$this , $node = this.$node = $this.length ? $this.addClass("co-overlay") : $("
      ", {"class" : "co-overlay"}) , instanceId = this.id = instanceCounter += 1 // add this instance to the instances list. instances[instanceId] = this // store the index of this instance on the overlay. $node.data("overlay-instanceid", instanceId) if ( ! options.landscape && ! options.portrait && ! options.view ) { options.view = $("
      ", {"class": "co-overlay-defaultView"}) } if ( ! options.$this ) { options.$this = $("
      ") } // the overlay is not rendered by default. this.isRendered = false if ( options.autoshow || options.autorender ) { return this.render() } if (options.eventTopics && options.eventTopics.render) { this.renderToken = PubSub.subscribe( options.eventTopics.render, function() { self.render() } ) } return $node } /** * renders the overlay DOM structure and injects it onto a reference node. */ Overlay.prototype.render = function() { var $node = this.$node, options = this.options; this.isRendered = true; // hide by default. $node.css("display", "none") $node.css("opacity", "0") if ( options.contain ) $node.css("position", "absolute") if ( options.landscape && options.portrait && ! options.view ) { options.$landscape = $(options.landscape).addClass("landscape").appendTo($node) options.$portrait = $(options.portrait).addClass("portrait").appendTo($node) } else if ( options.view && ! options.landscape && ! options.portrait ) { options.$view = $(options.view).addClass("view").appendTo($node) } else { throw new Error("The overlay module only supports landscape AND portrait properties. For a single view use the 'view' property.") } if ( options.controlBarWrapper ) { $node.append(options.controlBarWrapper) } if ( options.autoshow ) { this.show(options.autoshow) this.isShown = true } else { this.isShown = false } this.options.$this.appendTo("body") // set rendered property to true. this.isRendered = true return $node } /** * shows the overlay * @param callback {Function} function called when the overlay is displayed. */ Overlay.prototype.show = function(callback) { var self = this // make sure the overlay is in the DOM. if ( ! this.isRendered ) this.render() $("head").append($('')) // store the position in order to restore when hidden again. this.position = { x: $(window).scrollLeft(), y: $(window).scrollTop() } $("html").addClass("overlay-open") if ( this.options.$portrait && this.options.$landscape ) { this.changeOrientation() } this.$node.css("display", "block").animate( $.extend({}, animation, { opacity : 1 }), this.options.animationDuration, function() { self.isShown = true if (self.options.controlBarWrapper) self.options.controlBarWrapper.css("display", "block").animate({"opacity": 1}) if ( typeof callback === "function" ) callback() } ) } /** * hides the overlay * @param callback {Function} function called when the overlay is hidden. */ Overlay.prototype.hide = function(callback) { var self = this // wait 50ms for the new scroll positions to be set. (negates any flicker.) setTimeout(function() { self.$node.animate( { opacity : 0 }, self.options.animationDuration, function() { self.$node.css("display", "none") self.isShown = false $("html").removeClass("overlay-open") window.scrollTo(self.position.x, self.position.y) if ( typeof callback === "function" ) callback() } ) }, 50) } /** * disposes of the overlay instance. * @param override {Boolean} forces the overlay to be disposed of even if still on screen. * @return {Boolean} false if the instance was successfully removed. */ Overlay.prototype.dispose = function(override) { var options = this.options , self = this // is the overlay is still showing do nothing unless override is truthy. if ( this.isShown && ! override && ! options.eventTopics ) { return false } if (this.isRendered) this.hide(dispose) else dispose() function dispose() { if ( ! options.eventTopics ) { delete instances[self.id] jQuery.removeData(self.$node, "overlay-instanceid") return !!instances[self.id] } else { PubSub.unsubscribe(self.renderToken) PubSub.publish("moduleStopped", self.instanceName) } } } /** * returns an overlay instance by Id, or all overlay instances. * @return {Object} the Overlay instance of to the overlay element. */ Overlay.prototype.getInstance = function() { return this } /** * changes the overlay view depending on the orientation */ Overlay.prototype.changeOrientation = function() { var $landscape = this.options.$landscape , $portrait = this.options.$portrait , orientation = ( window.innerWidth > window.innerHeight ) ? "landscape" : "portrait" if ( !$landscape || !$portrait ) return; if ( orientation === "portrait" ) { $portrait.css("display", "block") $landscape.css("display", "none") if ( this.options.onportrait ) { this.options.onportrait($portrait) } } else { $portrait.css("display", "none") $landscape.css("display", "block") if ( this.options.onlandscape ) { this.options.onlandscape($landscape) } } //if ( this.options.mobile ) window.scrollTo(0, 1) $("body").height($(window).height() + 200) //if ( this.options.mobile ) window.scrollTo(0, 0) } /** * calls the changeOrientation method for each overlay instance. */ function overlayOrientationChangeDelegate() { for ( var id in instances ) { if ( instances.hasOwnProperty(id) ) { instances[id].changeOrientation() } } } /** * method for getting an overlay instance with an instance id. * @param id {String|Number} the instance id. * @return {Object} an Overlay instance. * @public */ Overlay.getInstance = function(id) { return instances[id] } /** * calls a given method for all overlay instances. * @param method {String} the name of the method to call. * @public */ Overlay.allInstances = function(method) { if ( typeof method === "string" && typeof Overlay.prototype[method] === "function" ) { for ( var i in instances ) { if ( instances.hasOwnProperty(i) ) { instances[i][method].apply(instances[i], Array.prototype.splice.call(arguments, 1)) } } } else { throw new Error("Overlay has no such method " + method + ".") } } // construct an instance with array of arguments. // http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible function construct(args) { function OverlayConstructor() { return Overlay.apply(this, args) } OverlayConstructor.prototype = Overlay.prototype return new OverlayConstructor } /** * exposes Overlay as a jQuery plugin allowing each initialisation to create a new instance. * @usage: * >> create an overlay. * var $overlayContainerNode = $("
      ").overlay({view: $("
      ", {class: "defaultView"})}) * >> call show method on overlay instance. * $overlayContainerNode.overlay("show") * >> call dispose method for all overlay instances. * $.fn.overlay("allInstances", "dispose", true) */ $.fn.overlay = function(method) { var $this = $(this) , args = Array.prototype.slice.call(arguments) , instance = instances[$this.data("overlay-instanceid")] if ( instance && typeof Overlay.prototype[method] === "function" ) { return instance[method].apply(instance, args.slice(1)) } else if ( !instance && /^(undefined|object)$/.test(typeof method) ) { // ensure there is an options argument. args[0] = args[0] || {} // inject the jQuery context into the options. args[0].$this = $this // construct a Overlay instance. return construct(args) } else if ( ! instance && typeof method === "string" && typeof Overlay[method] === "function" ) { return Overlay[method].apply($this, args.slice(1)) } else { throw new Error("Method " + method + " is not implemented on Overlay.") } } // AMD definition. if ( typeof window.define === "function" ) { window.define("Overlay", function() { return Overlay }) } })(jQuery, window); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.overlay.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.social.js */ /*jshint camelcase:true, curly:false, eqeqeq:true, forin:true, latedef:false, newcap:true, nonew:false, noarg:true, noempty: true, boss:true, plusplus:true, quotmark:false, unused:true, strict:true, asi:true, laxcomma:true, debug:true, smarttabs:true, supernew:true */ /*global jQuery, Modernizr, PubSub */ ;(function($) { "use strict"; var instances = [] // used to store instances , instanceCounter = -1 // used to identify instances. // default options. var _options = { // method called when the close button is clicked. dismiss: null, // tracking data. analyticsData: { "InteractionList": [] }, translations: { Close: "Close", Like: "Like", Share: "Share", Download: "Download" }, // the number of ms to wait before automatically collapsing the widget on mouseout. waitDuration: 500, // animation speed animationSpeed: 200, // default to the top of a container verticalPosition: "top", // the order in which the social items are shown. socialItemsOrder: "close like share", // slides the social widget into view. slideIn: true } function enhancedAnimation(animation) { // base animation object to enable CSS3 animations. var _animation = {} return $.extend({}, _animation, animation) } // the encoded location of the current page. var href = encodeURIComponent(location.href) // default social items. var _socialItems = { close: '', like: '', share: { markup: '', // options for the share item. settings: { socialType: 1, title: $(".ca-section[data-id='NewLS'] .heading h2").text(), enableAnalytics: true, analyticsDefaults: _options.analyticsData, analyticsDynamicValSelector: '.cc-model-changer li.active div' } } } /** * the constructor method used for initialising the instance. * @param options {Object} the options object with which to configure the instance. * @param options.$context {jQueryObject} the jQuery context that the plugin was initialised with. * e.g. in $(".foo").pluginName(), $(".foo") will be passed as options.$context. * @param socialItems {Object} an object containing additional social items. (will extend _socialItems.) */ var SocialWidget = function(__options, socialItems) { var self = this this.isRendered = false // settings. var options = this.options = $.extend(true, {}, _options, __options) socialItems = $.extend({}, _socialItems, socialItems) // Merge analytics defaults... socialItems.share.settings.analyticsDefaults = $.extend({}, socialItems.share.settings.analyticsDefaults, __options.analyticsData); // register the instance. instances[instanceCounter += 1] = this if (options.$context) options.$context.data("cs-social-instanceid", instanceCounter) var $container = this.$container = $("
      ", { "class": "cs-social-wrapper" }) var $node = this.$node = $("
      ", { "class": "cs-social" }).appendTo($container) $(options.socialItemsOrder.split(" ")).each(function(i, item) { var $item = createItem( options.translations[item.charAt(0).toUpperCase() + item.substr(1)], item, socialItems[item], false, socialItems[item].heightOverride ).appendTo($node) if (item === "share") { if ($.fn.SocialTwitter && $.fn.SocialFacebook && $.fn.SocialGooglePlus) { $item.find(".social") .SocialTwitter(socialItems.share.settings) .SocialFacebook(socialItems.share.settings) .SocialGooglePlus(socialItems.share.settings) } } if (item === "close" && typeof options.dismiss === "function") { $item.click(options.dismiss) } else if (item === "close" && options.eventTopics.close) { $item.click(function() { PubSub.publish(options.eventTopics.close) return false }) } else { $item.click(function($e) { // do not trigger expansion / contraction for items within the expanding box. if ($($e.target).parents(".expanding").length) return; var $item = $e.target.tagName === "LI" ? $($e.target) : $($e.target).parents("li") self[$item.hasClass("active") ? "closeActive" : "expand"]($item) return false }) } }) // configure vertical position. switch (options.verticalPosition) { case "top": $container.css("top", "0") break; case "middle": $container.css("top", "50%").css("margin-top", "-" + (options.socialItemsOrder.split(" ").length * 30) + "px") break; case "bottom": $container.css("bottom", "0") } if (!Modernizr.touch) $node.hover(function() { self.open() }, function() { self.close() }) if (options.$context) { this.render() return options.$context } else { this.renderToken = PubSub.subscribe(options.eventTopics.render, function() { self.render() }) } } /** * renders the social widget. */ SocialWidget.prototype.render = function() { var $parent = this.options.renderTo ? $(this.options.renderTo) : this.options.$context , $container = this.$container.appendTo($parent) , self = this if (this.instanceName) $container.attr("id", this.instanceName) $parent.addClass("cc-spin-trigger") if (this.options.slideIn) { $container.animate( enhancedAnimation({ right: "0px" }), self.options.animationSpeed, function() { if (self.options.eventTopics) { PubSub.publish(self.options.eventTopics.rendered) } } ) } else { $container.css("right", "0px") } } /** * disposes of the social widget. * @param callback {Function} (optional) called once the widget has been disposed of. */ SocialWidget.prototype.dispose = function(callback) { var self = this , $node = self.$container , id = $node.parent().data("cs-social-instanceid") self.close(0) // slide out $node.animate( enhancedAnimation({ right: "-" + $node.width() + "px" }), self.options.animationSpeed, function() { if (id) { instances.splice(id, 1) $node.parent().removeData("cs-social-instanceid") } $node.remove() if (self.renderToken) PubSub.unsubscribe(self.renderToken) if (PubSub) PubSub.publish("moduleStopped", self.instanceName) if (callback) callback() } ) } /** * contracts the width of the social widget to a closed state. * @param n {Number} the amount of time in ms to wait before closing. */ SocialWidget.prototype.close = function(n) { var self = this self.timeout = setTimeout(function() { self.closeActive() self.$container.animate( enhancedAnimation({ width: 60 }), self.options.animationSpeed, function() { self.opened = self.options.timeout = false }) }, typeof n === "number" ? n : self.options.waitDuration) } /** * closes all expanded items in the social widget. * @param $item {jQueryObject} forces closeActive to close this item only. */ SocialWidget.prototype.closeActive = function($item) { var $active = $item || this.$container.find(".active") if (Modernizr.touch && $item) this.close(0) $active.find(".expanding").animate( enhancedAnimation({ height: 0 }), this.options.animationSpeed, function() { $active.removeClass("active") } ) } /** * expands the width of the social widget to an opened state. */ SocialWidget.prototype.open = function() { if (this.timeout) clearTimeout(this.timeout) this.$container.animate(enhancedAnimation({ width: 250 }), this.options.animationSpeed) this.opened = true } /** * expands the .expanding element within the SocialWidget item. * @param $item {jQueryObject} the (jQuery wrapped)
    • element to be expanded. */ SocialWidget.prototype.expand = function($item) { if (!this.opened) this.open() var $box = $item.find(".expanding") var analyticsData = $.extend(true, {}, this.options.analyticsData); analyticsData.InteractionList.push($item.attr('class') + ' - Opened'); $.analyticsEmitter.trackEvent(analyticsData); this.closeActive() $item.addClass("active") var height = $box.data("expanded-height") || 100 $box.animate(enhancedAnimation({ height: height }), this.options.animationSpeed) } /** * returns the SocialWidget instance for a given node. * Usage: * $(".foo").socialWidget() // create an instance on .foo * var instance = $(".foo").socialWidget("getInstance") // get the instance for .foo */ SocialWidget.prototype.getInstance = function() { return this; } /** * closes all SocialWidget instances. * @public */ SocialWidget.close = function() { for (var i in instances) { if (instances.hasOwnProperty(i)) { instances[i].close() } } } /** * gets the SocialWidget. * @return {SocialWidget} the SocialWidget constructor. * @public */ SocialWidget.getConstructor = function() { return SocialWidget; } /** * creates a social widget item. * @param title {String} the title of the item. * @param identifier (optional) {String} the class used to reference the item. * @param boxInner (optional) {String|HTMLElement} The contents of the expanded box. * @param url (optional) {String} url for the anchor. * @param heightOverride (optional) {Number} specifies the expanded height of the inner box. * @return {jQueryObject} a jQuery-wrapped HTMLLIElement. */ function createItem(title, identifier, boxInner, url, heightOverride) { url = url || "#" var item = $("
    • ", { "class": identifier }).html('' + title + '') if (boxInner) { item.append( $("
      ", { "class": "expanding" }).html(typeof boxInner === "string" ? boxInner : boxInner.markup) ) } if (heightOverride) { item.find(".expanding").data("expanded-height", heightOverride) } return item } $.fn.socialWidget = function(method) { var $this = $(this) , args = Array.prototype.splice.call(arguments, 0) , instance = instances[+$this.data("cs-social-instanceid")] if (instance && typeof SocialWidget.prototype[method] === "function") { return instance[method].apply(instance, args.splice(1)) } else if (!instance && /^(undefined|object)$/.test(typeof method)) { // ensure there is an options argument. args[0] = args[0] || {} // inject the jQuery context into the options. args[0].$context = $this // construct a Overlay instance. return construct(args) } else if (!instance && typeof method === "string" && typeof SocialWidget[method] === "function") { return SocialWidget[method].apply($this, args.splice(1)) } else { throw new Error("Method " + method + " is not implemented on SocialWidget.") } } // construct an instance with array of arguments. // http://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible function construct(args) { function SocialWidgetConstructor() { return SocialWidget.apply(this, args) } SocialWidgetConstructor.prototype = SocialWidget.prototype return new SocialWidgetConstructor } // AMD definition. if (typeof window.define === "function") { window.define("SocialWidget", function() { return SocialWidget }) } })(jQuery); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.social.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.spin.js */ /** * a parallax module. */ /*jshint asi: true, eqeqeq: true, noempty: true, strict: true, undef: false */ /*global jQuery: true */ ;(function($) { 'use strict'; // default options object. var options = { // the list element to use with the spinner. node: null, // a frames array override. will be an Array, with each element representing a single frame. frames: false, // define the naming structure of an image. // %i is replaced with the range index. pattern: "", // the range that determines the indexes of the loaded images. // the zeroth element is the first index, and the first element // will be the final index, everything in between will be iterated. range: [], // the number of places to pad the index to. e.g. 001 for the first index // id padIndex is set to 3, 0054 for the 54th index if the padIndex is set to 4. padIndex: 0, // the directory path to the image resource. e.g. path should be "images" // to prefix "images/" before all image names. path: "", // the index of the frame that's displayed when the spin is loaded. initialFrame: 0, // determines how frequently the frame is changed as the cursor/finger move horizontally. // the lower the integer the more sensitive the input. sensitivity: 7, // determines how quickly the inertial speed will be decayed. // range is between 1 and 0, where 1 will result in the inertia never decreasing // and 0 resulting in the inertia immediately becoming zero. friction: 0.035, // determines the amount of inertia that the model starts with. inertia: 0 }, // object to cache the model frames in. models = {}, // a list of frames. frames = [], // currently displayed frame's index. frameIndex, // the last clientX coordinate detected. lastX = null, // determines the direction of inertia. inertialDirection, touchTime, moveTime, touchPoint, socialWidgetInstance, // loading overlay. $loadingShroud = $("
      ").addClass("ci-throbberShroud"), // throbber. $throbber = $("
      ").appendTo($loadingShroud), $loadingPercent = $("").appendTo($throbber).text("0%"), // pads a number // @param n {Number} the number to pad. // @param padding {Number} the number of spaces to pad. padNumber = function(n, padding) { n = n.toString() var length = n.length if (length < padding) { for (var i = 0; i < (padding - length); i += 1) { n = "0" + n } } return n }, preventDefault = function(e) { e.preventDefault() }, disableScrolling = function() { document.removeEventListener("touchmove", preventDefault) }, enableScrolling = function() { document.addEventListener("touchmove", preventDefault) }, // loads the frames and injects them into the model node. // @param done {Function} called when the frames are loaded. loadFrames = function(done) { if (!models[options.path + options.pattern]) { $loadingShroud.css("display", "block") $loadingShroud.css("opacity", "1") options.node.append($loadingShroud) options.node.find("img").remove() var urls = [] if (options.pattern.length !== 0 && options.range.length === 2) { for (var i = options.range[0]; i <= options.range[1]; i += 1) { urls.push(options.path + '/' + options.pattern.replace("%i", padNumber(i, options.padIndex))) } } else { $.error("Cannot continue without a path and pattern.") } $throbber.attr("class", "ci-throbber") $loadingPercent.text("0%") $(document).imageLoader(urls, function(percent) { $throbber.addClass("p" + Math.round(percent / 10) * 10) $loadingPercent.text(percent.toFixed(0) + "%") }, function(_frames) { frames = _frames $(frames).each(function(i, frame) { $(frame).css("display", "none") $(frame).attr("draggable", "false") frame.onselectstart = function(e) { if (e.preventDefault) { e.preventDefault() } return false } $(options.node).append(frame) }) models[options.path + options.pattern] = _frames // display the initial model. $(frames[options.initialFrame]).css("display", "block") frameIndex = options.initialFrame $loadingShroud.css("opacity", "0") setTimeout(function() { $loadingShroud.css("display", "none") }, 500) if (typeof done === "function") { done(false) } }) } else { frames = models[options.path + options.pattern] $(frames).each(function(i, frame) { $(frame).css("display", "none") $(frame).attr("draggable", "false") frame.onselectstart = function(e) { if (e.preventDefault) { e.preventDefault() } return false } $(options.node).append(frame) }) // display the initial model. $(frames[options.initialFrame]).css("display", "block") frameIndex = options.initialFrame if ( done ) done() } }, startHandler = function(e) { if (Object.prototype.toString.call(e.target) === "[object HTMLLIElement]") { e.preventDefault() } e = e.originalEvent if (socialWidgetInstance.opened) { socialWidgetInstance.close() } if (Modernizr.touch && e.touches && e.touches.length === 1) { lastX = e.touches[0].clientX } else if (e.clientX) { lastX = e.clientX } else { lastX = null } touchPoint = lastX touchTime = new Date().getTime() $(options.node).bind("touchmove mousemove", moveHandler) return false }, // handles mouse and touch movement and passes the direction calculations on to moveTo. moveHandler = function(e) { e.preventDefault() e = e.originalEvent // prevent mouse events from interfering with touch events. if ( Modernizr.touch && e instanceof MouseEvent ) { return } // ensure that lastX was successfully set by the down/start event handler. if ( ! lastX ) { return } // find the distance of the input from the x axis on the left. var clientX = e.clientX || e.touches[0].clientX // if the clientX is > the last known distance plus the range, // then move to the next frame and set the last known x to the current x. if (clientX >= (lastX + options.sensitivity)) { moveTo(frameIndex - 1) lastX = clientX } // same as above, but determines negative motion and decrements the current frame. if (clientX <= (lastX - options.sensitivity)) { moveTo(frameIndex + 1) lastX = clientX } moveTime = new Date().getTime() return false }, endHandler = function(e) { $(options.node).unbind("touchmove mousemove", moveHandler) e = e.originalEvent // set the direction of inertia. inertialDirection = (touchPoint > lastX) ? 1 : 0 // determine the inertial speed. options.inertia = Math.abs( Math.round( Math.abs(touchPoint - lastX) / (touchTime - new Date().getTime()) ) ) // prevent inertia after model has been held in place for 600ms. if ( ( moveTime - touchTime ) > 500 ) { options.inertia = 0 } if (options.inertia !== 0) { animateInertia() } else { if (options.onmovement) { options.onmovement(frameIndex) } } return false }, // moves to a new position. // @param i {Number} the index of the model. moveTo = function(i) { // hide the current frame. $(frames[frameIndex]).css("display", "none") // check the index is within bounds. if (i < 0) { i += frames.length } else if (i >= frames.length) { i -= frames.length } $(frames[i]).css("display", "block") // set the new frame index. frameIndex = i }, // animates inertia. animateInertia = function() { options.inertia -= ( options.inertia * options.friction ) if (inertialDirection) { moveTo(frameIndex + Math.round(options.inertia) ) } else { moveTo(frameIndex - Math.round(options.inertia) ) } if ( Math.round( options.inertia ) !== 0 ) { requestAnimationFrame(animateInertia) } else { if ( options.onmovement ) { options.onmovement(frameIndex) } } }, // return the Spin object. methods = { init: function(_options) { _options.node = $(this) // augment the options with the initialisation object. options = $.extend({}, options, _options) return $(this) }, moveTo: moveTo, enable: function(done) { loadFrames(function(cached) { if ( ! socialWidgetInstance ) { socialWidgetInstance = options.node.parent().socialWidget("getInstance") } done && done() if ( !! Math.floor(options.inertia) ) { animateInertia() } else { if (options.onmovement) { options.onmovement(frameIndex) } } }) $(options.node).bind("mousedown touchstart", startHandler) $(options.node).bind("mouseup touchend", endHandler) return methods }, disable: function() { $(options.node).unbind("mousedown touchstart", startHandler) $(options.node).unbind("mouseup touchend", endHandler) return methods }, getCurrentFrame: function() { return frameIndex }, changeModel: function(_options, done) { var $node = options.node.empty() options = $.extend(options, _options) methods.enable(done) } } $.fn.parallaxSpin = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)) } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments) } else { $.error("No such method: " + method + " in parallaxSpin.") } } }) (jQuery) /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.spin.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.modelChanger.js */ // provides an interface for changing the car model. ;(function($) { var $modelChanger, disabled, $disable, analyticsData = { 'wtNav': 'Content Clicked', 'wtDl': '20' } var itemFactory = function(title, subtitle, url, callback) { var item = $("
    • ").append( $("
      ") .css("background-image", url) .append($("

      ").text(title)) .append($("

      ").text(subtitle)) ) if (url) { item.find("div").css("background-image", url) } var handler = function(e) { var target = e.target while (target.tagName !== "LI") { target = target.parentNode } if ($(target).hasClass("active")) { return } var evtAnalyticsData = $.extend({}, analyticsData, { 'InteractionList': ['Model Changed', $(target).text()] }); $.analyticsEmitter.trackEvent(evtAnalyticsData); $(".cc-info-pane").animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200) $modelChanger.find(".active").removeClass("active") var target = e.originalEvent.target || e.originalEvent.srcElement while (target.nodeName !== "LI") { target = target.parentNode } $(target).addClass("active") if (/(iphone|ipad)/i.test(navigator.userAgent)) { callback($.fn.parallaxSpin("getCurrentFrame")) } else { callback() } } item.click(handler) return item } var methods = { init: function(options) { analyticsData = $.extend({}, analyticsData, options.analyticsData); $modelChanger = $("
        ").addClass("cc-model-changer").appendTo($(this)) $disable = $("
        ").addClass("disable").appendTo($modelChanger) // only disable the model switcher for flash. if (!$("html").hasClass("mobileSafari")) { methods.disable() } $(options.models).each(function(i, model) { var $item = itemFactory(model.title, model.subtitle, model.imageUrl, model.callback) if (model.active) { $item.addClass("active") } if ($("html").hasClass("oldie")) { $item.height($modelChanger.height()) } $modelChanger.append($item) }) }, enable: function() { if (disabled) { disabled = false $disable.animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200, function() { $disable.css("display", "none") }) } }, disable: function(n) { if (!disabled) { disabled = true $disable.css("display", "block").animate({ opacity: (typeof n === "number") ? n : 0.8, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200) } } } $.fn.modelChanger = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)) } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments) } else { $.error("No such method: " + method + " in overlay.") } } })(jQuery) /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.modelChanger.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.infoPanes.js */ ;(function($) { var info = [], $modelChangerItems, $controlBarWrapper, $infoPane, $factNumber, $factText, fact, analyticsData, spinTracked = '', // returns the fact for a given frame. getFact = function(frame) { var _fact for (var i = 0; i < info.length; i += 1) { if (frame >= info[i].range[0] && frame <= info[i].range[1]) { _fact = info[i] break } } return { text: _fact, index: i } }, adjustSize = function(callback) { if (!$modelChangerItems) { $modelChangerItems = $(".cc-model-changer > li") } // five lines or more. if ($factText.height() >= 55) { $factText.css("padding-top", 0) $modelChangerItems.add($controlBarWrapper).animate({ height: $factText.height() + 20, avoidCSSTransitions: false, useTranslate3d: false, avoidTransforms: false }, 100, callback) $factNumber.parent().css("margin-top", "10px") return // four lines. } else if ($factText.height() >= 40) { $factText.css("padding-top", 0) $modelChangerItems.add($controlBarWrapper).animate({ height: $factText.height() + 20, avoidCSSTransitions: false, useTranslate3d: false, avoidTransforms: false }, 100, callback) $factNumber.parent().css("margin-top", "5px") return // less than four lines } else { $modelChangerItems.add($controlBarWrapper).animate({ height: 60, avoidCSSTransitions: false, useTranslate3d: false, avoidTransforms: false }, 100, function() { $factNumber.parent().css("margin-top", "0px") // vertically centre the fact text. $factText.css("padding-top", (($controlBarWrapper.height() - $factText.height()) / 2) - 10) callback() }) return } }, methods = { init: function(_info) { info = _info.panes analyticsData = _info.analyticsData; $infoPane = $("
          ") .addClass("cc-info-pane") .append( $("
        1. ") .addClass("fact-number") .html("

          " + _info.factText + "

          10

          ") ).append( $("
        2. ") .addClass("fact") .html("

          ") ) $factNumber = $infoPane.find("h1") $factText = $infoPane.find("p") $controlBarWrapper = $(".controlBarWrapper") $infoPane.css("opacity", "0") $(this).append($infoPane) }, changeFact: function(frame) { if (frame.toString() === "NaN") { console.trace() } // get the fact for the current frame. var _fact = getFact(frame) if (fact === _fact.text) { $(".cc-info-pane").animate({ opacity: 1, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200) return } else { fact = _fact.text; var currentModel = $('.cc-model-changer li.active div').text(); if (frame > 1 && spinTracked.indexOf(currentModel + ',') == -1) { var evtAnalyticsData = $.extend({}, analyticsData, { 'InteractionList': ['Model Spun', currentModel] }); $.analyticsEmitter.trackEvent(evtAnalyticsData); spinTracked += currentModel + ','; } } setTimeout(function() { $factNumber.text(_fact.index + 1) $factText.text(fact.text) adjustSize(function() { $factNumber.add($factText).add($infoPane).animate({ opacity: 1, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200) }) }, 200) $factNumber.add($factText).add($infoPane).animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 200) }, updateFacts: function(facts) { info = facts } } $.fn.infoPanes = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)) } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments) } else { $.error("No such method: " + method + " in overlay.") } } })(jQuery) /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.infoPanes.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.imageLoader.js */ /*jshint camelcase:true, curly:false, eqeqeq:true, forin:true, latedef:false, newcap:true, nonew:false, noarg:true, noempty: true, boss:true, plusplus:true, quotmark:true, unused:true, strict:true, asi:true, laxcomma:true, debug:true, smarttabs:true, supernew:true */ /*global jQuery */ ;(function( $ ) { // preload loading throbber. (I know.) $(new Image()).attr("src", "/img/glb/cc-spin/co-throbber.png"); var getPercent = function(loaded, failed, total) { return ((loaded + failed) / total) * 100 } var methods = { // initialises an image loader. // @param urls {Array} a list of image urls. // @param each {Function} called for each image that's loaded. // @param done {Function} called when all images have loaded. init: function(urls, each, done) { // array of images loaded. var images = $.isArray(this) ? this : [], count = urls.length, loaded = 0, failed = 0, percent = 0 $(urls).each(function(i, url) { var img = new Image() $(img).load(function() { loaded += 1 percent = getPercent(loaded, failed, count) if (percent === 100) { if ( done ) done(images) } else { if ( each ) each(percent, true, url) } }) $(img).error(function() { failed += 1 percent = getPercent(loaded, failed, count) if (percent === 100) { if ( done ) done(images) } else { if ( each ) each(percent, false, url) } }) img.src = url images.push(img) }) } } $.fn.imageLoader = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)) } else if (typeof method === 'object' || !method) { return methods.init.apply(this, arguments) } else { $.error("No such method: " + method + " in overlay.") } } }) (jQuery) /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\common.imageLoader.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.spinLauncher.js */ /*jshint camelcase:true, curly:false, eqeqeq:true, forin:true, latedef:false, newcap:true, nonew:false, noarg:true, noempty: true, boss:true, plusplus:true, unused:true, strict:true, asi:true, laxcomma:true, debug:true, smarttabs:true, supernew:true */ /*global jQuery:false, SWFAddress:false, PubSub:false, Modernizr:false */ ;(function($) { "use strict"; $.fn.parallaxSpinLauncher = function(options) { var ls = options, // detect the mobile version. isMobile = $(".m-l-container-12").length !== 0, // detect the isTablet version. isTablet = /mobile/i.test(navigator.userAgent) && !isMobile, // detect the isDesktop version. isDesktop = !/mobile/i.test(navigator.userAgent) && !isMobile, informationPaneData, $configElem = $(this), // wrapper for the control bar. $controlBarWrapper = $("
          ").addClass("controlBarWrapper"), // control bar at the bottom of the window. $controlBar = $("
          ").addClass("controlBar").appendTo($controlBarWrapper), bannerIsExpanded = false, analyticsData = { "ModuleCategory": "Component", "PageModuleName": "LSSpin", "NavigatedSectionName": "LSSpin" }, $overlay, flash = function() { // contains the viewport div. var $viewport, // contains the parallax. $view, // contains the original contents of the banner. $container, // banner element that expands into the parallax. $expandingBanner, // keeps the loaded status of the model changer. modelChangerLoaded = false, centreView = function() { if (bannerIsExpanded) { if (Modernizr.touch) $("body").css("overflow-x", "hidden") if ($(window).width() >= 1366) { $expandingBanner.width("1366px") } else if ($(window).width() >= 680) { $expandingBanner.width($(window).width() - 18) } if ($(window).width() >= 680) { $expandingBanner.find(".flash").css("margin-left", (($expandingBanner.width() - $viewport.width()) / 2) + "px"); } if (Modernizr.touch) $("body").css("overflow-x", "auto") } }, // expands the banner. expandBanner = function() { if (bannerIsExpanded) { return } else { bannerIsExpanded = true $.analyticsEmitter.trackEvent(analyticsData); } $container = $expandingBanner.find(".container") $("html:not(:animated),body:not(:animated)").animate({ scrollTop: $configElem.position().top - 50 }, 500, "swing", function() { $container.animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 400, function() { $expandingBanner.animate({ height: 768, width: ($(window).width() > 1366) ? 1366 : $(window).width() - 18, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 800, function() { if ($expandingBanner.data("cs-social-instanceid")) { $expandingBanner.socialWidget("getInstance").$container.css("opacity", "0").animate({ opacity: 1 }, 400) } else { $expandingBanner.socialWidget({ dismiss: contractBanner, analyticsData: analyticsData, translations: ls.translations }).css("opacity", "0").animate({ opacity: 1 }, 400) } $viewport.css("display", "block").animate({ opacity: 1, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 400) setTimeout(function() { centreView() }, 400) $controlBarWrapper.css("display", "block").animate({ opacity: 1, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 400) if (!modelChangerLoaded) { modelChangerLoaded = true $controlBar.modelChanger({ models: [{ title: "LS", subtitle: "F Sport", imageUrl: "url(/img/glb/LS-FSPORT_tcm864-1168596.png)", callback: function() { SWFAddress.setValue("/exterior/LSMCF") }, active: !/LSMC$/.test(location.href) }, { title: "LS", imageUrl: "url(/img/glb/LS_tcm864-1168595.png)", callback: function() { SWFAddress.setValue("/exterior/LSMC") }, active: /LSMC$/.test(location.href) } ], analyticsData: analyticsData }) } }) }) }); return false }, contractBanner = function() { if (!bannerIsExpanded) { return } else { bannerIsExpanded = false } $(document).socialWidget("close") var socialWidgetInstance = $expandingBanner.socialWidget("getInstance") socialWidgetInstance.$container.animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 300) socialWidgetInstance.close(0) $controlBarWrapper.animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 300, function() { $controlBarWrapper.css("display", "none") }) $viewport.animate({ opacity: 0, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 300, function() { $viewport.css("display", "none") setTimeout(function() { $container.animate({ opacity: 1, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 400) }, 800) $expandingBanner.animate({ width: 680, height: 250, avoidCSSTransitions: false, useTranslate3d: true, avoidTransforms: false }, 800) $expandingBanner.socialWidget("dispose") $expandingBanner.removeData("cs-social-instanceid") }) return false }, modelLoaded = { LSMC: false, LSMCF: false }, // event handler methods for the flash parallax. events = { // called when the flash element is embedded in the page. embedded: function(msg, data) { // set the view. $view = $(data.ref) }, // called when the parallax is transitioning between models. // @param msg {String} event name. // @param data {Object} contains event data. menu: function(msg, data) { if (data.enabled && modelLoaded.LSMC && modelLoaded.LSMCF) { $(document).modelChanger("enable") } else { $(document).modelChanger("disable") } }, // handles modelLoaded event. modelLoaded: function(msg, data) { modelLoaded[data.guid] = true if (modelLoaded.LSMC && modelLoaded.LSMCF) { $(document).modelChanger("enable") } }, // called when the movement: function(msg, data) { $.fn.infoPanes("changeFact", data.frame) } }, // options for the embedded flash. options = { id: "parallax", configxml: $configElem.data("configxml"), contentxml: $configElem.data("contentxml"), applicationswf: $configElem.data("applicationswf"), width: "1366px", height: "768px", wmode: "transparent" } // embed the flash video. $viewport = $('
          ') $expandingBanner = $configElem $viewport.appendTo($expandingBanner).css("display", "none") // subscribe to flash events. PubSub.subscribe('flash.event.embedded.parallax', events.embedded) PubSub.subscribe('flash.event.menu.parallax', events.menu) PubSub.subscribe('flash.event.frameChanged.parallax', events.movement) PubSub.subscribe('flash.event.modelLoaded.parallax', events.modelLoaded) // append the control bar. $controlBarWrapper.appendTo($expandingBanner) // centre the flash when the window resizes. $(window).bind("resize", centreView) $viewport.flashEmbed(options) // bind click to the expanding banner. $expandingBanner.click(expandBanner) }, html5 = function() { if (isMobile) $controlBarWrapper.addClass("mobile") /* Lanscape elements. */ var $images, centreView = function(reloadImages) { if (!$images || reloadImages) { $images = $(".cc-spin > img") $.fn.modelChanger("enable") } var margin = ($parallax.height() - $($images[0]).height()) / 2 $images.each(function() { $(this).css("margin-top", margin) }) }, LSMC = { pattern: isDesktop || isTablet ? $configElem.data("htmlimagepatternlsmc") : $configElem.data("htmlmobileimagepatternlsmc"), padIndex: 3, path: $configElem.data("htmlimagelocation"), range: isDesktop || isTablet ? [0, 71] : [0, 35], initialFrame: 0, onmovement: function(frame) { $.fn.infoPanes("changeFact", frame) } }, LSMCF = $.extend({}, LSMC, { pattern: isDesktop || isTablet ? $configElem.data("htmlimagepatternlsmcf") : $configElem.data("htmlmobileimagepatternlsmcf") }) // create the parallax. var $parallax = $("
          ").addClass("cc-spin landscape").parallaxSpin(LSMCF) $controlBar.modelChanger({ models: [{ title: "LS", subtitle: "F Sport", imageUrl: "url(/img/glb/LS-FSPORT_tcm864-1168596.png)", callback: function(currentFrame) { LSMCF.initialFrame = currentFrame $(document).parallaxSpin("changeModel", LSMCF, function() { centreView(true) }) }, active: true }, { title: "LS", subtitle: "", imageUrl: "url(/img/glb/LS_tcm864-1168595.png)", callback: function(currentFrame) { LSMC.initialFrame = currentFrame $(document).parallaxSpin("changeModel", LSMC, function() { centreView(true) }) } }], analyticsData: analyticsData }) // centre the flash when the window resizes. $(window).bind("resize", centreView) /* Portrait elements. */ var $portrait = $("
          ").addClass("portrait"), $galleryOrientationMessage = $("

          ").addClass("orientationMessage") $.ajax({ url: $configElem.data('htmlgallery') }).done(function(data) { var text = isMobile ? $(data).find(".header h1").html() : $(data).find(".ajaxable .heading h2").html() $galleryOrientationMessage = $galleryOrientationMessage.html(text).prepend("") $(data).find(".ajaxable").appendTo($portrait).css('margin-top', '0px').css('padding-top', '0px').find(".heading").remove(); }) /* Agnostic elements. */ $overlay = $("
          ").overlay({ landscape: $parallax, portrait: $portrait, controlBarWrapper: $controlBarWrapper, autorender: true, onclose: function() { $.fn.socialWidget("close") $.fn.parallaxSpin("disable") $overlay.overlay("dispose") }, onlandscape: function() { $.fn.parallaxSpin("enable", function() { setTimeout(centreView, 200) }) $galleryOrientationMessage.css("display", "none") $controlBar.css("display", "block") $controlBarWrapper.removeClass("portrait") $controlBarWrapper.addClass("landscape") }, onportrait: function() { $.fn.parallaxSpin("disable") $galleryOrientationMessage.css("display", "block") $controlBar.css("display", "none") $controlBarWrapper.addClass("portrait") $controlBarWrapper.removeClass("landscape") } }).appendTo("body") $overlay.socialWidget({ dismiss: function(e) { e.preventDefault() $overlay.overlay("hide") }, translations: ls.translations, analyticsData: analyticsData }) $controlBarWrapper.append($galleryOrientationMessage) $configElem.click(function() { $overlay.overlay("show") return false }) } $.getJSON($configElem.data('infopanejson'), function(data) { informationPaneData = data // transform info snippet range for 145 frames. if (isDesktop && Modernizr.flash) { informationPaneData.panes = $(informationPaneData.panes).map(function(i, pane) { return { text: pane.text, range: [ (pane.range[0] === 0) ? 1 : pane.range[0] * 2, ((pane.range[1] + 1) * 2) === 144 ? 145 : (pane.range[1] * 2) + 1] } }) } informationPaneData.analyticsData = analyticsData; if (!isMobile) $controlBar.infoPanes(informationPaneData) }) if (isDesktop && Modernizr.flash) { flash() } else { html5() } } // disable jquery-animate-enhanced globally. $.toggleDisabledByDefault() })(jQuery) /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc-spin\carconfigurator.spinLauncher.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.flip.js */ /*jshint camelcase:true, curly:false, eqeqeq:true, forin:true, latedef:false, newcap:true, nonew:false, noarg:true, noempty: true, boss:true, plusplus:true, quotmark:false, unused:true, strict:true, asi:true, laxcomma:true, debug:true, smarttabs:true, supernew:true */ /*global jQuery:false */ ;(function($, window, document) { "use strict"; // default options. var _options = { // determines how long (in seconds) the flip (or legacy fade-in-out) transition will take. animationDuration: 0.5, // overrides the transition to default to legacy-compliant fade-in-out. forceLegacy: false, // allows the entire card (DOM structure with a .container element with two // child elements of equal size having classes .front and .back respectively.) cardIsTrigger: true } var publicMethod = {} , vendorPrefix = getVendorPrefix() , legacyMode = /^(false|o|ms)$/i.test(vendorPrefix) // maintain reference to the last flipped node. var lastFlipped = null , $nav = $(".cs-secondary-nav") /** * initialisation method. * @param options {Object} options overrides. * @param options::animationDuration {Number} duration of the content change animation. * @param options::forceLegacy {Boolean} force all content transitions to be legacy-compatible. */ publicMethod.init = function(options) { options = typeof options === "object" ? $.extend({}, _options, options) : _options return this.each(function() { var $this = $(this) , $triggers = $this.find(".flip") , faces = { front: $this.find(".front"), back: $this.find(".back") } // give the faces indexes. faces[0] = faces.front; faces[1] = faces.back // configure the container. if (!legacyMode && !options.forceLegacy) { initialiseFlip.call(this, options, faces) } if (options.cardIsTrigger) { $this.click(changeHandler) } else if ($triggers.length) { $this.delegate($triggers.selector, "click", function() { changeHandler.call($this) return false }) } /** * changes the face using the appropriate method. */ function changeHandler() { if (lastFlipped && lastFlipped.faces.front !== faces.front) { ; ((legacyMode || options.forceLegacy) ? fadeToContent : flipToContent).call(this, lastFlipped.options, lastFlipped.faces) } ; ((legacyMode || options.forceLegacy) ? fadeToContent : flipToContent).call(this, options, faces) return false } }) } /** * performs a 3d flip from one face to another. * @this {jHTMLElement} the card jQuery element. */ function flipToContent(options, faces) { if ( /safari/i.test(navigator.userAgent) && $nav.length ) { $nav.css("-webkit-transform", "translate3d(0px, 0px, 100000px)") } var back = faces.back[0] , front = faces.front[0] , $this = $(this) $this.css("z-index", "100") // ensure the flipping card is above other cards. if (back.style[vendorPrefix + "Transform"] === "rotateY(-180deg)") { front.style[vendorPrefix + "Transform"] = "rotateY(180deg)" back.style[vendorPrefix + "Transform"] = "rotateY(0deg)" // set z-index. front.style.zIndex = "800" back.style.zIndex = "900" lastFlipped = { faces: faces, options: options } } else { front.style[vendorPrefix + "Transform"] = "rotateY(0deg)" back.style[vendorPrefix + "Transform"] = "rotateY(-180deg)" // set z-index. front.style.zIndex = "900" back.style.zIndex = "800" lastFlipped = null } setTimeout(function() { // revert to the default z-index. $this.css("z-index", "1") }, options.animationDuration * 1000) } /** * performs a fade-in-out transition from one face to another. * @this {jHTMLElement} the card jQuery element. * @param options {Object} options from the scope used to initialise the card. * @param faces {Object} front and back face jQuery elements. */ function fadeToContent(options, faces) { var toShow = faces.front.css("z-index") == 900 ? 1 : 0 , toHide = +!toShow faces[toHide].animate({ opacity: 0 }, options.animationDuration * 1000, function() { faces[toShow].css("z-index", "900") faces[toHide].css("z-index", "800") faces[toHide].css("opacity", "1") if (faces[toShow] === faces.front) { lastFlipped = null } else { lastFlipped = { faces: faces, options: options } } }) } /** * initialises the structure for 3d flip. * @param options {Object} the options for the current scope. * @param faces {Object} the two faces. */ function initialiseFlip(options) { var $this = $(this) , $back = $this.find(".back") , $front = $this.find(".front") $this.addClass("supported") $front[0].style[vendorPrefix + "Transform"] = "rotateY(0deg)" $back[0].style[vendorPrefix + "Transform"] = "rotateY(-180deg)" // set the transition properties on the next tick. setTimeout(function() { $back.add($front).each(function() { this.style[vendorPrefix + "Transition"] = "all " + options.animationDuration + "s linear" }) }, 0) } /** * gets the vendor prefix for CSS3 transitions. * @return {String|Boolean} vendor prefix. */ function getVendorPrefix() { // create temporary node to test against. var tmp = document.createElement("div") , prefixMap = ["webkit", "Moz", "ms", "O", ""] for (var i = 0; i < prefixMap.length; i += 1) { if (prefixMap[i] + "Transition" in tmp.style) { return prefixMap[i] } } return false } // expose the plugin on the jQuery object. $.fn.flip = function(method) { if (publicMethod[method]) { return publicMethod[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method === 'object' || !method) { return publicMethod.init.apply(this, arguments); } else { $.error('Method ' + method + ' does not exist on jQuery.flip'); } }; })(jQuery, window, document); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\jquery.flip.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc5\plugins\Sprite3D.js */ /* * Sprite3D.js * Visit the internets for documentation, updates and examples. * https://github.com/boblemarin/Sprite3D.js * http://minimal.be/lab/Sprite3D * * Copyright (c) 2010 boblemarin emeric@minimal.be http://www.minimal.be * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /** * Creates an instance of Sprite3D * * @constructor * @author boblemarin * @this {Sprite3D} * @param {Object} element The DOM element to wrap the Sprite3D object around. When no element is provided, a empty div is created and added to the document. */ function Sprite3D(element) { if ( !Sprite3D.prototype._isInit ) Sprite3D.isSupported(); // private variables var p = "", s = "", rx = "", ry = "", rz = "", ts = "", i, alpha = 1; // listeners = {}; this.listeners = {}; // create an empty
          if no element is provided if (element == null) { element = document.createElement("div"); } // prepare for 3D positionning element.style[ this._browserPrefix + "TransformStyle" ] = "preserve-3d"; element.style.margin = "0px"; element.style.padding = "0px"; element.style.position = "absolute"; // trigger hardware acceleration even if no property is set element.style[ this._transformProperty ] = "translateZ(0px)"; // debug style //element.style.border = '1px solid red'; this.domElement = element; this.style = element.style; this.children = []; } /** The X-axis position of the Sprite3D */ Sprite3D.prototype.x = 0; /** The Y-axis position of the Sprite3D */ Sprite3D.prototype.y = 0; /** The Z-axis position of the Sprite3D */ Sprite3D.prototype.z = 0; /** The X-axis rotation of the Sprite3D */ Sprite3D.prototype.rotationX = 0; /** The Y-axis rotation of the Sprite3D */ Sprite3D.prototype.rotationY = 0; /** The Z-axis rotation of the Sprite3D */ Sprite3D.prototype.rotationZ = 0; /** The X-axis scale of the Sprite3D */ Sprite3D.prototype.scaleX = 1; /** The Y-axis scale of the Sprite3D */ Sprite3D.prototype.scaleY = 1; /** The Z-axis scale of the Sprite3D */ Sprite3D.prototype.scaleZ = 1; /** The width of the HTML element associated with the Sprite3D object */ Sprite3D.prototype.width = 0; /** The height of the HTML element associated with the Sprite3D object */ Sprite3D.prototype.height = 0; /** The X-axis registration point of the Sprite3D object used for 3D positionning */ Sprite3D.prototype.regX = 0; /** The Y-axis registration point of the Sprite3D object used for 3D positionning */ Sprite3D.prototype.regY = 0; /** The Y-axis registration point of the Sprite3D object used for 3D positionning */ Sprite3D.prototype.regZ = 0; /** The width (in pixels) of the tiles in the spritesheet */ Sprite3D.prototype.tileWidth = 0; /** The height (in pixels) of the tiles in the spritesheet */ Sprite3D.prototype.tileHeight = 0; /** A reference to the DOM element associated with this Sprite3D object */ Sprite3D.prototype.domElement = null; /** A reference to the CSS style object of the DOM element */ Sprite3D.prototype.style = null; /** An array holding references of the Sprite3D's children object */ Sprite3D.prototype.children = []; /** The number of child objects */ Sprite3D.prototype.numChildren = 0; /** A boolean value to decide in which order transformations are applied. If true, rotations are applied before translations. If false, translations are applied before rotations. For a more accurate control over transformations order, you should use the transformString property. This property is now BROKEN. */ Sprite3D.prototype.rotateFirst = false; /** The transform string. You can use this property to fine control the order in which transformations are applied. * The following values will be replaced by their respective transformations : * _p for position/translations * _s for scaling * _rx for rotationX * _ry for rotationY * _rz for rotationZ * Example: sprite.transformString = "_rx _ry _rz _p _s"; */ Sprite3D.prototype.transformString = "_p _rx _ry _rz _s"; /** * Sets the value of the transformString property, allowing to control transformations order. * A valid value may be "_rx _ry _rz _p _s". See the transformString property for more informations. * @param {String} ts The string that will be used to swap * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setTransformString = function(ts) { this.transformString = ts; return this; }; /** * Sets the X-axis position of the Sprite3D. * @param {Number} px The position * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setX = function(px) { this.x = px; return this; }; /** * Sets the Y-axis position of the Sprite3D. * @param {Number} py The position * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setY = function(py) { this.y = py; return this; }; /** * Sets the Z-axis position of the Sprite3D. * @param {Number} pz The position * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setZ = function(pz) { this.z = pz; return this; }; /** * Sets the 3D position of the Sprite. * @param {Number} px The position on the X-axis * @param {Number} py The position on the Y-axis * @param {Number} pz The position on the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setPosition = function(px, py, pz) { this.x = px; this.y = py; this.z = pz; return this; }; /** * Applies a relative translation in 3D space on the X-axis. * @param {Number} px The value of the translation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.moveX = function(px) { this.x += px; return this; }; /** * Applies a relative translation in 3D space on the Y-axis. * @param {Number} py The value of the translation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.moveY = function(py) { this.y += py; return this; }; /** * Applies a relative translation in 3D space on the Z-axis. * @param {Number} pz The value of the translation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.moveZ = function(pz) { this.z += pz; return this; }; /** * Applies a relative translation in 3D space. * @param {Number} px The value of the translation on the X-axis * @param {Number} py The value of the translation on the Y-axis * @param {Number} pz The value of the translation on the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.move = function(px, py, pz) { this.x += px; this.y += py; this.z += pz; return this; }; /** * Sets the amount of rotation around the X-axis of the Sprite3D. * @param {Number} rx The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRotationX = function(rx) { this.rotationX = rx; return this; }; /** * Sets the amount of rotation around the Y-axis of the Sprite3D. * @param {Number} ry The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRotationY = function(ry) { this.rotationY = ry; return this; }; /** * Sets the amount of rotation around the Z-axis of the Sprite3D. * @param {Number} rz The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRotationZ = function(rz) { this.rotationZ = rz; return this; }; /** * Sets the 3D rotation of the Sprite. * @param {Number} rx The rotation around the X-axis * @param {Number} ry The rotation around the Y-axis * @param {Number} rz The rotation around the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRotation = function(rx, ry, rz) { this.rotationX = rx; this.rotationY = ry; this.rotationZ = rz; return this; }; /** * Applies a relative rotation in 3D space around the X-axis. * @param {Number} rx The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.rotateX = function(rx) { this.rotationX += rx; return this; }; /** * Applies a relative rotation in 3D space around the Y-axis. * @param {Number} ry The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.rotateY = function(ry) { this.rotationY += ry; return this; }; /** * Applies a relative rotation in 3D space around the Z-axis. * @param {Number} rz The value of the rotation * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.rotateZ = function(rz) { this.rotationZ += rz; return this; }; /** * Applies a relative rotation in 3D space. * @param {Number} rx The value of the rotation around the X-axis * @param {Number} ry The value of the rotation around the Y-axis * @param {Number} rz The value of the rotation around the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.rotate = function(rx, ry, rz) { this.rotationX += rx; this.rotationY += ry; this.rotationZ += rz; return this; }; /** * Sets the scaling of the Sprite3D object on the X-axis. * @param {Number} sx The value of the scaling on the X-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setScaleX = function( sx ) { this.scaleX = sx; return this; }; /** * Sets the scaling of the Sprite3D object on the Y-axis. * @param {Number} sy The value of the scaling on the Y-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setScaleY = function( sy ) { this.scaleY = sy; return this; }; /** * Sets the scaling of the Sprite3D object on the Z-axis. * @param {Number} sz The value of the scaling on the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setScaleZ = function( sz ) { this.scaleZ = sz; return this; }; /** * Sets the scaling of the Sprite3D object on the 3 axis. * @param {Number} sx The value of the scaling on the X-axis * @param {Number} sy The value of the scaling on the Y-axis * @param {Number} sz The value of the scaling on the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setScale = function( sx, sy, sz ) { this.scaleX = sx; this.scaleY = sy; this.scaleZ = sz; return this; }; /** * Sets the registrations point for the Sprite3D object. * By default, CSS positionning is relative to the top left corner of the element. * The registration point values are simply substracted from the position when applied * @param {Number} rx The registration point value for the X-axis * @param {Number} ry The registration point value for the Y-axis * @param {Number} rz The registration point value for the Z-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRegistrationPoint = function(rx, ry, rz) { this.regX = rx; this.regY = ry; this.regZ = rz; return this; }; /** * Sets the origin of the 3D transforms. * By default, CSS transforms are relative to the center of the element. * @param {Number} px The transform origin value for the X-axis * @param {Number} py The transform origin value for the Y-axis * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setTransformOrigin = function(px, py) { // this.style.webkitTransformOrigin = px + " " + py; this.style[ this._browserPrefix + "TransformOrigin" ] = px + " " + py; return this; }; /** * Sets the size of the HTML element linked to the Sprite3D object, using the width and height css properties. * Note that animating using these properties does not provide an optimal performance. * You should rather try to use CSS scale using the scale() method * This method applies the changes to the style object, so it does not require a call to the update methods * @param {Number} width The desired width * @param {Number} height The desired height * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setSize = function(width, height) { this.style.width = (this.width = width) + "px"; this.style.height = (this.height = height) + "px"; return this; }; /** * Sets the opacity of the element. * This method applies the changes to the style object, so it does not require a call to the update methods * @param {Number} alpha The desired opacity, ranging from 0 to 1 * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setOpacity = function(alpha) { this.style.opacity = this.alpha = alpha; return this; }; /** * Returns the opacity of the element. * @return {Number} The opacity of the element */ Sprite3D.prototype.getOpacity = function() { return this.alpha; }; /** * Sets the CSS class name of the DOM element associated with the Sprite3D object. * When applying multiple class names, provide a single string with space-separated class names like you would do in pure CSS manipulation. * This method does not require a call to the update methods. * @param {String} className The name of the class to be set * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setClassName = function(className) { this.domElement.className = className; return this; }; /** * Returns the name of the CSS class of the DOM element. * @return {String} The CSS class name */ Sprite3D.prototype.getClassName = function() { return this.domElement.className; }; /** * Adds a CSS class to the DOM element * This method does not require a call to the update methods. * @param {String} className The name of the class to be added * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.addClassName = function(className) { this.domElement.className += " " + className + " "; return this; }; /** * [BETA] Removes a CSS class from the DOM element * This method does not require a call to the update methods. * @param {String} className The name of the class to be removed * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.removeClassName = function(className) { this.domElement.className = this.domElement.className.replace(className, ''); //this.domElement.className += " " + className; return this; }; /** * Sets the ID of the DOM element in the document. * This method is just a helper allowing neverending chaining in the Sprite3D creation syntax. * You can also simply access the domElement property of the Sprite3D and set its id property. * This method does not require a call to the update methods. * @param {String} id The ID * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setId = function(id) { this.domElement.id = id; return this; }; /** * Returns the ID of the DOM element associated with the Sprite3D. * @return {String} The CSS class name */ Sprite3D.prototype.getId = function() { return this.domElement.id; }; /** * Allows to set any value in any CSS property of the style object of the DOM element. * This method is just a helper allowing neverending chaining in the Sprite3D creation syntax. * For one time modifications, you can simply use the style property of the Sprite3D. * This method does not require a call to the update methods. * @param {String} name The name of the CSS property in which the value will be stored * @param {String} value The value to assign to the property * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setCSS = function(name, value) { this.domElement.style[name] = value; return this; }; /** * Returns the value assigned to the provided CSS property. * @param {String} name The name of the property to get the value from * @return {String} The value of the CSS property */ Sprite3D.prototype.getCSS = function(name) { return this.domElement.style[name]; }; /** * Allows direct write access to the innerHTML property of the DOM element. * @param {String} value The string to write into the innerHTML property * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setInnerHTML = function(value) { this.domElement.innerHTML = value; return this; }; /** * Sets the size of the tiles in the spritesheet used as background image. * @param {Number} width The desired width * @param {Number} height The desired height * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setTileSize = function(width, height) { this.tileWidth = width; this.tileHeight = height; return this; }; /** * Modifies the sprites's background image position to display the selected tile. * For this method to work, you are supposed to set a background image and limit the size of the element using CSS styles, * and use a sprite sheet where all tiles have the same size. No checking is performed on the provided values. * @param {Number} tilePosX The horizontal index of the tile to be displayed * @param {Number} tilePosY The vertical index of the tile to be displayed * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setTilePosition = function(tilePosX, tilePosY) { this.style.backgroundPosition = "-" + (tilePosX * this.tileWidth) + "px -" + (tilePosY * this.tileHeight) + "px"; return this; }; /** * Allows to set a arbitary property value while using the chaining syntax. * @param {String} label The name of the property * @param {Object} value The value for that property * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setProperty = function(label, value) { this[label] = value; return this; }; /** * Sets the order in which transformations are applied. * If true, rotations are applied before translations. If false, translations are applied before rotations. * Note that, when applying rotations, the axis of the object rotate, and subsequent translations follow the modified orientation of the axis. * For a more accurate control, you should use the transformString property. * @param {boolean} rf true to rotate first, false to translate first * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.setRotateFirst = function(rf) { this.rotateFirst = rf; if ( rf ) { this.transformString = "_rx _ry _rz _p _s"; } else { this.transformString = "_p _rz _ry _rx _s"; } return this; }; /** * Applies position and rotation values. * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.update = function() { this.p = "translate3d(" + (this.x - this.regX) + "px," + (this.y - this.regY) + "px," + (this.z - this.regZ) + "px) "; this.rx = "rotateX(" + this.rotationX + "deg) "; this.ry = "rotateY(" + this.rotationY + "deg) "; this.rz = "rotateZ(" + this.rotationZ + "deg) "; this.s = "scale3d(" + this.scaleX + ", " + this.scaleY + ", " + this.scaleX + ") "; /* if (this.rotateFirst) this.style.webkitTransform = this.rz + this.ry + this.rx + this.p + this.s; else this.style.webkitTransform = this.p + this.rx + this.ry + this.rz + this.s; */ // var transformString = "_rx _ry _rz _p _s"; this.ts = this.transformString; this.ts = this.ts.replace( "_p", this.p ); this.ts = this.ts.replace( "_rx", this.rx ); this.ts = this.ts.replace( "_ry", this.ry ); this.ts = this.ts.replace( "_rz", this.rz ); this.ts = this.ts.replace( "_s", this.s ); //this.style.webkitTransform = this.ts; this.style[this._transformProperty] = this.ts; return this; }; /** * Applies 2D position, rotation and scaling values. * This method allows to use Sprite3D with browsers that only support 2D transforms. * When applying the transforms, it uses the x and y position, z rotation and x and y scaling. * The other values are ignored. * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.update2D = function() { this.p = "translate(" + (this.x - this.regX) + "px," + (this.y - this.regY) + "px) "; this.rz = "rotate(" + this.rotationZ + "deg) "; this.s = "scale(" + this.scaleX + ", " + this.scaleY + ") "; this.ts = this.transformString; this.ts = this.ts.replace( "_p", this.p ); this.ts = this.ts.replace( "_rx", "" ); this.ts = this.ts.replace( "_ry", "" ); this.ts = this.ts.replace( "_rz", this.rz ); this.ts = this.ts.replace( "_s", this.s ); //this.style.webkitTransform = this.ts; this.style[this._transformProperty] = this.ts; //console.log( "apply 2D transforms using " + this._transformProperty ); return this; }; /** * Applies position and rotation values, as well as opacity and size. * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.updateAll = function() { this.update(); this.style.opacity = this.alpha; this.style.width = this.width + "px"; this.style.height = this.height + "px"; return this.update(); }; /** * Calls the update() method on every child of the Sprite3D object. * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.updateChildren = function() { for (this.i = 0; this.i < this.numChildren; this.i++) { this.children[this.i].update(); } return this; }; /** * Calls the updateAll() method on every child of the Sprite3D object. * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.updateChildrenAll = function() { for (this.i = 0; this.i < this.numChildren; this.i++) { this.children[this.i].updateAll(); } return this; }; /** * Updates itself, then calls the update() method on every child of the Sprite3D object. * @param {boolean} recursive If set to true, make the update call recursive, update every child's children * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.updateWithChildren = function(recursive) { this.update(); for (this.i = 0; this.i < this.numChildren; this.i++) { if (recursive) { this.children[this.i].updateWithChildren(recursive); } else { this.children[this.i].update(); } } return this; }; /** * Adds a Sprite3D object to this Sprite3D children. * @param {Sprite3D} e The Sprite3D object to add * @return {Sprite3D} The reference to the added Sprite3D object */ Sprite3D.prototype.addChild = function(e) { this.numChildren = this.children.push(e); this.domElement.appendChild(e.domElement); return e; }; /** * Removes a Sprite3D object from this Sprite3D children. * @param {Sprite3D} child The Sprite3D object to remove * @return {Sprite3D} The reference to the removed Sprite3D object. null if the child was not found in this Sprite3D children list */ Sprite3D.prototype.removeChild = function(child) { var n = this.children.indexOf(child); if (n > -1) { return this.removeChildAt(n); } return null; }; /** * Removes the nth Sprite3D object from this Sprite3D children. * @param {number} n The index of the Sprite3D object to remove * @return {Sprite3D} The reference to the removed Sprite3D object. */ Sprite3D.prototype.removeChildAt = function(n) { --this.numChildren; this.domElement.removeChild(this.children[n].domElement); return this.children.splice(n, 1)[0]; }; /** * Finds and return the Sprite3D object associated with the provided DOM element * @param {Object} element The DOM element * @return {Sprite3D} The reference to the associated Sprite3D object. Returns null if no relevant Sprite3D object was found */ Sprite3D.prototype.findFromDOMElement = function(element) { for (this.i = 0; this.i < this.numChildren; this.i++) { if (element == this.children[this.i].domElement) { return this.children[this.i]; } } return null; }; Sprite3D.prototype.listeners = {}; /** * Adds an event listener to the DOM element for the provided event id. * @param {String} event The name of the event to watch * @param {Function} callback The callback function * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.addEventListener = function(event, callback) { var fname = event + "_" + callback.name; if ( this.listeners[fname] == null ) { var sprite = this; var fn = function(e) { callback(e, sprite); } this.listeners[fname] = fn; this.domElement.addEventListener(event, fn ); } return this; }; /** * Removes an event listener to the DOM element for the provided event id. * @param {String} event The name of the event to watch * @param {Function} callback The callback function * @return {Sprite3D} The reference to this Sprite3D object */ Sprite3D.prototype.removeEventListener = function(event, callback) { var fname = event + "_" + callback.name; if ( this.listeners[fname] != null ) { this.domElement.removeEventListener(event, this.listeners[fname] ); delete this.listeners[fname]; } return this; }; /** * Creates a centered empty HTML div element to be used as root container for the other Sprite3D objects. * @return {Sprite3D} The created Sprite3D object */ Sprite3D.createCenteredContainer = function() { var c = document.createElement('div'), s = c.style; if ( !Sprite3D.prototype._isInit ) Sprite3D.isSupported(); s[Sprite3D.prototype._browserPrefix+"Perspective"] = "800" + (Sprite3D.prototype._browserPrefix=="Moz"?"px":""); s[Sprite3D.prototype._browserPrefix+"PerspectiveOrigin"] = "0 0"; s[Sprite3D.prototype._browserPrefix+"TransformOrigin"] = "0 0"; s[Sprite3D.prototype._browserPrefix+"Transform"] = "translateZ(0px)"; s.position = "absolute"; s.top = "50%"; s.left = "50%"; s.margin = "0px"; s.padding = "0px"; //s.border = "1px solid red"; // <- this one is for debug document.body.appendChild(c); return new Sprite3D(c); }; /** * Creates a top-left aligned empty HTML div element to be used as root container for the other Sprite3D objects. * @return {Sprite3D} The created Sprite3D object */ Sprite3D.createTopLeftCenteredContainer = function() { var c = document.createElement('div'), s = c.style; if ( !Sprite3D.prototype._isInit ) Sprite3D.isSupported(); s[Sprite3D.prototype._browserPrefix+"Perspective"] = "800" + (Sprite3D.prototype._browserPrefix=="Moz"?"px":""); //s[Sprite3D.prototype._browserPrefix+"PerspectiveOrigin"] = "0 0"; //s[Sprite3D.prototype._browserPrefix+"TransformOrigin"] = "0 0"; s[Sprite3D.prototype._browserPrefix+"Transform"] = "translateZ(0px)"; //s.webkitPerspective = "800"; // s.webkitPerspectiveOrigin = "0 0"; // s.webkitTransformOrigin = "0 0"; //s.webkitTransform = "translateZ(0px)"; s.position = "relative"; /* s.position = "absolute"; s.top = "0px"; s.left = "0px"; s.right = "0px" s.bottom = "0px" s.margin = "0px"; s.padding = "0px"; s.border = "1px solid red"; */ /* i left all those comments above because they might be useful in some use cases */ document.body.appendChild(c); return new Sprite3D(c); }; /** Private static property. Used internally for browser checking. You should not change its value. */ Sprite3D.prototype._isInit = false; /** Private static property. Used internally for cross-browser compatibility. You should not change its value. */ Sprite3D.prototype._transformProperty = "webkitTransform"; /** Private static property. Used internally for cross-browser compatibility. You should not change its value. */ Sprite3D.prototype._browserPrefix = "webkit"; /** * Test for CSS 3D transforms support in the current browser. * If 3D transforms are not supported, the update() method is replaced by the update2D() method, * providing an automatic fallback that might save some bits :) * @return {boolean} True if the 3D transforms are supported by the browser */ Sprite3D.isSupported = function() { var d = document.createElement("div"), prefixes = ["", "webkit", "Moz", "o", "ms" ], n = prefixes.length, i; // check for 3D transforms for( i = 0; i < n; i++ ) { if ( ( prefixes[i] + "Perspective" ) in d.style ) { Sprite3D.prototype._transformProperty = prefixes[i] + "Transform"; Sprite3D.prototype._isInit = true; Sprite3D.prototype._browserPrefix = prefixes[i]; //console.log( "found support for 3D transforms using prefix: " + prefixes[i] ); return true; } } // check for 2D transforms for( i = 0; i < n; i++ ) { if ( ( prefixes[i] + "Transform" ) in d.style ) { Sprite3D.prototype._transformProperty = prefixes[i] + "Transform"; Sprite3D.prototype._isInit = true; Sprite3D.prototype._browserPrefix = prefixes[i]; Sprite3D.prototype.update = Sprite3D.prototype.update2D; //console.log( "found support for 2D transforms using prefix: " + prefixes[i] ); return false; } } //console.log( "no support for CSS transforms."); return false; }; /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc5\plugins\Sprite3D.js */ /* start file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\cc5\carconfigurator_1.0.8.3.js */ (function(){if(typeof window.be=="undefined")window.be={};if(typeof be.marlon=="undefined")be.marlon={};be.marlon.EventDispatcher=function(){this.eventTypes=[];this.eventHandlers=[]};be.marlon.EventDispatcher.prototype.addEventListener=function(G,t){this.eventTypes.push(G);this.eventHandlers.push(t)};be.marlon.EventDispatcher.prototype.removeEventListener=function(G,t){for(var s=this.eventTypes.length,v=0;vthis.eventTypes.length){t=this.eventTypes.length;s--}}};be.marlon.Utility=function(){function G(s,v,D){switch(typeof v){case "object":if(s!="")D+='"'+s+'":';if(Object.prototype.toString.apply(v)==="[object Array]"){D+="[";s=0;for(var R=v.length;s0&&typeof e.Standard!="undefined"&&e.Standard==true&&f.push(e)}return f}function ya(a){if(Y==null)return ia.submodels[0];var c,b=Y.length,e;for(c=0;c0?a.data[f].cta.data[j].title.data[0]:"not found";b["function"]=a.data[f].cta.data[j].title.href;b.type=a.data[f].cta.data[j].title["class"]}else F.dispatchEvent(new be.marlon.LogEvent(1,"No button title supplied!")); if(c)if(typeof a.data[f].cta.data[j].subtitle!="undefined")b.subtitle=a.data[f].cta.data[j].subtitle.data.length>0?a.data[f].cta.data[j].subtitle.data[0]:"not found";else{b.subtitle="";F.dispatchEvent(new be.marlon.LogEvent(1,"No button subtitle supplied!"))}if(typeof a.data[f].cta.data[j].action!="undefined"){b.window=a.data[f].cta.data[j].action.data.length>0?a.data[f].cta.data[j].action.data[0]:false;b.url=a.data[f].cta.data[j].action.href}if(typeof a.data[f].cta.data[j].wt!="undefined")if(a.data[f].cta.data[j].wt.data.length> 0)b.wt=a.data[f].cta.data[j].wt.data[0]}e.push(b)}return e}function aa(a){Aa=false;n.removeEventListener(be.marlon.Internal.CAR_INFO_LOADED,aa);sa=a.data;F.getEcoData(-1)}function da(a){n.removeEventListener(be.marlon.Internal.CONFIGURATION_XML_LOADED,da);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.CONFIGURATION_XML_LOADED,a.data));Ma=false}function Ia(a){n.removeEventListener(be.marlon.Internal.FINANCIAL_XML_LOADED,da);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.FINANCIAL_XML_LOADED, a.data));Ma=false}function Ja(a){n.removeEventListener(be.marlon.Internal.MODEL_LOADED,Ja);Ab(a.data);u.usepromo||Xa(I,"AvailablePromotions");if(I.AvailablePromotions){a=0;for(var c=I.AvailablePromotions.length,b;a0||f.length>0){k&&k.updateInteriorOptions&&k.updateInteriorOptions(f,e);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_INTERIOR_OPTIONS,[f,e]))}if(g.length>0||j.length>0){k&&k.updateExteriorOptions&&k.updateExteriorOptions(j,g);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_EXTERIOR_OPTIONS,[f,e]))}if(m.length>0||B.length>0){k&&k.updateAccessories&&k.updateAccessories(B,m); F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_ACCESSORIES,[f,e]))}}function h(a,c,b,e,f,g){var j,m=a.length,B,z,E,H,L,ja;for(j=0;j-1&&ga.splice(ja,1);i&&i.removeCode(L.InternalCode)}if(E=="EXT"){c.push(H);break}else if(E=="INT"){b.push(H);break}}}z=K.length;for(B=0;B-1&&ga.splice(ja,1);i&&i.removeCode(L.InternalCode)}e.push(H);break}}if(!f){z=M.length;for(B=0;B0)e=(e=q(d.ExteriorColourID,b.AvailableForExteriorColours))? 0:-1;else e=0;if(b.AvailableForCarUpholsteries&&b.AvailableForCarUpholsteries.length>0)f=(f=q(d.UpholsteryID,b.AvailableForCarUpholsteries))?0:-1;else f=0;if(f==-1&&e==-1||f==-1&&e==0||f==0&&e==-1)if(b.Path=="interior/inlays")m.push(b);else if(b.Type=="Option")if(b.Standard)i&&i.removeAsset(b.ID);else{g.push(b);d.hasOption(b.ID)&&ha(Qa(d.Options,b,qa,"addOptions","removeOptions",true,false,N,"setOption"),"removeOptions")}else if(b.Type=="Accessory")if(b.Standard)i&&i.removeAsset(b.ID);else{j.push(b); d.hasAccessory(b.ID)&&ha(Qa(d.Accessories,b,na,"addAccessory","removeAccessory",false,false,K,"setAccessorie"),"removeAccessory")}}g=O(g,N);a=O(m,fa);if(q(d.InlayID,m))(b=a[0])?C(b.ID):C("00000000-0000-0000-0000-000000000000");m=a;j=O(j,K);return[m,g,j]}function O(a,c){var b=null;if(a.length>0){var e=c.length,f=0,g=null;for(b=[];f-1&&ga.splice(a,1);ga.push(c)}function ha(a,c){for(var b=0,e=a.length;b0){E=Qb(f.concat(),a);a=E[0];var Eb=E[1];H=c.IncludeEquipment.length;m=f.length;for(E=0;E0){c=[c,B,Eb,a];k&&k.showIncludeOptions&&k.showIncludeOptions(c);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.SHOW_INCLUDE_OPTIONS,c));return-1}z.splice(0,1);H=a.length;for(E=0;E-1){g=d.Options.length;for(m=0;m-1){g=d.Accessories.length; for(m=0;m-1&&L.push(E)}}}g=ja.length;for(j=0;j0?-1:1}function wb(a,c){typeof a.Assets!="undefined"&&a.Assets.length>0&&i.addAsset(a);vb(a,true,[]);var b,e;c=c?c:a.IncludeEquipment;b=c.length;for(a=0;a0)for(;e0)for(;e-1){a=a.split(".");for(var c=window[a[0]],b=1,e=a.length;b-1){d[c]=f;g=true;break}}if(!g&&a.length>0){f=a[0].ID; if(ra){if(f!=d[c])d[c]=f}else f!=d[c]&&ga.push(d[c])}}function fb(a){Q=a.data.ExteriorColours;oa(Q,"Promotions");Za=[];var c=Q.length,b,e;if(i){if(Sa){a=0;for(e=Sa.Colours.length;a0||a[c].AvailableForCarUpholsteries&&a[c].AvailableForCarUpholsteries.length>0)Za.push(a[c])}function Vb(a){Aa=false;var c=ma(),b,e;eb(c[0]?c[0]:fa,"InlayID");d.BodyTypeLabel=W(d.BodyTypeID, La);d.EngineLabel=W(d.EngineID,ca,"Engine");d.EngineTypeLabel=W(d.FuelTypeID,ca,"Engine","Type");d.TransmissionLabel=W(d.TransmissionID,ca,"Transmission");d.WheelDriveLabel=W(d.WheelDriveID,ca,"Wheeldrive");d.GradeLabel=W(d.GradeID,Fa);d.ExteriorColourLabel=W(d.ExteriorColourID,Q);d.ExteriorColourDisclaimer=q(d.ExteriorColourID,Q).FootNote;d.UpholstryLabel=W(d.UpholsteryID,ea);d.InlayLabel=W(d.InlayID,fa);d.WheelLabel=W(d.WheelID,M);d.ExteriorColourPrice=pa(d.ExteriorColourID,Q);d.UpholstryPrice= pa(d.UpholsteryID,ea);if(!d.isEmpty(d.InlayID))d.InlayPrice=pa(d.InlayID,fa);d.WheelPrice=pa(d.WheelID,M);d.OptionsLabels=[];d.OptionsPrices=[];d.OptionsTypes=[];d.PackLabels=[];d.PackPrices=[];d.AccessoriesLabels=[];d.AccessoriesPrices=[];e=d.Options.length;for(b=0;b0&&i.addAsset(qa[b]);i.addCode(qa[b].InternalCode)}e=na.length;for(b=0;b0&&i.addAsset(na[b]);i.addCode(na[b].InternalCode)}e=d.Accessories.length;for(b=0;b0?ua(a.inlays,d.InlayID):[];a.upholsteryPriceDifference=a.upholstries.length>1?ua(a.upholstries,d.UpholsteryID):[];a.eco=sa.EcoSpecs;a.enginePromos=Kb(ca);a.gradePromos=Xb(Fa);Yb(a);Ea=Da=Ga=false;if(ra){ra= false;k&&k.compatibilityCheckComplete&&k.compatibilityCheckComplete(a);c=new be.marlon.DataEvent(be.marlon.Service.COMPATIBILITY_CHECK_LOADED,a)}else{k&&k.loadComplete&&k.loadComplete(a);c=new be.marlon.DataEvent(be.marlon.Service.LOAD_COMPLETE,a)}F.dispatchEvent(c);w(d)}function Kb(a){for(var c=0,b=a.length,e,f,g,j,m,B=[],z;c0)z=[];for(;e0&&B.push({ID:g.Engine.ID+g.Engine.Type.ID+g.Transmission.ID+g.Wheeldrive.ID,Promotions:z});z=null}return B}function Xb(a){for(var c=0,b=a.length,e,f,g,j,m,B=[],z;c0&&B.push({ID:j.ID,Promotions:z});z=null}return B}function Ya(a){for(var c=0,b=ca.length,e;c0){b=q(d.SubModelID, Y);if(b=nb("PROMO-IMAGE",b.Assets,"Type")){a.promoImage=b.Url;c=true}}if(!c)if(I.Assets){b=nb("PROMO-IMAGE",I.Assets,"Type");a.promoImage=b?b.Url:""}a.promoLink="";if(a.promoImage!="")if(c){if(Y.length>0){b=q(d.SubModelID,Y);b=nb("PromoPage",b.Links,"Name");a.promoLink=b?b.Url:""}}else if(I.Links){b=nb("PromoPage",I.Links,"Name");a.promoLink=b?b.Url:""}}function nb(a,c,b){for(var e=0,f=c.length,g;e0){j=c.ExcludeEquipment.length;if(j>0)for(g=0;g0&&Ha){k&&k.showConflictMessage&&k.showConflictMessage(c);a=new be.marlon.DataEvent(be.marlon.Service.SHOW_CONFLICT,c);F.dispatchEvent(a)}else Lb()}function Lb(){if(d.EngineID!=S.EngineID||d.FuelTypeID!=S.FuelTypeID||d.WheelDriveID!=S.WheelDriveID||d.TransmissionID!=S.TransmissionID)Ca=null;J(S);sa=S=null;n.addEventListener(be.marlon.Internal.COLOURS_LOADED,fb);n.addEventListener(be.marlon.Internal.WHEELS_LOADED,gb);n.addEventListener(be.marlon.Internal.OPTIONAL_EQUIPMENT_LOADED, hb);n.addEventListener(be.marlon.Internal.STANDARD_EQUIPMENT_LOADED,ib);n.addEventListener(be.marlon.Internal.OPTIONAL_ACCESSORIES_LOADED,jb);n.addEventListener(be.marlon.Internal.STANDARD_ACCESSORIES_LOADED,kb);n.addEventListener(be.marlon.Internal.UPHOLSTRIES_LOADED,lb);n.addEventListener(be.marlon.Internal.INLAYS_LOADED,mb);if(Ga||Da||Ea){n.addEventListener(be.marlon.Internal.PACKS_LOADED,db);if(!Ea){n.addEventListener(be.marlon.Internal.MOTORIZATIONS_LOADED,bb);n.addEventListener(be.marlon.Internal.GRADES_LOADED, cb)}if(Ea)P("getPacks",[d.SubModelID,d.BodyTypeID,d.CarID]);else if(Da){n.addEventListener(be.marlon.Internal.BODY_TYPES_LOADED,ab);P("getBodyTypes",!d.isEmpty(u.submodelid)?[d.SubModelID]:[])}else P("getMotorizations",[d.SubModelID,d.BodyTypeID])}else{var a;if(u.load_all){a=[d.SubModelID,d.BodyTypeID];u.gradeid!=false&&a.push(d.GradeID)}else a=[d.SubModelID,d.CarID];a.push(d.Packs);P("getColourInfo",a)}}var F=this,Bb=false,i=false,k=false,d=false,Pa=be.marlon.Utility.getIndex,u=G;G=null;var Zb=s; s=null;var $b=v;v=null;var ac=D;D=null;var ia=R;R=null;var Ta,Oa=false;if(u.showprice=="true"||u.showprice==true)Oa=true;var S,I=false,Y=[],La=[],ca=[],Fa=[],X=[],Q=[],M=[],N=[],qa=[],K=[],na=[],ea,fa,sa=null,ba=false,ga,Za,Ma=false,pb=false,Sa,xb,ra=false,Ga=false,Ea=false,Da=false,Aa=false,Ca,Ha=false,n=false;this.eventTypes=[];this.eventHandlers=[];this.version=function(){return"1.0.8.3"};this.getFlashSettings=function(){return Zb};this.getFlashSkin=function(){return $b};this.getFlashLabels=function(){return ac}; this.getStandardEquipment=function(){return qa};this.getStandardAccessories=function(){return na};this.getServiceVersionObject=function(){return Ta};this.getTotalSelectablePacks=function(){for(var a=0,c=X.length,b=0;a0){var a={},c=0,b,e,f=d;a.ModelPromo=ka("MODELGENERATION");a.SubModelPromo=ka("SUBMODEL");a.BodyTypePromo= ka("BODY");e=Ya(f);var g=Kb([e])[0],j=e.AvailablePromotions.concat();c=0;for(b=j.length;c0){var a,c,b=[];T(d.BasePrice.Discounts,b);T(d.ExteriorColourPrice.Discounts,b);T(d.UpholstryPrice.Discounts,b);d.InlayPrice&&T(d.InlayPrice.Discounts,b);T(d.WheelPrice.Discounts, b);a=0;for(c=d.PackPrices.length;a1?ya(d.SubModelID):ia.submodels[0];if(f==null)return null;c=f.data.length;for(a=0;a0)e.title=b.data[a].title.data[0];else F.dispatchEvent(new be.marlon.LogEvent(1,"No summary title supplied!"));if(typeof b.data[a].left!="undefined")e.left=za(b.data[a].left,true);if(typeof b.data[a].right!="undefined")e.right=za(b.data[a].right,false)}return e};this.getSubmodelSkin=function(){var a=null;if(ia){a={};var c,b,e;e=ia.submodels.length>1&&Y?ya(d.SubModelID): ia.submodels[0];b=e.data.length;a.title="";a.subtitle="";for(c=0;c1||u.load_submodels==true){n.addEventListener(be.marlon.Internal.SUBMODELS_LOADED,Na);P("getSubModels")}else{var a= S?true:false;k&&k.submodelsLoaded&&k.submodelsLoaded(null,a);a=new be.marlon.DataEvent(be.marlon.Service.SUBMODELS_LOADED,[null,a]);F.dispatchEvent(a)}else{n.addEventListener(be.marlon.Internal.SERVICE_VERSION_LOADED,Ba);n.getBackEndVersion()}};this.loadXMLConfiguration=function(a){if(!pb){pb=true;n.addEventListener(be.marlon.Internal.CONFIGURATION_OBJECT_LOADED,l);a=escape(a);n.getConfigurationObject("xml="+a)}};this.loadConfiguration=function(a,c){S=a;J(S);if(c)F.startLoad();else k&&k.loadConfigurationStart&& k.loadConfigurationStart()};this.startLoad=function(){U();zb();Aa=true;n.addEventListener(be.marlon.Internal.INIT_CONFIGURATION_LOADED,qb);n.addEventListener(be.marlon.Internal.MODEL_LOADED,rb);n.addEventListener(be.marlon.Internal.BODY_TYPES_LOADED,ab);n.addEventListener(be.marlon.Internal.MOTORIZATIONS_LOADED,bb);n.addEventListener(be.marlon.Internal.GRADES_LOADED,cb);n.addEventListener(be.marlon.Internal.PACKS_LOADED,db);n.addEventListener(be.marlon.Internal.COLOURS_LOADED,fb);n.addEventListener(be.marlon.Internal.WHEELS_LOADED, gb);n.addEventListener(be.marlon.Internal.OPTIONAL_EQUIPMENT_LOADED,hb);n.addEventListener(be.marlon.Internal.STANDARD_EQUIPMENT_LOADED,ib);n.addEventListener(be.marlon.Internal.OPTIONAL_ACCESSORIES_LOADED,jb);n.addEventListener(be.marlon.Internal.STANDARD_ACCESSORIES_LOADED,kb);n.addEventListener(be.marlon.Internal.UPHOLSTRIES_LOADED,lb);n.addEventListener(be.marlon.Internal.INLAYS_LOADED,mb);Z("15","INITCONF");if(Ta)Ua();else{n.addEventListener(be.marlon.Internal.SERVICE_VERSION_LOADED,Hb);n.getBackEndVersion()}}; this.loadCompareGrades=function(){if(Ca){k&&k.compareGradesLoaded&&k.compareGradesLoaded(null,true);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.COMPARE_GRADES_LOADED,[Ca,true]))}else{Z("0","COMPG");n.addEventListener(be.marlon.Internal.COMPARE_GRADES_LOADED,r);P("getCompareGrade",[d.CarID])}};this.log=function(a,c,b){typeof be.marlon.utils.PopUpLogger!="undefined"&&this.dispatchEvent(new be.marlon.LogEvent(a,c,b))};this.changeView=function(a,c,b){if(i){if(typeof c=="undefined")c=true; if(a=="EXTERIOR"){k&&k.hideInteriorImage&&k.hideInteriorImage();i.changeView(a,b,c)}else{var e=x();if(e==true){k&&k.hideInteriorImage&&k.hideInteriorImage();i.changeView(a,b,c)}else k&&k.renderInteriorImage&&e!=""&&k.renderInteriorImage(e)}}else a=="EXTERIOR"&&k&&k.hideInteriorImage&&k.hideInteriorImage()};this.showPromoPage=function(a){if(k&&k.showPromoPage){if(typeof a=="undefined")bOption=true;k.showPromoPage(a)}};this.navigate=function(a,c){if(k&&k.navigate){if(typeof c=="undefined")c=false;k.navigate(a, c)}};this.resetConfiguration=function(){d.reset()};this.setLanguage=function(a){d.Language=a};this.setBrand=function(a){d.Brand=a};this.setCountry=function(a){d.Country=a};this.setModel=function(a){d.ModelID=a};this.setSubModel=function(a){d.SubModelID=a;d.reset()};this.setMotorization=function(a,c,b,e){if(X.length>0)Ea=true;var f=d.EngineID,g=d.FuelTypeID,j=d.WheelDriveID,m=d.TransmissionID,B=wa(false);d.EngineID=a;d.FuelTypeID=c;d.WheelDriveID=e;d.TransmissionID=b;a=wa(false);d.EngineID=f;d.FuelTypeID= g;d.WheelDriveID=j;d.TransmissionID=m;ob(B,a)};this.setBodyType=function(a){Ga=true;var c=d.BodyTypeID,b=wa(false);d.BodyTypeID=a;a=wa(false);d.BodyTypeID=c;ob(b,a)};this.setGrade=function(a){if(X.length>0)Ea=true;var c=d.GradeID,b=wa(false);d.GradeID=a;a=wa(false);d.GradeID=c;ob(b,a)};this.setExteriorColour=function(a){Ha=true;var c=q(d.ExteriorColourID,Q),b=q(a,Q);ta(d.ExteriorColourID,a);d.ExteriorColourID=a;d.ExteriorColourLabel=W(d.ExteriorColourID,Q);d.ExteriorColourDisclaimer=b.FootNote;d.ExteriorColourPrice= pa(d.ExteriorColourID,Q);var e=false,f=0,g;if(c.Upholsteries.length==b.Upholsteries.length)for(g=c.Upholsteries.length;f0)j=e[0].ID;if(c){if(i){i.setColour(b.Code,false);i.updateComplexAssets();i.update()}}else{i&&i.setColour(b.Code,true);for(f=0;f-1){j=m.ID;break}}V(j,false,false)}j=d.UpholsteryID;k&&k.setUpholsteries&&k.setUpholsteries(e,j);f=new be.marlon.DataEvent(be.marlon.Service.SET_UPHOLSTERIES,[e,j]);F.dispatchEvent(f);c&&o()}else{if(i){i.setColour(b.Code,false);i.updateComplexAssets();i.update()}o()}Ka(true);a=ua(Q,a);k&&k.updateColourPrices&&k.updateColourPrices(a);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_COLOUR_PRICES,a))};this.setWheels=function(a,c){Ha=true;if(a!=d.WheelID){var b=q(a, M),e=q(d.WheelID,K);e&&Qa(d.Accessories,e,na,"addAccessory","removeAccessory",false,false,K,null,[-1]);if(i){i.removeAsset(d.WheelID);i.addAsset(b)}ta(d.WheelID,a);d.WheelID=a;d.WheelLabel=W(d.WheelID,M);d.WheelPrice=pa(d.WheelID,M);var f=q(a,K);f&&Qa(d.Accessories,f,na,"addAccessory","removeAccessory",false,false,K,null,[-1]);b.IncludeEquipment.push(b);e&&b.ExcludeEquipment.push(e);if(typeof c=="undefined"||c===true)y(b,false,null);b.IncludeEquipment.pop();e&&b.ExcludeEquipment.pop();if(typeof c== "undefined"||c===true)Ka(true);i&&i.update();a=ua(M,a);k&&k.updateWheelPrices&&k.updateWheelPrices(a);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_WHEEL_PRICES,a))}};this.setUpholstry=function(a){Ha=true;ta(d.UpholsteryID,a);V(a,true,true)};this.setInlay=function(a){Ha=true;var c=d.InlayID;C(a);ta(c,a);i&&i.update();Ka(true)};this.setOption=function(a,c){Ha=true;a=q(a,N);if(typeof c=="undefined")c=[-1];var b=Qa(d.Options,a,qa,"addOptions","removeOptions",true,true,N,"setOption", c);if(b!=-1){y(a,b,c[0]==-1?null:c);Ka(true)}};this.setAccessorie=function(a,c){Ha=true;var b=q(a,K),e=b.Path.indexOf("wheels")!=-1;if(typeof c=="undefined")c=[-1];var f=Qa(d.Accessories,b,na,"addAccessory","removeAccessory",false,!e,K,"setAccessorie",c);if(f!=-1){if(f){if(e){a=M[0];if(i){i.removeAsset(d.WheelID);i.addAsset(a);i.updateComplexAssets();i.update()}d.WheelID=a.ID;d.WheelLabel=a.Name;d.WheelPrice=a.PriceInfo;k&&k.selectWheel&&k.selectWheel(d.WheelID);a=ua(M,d.WheelID);k&&k.updateWheelPrices&& k.updateWheelPrices(a);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_WHEEL_PRICES,a))}y(b,f,null)}else{y(b,false,c[0]==-1?null:c);if(e){if(q(a,M)){if(i){i.removeAsset(d.WheelID);i.addAsset(b);i.updateComplexAssets();i.update()}k&&k.selectWheel&&k.selectWheel(a)}else k&&k.deselectWheel&&k.deselectWheel(d.WheelID);d.WheelID=b.ID;d.WheelLabel=b.Name;d.WheelPrice=b.PriceInfo;a=ua(M,d.WheelID);k&&k.updateWheelPrices&&k.updateWheelPrices(a);F.dispatchEvent(new be.marlon.DataEvent(be.marlon.Service.UPDATE_WHEEL_PRICES, a))}}Ka(true)}};this.setPack=function(a){Ha=true;for(var c=0,b=d.Packs.length,e=false;c3?w[3]:null;h=w.length>4?w[4]:null;o=w.length>5?w[5]:null;if((y&&y!=""||h&&h!=""||o&&o!="")&&(A=="INT"||A=="EXT")){ha=U.length;for(w=0;w=0){p.label=x;p.name=r;U.push(p)}}if(V&&V.indexOf("SWF")!=-1&&R(y,h,o)){y={};y.source=xa+p.Url;if(A=="EXT"){y.frames=Number(ma.exec(V)[0]);va=Ua}else if(A=="INT")va=Va;if(va){ha=va.length;for(w=0;w-1:false;return l== ""&&r==""&&x==""||l==T&&r==""&&x==""||l==""&&r==ka&&x==""||l==""&&r==""&&p||l==T&&r==ka&&x==""||l==T&&r==ka&&p||l==""&&r==ka&&p||l==T&&r==""&&p}var xa="",ka,T="077",$,ya,za,aa=[],da=[],Ia=false,Ja=false,la=[],Ba=[],Na=be.marlon.Utility.getIndex,U=[];this.addSpinPlayer=function(l,r){la.push(l);if(typeof r=="undefined")r="EXTERIOR";Ba.push(r)};this.getEquipment=function(l){if(typeof l!="undefined"&&l==true)return be.marlon.Utility.stringify($);return $};this.initCameras=function(l){var r,x=l.length, p,w,A=[],V;for(r=0;r)(.*)(<\/title>)/g.exec(o.responseText);O=new be.marlon.ErrorEvent(be.marlon.Internal.SERVICE_ERROR,O[2],true);p.dispatchEvent(O);x=false;p.dispatchEvent(new be.marlon.LogEvent(1,"Error "+h.event+" time: "+ma+"ms: "+o.statusText,o.responseText))}}function D(h,o){y&&y.validateColourInfo(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function R(h,o){y&&y.validateUpholsteries(o); h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function xa(h,o){y&&y.validateInlays(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function ka(h,o){y&&y.validateEquipment(o,"GetOptionalEquipment",true);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function T(h,o){y&&y.validateEquipment(o,"GetStandardEquipment",false);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function $(h,o){y&&y.validateEquipment(o,"GetOptionalAccessories",true);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)} function ya(h,o){y&&y.validateEquipment(o,"GetStandardAccessories",false);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function za(h,o){y&&y.validateMotorizations(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function aa(h,o){y&&y.validateGrades(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function da(h,o){y&&y.validatePacks(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function Ia(h,o){y&&y.validateDefaultConfiguration(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)} function Ja(h,o){y&&y.validateCar(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function la(h,o){y&&y.validateCompareGrades(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function Ba(h,o){y&&y.validateCompatibilityCheck(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function Na(h,o){y&&y.validateBodyTypes(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function U(h,o){y&&y.validateCarModel(o,t);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function l(h,o){y&&y.validateSubModels(o, t);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}function r(h,o){y&&y.validateCarWheels(o);h=new be.marlon.DataEvent(h,o);p.dispatchEvent(h)}var x=false,p=this,w="",A="",V="XML",C="JSON",y=be.marlon.Validator?new be.marlon.Validator(G,this):false;this.eventTypes=[];this.eventHandlers=[];this.itemExists=function(h,o,ma){var O=false,ta=o.length,ha=0;if(ma)for(;ha'+ d.options.content+'
          ');d.openOverlay(d,u,x);o.preventDefault()})};a.prototype.openOverlay=function(d,g,o){var u=b('
          '),x=g.closest(d.options.selectors.container);b("div.main").first().append(u);u.fadeIn(100);d.options.center===false&&b("body,html").animate({scrollTop:x.offset().top},500);d.options.content!="inline"&&x.append(o);o.slideDown(100,function(){var v=o.outerHeight(true),p=o.position().top;x.css({"min-height":v+p+10+"px"});d.closeOverlay(d, u,o);typeof d.options.onOpen==="function"&&d.options.onOpen.call(u,g,o,close)})};a.prototype.closeOverlay=function(d,g,o){var u=o.find(".close");u.unbind();u.click(function(x){u=b(this);d.closeCleanup(d,g,o,u);x.preventDefault()});g.mouseup(function(){d.closeCleanup(d,g,o,u)})};a.prototype.removeOverlay=function(){var d=b("body"),g=d.find(".overlay");d=d.find(".js-generated");g.length&&g.remove();d.length&&d.remove()};a.prototype.closeCleanup=function(d,g,o,u){g.fadeOut(100,function(){b(this).remove()}); o.slideUp(100,function(){d.options.content!="inline"&&o.remove();typeof d.options.onClose==="function"&&d.options.onClose.call(o,u)})};b.fn[e]=function(d){return this.each(function(){if(!b.data(this,"plugin_"+e)){var g=b(this).data();d=b.extend({},g,d);b.data(this,"plugin_"+e,new a(this,d))}})}})(jQuery,window,document);var ccv5SelectorsToggleWidth=0; (function(b){var a={isDebug:false,animationSpeed:300,animationEasing:"linear",defaultClass:"default",toggleChangeEventName:"ToggleChange",enableSwipe:true,swipeThreshold:40,listContainerPadding:2,useCSS3:Modernizr.borderradius&&Modernizr.boxshadow,enabled:true},e={init:function(m){var d=b.extend({},a,m);return this.each(function(){var g=b(this);if(g.hasClass("active"))return false;var o=b("li",g);if(o.length!=2)return false;g.addClass("active").show();b("li."+d.defaultClass,g).length<1&&b("li:first", g).addClass(d.defaultClass);var u=b("li."+d.defaultClass,g),x=u.clone().removeClass(d.defaultClass).addClass("mask");x.css({left:u.index()*o.eq(0).width()+d.listContainerPadding});g.append(x);u.addClass("active");Modernizr.csstransitions&&x.ApplyCSSTransitionRules(d.animationSpeed/1E3);g.bind("click",function(v){v.preventDefault();ccv5SelectorsToggleWidth=Math.max(o.eq(1).position().left,ccv5SelectorsToggleWidth);v.originalEvent&&b(".selectors-toggle li.mask").each(function(){b(this)[0]!==x[0]&&b(this).trigger("click")}); if(a.enabled&&!g.hasClass("disabled")){var p=b(".active",g);v=p.index()==0?o.eq(1):o.eq(0);p.removeClass("active");v.addClass("active");x.children("a").text(b.trim(v.children("a").text().replace(" ","\u00a0")));p=v.index()==0?d.listContainerPadding:ccv5SelectorsToggleWidth;Modernizr.csstransitions?x.css({left:p+"px"}):x.stop().animate({left:p},d.animationSpeed,d.animationEasing,function(){});v.trigger(d.toggleChangeEventName,b("a",v))}});d.enableSwipe&&g.swipe({swipeStatus:function(v,p){p=="end"&& g.trigger("click")},allowPageScroll:"none",threshold:d.swipeThreshold})})},disable:function(){a.enabled=false;b("a",b(this)).css("cursor","default")},enable:function(){a.enabled=true;b("a",b(this)).css("cursor","pointer")}};b.fn.SelectorsToggle=function(m){if(e[m])return e[m].apply(this,Array.prototype.slice.call(arguments,1));else if(typeof m==="object"||!m)return e.init.apply(this,arguments);else b.error("Method "+m+" does not exist on jQuery.plugin")}})(jQuery,window,document); (function(b){b.fn.ApplyCSSTransitionRules=function(a,e,m){if(e==null||e=="")e="all";if(m==null||m=="")m="ease";if(a==null||a=="")a=1;return this.each(function(){b(this).css({"-moz-transition":e+" "+a+"s "+m,"-o-transition":e+" "+a+"s "+m,"-webkit-transition":e+" "+a+"s "+m,"-ms-transition":e+" "+a+"s "+m,transition:e+" "+a+"s "+m})})};b.fn.RemoveCSSTransitionRules=function(){return this.each(function(){b(this).css({"-moz-transition":"none","-o-transition":"none","-webkit-transition":"none","-ms-transition":"none", transition:"none"})})};b.fn.ResetCSSTransitionRules=function(){return this.each(function(){b(this).css({"-moz-transition":"","-o-transition":"","-webkit-transition":"","-ms-transition":"",transition:""})})};b.fn.ApplyTranslate3D=function(a,e,m){return this.each(function(){b(this).css({"-webkit-transform-style":"preserve-3d","-webkit-backface-visibility":"hidden","-webkit-transform":"translate3d("+a+"px, "+e+"px, "+m+"px)","-moz-transform":"translate3d("+a+"px, "+e+"px, "+m+"px)"})})};b.fn.ApplyTranslate= function(a,e){return this.each(function(){b(this).css({"-webkit-backface-visibility":"hidden","-webkit-transform-style":"preserve-3d","-webkit-backface-visibility":"hidden","-moz-transform":"translate("+a+"px, "+e+"px)","-ms-transform":"translate("+a+"px, "+e+"px)","-o-transform":"translate("+a+"px, "+e+"px)",transform:"translate("+a+"px, "+e+"px)"})})}})(jQuery,window,document); (function(b){function a(j){if(j&&j.allowPageScroll===undefined&&(j.swipe!==undefined||j.swipeStatus!==undefined))j.allowPageScroll=v;j||(j={});j=b.extend({},b.fn.swipe.defaults,j);return this.each(function(){var l=b(this),C=l.data(c);if(!C){C=new e(this,j);l.data(c,C)}})}function e(j,l){function C(D){if(!U())if(!(b(D.target).closest(l.excludedElements,Y).length>0)){D=D.originalEvent;var fa,ka=y?D.touches[0]:D;X=r;if(y)V=D.touches.length;else D.preventDefault();qa=0;S=M=null;F=B=ta=0;ea=1;ca=sa(); if(!y||V===l.fingers||l.fingers===t||ma()){ca[0].start.x=ca[0].end.x=ka.pageX;ca[0].start.y=ca[0].end.y=ka.pageY;pa=T();if(V==2){ca[1].start.x=ca[1].end.x=D.touches[1].pageX;ca[1].start.y=ca[1].end.y=D.touches[1].pageY;B=F=N(ca[0].start,ca[1].start)}if(l.swipeStatus||l.pinchStatus)fa=I(D,X)}else{K(D);fa=false}if(fa===false){X=h;I(D,X);return fa}else{na(true);Y.bind(ha,w);Y.bind(R,J)}}}function w(D){D=D.originalEvent;if(!(X===f||X===h)){var fa,ka=y?D.touches[0]:D;ca[0].end.x=y?D.touches[0].pageX:ka.pageX; ca[0].end.y=y?D.touches[0].pageY:ka.pageY;oa=T();M=P(ca[0].start,ca[0].end);if(y)V=D.touches.length;X=q;if(V==2){if(B==0){ca[1].start.x=D.touches[1].pageX;ca[1].start.y=D.touches[1].pageY;B=F=N(ca[0].start,ca[1].start)}else{ca[1].end.x=D.touches[1].pageX;ca[1].end.y=D.touches[1].pageY;F=N(ca[0].end,ca[1].end);S=G(ca[0].end,ca[1].end)}ea=H(B,F)}if(V===l.fingers||l.fingers===t||!y){da(D,M);qa=ba(ca[0].start,ca[0].end);ta=Q(ca[0].start,ca[0].end);if(l.swipeStatus||l.pinchStatus)fa=I(D,X);if(!l.triggerOnTouchEnd){ka= !W();if(O()===true){X=f;fa=I(D,X)}else if(ka){X=h;I(D,X)}}}else{X=h;I(D,X)}if(fa===false){X=h;I(D,X)}}}function J(D){D=D.originalEvent;if(D.touches&&D.touches.length>0)return true;D.preventDefault();oa=T();if(B!=0){F=N(ca[0].end,ca[1].end);ea=H(B,F);S=G(ca[0].end,ca[1].end)}qa=ba(ca[0].start,ca[0].end);M=P(ca[0].start,ca[0].end);ta=Q();if(l.triggerOnTouchEnd||l.triggerOnTouchEnd===false&&X===q){X=f;var fa=E()||!ma(),ka=ca[0].end.x!==0;if((V===l.fingers||l.fingers===t||!y)&&ka&&fa){fa=W();ka=O();if((ka=== true||ka===null)&&fa)I(D,X);else if(!fa||ka===false){X=h;I(D,X)}}else{X=h;I(D,X)}}else if(X===q){X=h;I(D,X)}Y.unbind(ha,w,false);Y.unbind(R,J,false);na(false)}function K(){F=B=pa=oa=V=0;ea=1;na(false)}function I(D,fa){var ka=undefined;if(l.swipeStatus)ka=l.swipeStatus.call(Y,D,fa,M||null,qa||0,ta||0,V);if(l.pinchStatus&&E())ka=l.pinchStatus.call(Y,D,fa,S||null,F||0,ta||0,V,ea);if(fa===h)if(l.click&&(V===1||!y)&&(isNaN(qa)||qa===0))ka=l.click.call(Y,D,D.target);if(fa==f){if(l.swipe)ka=l.swipe.call(Y, D,M,qa,ta,V);switch(M){case m:if(l.swipeLeft)ka=l.swipeLeft.call(Y,D,M,qa,ta,V);break;case d:if(l.swipeRight)ka=l.swipeRight.call(Y,D,M,qa,ta,V);break;case g:if(l.swipeUp)ka=l.swipeUp.call(Y,D,M,qa,ta,V);break;case o:if(l.swipeDown)ka=l.swipeDown.call(Y,D,M,qa,ta,V);break}switch(S){case u:if(l.pinchIn)ka=l.pinchIn.call(Y,D,S||null,F||0,ta||0,V,ea);break;case x:if(l.pinchOut)ka=l.pinchOut.call(Y,D,S||null,F||0,ta||0,V,ea);break}}if(fa===h||fa===f)K(D);return ka}function O(){if(l.threshold!==null)return qa>= l.threshold;return null}function W(){return l.maxTimeThreshold?ta>=l.maxTimeThreshold?false:true:true}function da(D,fa){if(l.allowPageScroll===v||ma())D.preventDefault();else{var ka=l.allowPageScroll===p;switch(fa){case m:if(l.swipeLeft&&ka||!ka&&l.allowPageScroll!=z)D.preventDefault();break;case d:if(l.swipeRight&&ka||!ka&&l.allowPageScroll!=z)D.preventDefault();break;case g:if(l.swipeUp&&ka||!ka&&l.allowPageScroll!=i)D.preventDefault();break;case o:if(l.swipeDown&&ka||!ka&&l.allowPageScroll!=i)D.preventDefault(); break}}}function Q(){return oa-pa}function N(D,fa){var ka=Math.abs(D.x-fa.x);D=Math.abs(D.y-fa.y);return Math.round(Math.sqrt(ka*ka+D*D))}function H(D,fa){return(fa/D*1).toFixed(2)}function G(){return ea<1?x:u}function ba(D,fa){return Math.round(Math.sqrt(Math.pow(fa.x-D.x,2)+Math.pow(fa.y-D.y,2)))}function s(D,fa){D=Math.atan2(fa.y-D.y,D.x-fa.x);D=Math.round(D*180/Math.PI);if(D<0)D=360-Math.abs(D);return D}function P(D,fa){D=s(D,fa);return D<=45&&D>=0?m:D<=360&&D>=315?m:D>=135&&D<=225?d:D>45&&D< 135?o:g}function T(){return(new Date).getTime()}function la(){Y.unbind(ia,C);Y.unbind(Z,K);Y.unbind(ha,w);Y.unbind(R,J);na(false)}function ma(){return l.pinchStatus||l.pinchIn||l.pinchOut}function E(){return S&&ma()}function U(){return Y.data(c+"_intouch")===true?true:false}function na(D){D=D===true?true:false;Y.data(c+"_intouch",D)}function sa(){for(var D=[],fa=0;fa<=5;fa++)D.push({start:{x:0,y:0},end:{x:0,y:0},delta:{x:0,y:0}});return D}var L=y||!l.fallbackToMouseEvents,ia=L?"touchstart":"mousedown", ha=L?"touchmove":"mousemove",R=L?"touchend":"mouseup",Z="touchcancel",qa=0,M=null,ta=0,B=0,F=0,ea=1,S=0,Y=b(j),X="start",V=0,ca=null,pa=0,oa=0;try{Y.bind(ia,C);Y.bind(Z,K)}catch(ua){b.error("events not supported "+ia+","+Z+" on jQuery.swipe")}this.enable=function(){Y.bind(ia,C);Y.bind(Z,K);return Y};this.disable=function(){la();return Y};this.destroy=function(){la();Y.data(c,null);return Y}}var m="left",d="right",g="up",o="down",u="in",x="out",v="none",p="auto",z="horizontal",i="vertical",t="all", r="start",q="move",f="end",h="cancel",y="ontouchstart"in window,c="TouchSwipe";b.fn.swipe=function(j){var l=b(this),C=l.data(c);if(C&&typeof j==="string")if(C[j])return C[j].apply(this,Array.prototype.slice.call(arguments,1));else b.error("Method "+j+" does not exist on jQuery.swipe");else if(!C&&(typeof j==="object"||!j))return a.apply(this,arguments);return l};b.fn.swipe.defaults={fingers:1,threshold:75,maxTimeThreshold:null,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null, swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,triggerOnTouchEnd:true,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"button, input, select, textarea, a, .noSwipe"};b.fn.swipe.phases={PHASE_START:r,PHASE_MOVE:q,PHASE_END:f,PHASE_CANCEL:h};b.fn.swipe.directions={LEFT:m,RIGHT:d,UP:g,DOWN:o,IN:u,OUT:x};b.fn.swipe.pageScroll={NONE:v,HORIZONTAL:z,VERTICAL:i,AUTO:p};b.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:t}})(jQuery); (function(){if(typeof window.be=="undefined")window.be={};if(typeof be.marlon=="undefined")be.marlon={};if(typeof be.marlon.ui=="undefined")be.marlon.ui={};var b=be.marlon.ui;b.CarConfig=function(){this.init()};b.CarConfig.prototype={constructor:b.CarConfig,init:function(){var a=this,e=$(".lcc-container"),m=e.find(".accordion"),d=e.find(".scroller"),g=e.find(".tab-layout"),o=$(".checkbox input, .radio input"),u=$(".selectors-toggle"),x=$(".summary-cta");$("aside.primary .next");var v=$(".backtotop"), p=$('[rel="overlay"]'),z=$(".overlay-custom"),i=e.find(".compare-link");if(m.length){m.Accordion();this.scrollToPosition(m.find(".closed .trigger"))}d.length&&d.Scroller();if(g.length){g.Tabs();this.scrollToPosition(g.find(".tab-nav"),60)}p.length&&p.Overlay({selectors:{container:".main"},onOpen:function(){var t=$(".configs-scroller");if(t.length){t.Scroller({selectors:{group:".configs-strip",items:"ul",pager:".pager"}});t.length&&a.clearRows(t.find("li"))}},onClose:function(){$(".configs-scroller").find("li").height("auto")}}); z.length&&z.Overlay({selectors:{container:".main"},content:'

          Testmessage

          Test content

          '});o.length&&this.customInputs(o);if(u.length)u.SelectorsToggle({enableSwipe:Modernizr?Modernizr.touch:false,toggleChangeEventName:"onchange"}).bind("onchange",function(t,r){parseInt(r.getAttribute("data-value"),10)});x.length&&this.setSummary(e,x);v.length&&this.scrollToTop(v);i.length&&i.each(function(){var t=$(this),r=$("#"+t.data("target"));a.loadCompare(r, t)});$(".item-list .col").length&&this.clearRows($(".item-list .col .content"))},loadCompare:function(a,e){e.each(function(){});e.Overlay({selectors:{container:".middle"},center:false,onOpen:function(){a.compareTables({"compare/comfortpro.html":{$data:null},"compare/luxury.html":{$data:null},"compare/f-sport.html":{$data:null}})},onClose:function(){a.compareTables({cleanUp:true})}})},hideNext:function(a){a.slideUp(2E3)},showNext:function(a){a.slideDown(2E3)},scrollToTop:function(a){a.click(function(){$("body,html").animate({scrollTop:0}, 500)})},scrollToPosition:function(a,e){var m=$(window).height();a.each(function(){var d=$(this),g=d.outerHeight();d.click(function(){var o=$(this).offset(),u=o.top+g/2-m/2;typeof e=="number"?$("body,html").animate({scrollTop:o.top-e},500):$("body,html").animate({scrollTop:u},500)})})},setSummary:function(a,e){var m=e.find("li"),d=e.width()/m.length;e.is(":visible")&&a.addClass("has-summarycta");m.each(function(){$(this).width(d)})},customInputs:function(a){a=a.selector;var e=this;$(document).on("click", a,function(){var m=$(this);m.attr("data-text");var d=m.closest(".input");if(m.closest("label").hasClass("radio")){m=$('input[name="'+m.attr("name")+'"]');m.parent().removeClass("checked");m.closest("label").removeClass("active");m.closest(".col").removeClass("active")}e.toggleCustomInput(d,d.hasClass("checked"))});$(document).on("focus",a,function(){$(this).parent().addClass("focus")});$(document).on("blur",a,function(){$(this).parent().removeClass("focus")});$(".checkbox input:checked, .radio input:checked").parent().addClass("checked").closest(".col").addClass("active"); $(".checkbox input:checked, .radio input:checked").parent().closest("label").addClass("active")},toggleCustomInput:function(a,e){a.toggleClass("checked",!e).closest(".col").toggleClass("active",!e);a.toggleClass("checked",!e).closest("label").toggleClass("active",!e);a.children("input").attr("checked",!e)},clearRows:function(a){var e=0,m=0,d=[],g;a.each(function(){g=$(this);topPostion=g.position().top;if(m!=topPostion){for(currentDiv=0;currentDiv
          ');v.click&&U.find("a").bind("click",v.click)}ba.html(p);Modernizr.touch&&a.bind("touchstart",J)}function t(B,F){if(typeof F=="undefined")F=false;sa=B;var ea=0,S=H.length,Y,X;for(ma=0;ea
          ');P.append(pa);G.push(pa)}if(F==0&&U)oa[la].push(U);else{pa=h(X,la);oa[la].push(pa)}}if(ca.length<=1||o=="wheel"){ca=[];s.empty();m.hide()}else m.show();Y=ca.length;for(var D;S0?30:0))*F+"px");for(S=0;S'+ea+'

        3. ')}function h(B,F){var ea=$('
          '),S,Y={data:B,chkLabelSelected:qa.getLabel("selected"), chkLabelDeselected:p,chkID:B.ID,hasInfo:B.Description&&B.Description!=""};S=new g(Y,u,o,z);S.addEventListener(S.ITEM_CLICK,c);ea.append(S.getElement());if(Y.hasInfo){Y={data:B,chkLabelDeselected:p};var X=new b.DetailItem(Y,u,o);ea.append(X.getElement());X.addEventListener(X.DETAIL_SELECTED,da)}ea.data("id",B.ID);ea.data("catid",F);ea.data("class",S);ea.data("detail",X);return ea}function y(B){a.animate({height:B.data})}function c(B){if(o=="wheel"||o=="radio"||o==null)j([B.data]);else{for(var F=0, ea=ta.length,S=false,Y=[];F40&&Math.abs(F)>Math.abs(S))na=false;if(Math.abs(ea)>50)E=false;if(na)E||T.css("left",-B);else window.scrollTo(R-S,Z-F);return false}function I(B){B.stopPropagation();var F=-Number(T.css("left").replace("px",""));F=-(ha+F);var ea=d*0.2,S=N;if(F<=-ea)S++;else F>=ea&&S--;if(S<0)S=0;else if(S>=ma)S=ma-1;E&&na&&O(B.target);S!=N?w(S):T.animate({left:ha});na=E=true;$(document).unbind("touchmove",K);$(document).unbind("touchend",I);return false}function O(B){B=$(B);for(var F=$._data(B[0], "events");B&&B[0]!=null&&(typeof F=="undefined"||typeof F.click=="undefined")&&!B.hasClass("item-list");){B=B.parent();F=$._data(B[0],"events")}B&&B[0]&&F!=null&&F.click!=null&&B.click()}function W(B){var F=B.originalEvent?B.originalEvent:B;if(F&&F.targetTouches){B=F.targetTouches[0];F=B.clientX;B=B.clientY}else{F=B.pageX;B=B.pageY}return{x:F,y:B}}function da(B){c(B)}var Q=this,N=0,H=[],G=[],ba=m.find("h3"),s=m.find(".filters"),P=e.find(".pager"),T=a.find(".container"),la="all",ma=0,E,U=false,na= true,sa="",L,ia,ha,R,Z,qa=be.marlon.utils.Dictionary,M=be.marlon.utils.Settings,ta=[];T.css("position","relative");this.ITEM_CLICK="item_click";this.eventTypes=[];this.eventHandlers=[];this.getElement=function(){return a};this.initList=function(B){r();q(B);s.find("a").bind("click",l);P.find("a").bind("click",C);t(la)};this.selectItems=function(B){j(B)};this.nextPage=function(){var B=N+1;B>=ma||w(B)};this.previousPage=function(){var B=N-1;B<0||w(B)};this.updatePrices=function(B){for(var F=0,ea=B.length, S=null;F0&&$(p.find(".col")[i]).after(r);t&&p.isotope("reloadItems").isotope({sortBy:"original-order"},a)}var x="*",v=this,p,z=$('
          ');this.HEIGHT_CHANGED="height_changed";this.eventTypes=[];this.eventHandlers=[];this.init=function(i){p=z.children().first();for(var t=0,r=i.length;t< r;t++)p.append(i[t]);i=v.getItems();i.addClass("regular");i.find(".full-content").hide();p.isotope({itemSelector:".col",masonry:{columnWidth:1},resizeContainer:false,transformsEnabled:true},a)};this.destroy=function(){for(var i=v.getItems(),t=0,r=i.length,q,f;t0,q=a.data.PriceInfo!=undefined&&v.getSetting("showprice")=="true",f=p;if(a.data.DetailImage)f=f.replace("[IMG_URL]",a.data.DetailImage);else{r=r?$.grep(a.data.Assets,function(h){return h.Type=="IMG_PNG_360x322"})[0]:null;f=f.replace("[IMG_URL]",r?r.Url:"/img/glb/normal.png")}f=f.replace("[TITLE]",a.data.Name);f=f.replace("[DESCRIPTION]",a.data.Description);if(q){q=a.data.PriceInfo.ListPriceWithDiscount; f=f.replace("[PRICE]",q>0?e(q,true):"");f=v.getSetting("secondconversionrate")!=null?f.replace("[PRICE_DUAL]",q>0?e(q,true,true):""):f.replace("[PRICE_DUAL]","")}else{f=f.replace("[PRICE]","");f=f.replace("[PRICE_DUAL]","")}f=f.replace("[SELECTED]",x.getLabel("selected"));f=f.replace("[REMOVE]",x.getLabel("remove"));f=f.replace("[CLOSE]",x.getLabel("close"));z=$(f);i=z.find("div.content p").first();i.on("click",o);g()}function g(){if(t){i.empty();i.append('');i.find("i.icon-checked").css("background-position", m=="radio"?"2px -138px":"0 -100px");i.append(x.getLabel("selected"));m=="checkbox"&&i.append(" "+x.getLabel("remove")+"")}else{i.empty();i.append('');i.find("i.icon-checked").css("background-position",m=="radio"?"-38px -138px":"-40px -100px");i.append(a.chkLabelDeselected);m=="checkbox"&&i.append(" ")}}function o(){if(m=="checkbox")t=!t;else if(t==false)t=true;g();u.dispatchEvent({type:u.DETAIL_SELECTED,data:a.data.ID})}var u=this,x=be.marlon.utils.Dictionary, v=be.marlon.utils.Settings;this.eventTypes=[];this.eventHandlers=[];var p='

          [TITLE]

          [PRICE]
          [PRICE_DUAL]

          [SELECTED] [REMOVE]

          [DESCRIPTION]
          [CLOSE]
          ', z=null,i=null,t=false;this.getElement=function(){return z};this.setChecked=function(r){t=r;g()};d()};b.DetailItem.prototype=new be.marlon.EventDispatcher;b.DetailItem.prototype.constructor=b.DetailItem;b.DetailItem.DETAIL_SELECTED="DETAIL_SELECTED"})(); (function(){var b=be.marlon.ui;b.Message=function(a,e,m,d){function g(r,q,f){f.empty();f.append("

          "+r+"

          ");f.append('
          '+q+"
          ");f.append(''+v.getLabel("close")+"");f.find("a.close").on("click",function(h){h.preventDefault();f.hide();x()});f.show()}function o(r){for(var q=0,f=z.length,h=null;q",{"class":"overlay"});this.showPreloadError=function(r,q){t.show();$("div.main").first().append(t);t.css("display","block");g(r,q,d)};this.showInfoMessage=function(r,q){t.show();$("div.main").first().append(t);t.css("display","block");$("div.main .overlay").last().on("click",function(f){f.preventDefault();a.hide();x()}); g(r,q,a)};this.showConflictMessage=function(r,q){t.show();$("div.main").first().append(t);t.css("display","block");e.empty();e.append("

          "+v.getLabel("conflict_title")+"

          ");e.append('
          '+v.getLabel("conflict_message")+"
          ");var f='[CLOSE]';f=f.replace("[YES]",v.getLabel("yes"));f=f.replace("[NO]",v.getLabel("no")); f=f.replace("[CLOSE]",v.getLabel("close"));e.append($(f));e.find("div.actions a").first().on("click",function(h){h.preventDefault();r();e.hide();x()});e.find("div.actions a").last().on("click",function(h){h.preventDefault();q();e.hide();x()});e.find("a.close").last().on("click",function(h){h.preventDefault();q();e.hide();x()});e.show()};this.showIncludeMessage=function(r,q){t.show();$("div.main").first().append(t);t.css("display","block");p=r;m.empty();m.append("

          "+v.getLabel("include_title")+ "

          ");var f=$("
          ",{"class":"content"});f.append("

          "+v.getLabel("include_message").replace("[ITEM_NAME]",r[0].Name)+"

          ");r=r[2][0];var h=0,y=r.length;for(z=[];h[OK][CANCEL]
          [CLOSE]';f=f.replace("[OK]",v.getLabel("ok"));f=f.replace("[CANCEL]",v.getLabel("cancel"));f=f.replace("[CLOSE]",v.getLabel("close"));m.append($(f));m.find("div.additions").on("click",u); m.find("div.actions a").first().on("click",function(j){j.preventDefault();if(i){q(i,p);m.hide();x()}});m.find("div.actions a").last().on("click",function(j){j.preventDefault();m.hide();x()});m.find("a.close").last().on("click",function(j){j.preventDefault();m.hide();x()});m.show()}};b.Message.prototype=new be.marlon.EventDispatcher;b.Message.prototype.constructor=b.Message})(); (function(){var b=be.marlon.ui;b.Preloader=function(a){function e(x){d=Math.round(x*100);clearInterval(o);o=setInterval(m,d>=100?1:300/(d-g))}function m(){g+=d==100?4:1;if(g>=100){g=100;clearInterval(o);a.animate({opacity:0})}else g>=d&&clearInterval(o);var x=Math.ceil(g*0.36);if(x!=u){a.removeClass("preloader-"+u);u=x;a.addClass("preloader-"+u)}a.html(g+"%")}var d=0,g=0,o=null,u=0;this.hide=function(){a.animate({opacity:0})};this.show=function(){a.animate({opacity:1})};this.reset=function(){g=d= 0;clearInterval(o);a.removeClass(function(x,v){return(v.match(/\bpreloader-\S+/g)||[]).join(" ")});a.html("0%")};this.setValue=function(x){e(x)}};b.Preloader.prototype=new be.marlon.EventDispatcher;b.Preloader.prototype.constructor=b.Preloader})(); (function(){var b=be.marlon.ui;b.FullscreenSpinplayer=function(a,e){function m(){a.show();g.setShouldLoadImages(true);$("div.main").first().append(o);$("div.main .overlay").last().on("click",d);o.css("display","block")}function d(){a.hide();g.setShouldLoadImages(false);$("div.main .overlay").last().remove()}var g,o;this.init=function(){g=new b.SpinPlayer(a.find("section.player-exterior").first(),a.find("section.player-interior").first(),a.find("div.toggle-views").first(),e,true);g.setShouldLoadImages(false); g.init();o=$("
          ",{"class":"overlay"});o.show();o.css("display","block");a.find("a.close").on("click",d)};this.showExterior=function(u){g.showExterior(u)};this.setConfig=function(u){g.setConfig(u)};this.show=function(){m()};this.hide=function(){d()};this.isExtVisible=function(){return g.isExtVisible()};this.isIntVisible=function(){return g.isIntVisible()};this.getExtMirror=function(){return g.getExtMirror()};this.getIntMirror=function(){return g.getIntMirror()};this.addMirror=function(u,x){g.addMirror(u, x)}};b.FullscreenSpinplayer.prototype=new be.marlon.EventDispatcher;b.FullscreenSpinplayer.prototype.constructor=b.FullscreenSpinplayer})(); (function(){var b=be.marlon.ui;b.InteriorGallery=function(a,e,m,d,g,o){function u(){$.each(O,function(G,ba){ba({_face:C/e})})}function x(){I=$("
          ");I.addClass("gallery-click-handler");a.append(I);$.each([0,3,2,1],function(G,ba){G=$('");W.push(G);o.append(G)});o.find("a").on("click",y)}function v(){a.empty();l=[];for(var G=0;G<4;G++){a.append(K[G]);l.push(K[G])}K=[];a.append(I);I.on("touchstart",p);I.on("mousedown",t);f()}function p(G){H=true; N=0;da=G.originalEvent.touches[0].clientX;Q=G.originalEvent.touches[0].clientY;$(document).on("touchmove",z);$(document).on("touchend",i)}function z(G){N=da-G.originalEvent.touches[0].clientX;var ba=Math.abs(Q-G.originalEvent.touches[0].clientY),s=Math.abs(N);if(ba>s){if(ba>30){$(document).off("touchmove",z);$(document).off("touchend",i)}}else{G.preventDefault();if(N>100){h(C-e,true,false);$(document).off("touchmove",z);$(document).off("touchend",i)}else if(N<-100){h(C+e,true,false);$(document).off("touchmove", z);$(document).off("touchend",i)}}}function i(G){G.preventDefault();$(document).off("touchmove",z);$(document).off("touchend",i);if(Math.abs(N)<40)da-I.offset().left>m>>1?h(C-e,true,false):h(C+e,true,false)}function t(G){if(!H){G.preventDefault();da=G.clientX;Q=G.clientY;$(document).on("mousemove",r);$(document).on("mouseup",q)}}function r(G){if(!H){G.preventDefault();var ba=Math.abs(Q-G.clientY);G=Math.abs(da-G.clientX);if(ba>G)if(ba>50){$(document).off("mousemove",r);$(document).off("mouseup",q)}}} function q(G){if(!H){G.preventDefault();var ba=da-G.clientX;if(ba>100)h(C-e,true,false);else if(ba<-100)h(C+e,true,false);else if(Math.abs(ba)<30)G.pageX-I.offset().left>m>>1?h(C-e,true,false):h(C+e,true,false);$(document).off("mousemove",r);$(document).off("mouseup",q)}}function f(){if(g){clearInterval(w);J=C}else{J=(1*J+3*C)*0.25;if(Math.abs(J-C)<1){J=C;clearInterval(w)}}for(var G=0;Ge*2)s-=e*4;ba.style.left=j+ s+"px"}}}function h(G,ba,s){C=G;if(!s){u();c.dispatchEvent({type:"remove_tooltip",data:null})}clearInterval(w);$.each(W,function(P,T){T.attr("data")==(C/e+800)%4?T.addClass("active"):T.removeClass("active")});if(ba&&!s)w=setInterval(f,20);else{J=C;$.each(l,function(P,T){P=(J+T.xOffset)%(e*4);if(P<-(e*2))P+=e*4;if(P>e*2)P-=e*4;T.style.left=j+P+"px"})}}function y(G){h($(G.currentTarget).attr("data")*e,false,false)}var c=this,j=m-e>>1,l=[],C=0,w,J=0,K=[],I,O=[],W=[],da,Q,N,H=false;this.eventTypes=[]; this.eventHandlers=[];this.LOAD_PROGRESS="LOAD_PROGRESS";this.loadImages=function(G){K=[];for(var ba=0,s=0;s<4;s++){var P=new Image;P.onload=function(){ba++;ba==4&&v();c.dispatchEvent({type:c.LOAD_PROGRESS,data:ba/4})};P.width=e;P.height=e;P.className="gallery-image";P.style.left=-s*e+"px";P.style.width=e;P.style.height=e;P.xOffset=-s*e;P.src=G[s];K.push(P)}};this.addMirror=function(G){O.push(G)};this.mirror=function(G){h(G._face*e,false,true)};x()};b.InteriorGallery.prototype=new be.marlon.EventDispatcher; b.InteriorGallery.prototype.constructor=b.InteriorGallery})(); (function(){var b=be.marlon.ui;b.InteriorCSS=function(a,e,m,d){function g(){$.each(I,function(E,U){U({_verticalAngle:W,_horizontalAngle:O})})}function o(E){E=E.replace(/(width=)([0-9]+)/,u);return E=E.replace(/(height=)([0-9]+)/,u)}function u(E,U,na){return U+(Number(na)+T)}function x(E){a.find("div.interior-plane-css").empty();a.find("div.interior-plane-front").first().append(E[0]);a.find("div.interior-plane-left").first().append(E[1]);a.find("div.interior-plane-back").first().append(E[2]);a.find("div.interior-plane-right").first().append(E[3]); a.find("div.interior-plane-bottom").first().append(E[4]);a.find("div.interior-plane-top").first().append(E[5]);a.find("div.interior-plane-front_s").first().append(E[6]);a.find("div.interior-plane-left_s").first().append(E[10]);a.find("div.interior-plane-back_s").first().append(E[7]);a.find("div.interior-plane-right_s").first().append(E[11]);a.find("div.interior-plane-bottom_s").first().append(E[9]);a.find("div.interior-plane-top_s").first().append(E[8])}function v(E){var U=ma[E],na=T*0.5,sa=C,L=C; sa+=U.offset?na:0;L+=U.offset?P:0;E=(new Sprite3D).setClassName("interior-plane-css interior-plane-"+E+(U.offset?" expand":"")).setTransformOrigin(0,0).setPosition(-sa,-sa,-L).rotateY(U.yRotOffset).rotateX(U.xRotOffset).rotateZ(U.zRotOffset).setRotateFirst(true).update();U.img=E;p(E);J.addChild(E);da.push(E)}function p(E){E.draggable=false;E.onmousedown=function(U){U.preventDefault();return false}}function z(){J.setRotationY(O);J.setRotationX(W);J.update();var E,U;for(var na in ma){E=ma[na];U=true; if(E.invH){if(OE.maxH)U=false}else if(O>E.minH&&OE.minV&&W90&&W<270)W=W-180<0?90:270;z();if(!H&&Math.abs(G)<=1&&Math.abs(ba<=1)){ba=G=0;clearInterval(la);g()}}var l=this,C=e>>1,w,J,K,I=[],O=0,W=350,da=[],Q=0,N=0,H=false,G=0,ba=0,s=true,P=1,T=4,la, ma={top:{xRotOffset:-90,yRotOffset:0,zRotOffset:0,minH:-1,maxH:-1,invH:false,minV:269,maxV:346,aaH:true,aaV:true},top_s:{xRotOffset:-90,yRotOffset:0,zRotOffset:0,minH:-1,maxH:-1,invH:false,minV:269,maxV:346,aaH:true,aaV:true,offset:true},bottom:{xRotOffset:90,yRotOffset:0,zRotOffset:0,minH:-1,maxH:-1,invH:false,minV:14,maxV:91,aaH:true,aaV:true},bottom_s:{xRotOffset:90,yRotOffset:0,zRotOffset:0,minH:-1,maxH:-1,invH:false,minV:14,maxV:91,aaH:true,aaV:true,offset:true},front:{xRotOffset:0,yRotOffset:0, zRotOffset:0,minH:103,maxH:257,invH:false,minV:-1,maxV:-1,aaH:true,aaV:false},front_s:{xRotOffset:0,yRotOffset:0,zRotOffset:0,minH:103,maxH:257,invH:false,minV:-1,maxV:-1,aaH:true,aaV:false,offset:true},back:{xRotOffset:0,yRotOffset:180,zRotOffset:0,minH:77,maxH:283,invH:true,minV:-1,maxV:-1,aaH:true,aaV:false},back_s:{xRotOffset:0,yRotOffset:180,zRotOffset:0,minH:77,maxH:283,invH:true,minV:-1,maxV:-1,aaH:true,aaV:false,offset:true},left:{xRotOffset:0,yRotOffset:90,zRotOffset:0,minH:14,maxH:168,invH:false, minV:-1,maxV:-1,aaH:false,aaV:false},left_s:{xRotOffset:0,yRotOffset:90,zRotOffset:0,minH:14,maxH:168,invH:false,minV:-1,maxV:-1,aaH:false,aaV:false,offset:true},right:{xRotOffset:0,yRotOffset:-90,zRotOffset:0,minH:192,maxH:346,invH:false,minV:-1,maxV:-1,aaH:false,aaV:false},right_s:{xRotOffset:0,yRotOffset:-90,zRotOffset:0,minH:192,maxH:346,invH:false,minV:-1,maxV:-1,aaH:false,aaV:false,offset:true}};this.eventTypes=[];this.eventHandlers=[];this.LOAD_PROGRESS="LOAD_PROGRESS";this.init=function(){var E= navigator?navigator.userAgent:null,U;if(typeof E=="string"){U=/(Windows){1}.*(Firefox\/){1}(\d+)/i;if(U=U.exec(E)){U=Number(U[3]);if(U>17)s=false}U=/iPad{1}.*Mobile{1}.*Safari{1}.*/i;if(U=U.exec(E))s=false}if(!s){delete ma.top_s;delete ma.bottom_s;delete ma.front_s;delete ma.back_s;delete ma.left_s;delete ma.right_s}K=$("
          ");K.css("width",m);K.css("height",d);K.css("position","absolute");K.css("cursor","pointer");K.css("z-index",600);a.prepend(K);w=new Sprite3D(a.find("div.interior-container-center")[0]); J=(new Sprite3D).setZ(318).setX(367).setY(238).update();w.addChild(J);for(var na in ma)v(na);z();a.on("mousedown",t);a.on("touchstart",i)};this.addMirror=function(E){I.push(E)};this.mirror=function(E){W=E._verticalAngle;O=E._horizontalAngle;z()};this.loadImages=function(E){var U=[];s&&E.push(o(E[0]),o(E[2]),o(E[5]),o(E[4]),o(E[1]),o(E[3]));for(var na=0,sa=E.length,L=0;L0,l=a.data.PriceInfo!=undefined&&i.getSetting("showprice")=="true";c=m!=b.GenericItem.TYPE_WHEEL?t:r;c=c.replace(/\u00a3TYPE/g,m);var C="IMG_PNG_168x93";if(m=="wheel")C="IMG_PNG_42x42";if(a.data.Image){c=c.replace("[WIDTH]","148px");c=c.replace("[HEIGHT]","83px");c=c.replace("[IMG_URL]",a.data.Image)}else{c=c.replace("[WIDTH]","168px");c=c.replace("[HEIGHT]","93px");j=j?$.grep(a.data.Assets, function(w){return w.Type==C})[0]:null;c=c.replace("[IMG_URL]",j?j.Url:"/img/glb/thumb.png")}c=c.replace("[IMG_ALT]",a.data.Name);c=c.replace("[FOR]",a.chkID);c=c.replace("[TITLE]",a.data.Name);if(l){l=a.data.PriceInfo.ListPriceWithDiscount;j=a.data.priceFrom?z.getLabel("price_from")+" ":"";j+=e(l,true);c=c.replace("[PRICE]",l!=0?j:"");j=a.data.priceFrom?z.getLabel("price_from")+" ":"";if(i.getSetting("secondconversionrate")!=null){j+=e(l,true,true);c=c.replace("[PRICE_DUAL]",l!=0?j:"")}else c= c.replace("[PRICE_DUAL]","")}else{c=c.replace("[PRICE]","");c=c.replace("[PRICE_DUAL]","")}c=c.replace("[CHK_LABEL]",a.chkLabelDeselected);q=$(c);f=q.find("span.group").last();if(a.hasInfo&&d!="grade"){c=q.find("a.more");c.on("click",u);c.data("info",q)}else q.find(".icon").remove();if(d=="grade"){q.on("click",x);c=q.find("label.content")}else{c=q.find("label.content");c.on("click",x)}c.data("select",a.data.ID);o()}function o(){if(h){q.parent().addClass("active");f.find("span.text").html(a.chkLabelSelected); f.find("span.input").addClass("checked")}else{q.parent().removeClass("active");f.find("span.text").html(a.chkLabelDeselected);f.find("span.input").removeClass("checked")}}function u(){p.dispatchEvent({type:p.INFO_CLICK,data:q});v()}function x(c){if(!$(c.target).is("input")){p.dispatchEvent({type:p.ITEM_CLICK,data:a.data.ID});v()}}function v(){var c=$(".cs-secondary-nav");_contentTop=y.offset().top;c.length&&c.hasClass("fixed")?$("body,html").animate({scrollTop:_contentTop-c.outerHeight()},500):$("body,html").animate({scrollTop:_contentTop}, 500)}var p=this,z=be.marlon.utils.Dictionary,i=be.marlon.utils.Settings;this.ITEM_CLICK="item_click";this.INFO_CLICK="info_click";this.eventTypes=[];this.eventHandlers=[];var t='
          [IMG_ALT]
          ', r='
          [IMG_ALT]
          ', q=null,f=null,h=false,y=$(".main");this.getElement=function(){return q};this.getID=function(){return a.data.ID};this.getChecked=function(){return h};this.destroy=function(){var c,j;if(a.hasInfo){c=q.find("a.more");c.unbind("click",u);c=c.data();for(j in c)delete c[j]}c=q.find("span.group");c.unbind("click",x);c=c.data();for(j in c)delete c[j];f=q=p=null};this.setChecked=function(c){h=c;o()};this.forceHeight=function(c){m=="wheel"?q.find(".radio.group.content").height(c):q.find("."+m+".content").height(c)}; this.getHeight=function(){if(m=="wheel")return q.find(".radio.group.content").height();return q.find("."+m+".content").height()};this.toggle=function(){h=!h;o()};this.updatePrice=function(c){if(i.getSetting("showprice")=="true"){q.find("span.price").first().html(c!=0?e(c,true):"");if(i.getSetting("secondconversionrate")!=null)q.find("span.price").last().html(c!=0?e(c,true,true):"")}};g()};b.GenericItem.prototype=new be.marlon.EventDispatcher;b.GenericItem.prototype.constructor=b.GenericItem;b.GenericItem.TYPE_CHECKBOX= "checkbox";b.GenericItem.TYPE_RADIOBUTTON="radio";b.GenericItem.TYPE_WHEEL="wheel"})(); (function(){var b=be.marlon.ui;b.ColourItem=function(a,e){function m(){var i=p;$.grep(a.data.Assets,function(r){return r.Type=="SELECTOR"});i=i.replace("[FOR]",a.chkID);i=i.replace("[NAME]",a.data.Name);var t=a.data.PriceInfo.ListPriceWithDiscount;if(v.getSetting("showprice")=="true"){i=i.replace("[PRICE]",t!=0?e(t,true):"");i=v.getSetting("secondconversionrate")!=null?i.replace("[PRICE_DUAL]",t!=0?e(t,true,true):""):i.replace("[PRICE_DUAL]","")}else{i=i.replace("[PRICE]","");i=i.replace("[PRICE_DUAL]", "")}i=i.replace("[RDO_NAME]",a.chkID);i=i.replace("[RDO_ID]",a.chkID);i=i.replace("[RDO_VALUE]",a.data.ID);i=i.replace("[RDO_LABEL]",a.chkLabelDeselected);z=$(i);z.css("cursor","pointer");d();i=a.data.RGB;i=i.replace("0x","#");z.find("span.swatch").css("background-color",i);z.bind("click",g)}function d(){if(u){z.addClass("active");z.find("span.text").last().html(x.getLabel("selected"));z.find("span.radio").last().addClass("checked")}else{z.removeClass("active");z.find("span.text").last().html(x.getLabel("select_ext_colour")); z.find("span.radio").last().removeClass("checked")}}function g(){o.dispatchEvent({type:o.ITEM_CLICK,data:a.data.ID})}var o=this,u=false,x=be.marlon.utils.Dictionary,v=be.marlon.utils.Settings;this.ITEM_CLICK="item_click_colour";this.eventTypes=[];this.eventHandlers=[];var p='
          ', z=null;this.getElement=function(){return z};this.getID=function(){return a.data.ID};this.getChecked=function(){return u};this.destroy=function(){};this.setChecked=function(i){u=i;d()};this.forceHeight=function(i){z.height(i)};this.getHeight=function(){return z.height()};this.toggle=function(){u=!u;d()};this.updatePrice=function(i){if(v.getSetting("showprice")=="true"){z.find("span.price").first().html(i!=0?e(i,true):"");if(v.getSetting("secondconversionrate")!=null)z.find("span.price").last().html(i!= 0?e(i,true,true):"")}};m()};b.ColourItem.prototype=new be.marlon.EventDispatcher;b.ColourItem.prototype.constructor=b.ColourItem})(); (function(b){var a=function(e,m,d,g){function o(){b.each(sa,function(L,ia){ia({_iCurrentImage:j})})}function u(){N=b('
          ');N.css("width",m);N.css("height",d);U.append(N);N.mousedown(r);N.on("touchstart",t);na.find("span.tooltip").first().append("Click & drag to rotate");g&&e.find("span.preloader").css("left","0px").css("width","954px")}function x(){for(var L=0,ia=[],ha=0,R,Z,qa=[6,3,2,1],M=[3,6,12,12];L<3;L++){R=j+L*12;if(R>35)R-=36;ia.push(R)}for(Z=L=0;L<33;L++){R= ia[ha]+qa[Z];if(R>35)R-=36;if(R<0)R+=36;ia.push(R);if(ha==M[Z]-1){Z++;ha=0}else ha++}return ia}function v(L){L.load(i);L.error(z);var ia=b.data(L,"src");L.attr("src",ia);W.dispatchEvent({type:W.LOAD_PROGRESS,data:O+1})}function p(L){L.preventDefault?L.preventDefault():L.stop();L.returnValue=false;L.stopPropagation()}function z(){W.dispatchEvent({type:W.LOAD_ERROR})}function i(){var L=l[O];if(L){g||L.css("margin-left",-210);L.css("margin-top",-Math.round(d));L.unbind("load");var ia=b.data(L,"frame"); C[ia]=L;if(O==0){U.find("img").remove();E.reset();E.show()}else L.hide();U.append(L);O++;da=100-95*(O/36);O<=Q&&E.setValue(O/Q);if(O=Q){H=true;W.dispatchEvent({type:W.LOAD_COMPLETE});ba&&na.animate({opacity:1})}}}function t(L){r(L)}function r(L){s=true;var ia=c(L);p(L);T=window.scrollX;la=window.scrollY;if(!H)return false;w=ia.x;J=ia.y;I=j;ma=0;if(!G){v(l[O]);G=true}b(document).bind("mouseup",f);b(document).bind("mousemove",h);b(document).on("touchend",q);b(document).on("touchmove", h);W.dispatchEvent({type:W.NOTIFY,data:"mouse down!"});if(ba){na.clearQueue().fadeOut(500,function(){ba=false});L=be.marlon.Webtrend;ia={cg_n:"A_CarConfig",dl:"22",ModelID:L.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:L.getStep(),si_n:"Car Configurator",si_x:L.getNStep(),ev_val:"Spin Initiated",ev_act:g?"Full Screen Exterior":"Exterior"};L.track(ia)}}function q(L){f(L)}function f(L){p(L);P=true;b(document).unbind("mouseup",f);b(document).unbind("mousemove",h);b(document).off("touchend", q);b(document).off("touchmove",h);I=K=-1;W.dispatchEvent({type:W.NOTIFY,data:"mouse up!"});s=false;o()}function h(L){L=c(L);var ia=L.x-w,ha=L.y-J;if(L.touchevent&&Math.abs(ha)>40&&Math.abs(ha)>Math.abs(ia))P=false;if(P){ha=ia-ma;if(Math.abs(ha)>da){ma=ia;C[j].hide();var R=j;y(ha<0)}if(!H)if(j!=R){R=L.x=ia)j=0}}function c(L){var ia=L.originalEvent?L.originalEvent:L,ha;if(ia&&ia.targetTouches){L=ia.targetTouches[0];ha=L.clientX;L=L.clientY}else{ha=L.pageX;L=L.pageY}return{x:ha,y:L,touchevent:ia&&ia.targetTouches}}var j=3,l=[],C=false,w=-1,J=-1,K=-1,I=-1,O=0,W=this,da=50,Q=3,N,H=false,G=false,ba=true,s=false,P=true,T,la,ma=0,E=new be.marlon.ui.Preloader(e.find("span.preloader").first());e.find("div.container-images").first();var U=e.find(".exteriorspin"),na= e.find("span.indicator").first(),sa=[];this.LOAD_PROGRESS="load_progress";this.LOAD_COMPLETE="load_complete";this.LOAD_ERROR="load_error";this.NOTIFY="notify";this.update=function(L){da=100;var ia=0,ha=L.length,R;l=[];C=[];G=H=false;var Z=x();for(O=0;ia");b.data(R,"src",L[Z[ia]]);b.data(R,"frame",Z[ia]);l.push(R);C.push(null)}v(l[O])};this.hideLoader=function(){H&&_loader.hide()};this.hide=function(){e.hide()};this.show=function(){e.show()};this.addMirror=function(L){sa.push(L)}; this.mirror=function(L){if(!H&&!G)j=L._iCurrentImage;else{C[j].hide();j=L._iCurrentImage;C[j]||y(true);C[j].css("display","block")}};u()};a.prototype=new be.marlon.EventDispatcher;a.prototype.constructor=a;b.fn.ExteriorSpinCCv5=function(e,m,d){return new a(this,e,m,d)}})(jQuery); (function(){var b=be.marlon.ui;b.InteriorSpinCCv5=function(a,e){function m(){u=new b.Preloader(a.find("span.preloader").first());x=a.find("span.indicator").first();x.find("span.tooltip").first().append(_is3D?"Click & drag to rotate":"Click left or right to rotate");if(_is3D){var p=$("
          ",{"class":"interior-container-center"});a.find("div.interiorspin").first().append(p);o=e?new b.InteriorCSS(a.find("div.interiorspin").first(),734,954,426,e):new b.InteriorCSS(a.find("div.interiorspin").first(), 640,734,323,e);o.init()}else o=e?new b.InteriorGallery(a.find("div.interiorspin").first(),954,954,426,e,a.find("div.pager")):new b.InteriorGallery(a.find("div.interiorspin").first(),734,734,323,e,a.find("div.pager"));o.addEventListener("LOAD_PROGRESS",d);o.addEventListener("remove_tooltip",g)}function d(p){v&&p.data==1&&x.animate({opacity:1});u.setValue(p.data)}function g(){o.removeEventListener("remove_tooltip",g);x.animate({opacity:0},null,null,function(){x.hide()});var p=be.marlon.Webtrend,z={cg_n:"A_CarConfig", dl:"22",ModelID:p.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:p.getStep(),si_n:"Car Configurator",si_x:p.getNStep(),ev_val:"Spin Initiated",ev_act:e?"Full Screen Interior":"Interior"};p.track(z)}var o,u,x;_is3D=false;var v=true;this.update=function(p){u.reset();u.show();for(var z=_is3D?e?734:640:e?954:734,i=_is3D?6:4,t=0,r=[],q;t",{"class":"hide",html:"Stages"}));for(var h=0,y=f.length,c=$("
            ");hInfo');x($(".stages .panel-link"))};this.setActivePage=function(f){m(e(f))};this.showSection=function(f,h){d(e(f),h)};this.setConfig=function(f){for(var h=0,y=f.OptionsTypes.length,c=0,j=0;h0?t.getLabel("packs_added").replace("[NUM]", f.Packs.length):"");a.find('a[data-step="nav_exterior"] div.content').text(c>0?t.getLabel("ext_options_added").replace("[NUM]",c):"");a.find('a[data-step="nav_interior"] div.content').text(j>0?t.getLabel("int_options_added").replace("[NUM]",j):"");a.find('a[data-step="nav_accessories"] div.content').text(f.Accessories.length>0?t.getLabel("accessories_added").replace("[NUM]",f.Accessories.length):"")};this.isAvailable=function(f){return r[e(f)].ele.is(":visible")}};b.Navigation.prototype=new be.marlon.EventDispatcher; b.Navigation.prototype.constructor=b.Navigation})(); (function(){var b=be.marlon.ui;b.SummaryConfig=function(a,e){function m(){var w;w=0;c.find("div.group").first().find("div.col div.inner").each(function(){w=Math.max(w,$(this).height())})}function d(w){g(w.GradeLabel);o(w.Packs,w.PackLabels,w.PackPrices);u("EXT",w.Options,w.OptionsLabels,w.OptionsPrices,w.OptionsTypes);u("INT",w.Options,w.OptionsLabels,w.OptionsPrices,w.OptionsTypes);x(w.Accessories,w.AccessoriesLabels,w.AccessoriesPrices);m()}function g(w){q.find("strong").last().html(w)}function o(w, J,K){if(w&&w.length){f.css("display","block");f.find("h2").first().html(z.getLabel("my_packs")+(w.length?" ( "+w.length+" )":""));var I=0;if(K)for(var O=0,W=K.length;O0?e.formatPrice(I,true):"");f.find("span.price-dual").first().html(i.getSetting("secondconversionrate")!=null&&I>0?e.formatPrice(I,true,true):"");f.find("div.item-list-wrapper").html($("
            ",{"class":"item-list"}));f.find("div.item-list").append($("
            ", {"class":"page group"}));var da=f.find("div.group").last();$.each(w,function(Q,N){$.each(j,function(H,G){if(G.ID==N){H=G.Assets&&G.Assets.length>0?$.grep(G.Assets,function(ba){return ba.Type=="IMG_PNG_168x93"})[0]:null;da.append(p(J[Q],H?H.Url:"/img/glb/thumb.png",K&&K[Q]?K[Q].ListPriceWithDiscount:0))}})})}else f.hide()}function u(w,J,K,I,O){var W=0,da;if(w=="EXT")da=h;if(w=="INT")da=y;if(J&&J.length){var Q=0;if(I)for(var N=0,H=J.length;N0?e.formatPrice(Q,true):"");da.find("span.price-dual").first().html(i.getSetting("secondconversionrate")!=null&&Q>0?e.formatPrice(Q,true,true):"");da.find("div.item-list-wrapper").html($("
            ",{"class":"item-list"}));da.find("div.item-list").append($("
            ",{"class":"page group"}));var G=da.find("div.group").last();$.each(J,function(ba,s){O[ba]==w&&$.each(l,function(P,T){if(T.ID==s){W++;P=T.Assets&&T.Assets.length>0?$.grep(T.Assets,function(la){return la.Type== "IMG_PNG_168x93"})[0]:null;G.append(p(K[ba],P?P.Url:"/img/glb/thumb.png",I&&I[ba]?I[ba].ListPriceWithDiscount:0))}})});da.find("h2").first().html(z.getLabel("my_"+w+"_options")+(W?" ( "+W+" )":""))}W==0?da.hide():da.css("display","block")}function x(w,J,K){if(w&&w.length){c.css("display","block");c.find("h2").first().html(z.getLabel("my_accessories")+(w.length?" ( "+w.length+" )":""));var I=0;if(K)for(var O=0,W=K.length;O0?e.formatPrice(I,true):"");c.find("span.price-dual").first().html(i.getSetting("secondconversionrate")!=null&&I>0?e.formatPrice(I,true,true):"");c.find("div.item-list-wrapper").html($("
            ",{"class":"item-list"}));c.find("div.item-list").append($("
            ",{"class":"page group"}));var da=c.find("div.group").last();$.each(w,function(Q,N){$.each(C,function(H,G){if(G.ID==N){H=G.Assets&&G.Assets.length>0?$.grep(G.Assets,function(ba){return ba.Type== "IMG_PNG_168x93"})[0]:null;da.append(p(J[Q],H?H.Url:"/img/glb/thumb.png",K&&K[Q]?K[Q].ListPriceWithDiscount:0))}})})}else c.hide()}function v(w,J,K){var I=$("
            ",{"class":"section-row"}),O=$("
            ",{"class":"heading"});I.append(O);O.append($("

            ",{html:w+(K==true?" ( 0 )":"")}));O.append($("",{"class":"change",html:z.getLabel("change")+''}));O.find("a.change").attr("data",J);if(K==true){w=$("",{"class":"price"});J=$("", {"class":"price-dual"});K=$("
            ",{"class":"offer"});K.append(w);K.append(J);O.append(K);I.append($("
            ",{"class":"item-list-wrapper"}))}else I.append($("

            "));return I}function p(w,J,K){var I=t;I=I.replace("[IMG_SRC]",J);I=I.replace("[IMG_ALT]",w);I=I.replace("[TITLE]",w);I=I.replace("[PRICE]",K>0?e.formatPrice(K,true):"");I=I.replace("[PRICE_DUAL]",K>0&&i.getSetting("secondconversionrate")!=null?e.formatPrice(K,true,true):"");return $(I)}var z=be.marlon.utils.Dictionary, i=be.marlon.utils.Settings,t='
            [IMG_ALT]
            [TITLE]
            [PRICE]
            [PRICE_DUAL]
            ',r,q,f,h,y,c,j,l,C;this.init=function(){r=$("

            ",{"class":"hide",innerHTML:z.getLabel("summary_tab_configuration")});q=v(z.getLabel("my_grade"),"nav_grades", false);f=v(z.getLabel("my_packs"),"nav_packs",true);h=v(z.getLabel("my_ext_options"),"nav_exterior",true);y=v(z.getLabel("my_int_options"),"nav_interior",true);c=v(z.getLabel("my_accessories"),"nav_accessories",true);a.append(r);a.append(q);a.append(f);a.append(h);a.append(y);a.append(c);a.find("a.change").css("cursor","pointer")};this.getEle=function(){return a};this.setConfig=function(w){d(w)};this.setData=function(w,J,K){if(w)j=w;if(J)l=J;if(K)C=K};this.hide=function(){a.hide()};this.show=function(){a.show()}}; b.SummaryConfig.prototype=new be.marlon.EventDispatcher;b.SummaryConfig.prototype.constructor=b.SummaryConfig})(); (function(){var b=be.marlon.ui;b.SummaryStandard=function(a){function e(g){a.html("");for(var o=[],u=[],x=[],v=0,p=g.length,z="";v",{"class":"hide",html:d.getLabel("summary_tab_standard")}));x.length>0&&a.append(m(d.getLabel("standard_safety"),x));o.length>0&&a.append(m(d.getLabel("standard_exterior"),o));u.length>0&&a.append(m(d.getLabel("standard_interior"), u))}function m(g,o){var u=$("
            ",{"class":"section-row"}),x=$("
            ",{"class":"heading"});x.append($("

            ",{html:g}));g=$("
              ",{"class":"features"});for(var v=0,p=o.length;v",{html:o[v].Name}));u.append(x);u.append(g);return u}var d=be.marlon.utils.Dictionary;this.setStandardEquipment=function(g){e(g)};this.getEle=function(){return a};this.hide=function(){a.hide()};this.show=function(){a.show()}};b.SummaryStandard.prototype=new be.marlon.EventDispatcher;b.SummaryStandard.prototype.constructor= b.SummaryStandard})(); (function(){var b=be.marlon.ui;b.SummarySpecifications=function(a){function e(g){d.empty();var o="";o+=""+m.getLabel("specifications_model")+""+g.ModelLabel+"";o+=""+m.getLabel("specifications_bodytype")+""+g.BodyTypeLabel+"";o+=""+m.getLabel("specifications_engine")+""+g.EngineLabel+"";o+=""+m.getLabel("specifications_transmission")+""+g.TransmissionLabel+"";o+=""+m.getLabel("specifications_grade")+ ""+g.GradeLabel+"";o+="";d.html($(o))}var m=be.marlon.utils.Dictionary,d;this.init=function(){a.append("

              "+m.getLabel("summary_tab_specifications")+"

              ");a.append('
              ');d=a.find("table.specs").first()};this.getEle=function(){return a};this.setConfig=function(g){e(g)};this.hide=function(){a.hide()};this.show=function(){a.show()}};b.SummarySpecifications.prototype=new be.marlon.EventDispatcher;b.SummarySpecifications.prototype.constructor= b.SummarySpecifications})(); (function(){var b=be.marlon.ui;b.CompPage=function(a,e,m,d,g){function o(){a.show();$("div.main").first().append(h);h.css("display","block");h.on("click",function(l){l.preventDefault();u()});$("html, body").animate({scrollTop:a.offset().top-73},500)}function u(){a.hide();h.hide();h.off("click",function(l){l.preventDefault();u()});$("div.main .overlay").last().remove()}function x(l){$.each(q.find("th a.close-blue"),function(C,w){C=$(w);if(C.attr("data")==l){C.hide();p(C.attr("data"))}else{C.show();v(C.attr("data"))}})} function v(l){$.each(m,function(C,w){w.ID==l&&q.find("td:nth-child("+(C+2)+"),th:nth-child("+(C+2)+")").hide()});f.find("li[data="+l+"]").show()}function p(l){$.each(m,function(C,w){w.ID==l&&q.find("td:nth-child("+(C+2)+"),th:nth-child("+(C+2)+")").show()});f.find("li[data="+l+"]").hide()}function z(l,C){var w,J;w=0;for(J=l.StandardOn.length;w",{"class":"overlay"});a.find("a.close").last().on("click",function(l){l.preventDefault();u()});var y='Yes',c='No',j='Optional';this.hide=function(){u()};this.show=function(){o()};this.setData=function(l,C){if(!C){var w= $(""),J;if(g=="grades"){J=r.getLabel("compare_grades_btn");J=J.replace("[CARNAME]",e)}else if(g=="packs"){J=r.getLabel("compare_packs_btn");J=J.replace("[CARNAME]",e)}var K=$('');K.append('

              '+J+"

              ");$.each(m,function(O,W){O=$('');var da=W.Price>0?_controller.formatPrice(W.Price,true):"";O.append(''+W.Name+"");O.append(''+da+"");O.append('
              '); K.append(O)});w.append(K);var I;$.each(l,function(O,W){I=$('');I.append(""+W.Name+"");$.each(m,function(da,Q){I.append(""+z(W,Q.ID)+"")});w.append(I)});q.append(w);q.find("a.close-blue").on("click",i);a.find("h3").first().html(""+J+'');f.empty();$.each(m,function(O,W){f.append('
            • '+W.Name+"")});f.find("li").on("click",t);x(d)}o()}};b.CompPage.prototype=new be.marlon.EventDispatcher; b.CompPage.prototype.constructor=b.CompPage})(); (function(){var b=be.marlon.ui;b.CTABar=function(a,e,m){function d(c){var j=c.BasePrice.ListPriceWithDiscount;c=c.TotalPrice;var l=c-j;f.find("span.price").first().html(m.formatPrice(c,true));f.find("span.price-dual").first().html(t.getSetting("secondconversionrate")!=null?m.formatPrice(c,true,true):"");f.find("div.content .price").first().html(m.formatPrice(j,true));f.find("div.content .price-dual").first().html(t.getSetting("secondconversionrate")!=null?m.formatPrice(j,true,true):"");f.find("div.content .price").last().html(m.formatPrice(l, true));f.find("div.content .price-dual").last().html(t.getSetting("secondconversionrate")!=null?m.formatPrice(l,true,true):"");if(j==0||m.getPriceFormat().showPrice==false)f.hide()}function g(){for(var c=$("
                "),j=m.getSummaryContent().left,l=0,C=j.length;l');l.append('

                '+ C.title+'

                ');c.prepend(l)})}function x(c){var j="";switch(c){case "FINANCIAL":j="Finance Calculator";break;case "DEALERS":j="Dealer Finder";break;case "PDF":j="Download PDF";break;case "TESTDRIVE":j="Test Drive";break;case "BROCHURE":j="brochure_request";break;case "DEALER_OFFER":break;case "TAXATION":break;case "SHARE":break;case "INSURANCE":j="Insurance Calculator";break;case "SEND":j="Send Configuration to Dealer";break;case "SAVE":j="cc_save_config";break;case "PRINT":j= "Print Configuration";break;case "LOAD":j="cc_load_config";break}return j}function v(){var c={cg_n:"A_CarConfig",dl:"22",ModelID:r.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:r.getStep(),si_n:"Car Configurator",si_x:r.getNStep(),ev_val:"Price Summary",ev_act:"Next Step"};r.track(c);z.dispatchEvent({type:z.NEXT_STEP})}function p(c){if(!$(c.currentTarget).parent().hasClass("closed")){c={cg_n:"A_CarConfig",dl:"22",ModelID:r.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:r.getStep(), si_n:"Car Configurator",si_x:r.getNStep(),ev_val:"Price Summary",ev_act:"Expand Price"};r.track(c)}}var z=this,i=be.marlon.utils.Dictionary,t=be.marlon.utils.Settings,r=be.marlon.Webtrend,q,f;this.NEXT_STEP="next_step";var h,y;this.update=function(c){d(c)};this.showNextBtn=function(){a.find("a.next").slideDown(200)};this.hideNextBtn=function(){a.find("a.next").slideUp(200)};this.showVertical=function(){e.show();a.css("padding-top","140px")};this.hideVertical=function(){e.hide();a.css("padding-top", "61px")};this.init=function(){f=a.find("ul.pricing");a.find("a.next").first().prepend(i.getLabel("next_step"));a.find("ul.pricing.accordion h3").prepend(i.getLabel("otr_total_price"));a.find("ul.pricing.accordion div.offer").first().prepend(i.getLabel("otr_base_price"));a.find("ul.pricing.accordion div.offer").last().prepend(i.getLabel("otr_optional_price"));a.find("li.calc-finance").hide();a.find("li.calc-company").hide();a.find("a.next").on("click",v);a.find("a.next").css("cursor","pointer");g(); u();q=a.find(".accordion");if(q.length){q.Accordion();var c=q.find(".trigger");(c=c.length>=0?$(c[0]):false)&&c.bind("click",p)}}};b.CTABar.prototype=new be.marlon.EventDispatcher;b.CTABar.prototype.constructor=b.CTABar})(); (function(){var b=be.marlon.ui;b.Grades=function(a,e){function m(){if(a.is(":visible")&&z){v.initList(z);z=null}}function d(){if(a.is(":visible")&&i){v.selectItems([i]);i=null}}function g(r){u.dispatchEvent({type:u.GRD_SELECTED,data:r.data})}function o(){u.dispatchEvent({type:u.LOAD_COMPARE_GRADES})}var u=this,x=be.marlon.utils.Dictionary;this.GRD_SELECTED="grade_selected";this.LOAD_COMPARE_GRADES="load_compare_grades";var v=null,p=null,z=null,i=null,t=null;this.initData=function(r,q){a.find("h1.stage-title").first().html(x.getLabel("grades_title")); t||(t=new b.CompPage(a.find("#compare-grades"),q.ModelLabel,r,q.GradeID,"grades"));var f=a.find(".item-list-wrapper").first(),h=r.length>1?{label:x.getLabel("compare_grades_btn").replace("[CARNAME]",q.ModelLabel),click:o}:null;$.each(r,function(y,c){c.priceFrom=true});v=new be.marlon.ui.List(f.find(".item-list"),f.find(".item-list-nav"),f.find(".filters-wrapper.group"),760,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_RADIOBUTTON,e.formatPrice,8,h,x.getLabel("select_grade"),"grade");v.addEventListener(v.ITEM_CLICK, g);if(p==null){p=f.find(".item-list-nav");p.find(".icon.prev").bind("click",function(y){y.preventDefault();v.previousPage()});p.find(".icon.next").bind("click",function(y){y.preventDefault();v.nextPage()})}z=r;i=q.GradeID;m();d()};this.setCompareGrades=function(r,q){t.setData(r,q)};this.select=function(r){i=r.GradeID;d()};this.hide=function(){a.hide()};this.show=function(){a.show();m();d()}};b.Grades.prototype=new be.marlon.EventDispatcher;b.Grades.prototype.constructor=b.Grades})(); (function(){var b=be.marlon.ui;b.Packs=function(a,e){function m(){if(a.is(":visible")&&r){i.initList(r);r=null}}function d(){if(a.is(":visible")&&q){i.selectItems(u(q));q=null}}function g(j){p.dispatchEvent({type:p.PCK_SELECTED,data:j.data})}function o(j){for(var l=[],C=0,w=j.length,J=null,K=true;C0)for(var I=0,O=J.NotAvailableOn.length;I1?{label:z.getLabel("compare_packs_btn").replace("[CARNAME]",l.CarName),click:v}:null;if(!i){i=new be.marlon.ui.List(C.find(".item-list"),C.find(".item-list-nav"), C.find(".filters-wrapper.group"),760,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_CHECKBOX,e.formatPrice,8,w,z.getLabel("select_pack"));i.addEventListener(i.ITEM_CLICK,g)}if(t==null){t=C.find(".item-list-nav");t.find(".icon.prev").bind("click",function(J){J.preventDefault();i.previousPage()});t.find(".icon.next").bind("click",function(J){J.preventDefault();i.nextPage()})}r=j;q=l;m();d()};this.filterPacks=function(j){return o(j)};this.getActualPackCount=function(){return f};this.select=function(j){q= j;d()};this.hide=function(){a.hide()};this.show=function(){a.show();m();d()}};b.Packs.prototype=new be.marlon.EventDispatcher;b.Packs.prototype.constructor=b.Packs})(); (function(){var b=be.marlon.ui;b.Exterior=function(a,e){function m(){if(a.is(":visible")&&l.is(":visible")&&w){C.initList(w);h.updateColourPrices(J);w=null}}function d(){a.is(":visible")&&l.is(":visible")&&H&&C.selectItems([H.ExteriorColourID])}function g(){if(a.is(":visible")&&K.is(":visible")&&O){I.initList(O);h.updateWheelPrices(W);O=null}}function o(){a.is(":visible")&&K.is(":visible")&&H&&I.selectItems([H.WheelID])}function u(){if(a.is(":visible")&&da.is(":visible")&&N){Q.initList(N);N=null}} function x(){if(a.is(":visible")&&da.is(":visible")&&H)Q.selectItems(H.Options?H.Options:[])}function v(s){c=a.find("nav.tab-nav").first();c.find("li").off("click",q);c.empty();var P=$("
                  "),T=G;T=T.replace("[LABEL]",y.getLabel("ext_tab_colours"));T=T.replace("[VALUE]",0);P.append($(T));T=G;T=T.replace("[LABEL]",y.getLabel("ext_tab_wheels"));T=T.replace("[VALUE]",1);P.append($(T));if(s){s=G;s=s.replace("[LABEL]",y.getLabel("ext_tab_options"));s=s.replace("[VALUE]",2);P.append($(s))}c.append(P); c.append($(''));c.find("li").on("click",q);c.find("li").css("cursor","pointer");j=[];j.push(a.find("section#lcc-tab-exterior-colour"));j.push(a.find("section#lcc-tab-exterior-wheels"));j.push(a.find("section#lcc-tab-exterior-options"))}function p(s,P){c.find("li").removeClass("selected");c.find('li[value="'+s+'"]').addClass("selected");if(P===true){a.find("section.tab-content").hide().css("display","none");j[s].show().css("display","block")}else{P=a.find("section.tab-content"); var T=P.closest(".tab-layout").closest(".section-stage"),la=P.height(),ma=T.find("h1").outerHeight(true);T.css("height",la+ma+"px");P.fadeOut("250",function(){T.css("height","auto");$(this).css("display","none")});j[s].closest(".tab-layout").css("position","relative");j[s].css({position:"absolute",left:"0",top:+j[s].closest(".tab-layout").find("nav").outerHeight(true)+"px"});j[s].fadeIn("500",function(){j[s].css({position:"relative",top:"0",display:"block"})})}f();g();o();u();x()}function z(s,P,T, la,ma,E){var U=s.find(".item-list-wrapper").first(),na=new be.marlon.ui.List(U.find(".item-list"),U.find(".item-list-nav"),U.find(".filters-wrapper.group"),760,P,T,e.formatPrice,la,null,y.getLabel(E));na.addEventListener(na.ITEM_CLICK,ma);s=s.find(".item-list-nav");s.find(".icon.prev").bind("click",function(sa){sa.preventDefault();na.previousPage()});s.find(".icon.next").bind("click",function(sa){sa.preventDefault();na.nextPage()});return na}function i(s){h.dispatchEvent({type:h.WHL_SELECTED,data:s.data})} function t(s){h.dispatchEvent({type:h.CLR_SELECTED,data:s.data})}function r(s){h.dispatchEvent({type:h.OPT_SELECTED,data:s.data})}function q(s){p(s.currentTarget.value,false)}function f(){var s=$(".cs-secondary-nav");_contentTop=ba.offset().top;s.length&&s.hasClass("fixed")?$("body,html").animate({scrollTop:_contentTop-s.outerHeight()},500):$("body,html").animate({scrollTop:_contentTop},500)}var h=this,y=be.marlon.utils.Dictionary,c=null,j=[],l,C=null,w=null,J=null,K,I=null,O=null,W=null,da,Q=null, N=null,H=null;this.WHL_SELECTED="wheel_selected";this.CLR_SELECTED="colour_selected";this.OPT_SELECTED="ext_option_selected";var G='
                • [LABEL]
                • ',ba=$(".main");this.initData=function(s,P,T,la){a.find("h1.stage-title").first().html(y.getLabel("exterior_title"));w=s;O=P;N=T;H=la;l=a.find("section#lcc-tab-exterior-colour");K=a.find("section#lcc-tab-exterior-wheels");da=a.find("section#lcc-tab-exterior-options");s=T&&T.length>0;C||(C=z(l,be.marlon.ui.ColourItem,null,4,t,"select_ext_colour")); I||(I=z(K,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_WHEEL,8,i,"select_ext_wheel"));Q||(Q=z(da,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_CHECKBOX,8,r,"select_ext_option"));m();d();g();o();u();x();v(s);p(0,true)};this.renderOptions=function(s){N=s;u()};this.select=function(s){H=s;d();o();x()};this.hide=function(){a.hide()};this.show=function(){a.show();m();d();g();o();u();x()};this.showOptionsTab=function(){p(2,false)};this.updateWheelPrices=function(s){if(!a.is(":visible")|| !K.is(":visible"))W=s;else I.updatePrices(s)};this.updateColourPrices=function(s){if(!a.is(":visible")||!l.is(":visible"))J=s;else C.updatePrices(s)}};b.Exterior.prototype=new be.marlon.EventDispatcher;b.Exterior.prototype.constructor=b.Exterior})(); (function(){var b=be.marlon.ui;b.Interior=function(a,e){function m(){if(a.is(":visible")&&K.is(":visible")&&O){I.initList(O);h.updateUpholsteryPrices(W);O=null}}function d(){a.is(":visible")&&K.is(":visible")&&H&&I.selectItems([H.UpholsteryID])}function g(){if(a.is(":visible")&&l.is(":visible")&&w){C.initList(w);h.updateInlayPrices(J);w=null}}function o(){a.is(":visible")&&l.is(":visible")&&H&&C.selectItems([H.InlayID])}function u(){if(a.is(":visible")&&da.is(":visible")&&N){Q.initList(N);N=null}} function x(){if(a.is(":visible")&&da.is(":visible")&&H)Q.selectItems(H.Options?H.Options:[])}function v(s,P,T){c=a.find("nav.tab-nav").first();c.find("li").off("click",q);c.html("");var la=$("
                    ");if(s){s=G;s=s.replace("[LABEL]",y.getLabel("int_tab_trims"));s=s.replace("[VALUE]",0);la.append($(s))}if(P){P=G;P=P.replace("[LABEL]",y.getLabel("int_tab_inserts"));P=P.replace("[VALUE]",1);la.append($(P))}if(T){T=G;T=T.replace("[LABEL]",y.getLabel("int_tab_options"));T=T.replace("[VALUE]",2);la.append($(T))}c.append(la); c.append($(''));c.find("li").on("click",q);c.find("li").css("cursor","pointer");l==null&&da==null?c.hide():c.show();j=[];j.push(a.find("section#lcc-tab-interior-seats"));j.push(a.find("section#lcc-tab-interior-inserts"));j.push(a.find("section#lcc-tab-interior-options"))}function p(s,P){c.find("li").removeClass("selected");c.find('li[value="'+s+'"]').addClass("selected");if(P===true){a.find("section.tab-content").hide().css("display","none");j[s].show().css("display","block")}else{P= a.find("section.tab-content");var T=P.closest(".tab-layout").closest(".section-stage"),la=P.height(),ma=T.find("h1").outerHeight(true);T.css("height",la+ma+"px");P.fadeOut("250",function(){T.css("height","auto");$(this).css("display","none")});j[s].closest(".tab-layout").css("position","relative");j[s].css({position:"absolute",left:"0",top:+j[s].closest(".tab-layout").find("nav").outerHeight(true)+"px"});j[s].fadeIn("500",function(){j[s].css({position:"relative",top:"0",display:"block"})})}f();m(); d();g();o();u();x()}function z(s,P,T,la,ma,E){var U=s.find(".item-list-wrapper").first(),na=new be.marlon.ui.List(U.find(".item-list"),U.find(".item-list-nav"),U.find(".filters-wrapper.group"),760,P,T,e.formatPrice,la,null,y.getLabel(E));na.addEventListener(na.ITEM_CLICK,ma);s=s.find(".item-list-nav");s.find(".icon.prev").bind("click",function(sa){sa.preventDefault();na.previousPage()});s.find(".icon.next").bind("click",function(sa){sa.preventDefault();na.nextPage()});return na}function i(s){h.dispatchEvent({type:h.UPH_SELECTED, data:s.data})}function t(s){h.dispatchEvent({type:h.INL_SELECTED,data:s.data})}function r(s){h.dispatchEvent({type:h.OPT_SELECTED,data:s.data})}function q(s){p(s.currentTarget.value,false)}function f(){var s=$(".cs-secondary-nav");_contentTop=ba.offset().top;s.length&&s.hasClass("fixed")?$("body,html").animate({scrollTop:_contentTop-s.outerHeight()},500):$("body,html").animate({scrollTop:_contentTop},500)}var h=this,y=be.marlon.utils.Dictionary,c=null,j=[],l,C=null,w=null,J=null,K,I=null,O=null,W= null,da,Q=null,N=null,H=null;this.UPH_SELECTED="upholstery_selected";this.INL_SELECTED="inlay_selected";this.OPT_SELECTED="int_option_selected";var G='
                  • [LABEL]
                  • ',ba=$(".main");this.initData=function(s,P,T,la){a.find("h1.stage-title").first().html(y.getLabel("interior_title"));H=la;la=s&&s.length>0;O=s;K=a.find("section#lcc-tab-interior-seats");I||(I=z(K,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_RADIOBUTTON,8,i,"select_int_trim"));m();d();s=P&&P.length>0; w=P;l=a.find("section#lcc-tab-interior-inserts");C||(C=z(l,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_RADIOBUTTON,8,t,"select_int_insert"));g();d();P=T&&T.length>0;N=T;da=a.find("section#lcc-tab-interior-options");Q||(Q=z(da,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_CHECKBOX,8,r,"select_int_option"));u();x();v(la,s,P);p(0,true)};this.renderUpholsteries=function(s){O=s;m()};this.renderInlays=function(s){w=s;g()};this.renderOptions=function(s){N=s;u()};this.select=function(s){H= s;d();o();x()};this.hide=function(){a.hide()};this.show=function(){a.show();m();d();g();o();u();x()};this.showOptionsTab=function(){p(2,false)};this.updateUpholsteryPrices=function(s){if(!a.is(":visible")||!K.is(":visible"))W=s;else I.updatePrices(s)};this.updateInlayPrices=function(s){if(!a.is(":visible")||!l.is(":visible"))J=s;else C.updatePrices(s)}};b.Interior.prototype=new be.marlon.EventDispatcher;b.Interior.prototype.constructor=b.Interior})(); (function(){var b=be.marlon.ui;b.Accessories=function(a,e){function m(t){return t.Accessories?t.Accessories:[]}function d(){if(a.is(":visible")&&z){v.initList(z);z=null}}function g(){if(a.is(":visible")&&i){v.selectItems(m(i));i=null}}function o(t){u.dispatchEvent({type:u.ACC_SELECTED,data:t.data})}var u=this,x=be.marlon.utils.Dictionary,v=null,p=null,z=null,i=null;this.ACC_SELECTED="accessorie_selected";this.initData=function(t,r){a.find("h1.stage-title").first().html(x.getLabel("accessories_title")); var q=a.find(".item-list-wrapper").first();if(!v){v=new be.marlon.ui.List(q.find(".item-list"),q.find(".item-list-nav"),q.find(".filters-wrapper.group"),760,be.marlon.ui.GenericItem,be.marlon.ui.GenericItem.TYPE_CHECKBOX,e.formatPrice,8,null,x.getLabel("select_accessory"));v.addEventListener(v.ITEM_CLICK,o)}if(p==null){p=q.find(".item-list-nav");p.find(".icon.prev").bind("click",function(f){f.preventDefault();v.previousPage()});p.find(".icon.next").bind("click",function(f){f.preventDefault();v.nextPage()})}z= t;i=r;d();g()};this.renderAccessories=function(t){z=t;d()};this.select=function(t){i=t;g()};this.hide=function(){a.hide()};this.show=function(){a.show();d();g()}};b.Accessories.prototype=new be.marlon.EventDispatcher;b.Accessories.prototype.constructor=b.Accessories})(); (function(){var b=be.marlon.ui;b.Summary=function(a,e){function m(){t=a.find("nav.tab-nav").first();t.find("li").off("click",g);t.empty();var h=$("
                      "),y=q;y=y.replace("[LABEL]",v.getLabel("summary_tab_configuration"));y=y.replace("[VALUE]",0);h.append($(y));y=q;y=y.replace("[LABEL]",v.getLabel("summary_tab_standard"));y=y.replace("[VALUE]",1);h.append($(y));y=q;y=y.replace("[LABEL]",v.getLabel("summary_tab_specifications"));y=y.replace("[VALUE]",2);h.append($(y));t.append(h);t.append($('')); t.find("li").on("click",g);t.find("li").css("cursor","pointer");r=[];r.push(a.find("section#lcc-tab-summary-configuration"));r.push(a.find("section#lcc-tab-summary-equipment"));r.push(a.find("section#lcc-tab-summary-specifications"))}function d(h,y){t.find("li").removeClass("selected");t.find('li[value="'+h+'"]').addClass("selected");if(y===true){a.find("section.tab-content").hide().css("display","none");r[h].show().css("display","block")}else{y=a.find("section.tab-content");var c=y.closest(".tab-layout").closest(".section-stage"), j=y.height(),l=c.find("h1").outerHeight(true);c.css("height",j+l+"px");y.fadeOut("250",function(){c.css("height","auto");$(this).css("display","none")});r[h].closest(".tab-layout").css("position","relative");r[h].css({position:"absolute",left:"0",top:+r[h].closest(".tab-layout").find("nav").outerHeight(true)+"px"});r[h].fadeIn("500",function(){r[h].css({position:"relative",top:"0",display:"block"})})}u()}function g(h){var y=be.marlon.Webtrend;h=h.currentTarget.value;var c;switch(h){case 0:c="Your Configuration"; break;case 1:c="Standard Equipment";break;case 2:c="Specifications";break}c={cg_n:"A_CarConfig",dl:"22",ModelID:y.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:y.getStep(),si_n:"Car Configurator",si_x:y.getNStep(),ev_val:c,ev_act:"Option selected"};y.track(c);d(h,false)}function o(h){x.dispatchEvent({type:"summary_change",data:$(h.currentTarget).attr("data")})}function u(){var h=$(".cs-secondary-nav");_contentTop=f.offset().top;h.length&&h.hasClass("fixed")?$("body,html").animate({scrollTop:_contentTop- h.outerHeight()},500):$("body,html").animate({scrollTop:_contentTop},500)}var x=this,v=be.marlon.utils.Dictionary,p=new b.SummaryConfig(a.find("section#lcc-tab-summary-configuration"),e),z=new b.SummaryStandard(a.find("section#lcc-tab-summary-equipment"),e),i=new b.SummarySpecifications(a.find("section#lcc-tab-summary-specifications"),e),t=null,r=[],q='
                    • [LABEL]
                    • ',f=$(".main");this.init=function(h,y){a.find("h1.stage-title").first().html(e.getSummaryContent().title);m(); d(0,true);p.init();p.getEle().find("a.change").on("click",o);p.setConfig(h);z.setStandardEquipment(e.getStandardEquipment());i.init();i.setConfig(h);var c=false;y&&$.each(y,function(j,l){if(l.InternalCode=="ENERGY-EFFICIENCY-CLASS"){c=true;j=l.Value.replace("+","plus");a.find("aside.rating div.visual img").attr("src","/img/glb/ecolabel_"+(window.devicePixelRatio>2?2:1)+"x_"+j+".png")}});a.find("aside.rating").css("display",c?"block":"none")};this.setData=function(h,y,c){p.setData(h,y,c)}; this.setConfig=function(h,y){p.setConfig(h);i.setConfig(h);z.setStandardEquipment(e.getStandardEquipment());var c=false;y&&$.each(y,function(j,l){if(l.InternalCode=="ENERGY-EFFICIENCY-CLASS"){c=true;j=l.Value.replace("+","plus");a.find("aside.rating div.visual img").attr("src","/img/glb/ecolabel_"+(window.devicePixelRatio>2?2:1)+"x_"+j+".png")}});a.find("aside.rating").css("display",c?"block":"none")};this.hide=function(){a.hide()};this.show=function(){a.show()}};b.Summary.prototype=new be.marlon.EventDispatcher; b.Summary.prototype.constructor=b.Summary})(); (function(){var b=be.marlon.ui;b.SpinPlayer=function(a,e,m,d,g){function o(Q){if(Q.ExteriorImages[0]!=J){J=Q.ExteriorImages[0];for(var N=0,H="",G=Q.ExteriorImages.slice(),ba=G.length;N"+qa.getLabel("compare_legend_title")+"

            ");$(A).append("
              ");$(A).find("ul").append("
            • "+qa.getLabel("compare_legend_optional")+'
            • ');$(A).find("ul").append("
            • "+qa.getLabel("compare_legend_available")+'
            • ');$(A).find("ul").append("
            • "+qa.getLabel("compare_legend_not_available")+'
            • ')});M.setModelID(a.modelid);typeof a.wtcallback!="undefined"&&a.wtcallback!= ""&&M.setCallBack(a.wtcallback);R.addEventListener(be.marlon.Service.LOAD_COMPLETE,u);R.addEventListener(be.marlon.Service.COMPATIBILITY_CHECK_LOADED,x);R.addEventListener(be.marlon.Service.SHOW_CONFLICT,z);R.addEventListener(be.marlon.Service.SERVICE_ERROR,p);R.addEventListener(be.marlon.Service.SHOW_INCLUDE_OPTIONS,t);R.addEventListener(be.marlon.Configuration.CHANGED,h);R.addEventListener(be.marlon.Service.SET_UPHOLSTERIES,j);R.addEventListener(be.marlon.Service.RENDER_OPTIONS,C);R.addEventListener(be.marlon.Service.RENDER_INLAYS, l);R.addEventListener(be.marlon.Service.RENDER_ACCESSORIES,w);R.addEventListener(be.marlon.Service.UPDATE_WHEEL_PRICES,J);R.addEventListener(be.marlon.Service.UPDATE_COLOUR_PRICES,K);R.addEventListener(be.marlon.Service.UPDATE_UPHOLSTERY_PRICES,I);R.addEventListener(be.marlon.Service.UPDATE_INLAY_PRICES,O);R.addEventListener(be.marlon.Service.COMPARE_GRADES_LOADED,f);oa.setShouldLoadImages(true);oa.init();oa.addEventListener(oa.FULLSCREEN_CLICKED,la);ua.init();oa.addMirror("INT",ua.getIntMirror()); oa.addMirror("EXT",ua.getExtMirror());ua.addMirror("INT",oa.getIntMirror());ua.addMirror("EXT",oa.getExtMirror());ea.init();R.startLoad();$(document).on("keydown",g);$(document).on("keyup",o)}function g(k){if(k.keyCode==86)Ca=true;if(k.keyCode==32)Da=true;if(Ca&&Da){$(document).off("keydown",g);Fa=true;D.showInfoMessage("VERSION",ta+" ("+B+")
              "+F+"
              service version: "+R.getServiceVersionObject().service.version)}}function o(k){if(k.keyCode==86)Ca=false;if(k.keyCode==32)Da=false;if(Fa&&!Ca&& !Da){$(document).on("keydown",g);Fa=false}}function u(k){var A=k.data;k=A.configuration;var ja=A.motorizations,aa=A.grades,ga=A.packs,va=A.colours,ra=A.wheels,wa=A.options,Ba=A.upholstries,ya=A.accessories,Ga=A.inlays,Ha=A.wheelPriceDifference,Ia=A.colourPriceDifference,Ja=A.inlayPriceDifference,Ka=A.upholsteryPriceDifference;A=A.eco;var xa=[];za=[];$.each(aa,function(Aa,Ea){if(Ea.Image){Aa=Ea.Image;Aa=Aa.replace("{VIEW}","exterior");Aa=Aa.replace("{SIDE}","3");Aa=Aa.replace("{TYPE}","jpg");Ea.Image= a.imagepath+Aa+"?width=148&height=83&scale-mode=0&image-quality=75";Ea.DetailImage=a.imagepath+Aa+"?width=332&scale-mode=0&image-quality=75&padding=20"}});fa=y(aa,ja,k.EngineID);S.initData(fa,k);S.addEventListener(S.GRD_SELECTED,W);S.addEventListener(S.LOAD_COMPARE_GRADES,q);xa.push({label:qa.getLabel("enginegrade"),sublabel:k.CarName,data:Z.NAV_GRADES});za.push(Z.NAV_GRADES);Y.initData(Y.filterPacks(ga),k);Y.addEventListener(Y.PCK_SELECTED,da);xa.push({label:qa.getLabel("pack"),sublabel:"selected_packs", data:Z.NAV_PACKS});za.push(Z.NAV_PACKS);X.initData(va,ra,c(wa,"EXT"),k);X.updateWheelPrices(Ha);X.updateColourPrices(Ia);X.addEventListener(X.CLR_SELECTED,Q);X.addEventListener(X.WHL_SELECTED,N);X.addEventListener(X.OPT_SELECTED,ba);xa.push({label:qa.getLabel("exterior"),sublabel:"selected_exterior",data:Z.NAV_EXTERIOR});za.push(Z.NAV_EXTERIOR);V.initData(Ba,Ga,c(wa,"INT"),k);V.updateUpholsteryPrices(Ka);V.updateInlayPrices(Ja);V.addEventListener(V.UPH_SELECTED,H);V.addEventListener(V.INL_SELECTED, G);V.addEventListener(V.OPT_SELECTED,s);xa.push({label:qa.getLabel("interior"),sublabel:"selected_interior",data:Z.NAV_INTERIOR});za.push(Z.NAV_INTERIOR);ca.initData(ya,k);ca.addEventListener(ca.ACC_SELECTED,T);xa.push({label:qa.getLabel("accessories"),sublabel:"selected_accessories",data:Z.NAV_ACCESSORIES});za.push(Z.NAV_ACCESSORIES);pa.setData(ga,wa,ya);pa.init(k,A);xa.push({label:qa.getLabel("summary"),sublabel:"",data:Z.NAV_SUMMARY});pa.addEventListener("summary_change",L);za.push(Z.NAV_SUMMARY); Z.init(xa);Z.addEventListener(Z.NAV_CLICKED,sa);Z.setConfig(k);Z.showSection(Z.NAV_PACKS,Y.getActualPackCount()>0);Z.showSection(Z.NAV_ACCESSORIES,ya.length>0);ja=0;for(aa=fa.length;ja0?M.createString([k.Packs]):"")+"_Default");aa=M.filterOptions(k,"EXT");M.setDefaultExterior(M.createString($.merge([k.ExteriorColourID,k.WheelID],aa.length>0?[aa]:[]))+"_Default");aa=M.filterOptions(k,"INT");M.setDefaultInterior(M.createString($.merge([k.UpholsteryID,k.InlayID],aa.length>0?[aa]:[]))+"_Default");M.setDefaultAccessories((k.Accessories.length> 0?M.createString([k.Accessories]):"")+"_Default");k={cg_n:"A_CarConfig",dl:"0",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:"Engine and Grade",si_n:"Car Configurator",si_x:"1"};M.track(k);ma(ja,true,true)}function x(k){ha(".compatibilityCheckLoaded()");var A=k.data;k=A.configuration;var ja=A.motorizations,aa=A.grades,ga=A.packs,va=A.colours,ra=A.wheels,wa=A.options,Ba=A.upholstries,ya=A.accessories,Ga=A.inlays,Ha=A.wheelPriceDifference,Ia=A.colourPriceDifference,Ja=A.inlayPriceDifference, Ka=A.upholsteryPriceDifference;A=A.eco;ea.update(k);if(aa){fa=y(aa,ja,k.EngineID);S.initData(fa,k)}else S.select(k);if(ga&&ga.length>0){var xa=Y.filterPacks(ga);if(xa.length>0){Y.initData(xa,k);Z.showSection(Z.NAV_PACKS,true)}else{ka.localeCompare(Z.NAV_PACKS)==0&&na();Z.showSection(Z.NAV_PACKS,false)}}else Y.select(k);Z.showSection(Z.NAV_ACCESSORIES,ya.length>0);ja=0;for(aa=fa.length;ja0&&ca.initData(ya,k);pa.setData(xa,wa,ya);pa.setConfig(k,A);Z.setConfig(k);oa.setConfig(k);ua.setConfig(k)}function v(k){$("#panel-features a.icon-close").html(qa.getLabel("close"));var A=$("#panel-features div.features-content").first();A.empty();A.append("

              "+k.Name+"

              ");A.append("

              "+qa.getLabel("standard_features")+"

              ");A.append(k.Description)}function p(k){k.critical&&D.showInfoMessage(qa.getLabel("error_title"), k.text);if($("div.main").not(":visible")){$("#lcc-carconfig").append($("#msg-error"));$(".main-preloader").hide();$("#msg-error").css("margin-top","-150px");$("#msg-error").find("a.close").hide()}}function z(){D.showConflictMessage(R.acceptConflict,i)}function i(){R.declineConflict();var k=R.getConfiguration();S.select(k);Y.select(k)}function t(k){D.showIncludeMessage(k.data,r)}function r(k,A){for(var ja=A[3],aa=A[2][0],ga=0,va=aa.length;ga-1){A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Pack Selected",ev_act:k.data};M.track(A)}R.setPack(k.data)}function Q(k){ha(".colourSelectedHandler() "+k.data);if(k.data!=R.getConfiguration().ExteriorColourID){var A= {cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Colour Selected",ev_act:k.data};M.track(A);R.setExteriorColour(k.data)}}function N(k){ha(".wheelSelectedHandler() "+k.data);if(k.data!=R.getConfiguration().WheelID){var A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Wheel Selected",ev_act:k.data}; M.track(A);R.setWheels(k.data)}}function H(k){ha(".upholsterySelectedHandler() "+k.data);if(k.data!=R.getConfiguration().UpholsteryID){var A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Upholstery Selected",ev_act:k.data};M.track(A);R.setUpholstry(k.data)}}function G(k){ha(".inlaySelectedHandler() "+k.data);if(k.data!=R.getConfiguration().InlayID){var A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(), pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Inlay Selected",ev_act:k.data};M.track(A);R.setInlay(k.data)}}function ba(k){ha(".optionSelectedHandler() "+k.data);P(k.data,"EXT")}function s(k){ha(".optionSelectedHandler() "+k.data);P(k.data,"INT")}function P(k,A){for(var ja=0,aa=R.getConfiguration().Options,ga=aa.length;ja-1){A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator", cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:A=="EXT"?"Exterior Option Selected":"Interior Option Selected",ev_act:k};M.track(A)}R.setOption(k)}function T(k){for(var A=0,ja=R.getConfiguration().Accessories,aa=ja.length;A-1){A={cg_n:"A_CarConfig",dl:"22",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:M.getStep(),si_n:"Car Configurator",si_x:M.getNStep(),ev_val:"Accessory Selected",ev_act:k.data};M.track(A)}ha(".accessorySelectedHandler() "+ k.data);R.setAccessorie(k.data)}function la(){ha(".onFullScreenClickHandler()");ua.show();var k=be.marlon.Webtrend,A={cg_n:"A_CarConfig",dl:"22",ModelID:k.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:k.getStep(),si_n:"Car Configurator",si_x:k.getNStep(),ev_val:"Spin View Changed",ev_act:"Full Screen"};k.track(A)}function ma(k,A,ja){ka=k;k==Z.NAV_GRADES?S.show():S.hide();k==Z.NAV_PACKS?Y.show():Y.hide();k==Z.NAV_ACCESSORIES?ca.show():ca.hide();k==Z.NAV_EXTERIOR?X.show():X.hide();if(k==Z.NAV_INTERIOR){La= oa.isIntVisible();V.show();U()}else{V.hide();if(!La||k==Z.NAV_EXTERIOR)E()}if(k==Z.NAV_SUMMARY){pa.show();ea.hideNextBtn();ea.showVertical()}else{pa.hide();ea.showNextBtn();ea.hideVertical()}A==true&&Z.setActivePage(ka);var aa,ga,va,ra;A=R.getConfiguration();switch(k){case "nav_grades":aa="Engine and Grade";va="1";ga=A.GradeID;ra=M.getDefaultGrades();if(ga==ra.replace("- Base Grade",""))ra=ga="";break;case "nav_packs":aa="Packs";va="2";ga=A.Packs.length>0?M.createString([A.Packs]):"";ra=M.getDefaultPacks(); if(ga==ra.replace("_Default",""))ra=ga="";break;case "nav_exterior":aa="Exterior";va="3";ga=M.filterOptions(A,"EXT");ga=M.createString($.merge([A.ExteriorColourID,A.WheelID],ga.length>0?[ga]:[]));ra=M.getDefaultExterior();if(ga==ra.replace("_Default",""))ra=ga="";break;case "nav_interior":aa="Interior";va="4";ga=M.filterOptions(A,"INT");ga=M.createString($.merge([A.UpholsteryID,A.InlayID],ga.length>0?[ga]:[]));ra=M.getDefaultInterior();if(ga==ra.replace("_Default",""))ra=ga="";break;case "nav_accessories":aa= "Accessories";va="5";ga=A.Accessories.length>0?M.createString([A.Accessories]):"";ra=M.getDefaultAccessories();if(ga==ra.replace("_Default",""))ra=ga="";break;case "nav_summary":aa="Summary";va="6";ga="Your Configuration";ra="";break}M.setStep(aa);M.setNStep(va);aa={cg_n:"A_CarConfig",dl:"0",ModelID:M.getModelID(),pc:"Tools",pn:"Car Configurator",cc_step:aa,si_n:"Car Configurator",si_x:va,ev_val:ga,ev_act:ra};if(k=="nav_summary"){delete aa.ev_act;aa.si_cs="1";aa.cg_s=aa.ModelID;aa.SubmodelID=A.SubModelID; aa.InlayID=A.InlayID;aa.UpholsteryID=A.UpholsteryID;ga=M.filterOptions(A,"EXT");aa.ExteriorOptions=M.createString([ga.length>0?ga:"no_option"]);ga=M.filterOptions(A,"INT");aa.InteriorOptions=M.createString([ga.length>0?ga:"no_option"]);aa.Accessories=A.Accessories.length>0?M.createString([A.Accessories]):"no_accessory";aa.ExtColourID=A.ExteriorColourID;aa.Packs=A.Packs.length>0?M.createString([A.Packs]):"no_pack";aa.Wheels=A.WheelID}if(!ja||ja==false)M.track(aa)}function E(){oa.isExtVisible()||$(".selectors-toggle li.mask").trigger("click")} function U(){oa.isIntVisible()||$(".selectors-toggle li.mask").trigger("click")}function na(){$.each(za,function(k,A){if(A==ka){n=k;for(k=false;!k;){n++;k=n values - tolerance) { return value - rem + values; } } return value; }; var createUUID = R.createUUID = (function(uuidRegEx, uuidReplacer) { return function() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(uuidRegEx, uuidReplacer).toUpperCase(); }; })(/[xy]/g, function(c) { var r = math.random() * 16 | 0, v = c == "x" ? r : (r & 3 | 8); return v.toString(16); }); R.setWindow = function(newwin) { eve("raphael.setWindow", R, g.win, newwin); g.win = newwin; g.doc = g.win.document; if (R._engine.initWin) { R._engine.initWin(g.win); } }; var toHex = function(color) { if (R.vml) { // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/ var trim = /^\s+|\s+$/g; var bod; try { var docum = new ActiveXObject("htmlfile"); docum.write(""); docum.close(); bod = docum.body; } catch (e) { bod = createPopup().document.body; } var range = bod.createTextRange(); toHex = cacher(function(color) { try { bod.style.color = Str(color).replace(trim, E); var value = range.queryCommandValue("ForeColor"); value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16); return "#" + ("000000" + value.toString(16)).slice(-6); } catch (e) { return "none"; } }); } else { var i = g.doc.createElement("i"); i.title = "Rapha\xebl Colour Picker"; i.style.display = "none"; g.doc.body.appendChild(i); toHex = cacher(function(color) { i.style.color = color; return g.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color"); }); } return toHex(color); }, hsbtoString = function() { return "hsb(" + [this.h, this.s, this.b] + ")"; }, hsltoString = function() { return "hsl(" + [this.h, this.s, this.l] + ")"; }, rgbtoString = function() { return this.hex; }, prepareRGB = function(r, g, b) { if (g == null && R.is(r, "object") && "r" in r && "g" in r && "b" in r) { b = r.b; g = r.g; r = r.r; } if (g == null && R.is(r, string)) { var clr = R.getRGB(r); r = clr.r; g = clr.g; b = clr.b; } if (r > 1 || g > 1 || b > 1) { r /= 255; g /= 255; b /= 255; } return [r, g, b]; }, packageRGB = function(r, g, b, o) { r *= 255; g *= 255; b *= 255; var rgb = { r: r, g: g, b: b, hex: R.rgb(r, g, b), toString: rgbtoString }; R.is(o, "finite") && (rgb.opacity = o); return rgb; }; R.color = function(clr) { var rgb; if (R.is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) { rgb = R.hsb2rgb(clr); clr.r = rgb.r; clr.g = rgb.g; clr.b = rgb.b; clr.hex = rgb.hex; } else if (R.is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) { rgb = R.hsl2rgb(clr); clr.r = rgb.r; clr.g = rgb.g; clr.b = rgb.b; clr.hex = rgb.hex; } else { if (R.is(clr, "string")) { clr = R.getRGB(clr); } if (R.is(clr, "object") && "r" in clr && "g" in clr && "b" in clr) { rgb = R.rgb2hsl(clr); clr.h = rgb.h; clr.s = rgb.s; clr.l = rgb.l; rgb = R.rgb2hsb(clr); clr.v = rgb.b; } else { clr = { hex: "none" }; clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1; } } clr.toString = rgbtoString; return clr; }; R.hsb2rgb = function(h, s, v, o) { if (this.is(h, "object") && "h" in h && "s" in h && "b" in h) { v = h.b; s = h.s; h = h.h; o = h.o; } h *= 360; var R, G, B, X, C; h = (h % 360) / 60; C = v * s; X = C * (1 - abs(h % 2 - 1)); R = G = B = v - C; h = ~ ~h; R += [C, X, 0, 0, X, C][h]; G += [X, C, C, X, 0, 0][h]; B += [0, 0, X, C, C, X][h]; return packageRGB(R, G, B, o); }; R.hsl2rgb = function(h, s, l, o) { if (this.is(h, "object") && "h" in h && "s" in h && "l" in h) { l = h.l; s = h.s; h = h.h; } if (h > 1 || s > 1 || l > 1) { h /= 360; s /= 100; l /= 100; } h *= 360; var R, G, B, X, C; h = (h % 360) / 60; C = 2 * s * (l < .5 ? l : 1 - l); X = C * (1 - abs(h % 2 - 1)); R = G = B = l - C / 2; h = ~ ~h; R += [C, X, 0, 0, X, C][h]; G += [X, C, C, X, 0, 0][h]; B += [0, 0, X, C, C, X][h]; return packageRGB(R, G, B, o); }; R.rgb2hsb = function(r, g, b) { b = prepareRGB(r, g, b); r = b[0]; g = b[1]; b = b[2]; var H, S, V, C; V = mmax(r, g, b); C = V - mmin(r, g, b); H = (C == 0 ? null : V == r ? (g - b) / C : V == g ? (b - r) / C + 2 : (r - g) / C + 4 ); H = ((H + 360) % 6) * 60 / 360; S = C == 0 ? 0 : C / V; return { h: H, s: S, b: V, toString: hsbtoString }; }; R.rgb2hsl = function(r, g, b) { b = prepareRGB(r, g, b); r = b[0]; g = b[1]; b = b[2]; var H, S, L, M, m, C; M = mmax(r, g, b); m = mmin(r, g, b); C = M - m; H = (C == 0 ? null : M == r ? (g - b) / C : M == g ? (b - r) / C + 2 : (r - g) / C + 4); H = ((H + 360) % 6) * 60 / 360; L = (M + m) / 2; S = (C == 0 ? 0 : L < .5 ? C / (2 * L) : C / (2 - 2 * L)); return { h: H, s: S, l: L, toString: hsltoString }; }; R._path2string = function() { return this.join(",").replace(p2s, "$1"); }; function repush(array, item) { for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) { return array.push(array.splice(i, 1)[0]); } } function cacher(f, scope, postprocessor) { function newf() { var arg = Array.prototype.slice.call(arguments, 0), args = arg.join("\u2400"), cache = newf.cache = newf.cache || {}, count = newf.count = newf.count || []; if (cache[has](args)) { repush(count, args); return postprocessor ? postprocessor(cache[args]) : cache[args]; } count.length >= 1e3 && delete cache[count.shift()]; count.push(args); cache[args] = f[apply](scope, arg); return postprocessor ? postprocessor(cache[args]) : cache[args]; } return newf; } var preload = R._preload = function(src, f) { var img = g.doc.createElement("img"); img.style.cssText = "position:absolute;left:-9999em;top:-9999em"; img.onload = function() { f.call(this); this.onload = null; g.doc.body.removeChild(this); }; img.onerror = function() { g.doc.body.removeChild(this); }; g.doc.body.appendChild(img); img.src = src; }; function clrToString() { return this.hex; } R.getRGB = cacher(function(colour) { if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) { return { r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString }; } if (colour == "none") { return { r: -1, g: -1, b: -1, hex: "none", toString: clrToString }; } !(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour)); var res, red, green, blue, opacity, t, values, rgb = colour.match(colourRegExp); if (rgb) { if (rgb[2]) { blue = toInt(rgb[2].substring(5), 16); green = toInt(rgb[2].substring(3, 5), 16); red = toInt(rgb[2].substring(1, 3), 16); } if (rgb[3]) { blue = toInt((t = rgb[3].charAt(3)) + t, 16); green = toInt((t = rgb[3].charAt(2)) + t, 16); red = toInt((t = rgb[3].charAt(1)) + t, 16); } if (rgb[4]) { values = rgb[4][split](commaSpaces); red = toFloat(values[0]); values[0].slice(-1) == "%" && (red *= 2.55); green = toFloat(values[1]); values[1].slice(-1) == "%" && (green *= 2.55); blue = toFloat(values[2]); values[2].slice(-1) == "%" && (blue *= 2.55); rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3])); values[3] && values[3].slice(-1) == "%" && (opacity /= 100); } if (rgb[5]) { values = rgb[5][split](commaSpaces); red = toFloat(values[0]); values[0].slice(-1) == "%" && (red *= 2.55); green = toFloat(values[1]); values[1].slice(-1) == "%" && (green *= 2.55); blue = toFloat(values[2]); values[2].slice(-1) == "%" && (blue *= 2.55); (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360); rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3])); values[3] && values[3].slice(-1) == "%" && (opacity /= 100); return R.hsb2rgb(red, green, blue, opacity); } if (rgb[6]) { values = rgb[6][split](commaSpaces); red = toFloat(values[0]); values[0].slice(-1) == "%" && (red *= 2.55); green = toFloat(values[1]); values[1].slice(-1) == "%" && (green *= 2.55); blue = toFloat(values[2]); values[2].slice(-1) == "%" && (blue *= 2.55); (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360); rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3])); values[3] && values[3].slice(-1) == "%" && (opacity /= 100); return R.hsl2rgb(red, green, blue, opacity); } rgb = { r: red, g: green, b: blue, toString: clrToString }; rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1); R.is(opacity, "finite") && (rgb.opacity = opacity); return rgb; } return { r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString }; }, R); R.hsb = cacher(function(h, s, b) { return R.hsb2rgb(h, s, b).hex; }); R.hsl = cacher(function(h, s, l) { return R.hsl2rgb(h, s, l).hex; }); R.rgb = cacher(function(r, g, b) { return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1); }); R.getColor = function(value) { var start = this.getColor.start = this.getColor.start || { h: 0, s: 1, b: value || .75 }, rgb = this.hsb2rgb(start.h, start.s, start.b); start.h += .075; if (start.h > 1) { start.h = 0; start.s -= .2; start.s <= 0 && (this.getColor.start = { h: 0, s: 1, b: start.b }); } return rgb.hex; }; R.getColor.reset = function() { delete this.start; }; // http://schepers.cc/getting-to-the-point function catmullRom2bezier(crp, z) { var d = []; for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) { var p = [ { x: +crp[i - 2], y: +crp[i - 1] }, { x: +crp[i], y: +crp[i + 1] }, { x: +crp[i + 2], y: +crp[i + 3] }, { x: +crp[i + 4], y: +crp[i + 5] } ]; if (z) { if (!i) { p[0] = { x: +crp[iLen - 2], y: +crp[iLen - 1] }; } else if (iLen - 4 == i) { p[3] = { x: +crp[0], y: +crp[1] }; } else if (iLen - 2 == i) { p[2] = { x: +crp[0], y: +crp[1] }; p[3] = { x: +crp[2], y: +crp[3] }; } } else { if (iLen - 4 == i) { p[3] = p[2]; } else if (!i) { p[0] = { x: +crp[i], y: +crp[i + 1] }; } } d.push(["C", (-p[0].x + 6 * p[1].x + p[2].x) / 6, (-p[0].y + 6 * p[1].y + p[2].y) / 6, (p[1].x + 6 * p[2].x - p[3].x) / 6, (p[1].y + 6 * p[2].y - p[3].y) / 6, p[2].x, p[2].y ]); } return d; } R.parsePathString = function(pathString) { if (!pathString) { return null; } var pth = paths(pathString); if (pth.arr) { return pathClone(pth.arr); } var paramCounts = { a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0 }, data = []; if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption data = pathClone(pathString); } if (!data.length) { Str(pathString).replace(pathCommand, function(a, b, c) { var params = [], name = b.toLowerCase(); c.replace(pathValues, function(a, b) { b && params.push(+b); }); if (name == "m" && params.length > 2) { data.push([b][concat](params.splice(0, 2))); name = "l"; b = b == "m" ? "l" : "L"; } if (name == "r") { data.push([b][concat](params)); } else while (params.length >= paramCounts[name]) { data.push([b][concat](params.splice(0, paramCounts[name]))); if (!paramCounts[name]) { break; } } }); } data.toString = R._path2string; pth.arr = pathClone(data); return data; }; R.parseTransformString = cacher(function(TString) { if (!TString) { return null; } var paramCounts = { r: 3, s: 4, t: 2, m: 6 }, data = []; if (R.is(TString, array) && R.is(TString[0], array)) { // rough assumption data = pathClone(TString); } if (!data.length) { Str(TString).replace(tCommand, function(a, b, c) { var params = [], name = lowerCase.call(b); c.replace(pathValues, function(a, b) { b && params.push(+b); }); data.push([b][concat](params)); }); } data.toString = R._path2string; return data; }); // PATHS var paths = function(ps) { var p = paths.ps = paths.ps || {}; if (p[ps]) { p[ps].sleep = 100; } else { p[ps] = { sleep: 100 }; } setTimeout(function() { for (var key in p) if (p[has](key) && key != ps) { p[key].sleep--; !p[key].sleep && delete p[key]; } }); return p[ps]; }; R.findDotsAtSegment = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) { var t1 = 1 - t, t13 = pow(t1, 3), t12 = pow(t1, 2), t2 = t * t, t3 = t2 * t, x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x, y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y, mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x), my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y), nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x), ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y), ax = t1 * p1x + t * c1x, ay = t1 * p1y + t * c1y, cx = t1 * c2x + t * p2x, cy = t1 * c2y + t * p2y, alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI); (mx > nx || my < ny) && (alpha += 180); return { x: x, y: y, m: { x: mx, y: my }, n: { x: nx, y: ny }, start: { x: ax, y: ay }, end: { x: cx, y: cy }, alpha: alpha }; }; R.bezierBBox = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) { if (!R.is(p1x, "array")) { p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y]; } var bbox = curveDim.apply(null, p1x); return { x: bbox.min.x, y: bbox.min.y, x2: bbox.max.x, y2: bbox.max.y, width: bbox.max.x - bbox.min.x, height: bbox.max.y - bbox.min.y }; }; R.isPointInsideBBox = function(bbox, x, y) { return x >= bbox.x && x <= bbox.x2 && y >= bbox.y && y <= bbox.y2; }; R.isBBoxIntersect = function(bbox1, bbox2) { var i = R.isPointInsideBBox; return i(bbox2, bbox1.x, bbox1.y) || i(bbox2, bbox1.x2, bbox1.y) || i(bbox2, bbox1.x, bbox1.y2) || i(bbox2, bbox1.x2, bbox1.y2) || i(bbox1, bbox2.x, bbox2.y) || i(bbox1, bbox2.x2, bbox2.y) || i(bbox1, bbox2.x, bbox2.y2) || i(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y); }; function base3(t, p1, p2, p3, p4) { var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4, t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3; return t * t2 - 3 * p1 + 3 * p2; } function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) { if (z == null) { z = 1; } z = z > 1 ? 1 : z < 0 ? 0 : z; var z2 = z / 2, n = 12, Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816], Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472], sum = 0; for (var i = 0; i < n; i++) { var ct = z2 * Tvalues[i] + z2, xbase = base3(ct, x1, x2, x3, x4), ybase = base3(ct, y1, y2, y3, y4), comb = xbase * xbase + ybase * ybase; sum += Cvalues[i] * math.sqrt(comb); } return z2 * sum; } function getTatLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) { if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) { return; } var t = 1, step = t / 2, t2 = t - step, l, e = .01; l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2); while (abs(l - ll) > e) { step /= 2; t2 += (l < ll ? 1 : -1) * step; l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2); } return t2; } function intersect(x1, y1, x2, y2, x3, y3, x4, y4) { if ( mmax(x1, x2) < mmin(x3, x4) || mmin(x1, x2) > mmax(x3, x4) || mmax(y1, y2) < mmin(y3, y4) || mmin(y1, y2) > mmax(y3, y4) ) { return; } var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4), ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4), denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); if (!denominator) { return; } var px = nx / denominator, py = ny / denominator, px2 = +px.toFixed(2), py2 = +py.toFixed(2); if ( px2 < +mmin(x1, x2).toFixed(2) || px2 > +mmax(x1, x2).toFixed(2) || px2 < +mmin(x3, x4).toFixed(2) || px2 > +mmax(x3, x4).toFixed(2) || py2 < +mmin(y1, y2).toFixed(2) || py2 > +mmax(y1, y2).toFixed(2) || py2 < +mmin(y3, y4).toFixed(2) || py2 > +mmax(y3, y4).toFixed(2) ) { return; } return { x: px, y: py }; } function inter(bez1, bez2) { return interHelper(bez1, bez2); } function interCount(bez1, bez2) { return interHelper(bez1, bez2, 1); } function interHelper(bez1, bez2, justCount) { var bbox1 = R.bezierBBox(bez1), bbox2 = R.bezierBBox(bez2); if (!R.isBBoxIntersect(bbox1, bbox2)) { return justCount ? 0 : []; } var l1 = bezlen.apply(0, bez1), l2 = bezlen.apply(0, bez2), n1 = ~ ~(l1 / 5), n2 = ~ ~(l2 / 5), dots1 = [], dots2 = [], xy = {}, res = justCount ? 0 : []; for (var i = 0; i < n1 + 1; i++) { var p = R.findDotsAtSegment.apply(R, bez1.concat(i / n1)); dots1.push({ x: p.x, y: p.y, t: i / n1 }); } for (i = 0; i < n2 + 1; i++) { p = R.findDotsAtSegment.apply(R, bez2.concat(i / n2)); dots2.push({ x: p.x, y: p.y, t: i / n2 }); } for (i = 0; i < n1; i++) { for (var j = 0; j < n2; j++) { var di = dots1[i], di1 = dots1[i + 1], dj = dots2[j], dj1 = dots2[j + 1], ci = abs(di1.x - di.x) < .001 ? "y" : "x", cj = abs(dj1.x - dj.x) < .001 ? "y" : "x", is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y); if (is) { if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) { continue; } xy[is.x.toFixed(4)] = is.y.toFixed(4); var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t), t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t); if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) { if (justCount) { res++; } else { res.push({ x: is.x, y: is.y, t1: t1, t2: t2 }); } } } } } return res; } R.pathIntersection = function(path1, path2) { return interPathHelper(path1, path2); }; R.pathIntersectionNumber = function(path1, path2) { return interPathHelper(path1, path2, 1); }; function interPathHelper(path1, path2, justCount) { path1 = R._path2curve(path1); path2 = R._path2curve(path2); var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2, res = justCount ? 0 : []; for (var i = 0, ii = path1.length; i < ii; i++) { var pi = path1[i]; if (pi[0] == "M") { x1 = x1m = pi[1]; y1 = y1m = pi[2]; } else { if (pi[0] == "C") { bez1 = [x1, y1].concat(pi.slice(1)); x1 = bez1[6]; y1 = bez1[7]; } else { bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m]; x1 = x1m; y1 = y1m; } for (var j = 0, jj = path2.length; j < jj; j++) { var pj = path2[j]; if (pj[0] == "M") { x2 = x2m = pj[1]; y2 = y2m = pj[2]; } else { if (pj[0] == "C") { bez2 = [x2, y2].concat(pj.slice(1)); x2 = bez2[6]; y2 = bez2[7]; } else { bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m]; x2 = x2m; y2 = y2m; } var intr = interHelper(bez1, bez2, justCount); if (justCount) { res += intr; } else { for (var k = 0, kk = intr.length; k < kk; k++) { intr[k].segment1 = i; intr[k].segment2 = j; intr[k].bez1 = bez1; intr[k].bez2 = bez2; } res = res.concat(intr); } } } } } return res; } R.isPointInsidePath = function(path, x, y) { var bbox = R.pathBBox(path); return R.isPointInsideBBox(bbox, x, y) && interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1; }; R._removedFactory = function(methodname) { return function() { eve("raphael.log", null, "Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object", methodname); }; }; var pathDimensions = R.pathBBox = function(path) { var pth = paths(path); if (pth.bbox) { return pth.bbox; } if (!path) { return { x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0 }; } path = path2curve(path); var x = 0, y = 0, X = [], Y = [], p; for (var i = 0, ii = path.length; i < ii; i++) { p = path[i]; if (p[0] == "M") { x = p[1]; y = p[2]; X.push(x); Y.push(y); } else { var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]); X = X[concat](dim.min.x, dim.max.x); Y = Y[concat](dim.min.y, dim.max.y); x = p[5]; y = p[6]; } } var xmin = mmin[apply](0, X), ymin = mmin[apply](0, Y), xmax = mmax[apply](0, X), ymax = mmax[apply](0, Y), bb = { x: xmin, y: ymin, x2: xmax, y2: ymax, width: xmax - xmin, height: ymax - ymin }; pth.bbox = clone(bb); return bb; }, pathClone = function(pathArray) { var res = clone(pathArray); res.toString = R._path2string; return res; }, pathToRelative = R._pathToRelative = function(pathArray) { var pth = paths(pathArray); if (pth.rel) { return pathClone(pth.rel); } if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption pathArray = R.parsePathString(pathArray); } var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0; if (pathArray[0][0] == "M") { x = pathArray[0][1]; y = pathArray[0][2]; mx = x; my = y; start++; res.push(["M", x, y]); } for (var i = start, ii = pathArray.length; i < ii; i++) { var r = res[i] = [], pa = pathArray[i]; if (pa[0] != lowerCase.call(pa[0])) { r[0] = lowerCase.call(pa[0]); switch (r[0]) { case "a": r[1] = pa[1]; r[2] = pa[2]; r[3] = pa[3]; r[4] = pa[4]; r[5] = pa[5]; r[6] = +(pa[6] - x).toFixed(3); r[7] = +(pa[7] - y).toFixed(3); break; case "v": r[1] = +(pa[1] - y).toFixed(3); break; case "m": mx = pa[1]; my = pa[2]; default: for (var j = 1, jj = pa.length; j < jj; j++) { r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3); } } } else { r = res[i] = []; if (pa[0] == "m") { mx = pa[1] + x; my = pa[2] + y; } for (var k = 0, kk = pa.length; k < kk; k++) { res[i][k] = pa[k]; } } var len = res[i].length; switch (res[i][0]) { case "z": x = mx; y = my; break; case "h": x += +res[i][len - 1]; break; case "v": y += +res[i][len - 1]; break; default: x += +res[i][len - 2]; y += +res[i][len - 1]; } } res.toString = R._path2string; pth.rel = pathClone(res); return res; }, pathToAbsolute = R._pathToAbsolute = function(pathArray) { var pth = paths(pathArray); if (pth.abs) { return pathClone(pth.abs); } if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption pathArray = R.parsePathString(pathArray); } if (!pathArray || !pathArray.length) { return [["M", 0, 0]]; } var res = [], x = 0, y = 0, mx = 0, my = 0, start = 0; if (pathArray[0][0] == "M") { x = +pathArray[0][1]; y = +pathArray[0][2]; mx = x; my = y; start++; res[0] = ["M", x, y]; } var crz = pathArray.length == 3 && pathArray[0][0] == "M" && pathArray[1][0].toUpperCase() == "R" && pathArray[2][0].toUpperCase() == "Z"; for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) { res.push(r = []); pa = pathArray[i]; if (pa[0] != upperCase.call(pa[0])) { r[0] = upperCase.call(pa[0]); switch (r[0]) { case "A": r[1] = pa[1]; r[2] = pa[2]; r[3] = pa[3]; r[4] = pa[4]; r[5] = pa[5]; r[6] = +(pa[6] + x); r[7] = +(pa[7] + y); break; case "V": r[1] = +pa[1] + y; break; case "H": r[1] = +pa[1] + x; break; case "R": var dots = [x, y][concat](pa.slice(1)); for (var j = 2, jj = dots.length; j < jj; j++) { dots[j] = +dots[j] + x; dots[++j] = +dots[j] + y; } res.pop(); res = res[concat](catmullRom2bezier(dots, crz)); break; case "M": mx = +pa[1] + x; my = +pa[2] + y; default: for (j = 1, jj = pa.length; j < jj; j++) { r[j] = +pa[j] + ((j % 2) ? x : y); } } } else if (pa[0] == "R") { dots = [x, y][concat](pa.slice(1)); res.pop(); res = res[concat](catmullRom2bezier(dots, crz)); r = ["R"][concat](pa.slice(-2)); } else { for (var k = 0, kk = pa.length; k < kk; k++) { r[k] = pa[k]; } } switch (r[0]) { case "Z": x = mx; y = my; break; case "H": x = r[1]; break; case "V": y = r[1]; break; case "M": mx = r[r.length - 2]; my = r[r.length - 1]; default: x = r[r.length - 2]; y = r[r.length - 1]; } } res.toString = R._path2string; pth.abs = pathClone(res); return res; }, l2c = function(x1, y1, x2, y2) { return [x1, y1, x2, y2, x2, y2]; }, q2c = function(x1, y1, ax, ay, x2, y2) { var _13 = 1 / 3, _23 = 2 / 3; return [ _13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2 ]; }, a2c = function(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) { // for more information of where this math came from visit: // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes var _120 = PI * 120 / 180, rad = PI / 180 * (+angle || 0), res = [], xy, rotate = cacher(function(x, y, rad) { var X = x * math.cos(rad) - y * math.sin(rad), Y = x * math.sin(rad) + y * math.cos(rad); return { x: X, y: Y }; }); if (!recursive) { xy = rotate(x1, y1, -rad); x1 = xy.x; y1 = xy.y; xy = rotate(x2, y2, -rad); x2 = xy.x; y2 = xy.y; var cos = math.cos(PI / 180 * angle), sin = math.sin(PI / 180 * angle), x = (x1 - x2) / 2, y = (y1 - y2) / 2; var h = (x * x) / (rx * rx) + (y * y) / (ry * ry); if (h > 1) { h = math.sqrt(h); rx = h * rx; ry = h * ry; } var rx2 = rx * rx, ry2 = ry * ry, k = (large_arc_flag == sweep_flag ? -1 : 1) * math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))), cx = k * rx * y / ry + (x1 + x2) / 2, cy = k * -ry * x / rx + (y1 + y2) / 2, f1 = math.asin(((y1 - cy) / ry).toFixed(9)), f2 = math.asin(((y2 - cy) / ry).toFixed(9)); f1 = x1 < cx ? PI - f1 : f1; f2 = x2 < cx ? PI - f2 : f2; f1 < 0 && (f1 = PI * 2 + f1); f2 < 0 && (f2 = PI * 2 + f2); if (sweep_flag && f1 > f2) { f1 = f1 - PI * 2; } if (!sweep_flag && f2 > f1) { f2 = f2 - PI * 2; } } else { f1 = recursive[0]; f2 = recursive[1]; cx = recursive[2]; cy = recursive[3]; } var df = f2 - f1; if (abs(df) > _120) { var f2old = f2, x2old = x2, y2old = y2; f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1); x2 = cx + rx * math.cos(f2); y2 = cy + ry * math.sin(f2); res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]); } df = f2 - f1; var c1 = math.cos(f1), s1 = math.sin(f1), c2 = math.cos(f2), s2 = math.sin(f2), t = math.tan(df / 4), hx = 4 / 3 * rx * t, hy = 4 / 3 * ry * t, m1 = [x1, y1], m2 = [x1 + hx * s1, y1 - hy * c1], m3 = [x2 + hx * s2, y2 - hy * c2], m4 = [x2, y2]; m2[0] = 2 * m1[0] - m2[0]; m2[1] = 2 * m1[1] - m2[1]; if (recursive) { return [m2, m3, m4][concat](res); } else { res = [m2, m3, m4][concat](res).join()[split](","); var newres = []; for (var i = 0, ii = res.length; i < ii; i++) { newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x; } return newres; } }, findDotAtSegment = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) { var t1 = 1 - t; return { x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x, y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y }; }, curveDim = cacher(function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) { var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x), b = 2 * (c1x - p1x) - 2 * (c2x - c1x), c = p1x - c1x, t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a, t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a, y = [p1y, p2y], x = [p1x, p2x], dot; abs(t1) > "1e12" && (t1 = .5); abs(t2) > "1e12" && (t2 = .5); if (t1 > 0 && t1 < 1) { dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1); x.push(dot.x); y.push(dot.y); } if (t2 > 0 && t2 < 1) { dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2); x.push(dot.x); y.push(dot.y); } a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y); b = 2 * (c1y - p1y) - 2 * (c2y - c1y); c = p1y - c1y; t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a; t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a; abs(t1) > "1e12" && (t1 = .5); abs(t2) > "1e12" && (t2 = .5); if (t1 > 0 && t1 < 1) { dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1); x.push(dot.x); y.push(dot.y); } if (t2 > 0 && t2 < 1) { dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2); x.push(dot.x); y.push(dot.y); } return { min: { x: mmin[apply](0, x), y: mmin[apply](0, y) }, max: { x: mmax[apply](0, x), y: mmax[apply](0, y) } }; }), path2curve = R._path2curve = cacher(function(path, path2) { var pth = !path2 && paths(path); if (!path2 && pth.curve) { return pathClone(pth.curve); } var p = pathToAbsolute(path), p2 = path2 && pathToAbsolute(path2), attrs = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null }, attrs2 = { x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null }, processPath = function(path, d) { var nx, ny; if (!path) { return ["C", d.x, d.y, d.x, d.y, d.x, d.y]; } !(path[0] in { T: 1, Q: 1 }) && (d.qx = d.qy = null); switch (path[0]) { case "M": d.X = path[1]; d.Y = path[2]; break; case "A": path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1)))); break; case "S": nx = d.x + (d.x - (d.bx || d.x)); ny = d.y + (d.y - (d.by || d.y)); path = ["C", nx, ny][concat](path.slice(1)); break; case "T": d.qx = d.x + (d.x - (d.qx || d.x)); d.qy = d.y + (d.y - (d.qy || d.y)); path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); break; case "Q": d.qx = path[1]; d.qy = path[2]; path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4])); break; case "L": path = ["C"][concat](l2c(d.x, d.y, path[1], path[2])); break; case "H": path = ["C"][concat](l2c(d.x, d.y, path[1], d.y)); break; case "V": path = ["C"][concat](l2c(d.x, d.y, d.x, path[1])); break; case "Z": path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y)); break; } return path; }, fixArc = function(pp, i) { if (pp[i].length > 7) { pp[i].shift(); var pi = pp[i]; while (pi.length) { pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6))); } pp.splice(i, 1); ii = mmax(p.length, p2 && p2.length || 0); } }, fixM = function(path1, path2, a1, a2, i) { if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") { path2.splice(i, 0, ["M", a2.x, a2.y]); a1.bx = 0; a1.by = 0; a1.x = path1[i][1]; a1.y = path1[i][2]; ii = mmax(p.length, p2 && p2.length || 0); } }; for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) { p[i] = processPath(p[i], attrs); fixArc(p, i); p2 && (p2[i] = processPath(p2[i], attrs2)); p2 && fixArc(p2, i); fixM(p, p2, attrs, attrs2, i); fixM(p2, p, attrs2, attrs, i); var seg = p[i], seg2 = p2 && p2[i], seglen = seg.length, seg2len = p2 && seg2.length; attrs.x = seg[seglen - 2]; attrs.y = seg[seglen - 1]; attrs.bx = toFloat(seg[seglen - 4]) || attrs.x; attrs.by = toFloat(seg[seglen - 3]) || attrs.y; attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x); attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y); attrs2.x = p2 && seg2[seg2len - 2]; attrs2.y = p2 && seg2[seg2len - 1]; } if (!p2) { pth.curve = pathClone(p); } return p2 ? [p, p2] : p; }, null, pathClone), parseDots = R._parseDots = cacher(function(gradient) { var dots = []; for (var i = 0, ii = gradient.length; i < ii; i++) { var dot = {}, par = gradient[i].match(/^([^:]*):?([\d\.]*)/); dot.color = R.getRGB(par[1]); if (dot.color.error) { return null; } dot.color = dot.color.hex; par[2] && (dot.offset = par[2] + "%"); dots.push(dot); } for (i = 1, ii = dots.length - 1; i < ii; i++) { if (!dots[i].offset) { var start = toFloat(dots[i - 1].offset || 0), end = 0; for (var j = i + 1; j < ii; j++) { if (dots[j].offset) { end = dots[j].offset; break; } } if (!end) { end = 100; j = ii; } end = toFloat(end); var d = (end - start) / (j - i + 1); for (; i < j; i++) { start += d; dots[i].offset = start + "%"; } } } return dots; }), tear = R._tear = function(el, paper) { el == paper.top && (paper.top = el.prev); el == paper.bottom && (paper.bottom = el.next); el.next && (el.next.prev = el.prev); el.prev && (el.prev.next = el.next); }, tofront = R._tofront = function(el, paper) { if (paper.top === el) { return; } tear(el, paper); el.next = null; el.prev = paper.top; paper.top.next = el; paper.top = el; }, toback = R._toback = function(el, paper) { if (paper.bottom === el) { return; } tear(el, paper); el.next = paper.bottom; el.prev = null; paper.bottom.prev = el; paper.bottom = el; }, insertafter = R._insertafter = function(el, el2, paper) { tear(el, paper); el2 == paper.top && (paper.top = el); el2.next && (el2.next.prev = el); el.next = el2.next; el.prev = el2; el2.next = el; }, insertbefore = R._insertbefore = function(el, el2, paper) { tear(el, paper); el2 == paper.bottom && (paper.bottom = el); el2.prev && (el2.prev.next = el); el.prev = el2.prev; el2.prev = el; el.next = el2; }, toMatrix = R.toMatrix = function(path, transform) { var bb = pathDimensions(path), el = { _: { transform: E }, getBBox: function() { return bb; } }; extractTransform(el, transform); return el.matrix; }, transformPath = R.transformPath = function(path, transform) { return mapPath(path, toMatrix(path, transform)); }, extractTransform = R._extractTransform = function(el, tstr) { if (tstr == null) { return el._.transform; } tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E); var tdata = R.parseTransformString(tstr), deg = 0, dx = 0, dy = 0, sx = 1, sy = 1, _ = el._, m = new Matrix; _.transform = tdata || []; if (tdata) { for (var i = 0, ii = tdata.length; i < ii; i++) { var t = tdata[i], tlen = t.length, command = Str(t[0]).toLowerCase(), absolute = t[0] != command, inver = absolute ? m.invert() : 0, x1, y1, x2, y2, bb; if (command == "t" && tlen == 3) { if (absolute) { x1 = inver.x(0, 0); y1 = inver.y(0, 0); x2 = inver.x(t[1], t[2]); y2 = inver.y(t[1], t[2]); m.translate(x2 - x1, y2 - y1); } else { m.translate(t[1], t[2]); } } else if (command == "r") { if (tlen == 2) { bb = bb || el.getBBox(1); m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2); deg += t[1]; } else if (tlen == 4) { if (absolute) { x2 = inver.x(t[2], t[3]); y2 = inver.y(t[2], t[3]); m.rotate(t[1], x2, y2); } else { m.rotate(t[1], t[2], t[3]); } deg += t[1]; } } else if (command == "s") { if (tlen == 2 || tlen == 3) { bb = bb || el.getBBox(1); m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2); sx *= t[1]; sy *= t[tlen - 1]; } else if (tlen == 5) { if (absolute) { x2 = inver.x(t[3], t[4]); y2 = inver.y(t[3], t[4]); m.scale(t[1], t[2], x2, y2); } else { m.scale(t[1], t[2], t[3], t[4]); } sx *= t[1]; sy *= t[2]; } } else if (command == "m" && tlen == 7) { m.add(t[1], t[2], t[3], t[4], t[5], t[6]); } _.dirtyT = 1; el.matrix = m; } } el.matrix = m; _.sx = sx; _.sy = sy; _.deg = deg; _.dx = dx = m.e; _.dy = dy = m.f; if (sx == 1 && sy == 1 && !deg && _.bbox) { _.bbox.x += +dx; _.bbox.y += +dy; } else { _.dirtyT = 1; } }, getEmpty = function(item) { var l = item[0]; switch (l.toLowerCase()) { case "t": return [l, 0, 0]; case "m": return [l, 1, 0, 0, 1, 0, 0]; case "r": if (item.length == 4) { return [l, 0, item[2], item[3]]; } else { return [l, 0]; } case "s": if (item.length == 5) { return [l, 1, 1, item[3], item[4]]; } else if (item.length == 3) { return [l, 1, 1]; } else { return [l, 1]; } } }, equaliseTransform = R._equaliseTransform = function(t1, t2) { t2 = Str(t2).replace(/\.{3}|\u2026/g, t1); t1 = R.parseTransformString(t1) || []; t2 = R.parseTransformString(t2) || []; var maxlength = mmax(t1.length, t2.length), from = [], to = [], i = 0, j, jj, tt1, tt2; for (; i < maxlength; i++) { tt1 = t1[i] || getEmpty(t2[i]); tt2 = t2[i] || getEmpty(tt1); if ((tt1[0] != tt2[0]) || (tt1[0].toLowerCase() == "r" && (tt1[2] != tt2[2] || tt1[3] != tt2[3])) || (tt1[0].toLowerCase() == "s" && (tt1[3] != tt2[3] || tt1[4] != tt2[4])) ) { return; } from[i] = []; to[i] = []; for (j = 0, jj = mmax(tt1.length, tt2.length); j < jj; j++) { j in tt1 && (from[i][j] = tt1[j]); j in tt2 && (to[i][j] = tt2[j]); } } return { from: from, to: to }; }; R._getContainer = function(x, y, w, h) { var container; container = h == null && !R.is(x, "object") ? g.doc.getElementById(x) : x; if (container == null) { return; } if (container.tagName) { if (y == null) { return { container: container, width: container.style.pixelWidth || container.offsetWidth, height: container.style.pixelHeight || container.offsetHeight }; } else { return { container: container, width: y, height: w }; } } return { container: 1, x: x, y: y, width: w, height: h }; }; R.pathToRelative = pathToRelative; R._engine = {}; R.path2curve = path2curve; R.matrix = function(a, b, c, d, e, f) { return new Matrix(a, b, c, d, e, f); }; function Matrix(a, b, c, d, e, f) { if (a != null) { this.a = +a; this.b = +b; this.c = +c; this.d = +d; this.e = +e; this.f = +f; } else { this.a = 1; this.b = 0; this.c = 0; this.d = 1; this.e = 0; this.f = 0; } } (function(matrixproto) { matrixproto.add = function(a, b, c, d, e, f) { var out = [[], [], []], m = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]], matrix = [[a, c, e], [b, d, f], [0, 0, 1]], x, y, z, res; if (a && a instanceof Matrix) { matrix = [[a.a, a.c, a.e], [a.b, a.d, a.f], [0, 0, 1]]; } for (x = 0; x < 3; x++) { for (y = 0; y < 3; y++) { res = 0; for (z = 0; z < 3; z++) { res += m[x][z] * matrix[z][y]; } out[x][y] = res; } } this.a = out[0][0]; this.b = out[1][0]; this.c = out[0][1]; this.d = out[1][1]; this.e = out[0][2]; this.f = out[1][2]; }; matrixproto.invert = function() { var me = this, x = me.a * me.d - me.b * me.c; return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x); }; matrixproto.clone = function() { return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f); }; matrixproto.translate = function(x, y) { this.add(1, 0, 0, 1, x, y); }; matrixproto.scale = function(x, y, cx, cy) { y == null && (y = x); (cx || cy) && this.add(1, 0, 0, 1, cx, cy); this.add(x, 0, 0, y, 0, 0); (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy); }; matrixproto.rotate = function(a, x, y) { a = R.rad(a); x = x || 0; y = y || 0; var cos = +math.cos(a).toFixed(9), sin = +math.sin(a).toFixed(9); this.add(cos, sin, -sin, cos, x, y); this.add(1, 0, 0, 1, -x, -y); }; matrixproto.x = function(x, y) { return x * this.a + y * this.c + this.e; }; matrixproto.y = function(x, y) { return x * this.b + y * this.d + this.f; }; matrixproto.get = function(i) { return +this[Str.fromCharCode(97 + i)].toFixed(4); }; matrixproto.toString = function() { return R.svg ? "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")" : [this.get(0), this.get(2), this.get(1), this.get(3), 0, 0].join(); }; matrixproto.toFilter = function() { return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) + ", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) + ", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')"; }; matrixproto.offset = function() { return [this.e.toFixed(4), this.f.toFixed(4)]; }; function norm(a) { return a[0] * a[0] + a[1] * a[1]; } function normalize(a) { var mag = math.sqrt(norm(a)); a[0] && (a[0] /= mag); a[1] && (a[1] /= mag); } matrixproto.split = function() { var out = {}; // translation out.dx = this.e; out.dy = this.f; // scale and shear var row = [[this.a, this.c], [this.b, this.d]]; out.scalex = math.sqrt(norm(row[0])); normalize(row[0]); out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1]; row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear]; out.scaley = math.sqrt(norm(row[1])); normalize(row[1]); out.shear /= out.scaley; // rotation var sin = -row[0][1], cos = row[1][1]; if (cos < 0) { out.rotate = R.deg(math.acos(cos)); if (sin < 0) { out.rotate = 360 - out.rotate; } } else { out.rotate = R.deg(math.asin(sin)); } out.isSimple = ! +out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate); out.isSuperSimple = ! +out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate; out.noRotation = ! +out.shear.toFixed(9) && !out.rotate; return out; }; matrixproto.toTransformString = function(shorter) { var s = shorter || this[split](); if (s.isSimple) { s.scalex = +s.scalex.toFixed(4); s.scaley = +s.scaley.toFixed(4); s.rotate = +s.rotate.toFixed(4); return (s.dx || s.dy ? "t" + [s.dx, s.dy] : E) + (s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) + (s.rotate ? "r" + [s.rotate, 0, 0] : E); } else { return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)]; } }; })(Matrix.prototype); // WebKit rendering bug workaround method var version = navigator.userAgent.match(/Version\/(.*?)\s/) || navigator.userAgent.match(/Chrome\/(\d+)/); if ((navigator.vendor == "Apple Computer, Inc.") && (version && version[1] < 4 || navigator.platform.slice(0, 2) == "iP") || (navigator.vendor == "Google Inc." && version && version[1] < 8)) { paperproto.safari = function() { var rect = this.rect(-99, -99, this.width + 99, this.height + 99).attr({ stroke: "none" }); setTimeout(function() { rect.remove(); }); }; } else { paperproto.safari = fun; } var preventDefault = function() { this.returnValue = false; }, preventTouch = function() { return this.originalEvent.preventDefault(); }, stopPropagation = function() { this.cancelBubble = true; }, stopTouch = function() { return this.originalEvent.stopPropagation(); }, addEvent = (function() { if (g.doc.addEventListener) { return function(obj, type, fn, element) { var realName = supportsTouch && touchMap[type] ? touchMap[type] : type, f = function(e) { var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft, x = e.clientX + scrollX, y = e.clientY + scrollY; if (supportsTouch && touchMap[has](type)) { for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) { if (e.targetTouches[i].target == obj) { var olde = e; e = e.targetTouches[i]; e.originalEvent = olde; e.preventDefault = preventTouch; e.stopPropagation = stopTouch; break; } } } return fn.call(element, e, x, y); }; obj.addEventListener(realName, f, false); return function() { obj.removeEventListener(realName, f, false); return true; }; }; } else if (g.doc.attachEvent) { return function(obj, type, fn, element) { var f = function(e) { e = e || g.win.event; var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft, x = e.clientX + scrollX, y = e.clientY + scrollY; e.preventDefault = e.preventDefault || preventDefault; e.stopPropagation = e.stopPropagation || stopPropagation; return fn.call(element, e, x, y); }; obj.attachEvent("on" + type, f); var detacher = function() { obj.detachEvent("on" + type, f); return true; }; return detacher; }; } })(), drag = [], dragMove = function(e) { var x = e.clientX, y = e.clientY, scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft, dragi, j = drag.length; while (j--) { dragi = drag[j]; if (supportsTouch) { var i = e.touches.length, touch; while (i--) { touch = e.touches[i]; if (touch.identifier == dragi.el._drag.id) { x = touch.clientX; y = touch.clientY; (e.originalEvent ? e.originalEvent : e).preventDefault(); break; } } } else { e.preventDefault(); } var node = dragi.el.node, o, next = node.nextSibling, parent = node.parentNode, display = node.style.display; g.win.opera && parent.removeChild(node); node.style.display = "none"; o = dragi.el.paper.getElementByPoint(x, y); node.style.display = display; g.win.opera && (next ? parent.insertBefore(node, next) : parent.appendChild(node)); o && eve("raphael.drag.over." + dragi.el.id, dragi.el, o); x += scrollX; y += scrollY; eve("raphael.drag.move." + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e); } }, dragUp = function(e) { R.unmousemove(dragMove).unmouseup(dragUp); var i = drag.length, dragi; while (i--) { dragi = drag[i]; dragi.el._drag = {}; eve("raphael.drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e); } drag = []; }, elproto = R.el = {}; for (var i = events.length; i--; ) { (function(eventName) { R[eventName] = elproto[eventName] = function(fn, scope) { if (R.is(fn, "function")) { this.events = this.events || []; this.events.push({ name: eventName, f: fn, unbind: addEvent(this.shape || this.node || g.doc, eventName, fn, scope || this) }); } return this; }; R["un" + eventName] = elproto["un" + eventName] = function(fn) { var events = this.events || [], l = events.length; while (l--) if (events[l].name == eventName && events[l].f == fn) { events[l].unbind(); events.splice(l, 1); !events.length && delete this.events; return this; } return this; }; })(events[i]); } elproto.data = function(key, value) { var data = eldata[this.id] = eldata[this.id] || {}; if (arguments.length == 1) { if (R.is(key, "object")) { for (var i in key) if (key[has](i)) { this.data(i, key[i]); } return this; } eve("raphael.data.get." + this.id, this, data[key], key); return data[key]; } data[key] = value; eve("raphael.data.set." + this.id, this, value, key); return this; }; elproto.removeData = function(key) { if (key == null) { eldata[this.id] = {}; } else { eldata[this.id] && delete eldata[this.id][key]; } return this; }; elproto.hover = function(f_in, f_out, scope_in, scope_out) { return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in); }; elproto.unhover = function(f_in, f_out) { return this.unmouseover(f_in).unmouseout(f_out); }; var draggable = []; elproto.drag = function(onmove, onstart, onend, move_scope, start_scope, end_scope) { function start(e) { (e.originalEvent || e).preventDefault(); var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft; this._drag.x = e.clientX + scrollX; this._drag.y = e.clientY + scrollY; this._drag.id = e.identifier; !drag.length && R.mousemove(dragMove).mouseup(dragUp); drag.push({ el: this, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope }); onstart && eve.on("raphael.drag.start." + this.id, onstart); onmove && eve.on("raphael.drag.move." + this.id, onmove); onend && eve.on("raphael.drag.end." + this.id, onend); eve("raphael.drag.start." + this.id, start_scope || move_scope || this, e.clientX + scrollX, e.clientY + scrollY, e); } this._drag = {}; draggable.push({ el: this, start: start }); this.mousedown(start); return this; }; elproto.onDragOver = function(f) { f ? eve.on("raphael.drag.over." + this.id, f) : eve.unbind("raphael.drag.over." + this.id); }; elproto.undrag = function() { var i = draggable.length; while (i--) if (draggable[i].el == this) { this.unmousedown(draggable[i].start); draggable.splice(i, 1); eve.unbind("raphael.drag.*." + this.id); } !draggable.length && R.unmousemove(dragMove).unmouseup(dragUp); }; paperproto.circle = function(x, y, r) { var out = R._engine.circle(this, x || 0, y || 0, r || 0); this.__set__ && this.__set__.push(out); return out; }; paperproto.rect = function(x, y, w, h, r) { var out = R._engine.rect(this, x || 0, y || 0, w || 0, h || 0, r || 0); this.__set__ && this.__set__.push(out); return out; }; paperproto.ellipse = function(x, y, rx, ry) { var out = R._engine.ellipse(this, x || 0, y || 0, rx || 0, ry || 0); this.__set__ && this.__set__.push(out); return out; }; paperproto.path = function(pathString) { pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E); var out = R._engine.path(R.format[apply](R, arguments), this); this.__set__ && this.__set__.push(out); return out; }; paperproto.image = function(src, x, y, w, h) { var out = R._engine.image(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0); this.__set__ && this.__set__.push(out); return out; }; paperproto.text = function(x, y, text) { var out = R._engine.text(this, x || 0, y || 0, Str(text)); this.__set__ && this.__set__.push(out); return out; }; paperproto.set = function(itemsArray) { !R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length)); var out = new Set(itemsArray); this.__set__ && this.__set__.push(out); return out; }; paperproto.setStart = function(set) { this.__set__ = set || this.set(); }; paperproto.setFinish = function(set) { var out = this.__set__; delete this.__set__; return out; }; paperproto.setSize = function(width, height) { return R._engine.setSize.call(this, width, height); }; paperproto.setViewBox = function(x, y, w, h, fit) { return R._engine.setViewBox.call(this, x, y, w, h, fit); }; paperproto.top = paperproto.bottom = null; paperproto.raphael = R; var getOffset = function(elem) { var box = elem.getBoundingClientRect(), doc = elem.ownerDocument, body = doc.body, docElem = doc.documentElement, clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop) - clientTop, left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft; return { y: top, x: left }; }; paperproto.getElementByPoint = function(x, y) { var paper = this, svg = paper.canvas, target = g.doc.elementFromPoint(x, y); if (g.win.opera && target.tagName == "svg") { var so = getOffset(svg), sr = svg.createSVGRect(); sr.x = x - so.x; sr.y = y - so.y; sr.width = sr.height = 1; var hits = svg.getIntersectionList(sr, null); if (hits.length) { target = hits[hits.length - 1]; } } if (!target) { return null; } while (target.parentNode && target != svg.parentNode && !target.raphael) { target = target.parentNode; } target == paper.canvas.parentNode && (target = svg); target = target && target.raphael ? paper.getById(target.raphaelid) : null; return target; }; paperproto.getById = function(id) { var bot = this.bottom; while (bot) { if (bot.id == id) { return bot; } bot = bot.next; } return null; }; paperproto.forEach = function(callback, thisArg) { var bot = this.bottom; while (bot) { if (callback.call(thisArg, bot) === false) { return this; } bot = bot.next; } return this; }; paperproto.getElementsByPoint = function(x, y) { var set = this.set(); this.forEach(function(el) { if (el.isPointInside(x, y)) { set.push(el); } }); return set; }; function x_y() { return this.x + S + this.y; } function x_y_w_h() { return this.x + S + this.y + S + this.width + " \xd7 " + this.height; } elproto.isPointInside = function(x, y) { var rp = this.realPath = this.realPath || getPath[this.type](this); return R.isPointInsidePath(rp, x, y); }; elproto.getBBox = function(isWithoutTransform) { if (this.removed) { return {}; } var _ = this._; if (isWithoutTransform) { if (_.dirty || !_.bboxwt) { this.realPath = getPath[this.type](this); _.bboxwt = pathDimensions(this.realPath); _.bboxwt.toString = x_y_w_h; _.dirty = 0; } return _.bboxwt; } if (_.dirty || _.dirtyT || !_.bbox) { if (_.dirty || !this.realPath) { _.bboxwt = 0; this.realPath = getPath[this.type](this); } _.bbox = pathDimensions(mapPath(this.realPath, this.matrix)); _.bbox.toString = x_y_w_h; _.dirty = _.dirtyT = 0; } return _.bbox; }; elproto.clone = function() { if (this.removed) { return null; } var out = this.paper[this.type]().attr(this.attr()); this.__set__ && this.__set__.push(out); return out; }; elproto.glow = function(glow) { if (this.type == "text") { return null; } glow = glow || {}; var s = { width: (glow.width || 10) + (+this.attr("stroke-width") || 1), fill: glow.fill || false, opacity: glow.opacity || .5, offsetx: glow.offsetx || 0, offsety: glow.offsety || 0, color: glow.color || "#000" }, c = s.width / 2, r = this.paper, out = r.set(), path = this.realPath || getPath[this.type](this); path = this.matrix ? mapPath(path, this.matrix) : path; for (var i = 1; i < c + 1; i++) { out.push(r.path(path).attr({ stroke: s.color, fill: s.fill ? s.color : "none", "stroke-linejoin": "round", "stroke-linecap": "round", "stroke-width": +(s.width / c * i).toFixed(3), opacity: +(s.opacity / c).toFixed(3) })); } return out.insertBefore(this).translate(s.offsetx, s.offsety); }; var curveslengths = {}, getPointAtSegmentLength = function(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) { if (length == null) { return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y); } else { return R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, getTatLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length)); } }, getLengthFactory = function(istotal, subpath) { return function(path, length, onlystart) { path = path2curve(path); var x, y, p, l, sp = "", subpaths = {}, point, len = 0; for (var i = 0, ii = path.length; i < ii; i++) { p = path[i]; if (p[0] == "M") { x = +p[1]; y = +p[2]; } else { l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]); if (len + l > length) { if (subpath && !subpaths.start) { point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len); sp += ["C" + point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y]; if (onlystart) { return sp; } subpaths.start = sp; sp = ["M" + point.x, point.y + "C" + point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]].join(); len += l; x = +p[5]; y = +p[6]; continue; } if (!istotal && !subpath) { point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len); return { x: point.x, y: point.y, alpha: point.alpha }; } } len += l; x = +p[5]; y = +p[6]; } sp += p.shift() + p; } subpaths.end = sp; point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1); point.alpha && (point = { x: point.x, y: point.y, alpha: point.alpha }); return point; }; }; var getTotalLength = getLengthFactory(1), getPointAtLength = getLengthFactory(), getSubpathsAtLength = getLengthFactory(0, 1); R.getTotalLength = getTotalLength; R.getPointAtLength = getPointAtLength; R.getSubpath = function(path, from, to) { if (this.getTotalLength(path) - to < 1e-6) { return getSubpathsAtLength(path, from).end; } var a = getSubpathsAtLength(path, to, 1); return from ? getSubpathsAtLength(a, from).end : a; }; elproto.getTotalLength = function() { if (this.type != "path") { return; } if (this.node.getTotalLength) { return this.node.getTotalLength(); } return getTotalLength(this.attrs.path); }; elproto.getPointAtLength = function(length) { if (this.type != "path") { return; } return getPointAtLength(this.attrs.path, length); }; elproto.getSubpath = function(from, to) { if (this.type != "path") { return; } return R.getSubpath(this.attrs.path, from, to); }; var ef = R.easing_formulas = { linear: function(n) { return n; }, "<": function(n) { return pow(n, 1.7); }, ">": function(n) { return pow(n, .48); }, "<>": function(n) { var q = .48 - n / 1.04, Q = math.sqrt(.1734 + q * q), x = Q - q, X = pow(abs(x), 1 / 3) * (x < 0 ? -1 : 1), y = -Q - q, Y = pow(abs(y), 1 / 3) * (y < 0 ? -1 : 1), t = X + Y + .5; return (1 - t) * 3 * t * t + t * t * t; }, backIn: function(n) { var s = 1.70158; return n * n * ((s + 1) * n - s); }, backOut: function(n) { n = n - 1; var s = 1.70158; return n * n * ((s + 1) * n + s) + 1; }, elastic: function(n) { if (n == !!n) { return n; } return pow(2, -10 * n) * math.sin((n - .075) * (2 * PI) / .3) + 1; }, bounce: function(n) { var s = 7.5625, p = 2.75, l; if (n < (1 / p)) { l = s * n * n; } else { if (n < (2 / p)) { n -= (1.5 / p); l = s * n * n + .75; } else { if (n < (2.5 / p)) { n -= (2.25 / p); l = s * n * n + .9375; } else { n -= (2.625 / p); l = s * n * n + .984375; } } } return l; } }; ef.easeIn = ef["ease-in"] = ef["<"]; ef.easeOut = ef["ease-out"] = ef[">"]; ef.easeInOut = ef["ease-in-out"] = ef["<>"]; ef["back-in"] = ef.backIn; ef["back-out"] = ef.backOut; var animationElements = [], requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { setTimeout(callback, 16); }, animation = function() { var Now = +new Date, l = 0; for (; l < animationElements.length; l++) { var e = animationElements[l]; if (e.el.removed || e.paused) { continue; } var time = Now - e.start, ms = e.ms, easing = e.easing, from = e.from, diff = e.diff, to = e.to, t = e.t, that = e.el, set = {}, now, init = {}, key; if (e.initstatus) { time = (e.initstatus * e.anim.top - e.prev) / (e.percent - e.prev) * ms; e.status = e.initstatus; delete e.initstatus; e.stop && animationElements.splice(l--, 1); } else { e.status = (e.prev + (e.percent - e.prev) * (time / ms)) / e.anim.top; } if (time < 0) { continue; } if (time < ms) { var pos = easing(time / ms); for (var attr in from) if (from[has](attr)) { switch (availableAnimAttrs[attr]) { case nu: now = +from[attr] + pos * ms * diff[attr]; break; case "colour": now = "rgb(" + [ upto255(round(from[attr].r + pos * ms * diff[attr].r)), upto255(round(from[attr].g + pos * ms * diff[attr].g)), upto255(round(from[attr].b + pos * ms * diff[attr].b)) ].join(",") + ")"; break; case "path": now = []; for (var i = 0, ii = from[attr].length; i < ii; i++) { now[i] = [from[attr][i][0]]; for (var j = 1, jj = from[attr][i].length; j < jj; j++) { now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j]; } now[i] = now[i].join(S); } now = now.join(S); break; case "transform": if (diff[attr].real) { now = []; for (i = 0, ii = from[attr].length; i < ii; i++) { now[i] = [from[attr][i][0]]; for (j = 1, jj = from[attr][i].length; j < jj; j++) { now[i][j] = from[attr][i][j] + pos * ms * diff[attr][i][j]; } } } else { var get = function(i) { return +from[attr][i] + pos * ms * diff[attr][i]; }; // now = [["r", get(2), 0, 0], ["t", get(3), get(4)], ["s", get(0), get(1), 0, 0]]; now = [["m", get(0), get(1), get(2), get(3), get(4), get(5)]]; } break; case "csv": if (attr == "clip-rect") { now = []; i = 4; while (i--) { now[i] = +from[attr][i] + pos * ms * diff[attr][i]; } } break; default: var from2 = [][concat](from[attr]); now = []; i = that.paper.customAttributes[attr].length; while (i--) { now[i] = +from2[i] + pos * ms * diff[attr][i]; } break; } set[attr] = now; } that.attr(set); (function(id, that, anim) { setTimeout(function() { eve("raphael.anim.frame." + id, that, anim); }); })(that.id, that, e.anim); } else { (function(f, el, a) { setTimeout(function() { eve("raphael.anim.frame." + el.id, el, a); eve("raphael.anim.finish." + el.id, el, a); R.is(f, "function") && f.call(el); }); })(e.callback, that, e.anim); that.attr(to); animationElements.splice(l--, 1); if (e.repeat > 1 && !e.next) { for (key in to) if (to[has](key)) { init[key] = e.totalOrigin[key]; } e.el.attr(init); runAnimation(e.anim, e.el, e.anim.percents[0], null, e.totalOrigin, e.repeat - 1); } if (e.next && !e.stop) { runAnimation(e.anim, e.el, e.next, null, e.totalOrigin, e.repeat); } } } R.svg && that && that.paper && that.paper.safari(); animationElements.length && requestAnimFrame(animation); }, upto255 = function(color) { return color > 255 ? 255 : color < 0 ? 0 : color; }; elproto.animateWith = function(el, anim, params, ms, easing, callback) { var element = this; if (element.removed) { callback && callback.call(element); return element; } var a = params instanceof Animation ? params : R.animation(params, ms, easing, callback), x, y; runAnimation(a, element, a.percents[0], null, element.attr()); for (var i = 0, ii = animationElements.length; i < ii; i++) { if (animationElements[i].anim == anim && animationElements[i].el == el) { animationElements[ii - 1].start = animationElements[i].start; break; } } return element; // // // var a = params ? R.animation(params, ms, easing, callback) : anim, // status = element.status(anim); // return this.animate(a).status(a, status * anim.ms / a.ms); }; function CubicBezierAtTime(t, p1x, p1y, p2x, p2y, duration) { var cx = 3 * p1x, bx = 3 * (p2x - p1x) - cx, ax = 1 - cx - bx, cy = 3 * p1y, by = 3 * (p2y - p1y) - cy, ay = 1 - cy - by; function sampleCurveX(t) { return ((ax * t + bx) * t + cx) * t; } function solve(x, epsilon) { var t = solveCurveX(x, epsilon); return ((ay * t + by) * t + cy) * t; } function solveCurveX(x, epsilon) { var t0, t1, t2, x2, d2, i; for (t2 = x, i = 0; i < 8; i++) { x2 = sampleCurveX(t2) - x; if (abs(x2) < epsilon) { return t2; } d2 = (3 * ax * t2 + 2 * bx) * t2 + cx; if (abs(d2) < 1e-6) { break; } t2 = t2 - x2 / d2; } t0 = 0; t1 = 1; t2 = x; if (t2 < t0) { return t0; } if (t2 > t1) { return t1; } while (t0 < t1) { x2 = sampleCurveX(t2); if (abs(x2 - x) < epsilon) { return t2; } if (x > x2) { t0 = t2; } else { t1 = t2; } t2 = (t1 - t0) / 2 + t0; } return t2; } return solve(t, 1 / (200 * duration)); } elproto.onAnimation = function(f) { f ? eve.on("raphael.anim.frame." + this.id, f) : eve.unbind("raphael.anim.frame." + this.id); return this; }; function Animation(anim, ms) { var percents = [], newAnim = {}; this.ms = ms; this.times = 1; if (anim) { for (var attr in anim) if (anim[has](attr)) { newAnim[toFloat(attr)] = anim[attr]; percents.push(toFloat(attr)); } percents.sort(sortByNumber); } this.anim = newAnim; this.top = percents[percents.length - 1]; this.percents = percents; } Animation.prototype.delay = function(delay) { var a = new Animation(this.anim, this.ms); a.times = this.times; a.del = +delay || 0; return a; }; Animation.prototype.repeat = function(times) { var a = new Animation(this.anim, this.ms); a.del = this.del; a.times = math.floor(mmax(times, 0)) || 1; return a; }; function runAnimation(anim, element, percent, status, totalOrigin, times) { percent = toFloat(percent); var params, isInAnim, isInAnimSet, percents = [], next, prev, timestamp, ms = anim.ms, from = {}, to = {}, diff = {}; if (status) { for (i = 0, ii = animationElements.length; i < ii; i++) { var e = animationElements[i]; if (e.el.id == element.id && e.anim == anim) { if (e.percent != percent) { animationElements.splice(i, 1); isInAnimSet = 1; } else { isInAnim = e; } element.attr(e.totalOrigin); break; } } } else { status = +to; // NaN } for (var i = 0, ii = anim.percents.length; i < ii; i++) { if (anim.percents[i] == percent || anim.percents[i] > status * anim.top) { percent = anim.percents[i]; prev = anim.percents[i - 1] || 0; ms = ms / anim.top * (percent - prev); next = anim.percents[i + 1]; params = anim.anim[percent]; break; } else if (status) { element.attr(anim.anim[anim.percents[i]]); } } if (!params) { return; } if (!isInAnim) { for (var attr in params) if (params[has](attr)) { if (availableAnimAttrs[has](attr) || element.paper.customAttributes[has](attr)) { from[attr] = element.attr(attr); (from[attr] == null) && (from[attr] = availableAttrs[attr]); to[attr] = params[attr]; switch (availableAnimAttrs[attr]) { case nu: diff[attr] = (to[attr] - from[attr]) / ms; break; case "colour": from[attr] = R.getRGB(from[attr]); var toColour = R.getRGB(to[attr]); diff[attr] = { r: (toColour.r - from[attr].r) / ms, g: (toColour.g - from[attr].g) / ms, b: (toColour.b - from[attr].b) / ms }; break; case "path": var pathes = path2curve(from[attr], to[attr]), toPath = pathes[1]; from[attr] = pathes[0]; diff[attr] = []; for (i = 0, ii = from[attr].length; i < ii; i++) { diff[attr][i] = [0]; for (var j = 1, jj = from[attr][i].length; j < jj; j++) { diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms; } } break; case "transform": var _ = element._, eq = equaliseTransform(_[attr], to[attr]); if (eq) { from[attr] = eq.from; to[attr] = eq.to; diff[attr] = []; diff[attr].real = true; for (i = 0, ii = from[attr].length; i < ii; i++) { diff[attr][i] = [from[attr][i][0]]; for (j = 1, jj = from[attr][i].length; j < jj; j++) { diff[attr][i][j] = (to[attr][i][j] - from[attr][i][j]) / ms; } } } else { var m = (element.matrix || new Matrix), to2 = { _: { transform: _.transform }, getBBox: function() { return element.getBBox(1); } }; from[attr] = [ m.a, m.b, m.c, m.d, m.e, m.f ]; extractTransform(to2, to[attr]); to[attr] = to2._.transform; diff[attr] = [ (to2.matrix.a - m.a) / ms, (to2.matrix.b - m.b) / ms, (to2.matrix.c - m.c) / ms, (to2.matrix.d - m.d) / ms, (to2.matrix.e - m.e) / ms, (to2.matrix.f - m.f) / ms ]; // from[attr] = [_.sx, _.sy, _.deg, _.dx, _.dy]; // var to2 = {_:{}, getBBox: function () { return element.getBBox(); }}; // extractTransform(to2, to[attr]); // diff[attr] = [ // (to2._.sx - _.sx) / ms, // (to2._.sy - _.sy) / ms, // (to2._.deg - _.deg) / ms, // (to2._.dx - _.dx) / ms, // (to2._.dy - _.dy) / ms // ]; } break; case "csv": var values = Str(params[attr])[split](separator), from2 = Str(from[attr])[split](separator); if (attr == "clip-rect") { from[attr] = from2; diff[attr] = []; i = from2.length; while (i--) { diff[attr][i] = (values[i] - from[attr][i]) / ms; } } to[attr] = values; break; default: values = [][concat](params[attr]); from2 = [][concat](from[attr]); diff[attr] = []; i = element.paper.customAttributes[attr].length; while (i--) { diff[attr][i] = ((values[i] || 0) - (from2[i] || 0)) / ms; } break; } } } var easing = params.easing, easyeasy = R.easing_formulas[easing]; if (!easyeasy) { easyeasy = Str(easing).match(bezierrg); if (easyeasy && easyeasy.length == 5) { var curve = easyeasy; easyeasy = function(t) { return CubicBezierAtTime(t, +curve[1], +curve[2], +curve[3], +curve[4], ms); }; } else { easyeasy = pipe; } } timestamp = params.start || anim.start || +new Date; e = { anim: anim, percent: percent, timestamp: timestamp, start: timestamp + (anim.del || 0), status: 0, initstatus: status || 0, stop: false, ms: ms, easing: easyeasy, from: from, diff: diff, to: to, el: element, callback: params.callback, prev: prev, next: next, repeat: times || anim.times, origin: element.attr(), totalOrigin: totalOrigin }; animationElements.push(e); if (status && !isInAnim && !isInAnimSet) { e.stop = true; e.start = new Date - ms * status; if (animationElements.length == 1) { return animation(); } } if (isInAnimSet) { e.start = new Date - e.ms * status; } animationElements.length == 1 && requestAnimFrame(animation); } else { isInAnim.initstatus = status; isInAnim.start = new Date - isInAnim.ms * status; } eve("raphael.anim.start." + element.id, element, anim); } R.animation = function(params, ms, easing, callback) { if (params instanceof Animation) { return params; } if (R.is(easing, "function") || !easing) { callback = callback || easing || null; easing = null; } params = Object(params); ms = +ms || 0; var p = {}, json, attr; for (attr in params) if (params[has](attr) && toFloat(attr) != attr && toFloat(attr) + "%" != attr) { json = true; p[attr] = params[attr]; } if (!json) { return new Animation(params, ms); } else { easing && (p.easing = easing); callback && (p.callback = callback); return new Animation({ 100: p }, ms); } }; elproto.animate = function(params, ms, easing, callback) { var element = this; if (element.removed) { callback && callback.call(element); return element; } var anim = params instanceof Animation ? params : R.animation(params, ms, easing, callback); runAnimation(anim, element, anim.percents[0], null, element.attr()); return element; }; elproto.setTime = function(anim, value) { if (anim && value != null) { this.status(anim, mmin(value, anim.ms) / anim.ms); } return this; }; elproto.status = function(anim, value) { var out = [], i = 0, len, e; if (value != null) { runAnimation(anim, this, -1, mmin(value, 1)); return this; } else { len = animationElements.length; for (; i < len; i++) { e = animationElements[i]; if (e.el.id == this.id && (!anim || e.anim == anim)) { if (anim) { return e.status; } out.push({ anim: e.anim, status: e.status }); } } if (anim) { return 0; } return out; } }; elproto.pause = function(anim) { for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { if (eve("raphael.anim.pause." + this.id, this, animationElements[i].anim) !== false) { animationElements[i].paused = true; } } return this; }; elproto.resume = function(anim) { for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { var e = animationElements[i]; if (eve("raphael.anim.resume." + this.id, this, e.anim) !== false) { delete e.paused; this.status(e.anim, e.status); } } return this; }; elproto.stop = function(anim) { for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { if (eve("raphael.anim.stop." + this.id, this, animationElements[i].anim) !== false) { animationElements.splice(i--, 1); } } return this; }; function stopAnimation(paper) { for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.paper == paper) { animationElements.splice(i--, 1); } } eve.on("raphael.remove", stopAnimation); eve.on("raphael.clear", stopAnimation); elproto.toString = function() { return "Rapha\xebl\u2019s object"; }; // Set var Set = function(items) { this.items = []; this.length = 0; this.type = "set"; if (items) { for (var i = 0, ii = items.length; i < ii; i++) { if (items[i] && (items[i].constructor == elproto.constructor || items[i].constructor == Set)) { this[this.items.length] = this.items[this.items.length] = items[i]; this.length++; } } } }, setproto = Set.prototype; setproto.push = function() { var item, len; for (var i = 0, ii = arguments.length; i < ii; i++) { item = arguments[i]; if (item && (item.constructor == elproto.constructor || item.constructor == Set)) { len = this.items.length; this[len] = this.items[len] = item; this.length++; } } return this; }; setproto.pop = function() { this.length && delete this[this.length--]; return this.items.pop(); }; setproto.forEach = function(callback, thisArg) { for (var i = 0, ii = this.items.length; i < ii; i++) { if (callback.call(thisArg, this.items[i], i) === false) { return this; } } return this; }; for (var method in elproto) if (elproto[has](method)) { setproto[method] = (function(methodname) { return function() { var arg = arguments; return this.forEach(function(el) { el[methodname][apply](el, arg); }); }; })(method); } setproto.attr = function(name, value) { if (name && R.is(name, array) && R.is(name[0], "object")) { for (var j = 0, jj = name.length; j < jj; j++) { this.items[j].attr(name[j]); } } else { for (var i = 0, ii = this.items.length; i < ii; i++) { this.items[i].attr(name, value); } } return this; }; setproto.clear = function() { while (this.length) { this.pop(); } }; setproto.splice = function(index, count, insertion) { index = index < 0 ? mmax(this.length + index, 0) : index; count = mmax(0, mmin(this.length - index, count)); var tail = [], todel = [], args = [], i; for (i = 2; i < arguments.length; i++) { args.push(arguments[i]); } for (i = 0; i < count; i++) { todel.push(this[index + i]); } for (; i < this.length - index; i++) { tail.push(this[index + i]); } var arglen = args.length; for (i = 0; i < arglen + tail.length; i++) { this.items[index + i] = this[index + i] = i < arglen ? args[i] : tail[i - arglen]; } i = this.items.length = this.length -= count - arglen; while (this[i]) { delete this[i++]; } return new Set(todel); }; setproto.exclude = function(el) { for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) { this.splice(i, 1); return true; } }; setproto.animate = function(params, ms, easing, callback) { (R.is(easing, "function") || !easing) && (callback = easing || null); var len = this.items.length, i = len, item, set = this, collector; if (!len) { return this; } callback && (collector = function() { ! --len && callback.call(set); }); easing = R.is(easing, string) ? easing : collector; var anim = R.animation(params, ms, easing, collector); item = this.items[--i].animate(anim); while (i--) { this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, anim, anim); } return this; }; setproto.insertAfter = function(el) { var i = this.items.length; while (i--) { this.items[i].insertAfter(el); } return this; }; setproto.getBBox = function() { var x = [], y = [], x2 = [], y2 = []; for (var i = this.items.length; i--; ) if (!this.items[i].removed) { var box = this.items[i].getBBox(); x.push(box.x); y.push(box.y); x2.push(box.x + box.width); y2.push(box.y + box.height); } x = mmin[apply](0, x); y = mmin[apply](0, y); x2 = mmax[apply](0, x2); y2 = mmax[apply](0, y2); return { x: x, y: y, x2: x2, y2: y2, width: x2 - x, height: y2 - y }; }; setproto.clone = function(s) { s = new Set; for (var i = 0, ii = this.items.length; i < ii; i++) { s.push(this.items[i].clone()); } return s; }; setproto.toString = function() { return "Rapha\xebl\u2018s set"; }; R.registerFont = function(font) { if (!font.face) { return font; } this.fonts = this.fonts || {}; var fontcopy = { w: font.w, face: {}, glyphs: {} }, family = font.face["font-family"]; for (var prop in font.face) if (font.face[has](prop)) { fontcopy.face[prop] = font.face[prop]; } if (this.fonts[family]) { this.fonts[family].push(fontcopy); } else { this.fonts[family] = [fontcopy]; } if (!font.svg) { fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10); for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) { var path = font.glyphs[glyph]; fontcopy.glyphs[glyph] = { w: path.w, k: {}, d: path.d && "M" + path.d.replace(/[mlcxtrv]/g, function(command) { return { l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M"; }) + "z" }; if (path.k) { for (var k in path.k) if (path[has](k)) { fontcopy.glyphs[glyph].k[k] = path.k[k]; } } } } return font; }; paperproto.getFont = function(family, weight, style, stretch) { stretch = stretch || "normal"; style = style || "normal"; weight = +weight || { normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400; if (!R.fonts) { return; } var font = R.fonts[family]; if (!font) { var name = new RegExp("(^|\\s)" + family.replace(/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i"); for (var fontName in R.fonts) if (R.fonts[has](fontName)) { if (name.test(fontName)) { font = R.fonts[fontName]; break; } } } var thefont; if (font) { for (var i = 0, ii = font.length; i < ii; i++) { thefont = font[i]; if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) { break; } } } return thefont; }; paperproto.print = function(x, y, string, font, size, origin, letter_spacing) { origin = origin || "middle"; // baseline|middle letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1); var letters = Str(string)[split](E), shift = 0, notfirst = 0, path = E, scale; R.is(font, string) && (font = this.getFont(font)); if (font) { scale = (size || 16) / font.face["units-per-em"]; var bb = font.face.bbox[split](separator), top = +bb[0], lineHeight = bb[3] - bb[1], shifty = 0, height = +bb[1] + (origin == "baseline" ? lineHeight + (+font.face.descent) : lineHeight / 2); for (var i = 0, ii = letters.length; i < ii; i++) { if (letters[i] == "\n") { shift = 0; curr = 0; notfirst = 0; shifty += lineHeight; } else { var prev = notfirst && font.glyphs[letters[i - 1]] || {}, curr = font.glyphs[letters[i]]; shift += notfirst ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0; notfirst = 1; } if (curr && curr.d) { path += R.transformPath(curr.d, ["t", shift * scale, shifty * scale, "s", scale, scale, top, height, "t", (x - top) / scale, (y - height) / scale]); } } } return this.path(path).attr({ fill: "#000", stroke: "none" }); }; paperproto.add = function(json) { if (R.is(json, "array")) { var res = this.set(), i = 0, ii = json.length, j; for (; i < ii; i++) { j = json[i] || {}; elements[has](j.type) && res.push(this[j.type]().attr(j)); } } return res; }; R.format = function(token, params) { var args = R.is(params, array) ? [0][concat](params) : arguments; token && R.is(token, string) && args.length - 1 && (token = token.replace(formatrg, function(str, i) { return args[++i] == null ? E : args[i]; })); return token || E; }; R.fullfill = (function() { var tokenRegex = /\{([^\}]+)\}/g, objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches .xxxxx or ["xxxxx"] to run over object properties replacer = function(all, key, obj) { var res = obj; key.replace(objNotationRegex, function(all, name, quote, quotedName, isFunc) { name = name || quotedName; if (res) { if (name in res) { res = res[name]; } typeof res == "function" && isFunc && (res = res()); } }); res = (res == null || res == obj ? all : res) + ""; return res; }; return function(str, obj) { return String(str).replace(tokenRegex, function(all, key) { return replacer(all, key, obj); }); }; })(); R.ninja = function() { oldRaphael.was ? (g.win.Raphael = oldRaphael.is) : delete Raphael; return R; }; R.st = setproto; // Firefox <3.6 fix: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html (function(doc, loaded, f) { if (doc.readyState == null && doc.addEventListener) { doc.addEventListener(loaded, f = function() { doc.removeEventListener(loaded, f, false); doc.readyState = "complete"; }, false); doc.readyState = "loading"; } function isLoaded() { (/in/).test(doc.readyState) ? setTimeout(isLoaded, 9) : R.eve("raphael.DOMload"); } isLoaded(); })(document, "DOMContentLoaded"); oldRaphael.was ? (g.win.Raphael = R) : (Raphael = R); eve.on("raphael.DOMload", function() { loaded = true; }); })(); // ┌─────────────────────────────────────────────────────────────────────┐ \\ // │ Raphaël - JavaScript Vector Library │ \\ // ├─────────────────────────────────────────────────────────────────────┤ \\ // │ SVG Module │ \\ // ├─────────────────────────────────────────────────────────────────────┤ \\ // │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\ // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\ // └─────────────────────────────────────────────────────────────────────┘ \\ window.Raphael.svg && function(R) { var has = "hasOwnProperty", Str = String, toFloat = parseFloat, toInt = parseInt, math = Math, mmax = math.max, abs = math.abs, pow = math.pow, separator = /[, ]+/, eve = R.eve, E = "", S = " "; var xlink = "http://www.w3.org/1999/xlink", markers = { block: "M5,0 0,2.5 5,5z", classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z", diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z", open: "M6,1 1,3.5 6,6", oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z" }, markerCounter = {}; R.toString = function() { return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version; }; var $ = function(el, attr) { if (attr) { if (typeof el == "string") { el = $(el); } for (var key in attr) if (attr[has](key)) { if (key.substring(0, 6) == "xlink:") { el.setAttributeNS(xlink, key.substring(6), Str(attr[key])); } else { el.setAttribute(key, Str(attr[key])); } } } else { el = R._g.doc.createElementNS("http://www.w3.org/2000/svg", el); el.style && (el.style.webkitTapHighlightColor = "rgba(0,0,0,0)"); } return el; }, addGradientFill = function(element, gradient) { var type = "linear", id = element.id + gradient, fx = .5, fy = .5, o = element.node, SVG = element.paper, s = o.style, el = R._g.doc.getElementById(id); if (!el) { gradient = Str(gradient).replace(R._radial_gradient, function(all, _fx, _fy) { type = "radial"; if (_fx && _fy) { fx = toFloat(_fx); fy = toFloat(_fy); var dir = ((fy > .5) * 2 - 1); pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) && fy != .5 && (fy = fy.toFixed(5) - 1e-5 * dir); } return E; }); gradient = gradient.split(/\s*\-\s*/); if (type == "linear") { var angle = gradient.shift(); angle = -toFloat(angle); if (isNaN(angle)) { return null; } var vector = [0, 0, math.cos(R.rad(angle)), math.sin(R.rad(angle))], max = 1 / (mmax(abs(vector[2]), abs(vector[3])) || 1); vector[2] *= max; vector[3] *= max; if (vector[2] < 0) { vector[0] = -vector[2]; vector[2] = 0; } if (vector[3] < 0) { vector[1] = -vector[3]; vector[3] = 0; } } var dots = R._parseDots(gradient); if (!dots) { return null; } id = id.replace(/[\(\)\s,\xb0#]/g, "_"); if (element.gradient && id != element.gradient.id) { SVG.defs.removeChild(element.gradient); delete element.gradient; } if (!element.gradient) { el = $(type + "Gradient", { id: id }); element.gradient = el; $(el, type == "radial" ? { fx: fx, fy: fy } : { x1: vector[0], y1: vector[1], x2: vector[2], y2: vector[3], gradientTransform: element.matrix.invert() }); SVG.defs.appendChild(el); for (var i = 0, ii = dots.length; i < ii; i++) { el.appendChild($("stop", { offset: dots[i].offset ? dots[i].offset : i ? "100%" : "0%", "stop-color": dots[i].color || "#fff" })); } } } $(o, { fill: "url(#" + id + ")", opacity: 1, "fill-opacity": 1 }); s.fill = E; s.opacity = 1; s.fillOpacity = 1; return 1; }, updatePosition = function(o) { var bbox = o.getBBox(1); $(o.pattern, { patternTransform: o.matrix.invert() + " translate(" + bbox.x + "," + bbox.y + ")" }); }, addArrow = function(o, value, isEnd) { if (o.type == "path") { var values = Str(value).toLowerCase().split("-"), p = o.paper, se = isEnd ? "end" : "start", node = o.node, attrs = o.attrs, stroke = attrs["stroke-width"], i = values.length, type = "classic", from, to, dx, refX, attr, w = 3, h = 3, t = 5; while (i--) { switch (values[i]) { case "block": case "classic": case "oval": case "diamond": case "open": case "none": type = values[i]; break; case "wide": h = 5; break; case "narrow": h = 2; break; case "long": w = 5; break; case "short": w = 2; break; } } if (type == "open") { w += 2; h += 2; t += 2; dx = 1; refX = isEnd ? 4 : 1; attr = { fill: "none", stroke: attrs.stroke }; } else { refX = dx = w / 2; attr = { fill: attrs.stroke, stroke: "none" }; } if (o._.arrows) { if (isEnd) { o._.arrows.endPath && markerCounter[o._.arrows.endPath]--; o._.arrows.endMarker && markerCounter[o._.arrows.endMarker]--; } else { o._.arrows.startPath && markerCounter[o._.arrows.startPath]--; o._.arrows.startMarker && markerCounter[o._.arrows.startMarker]--; } } else { o._.arrows = {}; } if (type != "none") { var pathId = "raphael-marker-" + type, markerId = "raphael-marker-" + se + type + w + h; if (!R._g.doc.getElementById(pathId)) { p.defs.appendChild($($("path"), { "stroke-linecap": "round", d: markers[type], id: pathId })); markerCounter[pathId] = 1; } else { markerCounter[pathId]++; } var marker = R._g.doc.getElementById(markerId), use; if (!marker) { marker = $($("marker"), { id: markerId, markerHeight: h, markerWidth: w, orient: "auto", refX: refX, refY: h / 2 }); use = $($("use"), { "xlink:href": "#" + pathId, transform: (isEnd ? "rotate(180 " + w / 2 + " " + h / 2 + ") " : E) + "scale(" + w / t + "," + h / t + ")", "stroke-width": (1 / ((w / t + h / t) / 2)).toFixed(4) }); marker.appendChild(use); p.defs.appendChild(marker); markerCounter[markerId] = 1; } else { markerCounter[markerId]++; use = marker.getElementsByTagName("use")[0]; } $(use, attr); var delta = dx * (type != "diamond" && type != "oval"); if (isEnd) { from = o._.arrows.startdx * stroke || 0; to = R.getTotalLength(attrs.path) - delta * stroke; } else { from = delta * stroke; to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0); } attr = {}; attr["marker-" + se] = "url(#" + markerId + ")"; if (to || from) { attr.d = Raphael.getSubpath(attrs.path, from, to); } $(node, attr); o._.arrows[se + "Path"] = pathId; o._.arrows[se + "Marker"] = markerId; o._.arrows[se + "dx"] = delta; o._.arrows[se + "Type"] = type; o._.arrows[se + "String"] = value; } else { if (isEnd) { from = o._.arrows.startdx * stroke || 0; to = R.getTotalLength(attrs.path) - from; } else { from = 0; to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0); } o._.arrows[se + "Path"] && $(node, { d: Raphael.getSubpath(attrs.path, from, to) }); delete o._.arrows[se + "Path"]; delete o._.arrows[se + "Marker"]; delete o._.arrows[se + "dx"]; delete o._.arrows[se + "Type"]; delete o._.arrows[se + "String"]; } for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) { var item = R._g.doc.getElementById(attr); item && item.parentNode.removeChild(item); } } }, dasharray = { "": [0], "none": [0], "-": [3, 1], ".": [1, 1], "-.": [3, 1, 1, 1], "-..": [3, 1, 1, 1, 1, 1], ". ": [1, 3], "- ": [4, 3], "--": [8, 3], "- .": [4, 3, 1, 3], "--.": [8, 3, 1, 3], "--..": [8, 3, 1, 3, 1, 3] }, addDashes = function(o, value, params) { value = dasharray[Str(value).toLowerCase()]; if (value) { var width = o.attrs["stroke-width"] || "1", butt = { round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0, dashes = [], i = value.length; while (i--) { dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt; } $(o.node, { "stroke-dasharray": dashes.join(",") }); } }, setFillAndStroke = function(o, params) { var node = o.node, attrs = o.attrs, vis = node.style.visibility; node.style.visibility = "hidden"; for (var att in params) { if (params[has](att)) { if (!R._availableAttrs[has](att)) { continue; } var value = params[att]; attrs[att] = value; switch (att) { case "blur": o.blur(value); break; case "href": case "title": case "target": var pn = node.parentNode; if (pn.tagName.toLowerCase() != "a") { var hl = $("a"); pn.insertBefore(hl, node); hl.appendChild(node); pn = hl; } if (att == "target") { pn.setAttributeNS(xlink, "show", value == "blank" ? "new" : value); } else { pn.setAttributeNS(xlink, att, value); } break; case "cursor": node.style.cursor = value; break; case "transform": o.transform(value); break; case "arrow-start": addArrow(o, value); break; case "arrow-end": addArrow(o, value, 1); break; case "clip-rect": var rect = Str(value).split(separator); if (rect.length == 4) { o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode); var el = $("clipPath"), rc = $("rect"); el.id = R.createUUID(); $(rc, { x: rect[0], y: rect[1], width: rect[2], height: rect[3] }); el.appendChild(rc); o.paper.defs.appendChild(el); $(node, { "clip-path": "url(#" + el.id + ")" }); o.clip = rc; } if (!value) { var path = node.getAttribute("clip-path"); if (path) { var clip = R._g.doc.getElementById(path.replace(/(^url\(#|\)$)/g, E)); clip && clip.parentNode.removeChild(clip); $(node, { "clip-path": E }); delete o.clip; } } break; case "path": if (o.type == "path") { $(node, { d: value ? attrs.path = R._pathToAbsolute(value) : "M0,0" }); o._.dirty = 1; if (o._.arrows) { "startString" in o._.arrows && addArrow(o, o._.arrows.startString); "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); } } break; case "width": node.setAttribute(att, value); o._.dirty = 1; if (attrs.fx) { att = "x"; value = attrs.x; } else { break; } case "x": if (attrs.fx) { value = -attrs.x - (attrs.width || 0); } case "rx": if (att == "rx" && o.type == "rect") { break; } case "cx": node.setAttribute(att, value); o.pattern && updatePosition(o); o._.dirty = 1; break; case "height": node.setAttribute(att, value); o._.dirty = 1; if (attrs.fy) { att = "y"; value = attrs.y; } else { break; } case "y": if (attrs.fy) { value = -attrs.y - (attrs.height || 0); } case "ry": if (att == "ry" && o.type == "rect") { break; } case "cy": node.setAttribute(att, value); o.pattern && updatePosition(o); o._.dirty = 1; break; case "r": if (o.type == "rect") { $(node, { rx: value, ry: value }); } else { node.setAttribute(att, value); } o._.dirty = 1; break; case "src": if (o.type == "image") { node.setAttributeNS(xlink, "href", value); } break; case "stroke-width": if (o._.sx != 1 || o._.sy != 1) { value /= mmax(abs(o._.sx), abs(o._.sy)) || 1; } if (o.paper._vbSize) { value *= o.paper._vbSize; } node.setAttribute(att, value); if (attrs["stroke-dasharray"]) { addDashes(o, attrs["stroke-dasharray"], params); } if (o._.arrows) { "startString" in o._.arrows && addArrow(o, o._.arrows.startString); "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); } break; case "stroke-dasharray": addDashes(o, value, params); break; case "fill": var isURL = Str(value).match(R._ISURL); if (isURL) { el = $("pattern"); var ig = $("image"); el.id = R.createUUID(); $(el, { x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1 }); $(ig, { x: 0, y: 0, "xlink:href": isURL[1] }); el.appendChild(ig); (function(el) { R._preload(isURL[1], function() { var w = this.offsetWidth, h = this.offsetHeight; $(el, { width: w, height: h }); $(ig, { width: w, height: h }); o.paper.safari(); }); })(el); o.paper.defs.appendChild(el); $(node, { fill: "url(#" + el.id + ")" }); o.pattern = el; o.pattern && updatePosition(o); break; } var clr = R.getRGB(value); if (!clr.error) { delete params.gradient; delete attrs.gradient; !R.is(attrs.opacity, "undefined") && R.is(params.opacity, "undefined") && $(node, { opacity: attrs.opacity }); !R.is(attrs["fill-opacity"], "undefined") && R.is(params["fill-opacity"], "undefined") && $(node, { "fill-opacity": attrs["fill-opacity"] }); } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) { if ("opacity" in attrs || "fill-opacity" in attrs) { var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); if (gradient) { var stops = gradient.getElementsByTagName("stop"); $(stops[stops.length - 1], { "stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1) }); } } attrs.gradient = value; attrs.fill = "none"; break; } clr[has]("opacity") && $(node, { "fill-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity }); case "stroke": clr = R.getRGB(value); node.setAttribute(att, clr.hex); att == "stroke" && clr[has]("opacity") && $(node, { "stroke-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity }); if (att == "stroke" && o._.arrows) { "startString" in o._.arrows && addArrow(o, o._.arrows.startString); "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); } break; case "gradient": (o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value); break; case "opacity": if (attrs.gradient && !attrs[has]("stroke-opacity")) { $(node, { "stroke-opacity": value > 1 ? value / 100 : value }); } // fall case "fill-opacity": if (attrs.gradient) { gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); if (gradient) { stops = gradient.getElementsByTagName("stop"); $(stops[stops.length - 1], { "stop-opacity": value }); } break; } default: att == "font-size" && (value = toInt(value, 10) + "px"); var cssrule = att.replace(/(\-.)/g, function(w) { return w.substring(1).toUpperCase(); }); node.style[cssrule] = value; o._.dirty = 1; node.setAttribute(att, value); break; } } } tuneText(o, params); node.style.visibility = vis; }, leading = 1.2, tuneText = function(el, params) { if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) { return; } var a = el.attrs, node = el.node, fontSize = node.firstChild ? toInt(R._g.doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10; if (params[has]("text")) { a.text = params.text; while (node.firstChild) { node.removeChild(node.firstChild); } var texts = Str(params.text).split("\n"), tspans = [], tspan; for (var i = 0, ii = texts.length; i < ii; i++) { tspan = $("tspan"); i && $(tspan, { dy: fontSize * leading, x: a.x }); tspan.appendChild(R._g.doc.createTextNode(texts[i])); node.appendChild(tspan); tspans[i] = tspan; } } else { tspans = node.getElementsByTagName("tspan"); for (i = 0, ii = tspans.length; i < ii; i++) if (i) { $(tspans[i], { dy: fontSize * leading, x: a.x }); } else { $(tspans[0], { dy: 0 }); } } $(node, { x: a.x, y: a.y }); el._.dirty = 1; var bb = el._getBBox(), dif = a.y - (bb.y + bb.height / 2); dif && R.is(dif, "finite") && $(tspans[0], { dy: dif }); }, Element = function(node, svg) { var X = 0, Y = 0; this[0] = this.node = node; node.raphael = true; this.id = R._oid++; node.raphaelid = this.id; this.matrix = R.matrix(); this.realPath = null; this.paper = svg; this.attrs = this.attrs || {}; this._ = { transform: [], sx: 1, sy: 1, deg: 0, dx: 0, dy: 0, dirty: 1 }; !svg.bottom && (svg.bottom = this); this.prev = svg.top; svg.top && (svg.top.next = this); svg.top = this; this.next = null; }, elproto = R.el; Element.prototype = elproto; elproto.constructor = Element; R._engine.path = function(pathString, SVG) { var el = $("path"); SVG.canvas && SVG.canvas.appendChild(el); var p = new Element(el, SVG); p.type = "path"; setFillAndStroke(p, { fill: "none", stroke: "#000", path: pathString }); return p; }; elproto.rotate = function(deg, cx, cy) { if (this.removed) { return this; } deg = Str(deg).split(separator); if (deg.length - 1) { cx = toFloat(deg[1]); cy = toFloat(deg[2]); } deg = toFloat(deg[0]); (cy == null) && (cx = cy); if (cx == null || cy == null) { var bbox = this.getBBox(1); cx = bbox.x + bbox.width / 2; cy = bbox.y + bbox.height / 2; } this.transform(this._.transform.concat([["r", deg, cx, cy]])); return this; }; elproto.scale = function(sx, sy, cx, cy) { if (this.removed) { return this; } sx = Str(sx).split(separator); if (sx.length - 1) { sy = toFloat(sx[1]); cx = toFloat(sx[2]); cy = toFloat(sx[3]); } sx = toFloat(sx[0]); (sy == null) && (sy = sx); (cy == null) && (cx = cy); if (cx == null || cy == null) { var bbox = this.getBBox(1); } cx = cx == null ? bbox.x + bbox.width / 2 : cx; cy = cy == null ? bbox.y + bbox.height / 2 : cy; this.transform(this._.transform.concat([["s", sx, sy, cx, cy]])); return this; }; elproto.translate = function(dx, dy) { if (this.removed) { return this; } dx = Str(dx).split(separator); if (dx.length - 1) { dy = toFloat(dx[1]); } dx = toFloat(dx[0]) || 0; dy = +dy || 0; this.transform(this._.transform.concat([["t", dx, dy]])); return this; }; elproto.transform = function(tstr) { var _ = this._; if (tstr == null) { return _.transform; } R._extractTransform(this, tstr); this.clip && $(this.clip, { transform: this.matrix.invert() }); this.pattern && updatePosition(this); this.node && $(this.node, { transform: this.matrix }); if (_.sx != 1 || _.sy != 1) { var sw = this.attrs[has]("stroke-width") ? this.attrs["stroke-width"] : 1; this.attr({ "stroke-width": sw }); } return this; }; elproto.hide = function() { !this.removed && this.paper.safari(this.node.style.display = "none"); return this; }; elproto.show = function() { !this.removed && this.paper.safari(this.node.style.display = ""); return this; }; elproto.remove = function() { if (this.removed || !this.node.parentNode) { return; } var paper = this.paper; paper.__set__ && paper.__set__.exclude(this); eve.unbind("raphael.*.*." + this.id); if (this.gradient) { paper.defs.removeChild(this.gradient); } R._tear(this, paper); if (this.node.parentNode.tagName.toLowerCase() == "a") { this.node.parentNode.parentNode.removeChild(this.node.parentNode); } else { this.node.parentNode.removeChild(this.node); } for (var i in this) { this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; } this.removed = true; }; elproto._getBBox = function() { if (this.node.style.display == "none") { this.show(); var hide = true; } var bbox = {}; try { bbox = this.node.getBBox(); } catch (e) { // Firefox 3.0.x plays badly here } finally { bbox = bbox || {}; } hide && this.hide(); return bbox; }; elproto.attr = function(name, value) { if (this.removed) { return this; } if (name == null) { var res = {}; for (var a in this.attrs) if (this.attrs[has](a)) { res[a] = this.attrs[a]; } res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient; res.transform = this._.transform; return res; } if (value == null && R.is(name, "string")) { if (name == "fill" && this.attrs.fill == "none" && this.attrs.gradient) { return this.attrs.gradient; } if (name == "transform") { return this._.transform; } var names = name.split(separator), out = {}; for (var i = 0, ii = names.length; i < ii; i++) { name = names[i]; if (name in this.attrs) { out[name] = this.attrs[name]; } else if (R.is(this.paper.customAttributes[name], "function")) { out[name] = this.paper.customAttributes[name].def; } else { out[name] = R._availableAttrs[name]; } } return ii - 1 ? out : out[names[0]]; } if (value == null && R.is(name, "array")) { out = {}; for (i = 0, ii = name.length; i < ii; i++) { out[name[i]] = this.attr(name[i]); } return out; } if (value != null) { var params = {}; params[name] = value; } else if (name != null && R.is(name, "object")) { params = name; } for (var key in params) { eve("raphael.attr." + key + "." + this.id, this, params[key]); } for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) { var par = this.paper.customAttributes[key].apply(this, [].concat(params[key])); this.attrs[key] = params[key]; for (var subkey in par) if (par[has](subkey)) { params[subkey] = par[subkey]; } } setFillAndStroke(this, params); return this; }; elproto.toFront = function() { if (this.removed) { return this; } if (this.node.parentNode.tagName.toLowerCase() == "a") { this.node.parentNode.parentNode.appendChild(this.node.parentNode); } else { this.node.parentNode.appendChild(this.node); } var svg = this.paper; svg.top != this && R._tofront(this, svg); return this; }; elproto.toBack = function() { if (this.removed) { return this; } var parent = this.node.parentNode; if (parent.tagName.toLowerCase() == "a") { parent.parentNode.insertBefore(this.node.parentNode, this.node.parentNode.parentNode.firstChild); } else if (parent.firstChild != this.node) { parent.insertBefore(this.node, this.node.parentNode.firstChild); } R._toback(this, this.paper); var svg = this.paper; return this; }; elproto.insertAfter = function(element) { if (this.removed) { return this; } var node = element.node || element[element.length - 1].node; if (node.nextSibling) { node.parentNode.insertBefore(this.node, node.nextSibling); } else { node.parentNode.appendChild(this.node); } R._insertafter(this, element, this.paper); return this; }; elproto.insertBefore = function(element) { if (this.removed) { return this; } var node = element.node || element[0].node; node.parentNode.insertBefore(this.node, node); R._insertbefore(this, element, this.paper); return this; }; elproto.blur = function(size) { // Experimental. No Safari support. Use it on your own risk. var t = this; if (+size !== 0) { var fltr = $("filter"), blur = $("feGaussianBlur"); t.attrs.blur = size; fltr.id = R.createUUID(); $(blur, { stdDeviation: +size || 1.5 }); fltr.appendChild(blur); t.paper.defs.appendChild(fltr); t._blur = fltr; $(t.node, { filter: "url(#" + fltr.id + ")" }); } else { if (t._blur) { t._blur.parentNode.removeChild(t._blur); delete t._blur; delete t.attrs.blur; } t.node.removeAttribute("filter"); } }; R._engine.circle = function(svg, x, y, r) { var el = $("circle"); svg.canvas && svg.canvas.appendChild(el); var res = new Element(el, svg); res.attrs = { cx: x, cy: y, r: r, fill: "none", stroke: "#000" }; res.type = "circle"; $(el, res.attrs); return res; }; R._engine.rect = function(svg, x, y, w, h, r) { var el = $("rect"); svg.canvas && svg.canvas.appendChild(el); var res = new Element(el, svg); res.attrs = { x: x, y: y, width: w, height: h, r: r || 0, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000" }; res.type = "rect"; $(el, res.attrs); return res; }; R._engine.ellipse = function(svg, x, y, rx, ry) { var el = $("ellipse"); svg.canvas && svg.canvas.appendChild(el); var res = new Element(el, svg); res.attrs = { cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000" }; res.type = "ellipse"; $(el, res.attrs); return res; }; R._engine.image = function(svg, src, x, y, w, h) { var el = $("image"); $(el, { x: x, y: y, width: w, height: h, preserveAspectRatio: "none" }); el.setAttributeNS(xlink, "href", src); svg.canvas && svg.canvas.appendChild(el); var res = new Element(el, svg); res.attrs = { x: x, y: y, width: w, height: h, src: src }; res.type = "image"; return res; }; R._engine.text = function(svg, x, y, text) { var el = $("text"); svg.canvas && svg.canvas.appendChild(el); var res = new Element(el, svg); res.attrs = { x: x, y: y, "text-anchor": "middle", text: text, font: R._availableAttrs.font, stroke: "none", fill: "#000" }; res.type = "text"; setFillAndStroke(res, res.attrs); return res; }; R._engine.setSize = function(width, height) { this.width = width || this.width; this.height = height || this.height; this.canvas.setAttribute("width", this.width); this.canvas.setAttribute("height", this.height); if (this._viewBox) { this.setViewBox.apply(this, this._viewBox); } return this; }; R._engine.create = function() { var con = R._getContainer.apply(0, arguments), container = con && con.container, x = con.x, y = con.y, width = con.width, height = con.height; if (!container) { throw new Error("SVG container not found."); } var cnvs = $("svg"), css = "overflow:hidden;", isFloating; x = x || 0; y = y || 0; width = width || 512; height = height || 342; $(cnvs, { height: height, version: 1.1, width: width, xmlns: "http://www.w3.org/2000/svg" }); if (container == 1) { cnvs.style.cssText = css + "position:absolute;left:" + x + "px;top:" + y + "px"; R._g.doc.body.appendChild(cnvs); isFloating = 1; } else { cnvs.style.cssText = css + "position:relative"; if (container.firstChild) { container.insertBefore(cnvs, container.firstChild); } else { container.appendChild(cnvs); } } container = new R._Paper; container.width = width; container.height = height; container.canvas = cnvs; container.clear(); container._left = container._top = 0; isFloating && (container.renderfix = function() { }); container.renderfix(); return container; }; R._engine.setViewBox = function(x, y, w, h, fit) { eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]); var size = mmax(w / this.width, h / this.height), top = this.top, aspectRatio = fit ? "meet" : "xMinYMin", vb, sw; if (x == null) { if (this._vbSize) { size = 1; } delete this._vbSize; vb = "0 0 " + this.width + S + this.height; } else { this._vbSize = size; vb = x + S + y + S + w + S + h; } $(this.canvas, { viewBox: vb, preserveAspectRatio: aspectRatio }); while (size && top) { sw = "stroke-width" in top.attrs ? top.attrs["stroke-width"] : 1; top.attr({ "stroke-width": sw }); top._.dirty = 1; top._.dirtyT = 1; top = top.prev; } this._viewBox = [x, y, w, h, !!fit]; return this; }; R.prototype.renderfix = function() { var cnvs = this.canvas, s = cnvs.style, pos; try { pos = cnvs.getScreenCTM() || cnvs.createSVGMatrix(); } catch (e) { pos = cnvs.createSVGMatrix(); } var left = -pos.e % 1, top = -pos.f % 1; if (left || top) { if (left) { this._left = (this._left + left) % 1; s.left = this._left + "px"; } if (top) { this._top = (this._top + top) % 1; s.top = this._top + "px"; } } }; R.prototype.clear = function() { R.eve("raphael.clear", this); var c = this.canvas; while (c.firstChild) { c.removeChild(c.firstChild); } this.bottom = this.top = null; (this.desc = $("desc")).appendChild(R._g.doc.createTextNode("Created with Rapha\xebl " + R.version)); c.appendChild(this.desc); c.appendChild(this.defs = $("defs")); }; R.prototype.remove = function() { eve("raphael.remove", this); this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas); for (var i in this) { this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; } }; var setproto = R.st; for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) { setproto[method] = (function(methodname) { return function() { var arg = arguments; return this.forEach(function(el) { el[methodname].apply(el, arg); }); }; })(method); } } (window.Raphael); // ┌─────────────────────────────────────────────────────────────────────┐ \\ // │ Raphaël - JavaScript Vector Library │ \\ // ├─────────────────────────────────────────────────────────────────────┤ \\ // │ VML Module │ \\ // ├─────────────────────────────────────────────────────────────────────┤ \\ // │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ // │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\ // │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\ // └─────────────────────────────────────────────────────────────────────┘ \\ window.Raphael.vml && function(R) { var has = "hasOwnProperty", Str = String, toFloat = parseFloat, math = Math, round = math.round, mmax = math.max, mmin = math.min, abs = math.abs, fillString = "fill", separator = /[, ]+/, eve = R.eve, ms = " progid:DXImageTransform.Microsoft", S = " ", E = "", map = { M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x" }, bites = /([clmz]),?([^clmz]*)/gi, blurregexp = / progid:\S+Blur\([^\)]+\)/g, val = /-?[^,\s-]+/g, cssDot = "position:absolute;left:0;top:0;width:1px;height:1px", zoom = 21600, pathTypes = { path: 1, rect: 1, image: 1 }, ovalTypes = { circle: 1, ellipse: 1 }, path2vml = function(path) { var total = /[ahqstv]/ig, command = R._pathToAbsolute; Str(path).match(total) && (command = R._path2curve); total = /[clmz]/g; if (command == R._pathToAbsolute && !Str(path).match(total)) { var res = Str(path).replace(bites, function(all, command, args) { var vals = [], isMove = command.toLowerCase() == "m", res = map[command]; args.replace(val, function(value) { if (isMove && vals.length == 2) { res += vals + map[command == "m" ? "l" : "L"]; vals = []; } vals.push(round(value * zoom)); }); return res + vals; }); return res; } var pa = command(path), p, r; res = []; for (var i = 0, ii = pa.length; i < ii; i++) { p = pa[i]; r = pa[i][0].toLowerCase(); r == "z" && (r = "x"); for (var j = 1, jj = p.length; j < jj; j++) { r += round(p[j] * zoom) + (j != jj - 1 ? "," : E); } res.push(r); } return res.join(S); }, compensation = function(deg, dx, dy) { var m = R.matrix(); m.rotate(-deg, .5, .5); return { dx: m.x(dx, dy), dy: m.y(dx, dy) }; }, setCoords = function(p, sx, sy, dx, dy, deg) { var _ = p._, m = p.matrix, fillpos = _.fillpos, o = p.node, s = o.style, y = 1, flip = "", dxdy, kx = zoom / sx, ky = zoom / sy; s.visibility = "hidden"; if (!sx || !sy) { return; } o.coordsize = abs(kx) + S + abs(ky); s.rotation = deg * (sx * sy < 0 ? -1 : 1); if (deg) { var c = compensation(deg, dx, dy); dx = c.dx; dy = c.dy; } sx < 0 && (flip += "x"); sy < 0 && (flip += " y") && (y = -1); s.flip = flip; o.coordorigin = (dx * -kx) + S + (dy * -ky); if (fillpos || _.fillsize) { var fill = o.getElementsByTagName(fillString); fill = fill && fill[0]; o.removeChild(fill); if (fillpos) { c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1])); fill.position = c.dx * y + S + c.dy * y; } if (_.fillsize) { fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy); } o.appendChild(fill); } s.visibility = "visible"; }; R.toString = function() { return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version; }; var addArrow = function(o, value, isEnd) { var values = Str(value).toLowerCase().split("-"), se = isEnd ? "end" : "start", i = values.length, type = "classic", w = "medium", h = "medium"; while (i--) { switch (values[i]) { case "block": case "classic": case "oval": case "diamond": case "open": case "none": type = values[i]; break; case "wide": case "narrow": h = values[i]; break; case "long": case "short": w = values[i]; break; } } var stroke = o.node.getElementsByTagName("stroke")[0]; stroke[se + "arrow"] = type; stroke[se + "arrowlength"] = w; stroke[se + "arrowwidth"] = h; }, setFillAndStroke = function(o, params) { // o.paper.canvas.style.display = "none"; o.attrs = o.attrs || {}; var node = o.node, a = o.attrs, s = node.style, xy, newpath = pathTypes[o.type] && (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.cx != a.cx || params.cy != a.cy || params.rx != a.rx || params.ry != a.ry || params.r != a.r), isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry), res = o; for (var par in params) if (params[has](par)) { a[par] = params[par]; } if (newpath) { a.path = R._getPath[o.type](o); o._.dirty = 1; } params.href && (node.href = params.href); params.title && (node.title = params.title); params.target && (node.target = params.target); params.cursor && (s.cursor = params.cursor); "blur" in params && o.blur(params.blur); if (params.path && o.type == "path" || newpath) { node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path); if (o.type == "image") { o._.fillpos = [a.x, a.y]; o._.fillsize = [a.width, a.height]; setCoords(o, 1, 1, 0, 0, 0); } } "transform" in params && o.transform(params.transform); if (isOval) { var cx = +a.cx, cy = +a.cy, rx = +a.rx || +a.r || 0, ry = +a.ry || +a.r || 0; node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom)); } if ("clip-rect" in params) { var rect = Str(params["clip-rect"]).split(separator); if (rect.length == 4) { rect[2] = +rect[2] + (+rect[0]); rect[3] = +rect[3] + (+rect[1]); var div = node.clipRect || R._g.doc.createElement("div"), dstyle = div.style; dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect); if (!node.clipRect) { dstyle.position = "absolute"; dstyle.top = 0; dstyle.left = 0; dstyle.width = o.paper.width + "px"; dstyle.height = o.paper.height + "px"; node.parentNode.insertBefore(div, node); div.appendChild(node); node.clipRect = div; } } if (!params["clip-rect"]) { node.clipRect && (node.clipRect.style.clip = "auto"); } } if (o.textpath) { var textpathStyle = o.textpath.style; params.font && (textpathStyle.font = params.font); params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"'); params["font-size"] && (textpathStyle.fontSize = params["font-size"]); params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]); params["font-style"] && (textpathStyle.fontStyle = params["font-style"]); } if ("arrow-start" in params) { addArrow(res, params["arrow-start"]); } if ("arrow-end" in params) { addArrow(res, params["arrow-end"], 1); } if (params.opacity != null || params["stroke-width"] != null || params.fill != null || params.src != null || params.stroke != null || params["stroke-width"] != null || params["stroke-opacity"] != null || params["fill-opacity"] != null || params["stroke-dasharray"] != null || params["stroke-miterlimit"] != null || params["stroke-linejoin"] != null || params["stroke-linecap"] != null) { var fill = node.getElementsByTagName(fillString), newfill = false; fill = fill && fill[0]; !fill && (newfill = fill = createNode(fillString)); if (o.type == "image" && params.src) { fill.src = params.src; } params.fill && (fill.on = true); if (fill.on == null || params.fill == "none" || params.fill === null) { fill.on = false; } if (fill.on && params.fill) { var isURL = Str(params.fill).match(R._ISURL); if (isURL) { fill.parentNode == node && node.removeChild(fill); fill.rotate = true; fill.src = isURL[1]; fill.type = "tile"; var bbox = o.getBBox(1); fill.position = bbox.x + S + bbox.y; o._.fillpos = [bbox.x, bbox.y]; R._preload(isURL[1], function() { o._.fillsize = [this.offsetWidth, this.offsetHeight]; }); } else { fill.color = R.getRGB(params.fill).hex; fill.src = E; fill.type = "solid"; if (R.getRGB(params.fill).error && (res.type in { circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) { a.fill = "none"; a.gradient = params.fill; fill.rotate = false; } } } if ("fill-opacity" in params || "opacity" in params) { var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1); opacity = mmin(mmax(opacity, 0), 1); fill.opacity = opacity; if (fill.src) { fill.color = "none"; } } node.appendChild(fill); var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]), newstroke = false; !stroke && (newstroke = stroke = createNode("stroke")); if ((params.stroke && params.stroke != "none") || params["stroke-width"] || params["stroke-opacity"] != null || params["stroke-dasharray"] || params["stroke-miterlimit"] || params["stroke-linejoin"] || params["stroke-linecap"]) { stroke.on = true; } (params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false); var strokeColor = R.getRGB(params.stroke); stroke.on && params.stroke && (stroke.color = strokeColor.hex); opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1); var width = (toFloat(params["stroke-width"]) || 1) * .75; opacity = mmin(mmax(opacity, 0), 1); params["stroke-width"] == null && (width = a["stroke-width"]); params["stroke-width"] && (stroke.weight = width); width && width < 1 && (opacity *= width) && (stroke.weight = 1); stroke.opacity = opacity; params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter"); stroke.miterlimit = params["stroke-miterlimit"] || 8; params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round"); if (params["stroke-dasharray"]) { var dasharray = { "-": "shortdash", ".": "shortdot", "-.": "shortdashdot", "-..": "shortdashdotdot", ". ": "dot", "- ": "dash", "--": "longdash", "- .": "dashdot", "--.": "longdashdot", "--..": "longdashdotdot" }; stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E; } newstroke && node.appendChild(stroke); } if (res.type == "text") { res.paper.canvas.style.display = E; var span = res.paper.span, m = 100, fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/); s = span.style; a.font && (s.font = a.font); a["font-family"] && (s.fontFamily = a["font-family"]); a["font-weight"] && (s.fontWeight = a["font-weight"]); a["font-style"] && (s.fontStyle = a["font-style"]); fontSize = toFloat(a["font-size"] || fontSize && fontSize[0]) || 10; s.fontSize = fontSize * m + "px"; res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/")); var brect = span.getBoundingClientRect(); res.W = a.w = (brect.right - brect.left) / m; res.H = a.h = (brect.bottom - brect.top) / m; // res.paper.canvas.style.display = "none"; res.X = a.x; res.Y = a.y + res.H / 2; ("x" in params || "y" in params) && (res.path.v = R.format("m{0},{1}l{2},{1}", round(a.x * zoom), round(a.y * zoom), round(a.x * zoom) + 1)); var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"]; for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) { res._.dirty = 1; break; } // text-anchor emulation switch (a["text-anchor"]) { case "start": res.textpath.style["v-text-align"] = "left"; res.bbx = res.W / 2; break; case "end": res.textpath.style["v-text-align"] = "right"; res.bbx = -res.W / 2; break; default: res.textpath.style["v-text-align"] = "center"; res.bbx = 0; break; } res.textpath.style["v-text-kern"] = true; } // res.paper.canvas.style.display = E; }, addGradientFill = function(o, gradient, fill) { o.attrs = o.attrs || {}; var attrs = o.attrs, pow = Math.pow, opacity, oindex, type = "linear", fxfy = ".5 .5"; o.attrs.gradient = gradient; gradient = Str(gradient).replace(R._radial_gradient, function(all, fx, fy) { type = "radial"; if (fx && fy) { fx = toFloat(fx); fy = toFloat(fy); pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5); fxfy = fx + S + fy; } return E; }); gradient = gradient.split(/\s*\-\s*/); if (type == "linear") { var angle = gradient.shift(); angle = -toFloat(angle); if (isNaN(angle)) { return null; } } var dots = R._parseDots(gradient); if (!dots) { return null; } o = o.shape || o.node; if (dots.length) { o.removeChild(fill); fill.on = true; fill.method = "none"; fill.color = dots[0].color; fill.color2 = dots[dots.length - 1].color; var clrs = []; for (var i = 0, ii = dots.length; i < ii; i++) { dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color); } fill.colors = clrs.length ? clrs.join() : "0% " + fill.color; if (type == "radial") { fill.type = "gradientTitle"; fill.focus = "100%"; fill.focussize = "0 0"; fill.focusposition = fxfy; fill.angle = 0; } else { // fill.rotate= true; fill.type = "gradient"; fill.angle = (270 - angle) % 360; } o.appendChild(fill); } return 1; }, Element = function(node, vml) { this[0] = this.node = node; node.raphael = true; this.id = R._oid++; node.raphaelid = this.id; this.X = 0; this.Y = 0; this.attrs = {}; this.paper = vml; this.matrix = R.matrix(); this._ = { transform: [], sx: 1, sy: 1, dx: 0, dy: 0, deg: 0, dirty: 1, dirtyT: 1 }; !vml.bottom && (vml.bottom = this); this.prev = vml.top; vml.top && (vml.top.next = this); vml.top = this; this.next = null; }; var elproto = R.el; Element.prototype = elproto; elproto.constructor = Element; elproto.transform = function(tstr) { if (tstr == null) { return this._.transform; } var vbs = this.paper._viewBoxShift, vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E, oldt; if (vbs) { oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E); } R._extractTransform(this, vbt + tstr); var matrix = this.matrix.clone(), skew = this.skew, o = this.node, split, isGrad = ~Str(this.attrs.fill).indexOf("-"), isPatt = !Str(this.attrs.fill).indexOf("url("); matrix.translate(-.5, -.5); if (isPatt || isGrad || this.type == "image") { skew.matrix = "1 0 0 1"; skew.offset = "0 0"; split = matrix.split(); if ((isGrad && split.noRotation) || !split.isSimple) { o.style.filter = matrix.toFilter(); var bb = this.getBBox(), bbt = this.getBBox(1), dx = bb.x - bbt.x, dy = bb.y - bbt.y; o.coordorigin = (dx * -zoom) + S + (dy * -zoom); setCoords(this, 1, 1, dx, dy, 0); } else { o.style.filter = E; setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate); } } else { o.style.filter = E; skew.matrix = Str(matrix); skew.offset = matrix.offset(); } oldt && (this._.transform = oldt); return this; }; elproto.rotate = function(deg, cx, cy) { if (this.removed) { return this; } if (deg == null) { return; } deg = Str(deg).split(separator); if (deg.length - 1) { cx = toFloat(deg[1]); cy = toFloat(deg[2]); } deg = toFloat(deg[0]); (cy == null) && (cx = cy); if (cx == null || cy == null) { var bbox = this.getBBox(1); cx = bbox.x + bbox.width / 2; cy = bbox.y + bbox.height / 2; } this._.dirtyT = 1; this.transform(this._.transform.concat([["r", deg, cx, cy]])); return this; }; elproto.translate = function(dx, dy) { if (this.removed) { return this; } dx = Str(dx).split(separator); if (dx.length - 1) { dy = toFloat(dx[1]); } dx = toFloat(dx[0]) || 0; dy = +dy || 0; if (this._.bbox) { this._.bbox.x += dx; this._.bbox.y += dy; } this.transform(this._.transform.concat([["t", dx, dy]])); return this; }; elproto.scale = function(sx, sy, cx, cy) { if (this.removed) { return this; } sx = Str(sx).split(separator); if (sx.length - 1) { sy = toFloat(sx[1]); cx = toFloat(sx[2]); cy = toFloat(sx[3]); isNaN(cx) && (cx = null); isNaN(cy) && (cy = null); } sx = toFloat(sx[0]); (sy == null) && (sy = sx); (cy == null) && (cx = cy); if (cx == null || cy == null) { var bbox = this.getBBox(1); } cx = cx == null ? bbox.x + bbox.width / 2 : cx; cy = cy == null ? bbox.y + bbox.height / 2 : cy; this.transform(this._.transform.concat([["s", sx, sy, cx, cy]])); this._.dirtyT = 1; return this; }; elproto.hide = function() { !this.removed && (this.node.style.display = "none"); return this; }; elproto.show = function() { !this.removed && (this.node.style.display = E); return this; }; elproto._getBBox = function() { if (this.removed) { return {}; } return { x: this.X + (this.bbx || 0) - this.W / 2, y: this.Y - this.H, width: this.W, height: this.H }; }; elproto.remove = function() { if (this.removed || !this.node.parentNode) { return; } this.paper.__set__ && this.paper.__set__.exclude(this); R.eve.unbind("raphael.*.*." + this.id); R._tear(this, this.paper); this.node.parentNode.removeChild(this.node); this.shape && this.shape.parentNode.removeChild(this.shape); for (var i in this) { this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; } this.removed = true; }; elproto.attr = function(name, value) { if (this.removed) { return this; } if (name == null) { var res = {}; for (var a in this.attrs) if (this.attrs[has](a)) { res[a] = this.attrs[a]; } res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient; res.transform = this._.transform; return res; } if (value == null && R.is(name, "string")) { if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) { return this.attrs.gradient; } var names = name.split(separator), out = {}; for (var i = 0, ii = names.length; i < ii; i++) { name = names[i]; if (name in this.attrs) { out[name] = this.attrs[name]; } else if (R.is(this.paper.customAttributes[name], "function")) { out[name] = this.paper.customAttributes[name].def; } else { out[name] = R._availableAttrs[name]; } } return ii - 1 ? out : out[names[0]]; } if (this.attrs && value == null && R.is(name, "array")) { out = {}; for (i = 0, ii = name.length; i < ii; i++) { out[name[i]] = this.attr(name[i]); } return out; } var params; if (value != null) { params = {}; params[name] = value; } value == null && R.is(name, "object") && (params = name); for (var key in params) { eve("raphael.attr." + key + "." + this.id, this, params[key]); } if (params) { for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) { var par = this.paper.customAttributes[key].apply(this, [].concat(params[key])); this.attrs[key] = params[key]; for (var subkey in par) if (par[has](subkey)) { params[subkey] = par[subkey]; } } // this.paper.canvas.style.display = "none"; if (params.text && this.type == "text") { this.textpath.string = params.text; } setFillAndStroke(this, params); // this.paper.canvas.style.display = E; } return this; }; elproto.toFront = function() { !this.removed && this.node.parentNode.appendChild(this.node); this.paper && this.paper.top != this && R._tofront(this, this.paper); return this; }; elproto.toBack = function() { if (this.removed) { return this; } if (this.node.parentNode.firstChild != this.node) { this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild); R._toback(this, this.paper); } return this; }; elproto.insertAfter = function(element) { if (this.removed) { return this; } if (element.constructor == R.st.constructor) { element = element[element.length - 1]; } if (element.node.nextSibling) { element.node.parentNode.insertBefore(this.node, element.node.nextSibling); } else { element.node.parentNode.appendChild(this.node); } R._insertafter(this, element, this.paper); return this; }; elproto.insertBefore = function(element) { if (this.removed) { return this; } if (element.constructor == R.st.constructor) { element = element[0]; } element.node.parentNode.insertBefore(this.node, element.node); R._insertbefore(this, element, this.paper); return this; }; elproto.blur = function(size) { var s = this.node.runtimeStyle, f = s.filter; f = f.replace(blurregexp, E); if (+size !== 0) { this.attrs.blur = size; s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")"; s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5)); } else { s.filter = f; s.margin = 0; delete this.attrs.blur; } }; R._engine.path = function(pathString, vml) { var el = createNode("shape"); el.style.cssText = cssDot; el.coordsize = zoom + S + zoom; el.coordorigin = vml.coordorigin; var p = new Element(el, vml), attr = { fill: "none", stroke: "#000" }; pathString && (attr.path = pathString); p.type = "path"; p.path = []; p.Path = E; setFillAndStroke(p, attr); vml.canvas.appendChild(el); var skew = createNode("skew"); skew.on = true; el.appendChild(skew); p.skew = skew; p.transform(E); return p; }; R._engine.rect = function(vml, x, y, w, h, r) { var path = R._rectPath(x, y, w, h, r), res = vml.path(path), a = res.attrs; res.X = a.x = x; res.Y = a.y = y; res.W = a.width = w; res.H = a.height = h; a.r = r; a.path = path; res.type = "rect"; return res; }; R._engine.ellipse = function(vml, x, y, rx, ry) { var res = vml.path(), a = res.attrs; res.X = x - rx; res.Y = y - ry; res.W = rx * 2; res.H = ry * 2; res.type = "ellipse"; setFillAndStroke(res, { cx: x, cy: y, rx: rx, ry: ry }); return res; }; R._engine.circle = function(vml, x, y, r) { var res = vml.path(), a = res.attrs; res.X = x - r; res.Y = y - r; res.W = res.H = r * 2; res.type = "circle"; setFillAndStroke(res, { cx: x, cy: y, r: r }); return res; }; R._engine.image = function(vml, src, x, y, w, h) { var path = R._rectPath(x, y, w, h), res = vml.path(path).attr({ stroke: "none" }), a = res.attrs, node = res.node, fill = node.getElementsByTagName(fillString)[0]; a.src = src; res.X = a.x = x; res.Y = a.y = y; res.W = a.width = w; res.H = a.height = h; a.path = path; res.type = "image"; fill.parentNode == node && node.removeChild(fill); fill.rotate = true; fill.src = src; fill.type = "tile"; res._.fillpos = [x, y]; res._.fillsize = [w, h]; node.appendChild(fill); setCoords(res, 1, 1, 0, 0, 0); return res; }; R._engine.text = function(vml, x, y, text) { var el = createNode("shape"), path = createNode("path"), o = createNode("textpath"); x = x || 0; y = y || 0; text = text || ""; path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1); path.textpathok = true; o.string = Str(text); o.on = true; el.style.cssText = cssDot; el.coordsize = zoom + S + zoom; el.coordorigin = "0 0"; var p = new Element(el, vml), attr = { fill: "#000", stroke: "none", font: R._availableAttrs.font, text: text }; p.shape = el; p.path = path; p.textpath = o; p.type = "text"; p.attrs.text = Str(text); p.attrs.x = x; p.attrs.y = y; p.attrs.w = 1; p.attrs.h = 1; setFillAndStroke(p, attr); el.appendChild(o); el.appendChild(path); vml.canvas.appendChild(el); var skew = createNode("skew"); skew.on = true; el.appendChild(skew); p.skew = skew; p.transform(E); return p; }; R._engine.setSize = function(width, height) { var cs = this.canvas.style; this.width = width; this.height = height; width == +width && (width += "px"); height == +height && (height += "px"); cs.width = width; cs.height = height; cs.clip = "rect(0 " + width + " " + height + " 0)"; if (this._viewBox) { R._engine.setViewBox.apply(this, this._viewBox); } return this; }; R._engine.setViewBox = function(x, y, w, h, fit) { R.eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]); var width = this.width, height = this.height, size = 1 / mmax(w / width, h / height), H, W; if (fit) { H = height / h; W = width / w; if (w * H < width) { x -= (width - w * H) / 2 / H; } if (h * W < height) { y -= (height - h * W) / 2 / W; } } this._viewBox = [x, y, w, h, !!fit]; this._viewBoxShift = { dx: -x, dy: -y, scale: size }; this.forEach(function(el) { el.transform("..."); }); return this; }; var createNode; R._engine.initWin = function(win) { var doc = win.document; doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)"); try { !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"); createNode = function(tagName) { return doc.createElement(''); }; } catch (e) { createNode = function(tagName) { return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">'); }; } }; R._engine.initWin(R._g.win); R._engine.create = function() { var con = R._getContainer.apply(0, arguments), container = con.container, height = con.height, s, width = con.width, x = con.x, y = con.y; if (!container) { throw new Error("VML container not found."); } var res = new R._Paper, c = res.canvas = R._g.doc.createElement("div"), cs = c.style; x = x || 0; y = y || 0; width = width || 512; height = height || 342; res.width = width; res.height = height; width == +width && (width += "px"); height == +height && (height += "px"); res.coordsize = zoom * 1e3 + S + zoom * 1e3; res.coordorigin = "0 0"; res.span = R._g.doc.createElement("span"); res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;"; c.appendChild(res.span); cs.cssText = R.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden", width, height); if (container == 1) { R._g.doc.body.appendChild(c); cs.left = x + "px"; cs.top = y + "px"; cs.position = "absolute"; } else { if (container.firstChild) { container.insertBefore(c, container.firstChild); } else { container.appendChild(c); } } res.renderfix = function() { }; return res; }; R.prototype.clear = function() { R.eve("raphael.clear", this); this.canvas.innerHTML = E; this.span = R._g.doc.createElement("span"); this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;"; this.canvas.appendChild(this.span); this.bottom = this.top = null; }; R.prototype.remove = function() { R.eve("raphael.remove", this); this.canvas.parentNode.removeChild(this.canvas); for (var i in this) { this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; } return true; }; var setproto = R.st; for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) { setproto[method] = (function(methodname) { return function() { var arg = arguments; return this.forEach(function(el) { el[methodname].apply(el, arg); }); }; })(method); } } (window.Raphael); /* /end file: E:\tridionweb\doc\_MKG_LEX_V10_INC\main\sys\inc\js\libs\raphael-min.js */