Artisan 4 Sketchup Serial Number __EXCLUSIVE__
Download https://urllio.com/2th452
\"; dwr.engine._ieConditions[cond] = !!(div.getElementsByTagName(\"p\").length); } return dwr.engine._ieConditions[cond]; }, tokenify: function(number) { var tokenbuf = []; var charmap = \"1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ*$\"; var remainder = number; while (remainder > 0) { tokenbuf.push(charmap.charAt(remainder & 0x3F)); remainder = Math.floor(remainder / 64); } return tokenbuf.join(\"\"); }, addEventListener: function(elem, name, func) { if (elem.addEventListener) elem.addEventListener(name, func, false); else elem.attachEvent(\"on\" + name, func); }, isCallOptionArgument: function(lastArg) { return (typeof lastArg === \"object\" && (typeof lastArg.callback === \"function\" typeof lastArg.exceptionHandler === \"function\" typeof lastArg .callbackHandler === \"function\" typeof lastArg.errorHandler === \"function\" typeof lastArg.warningHandler === \"function\" lastArg.hasOwnProperty(\"async\"))); }, logHandlerEx: function(func) { try { func(); } catch (ex) { dwr.engine._debug(\"Exception occured in user-specified handler:\"); dwr.engine._debug(ex); } } }; dwr.engine._initializer.init(); dwr.hub = { publish: function(topicName, data) { dwr.engine._execute(null, '__System', 'publish', topicName, data, {}); }, subscribe: function(topicName, callback, scope, subscriberData) { var subscription = \"\" + dwr.hub._subscriptionId; dwr.hub._subscriptionId++; dwr.hub._subscriptions[subscription] = { callback: callback, scope: scope, subscriberData: subscriberData }; dwr.engine._execute(null, '__System', 'subscribe', topicName, subscription, {}); return subscription; }, _remotePublish: function(subscriptionId, publishData) { var subscriptionData = dwr.hub._subscriptions[subscriptionId]; if (!subscriptionData) return; subscriptionData.callback.call(subscriptionData.scope, publishData, subscriptionData .subscriberData); }, _subscriptionId: 0, _subscriptions: {} }; dwr.data = { StoreChangeListener: { itemRemoved: function(source, itemId) {}, itemAdded: function(source, item) {}, itemChanged: function(source, item, changedAttributes) {} }, Cache: function(storeId, listener) { this.storeId = storeId; this.listener = listener; } }; dwr.data.Cache.prototype.viewRegion = function(region, callbackObj) { if (!region) region = {}; if (!region.start) region.start = 0; if (!region.count) region.count = -1; if (!region.sort) region.sort = []; else { for (var index = 0; index < region.sort.length; index++) { if (typeof region.sort[index].descending == \"undefined\") { region.sort[index].descending = false; } } } if (!region.query) region.query = {}; return dwr.engine._execute(null, '__Data', 'viewRegion', [this.storeId, region, this.listener, callbackObj ]); }; dwr.data.Cache.prototype.viewItem = function(itemId, callbackObj) { return dwr.engine._execute(null, '__Data', 'viewItem', [this.storeId, itemId, this.listener, callbackObj ]); }; dwr.data.Cache.prototype.unsubscribe = function(callbackObj) { if (this.listener) { return dwr.engine._execute(null, '__Data', 'unsubscribe', [this.storeId, this.listener, callbackObj ]); } }; dwr.data.Cache.prototype.update = function(items, callbackObj) { return dwr.engine._execute(null, '__Data', 'update', [this.storeId, items, callbackObj]); }; })(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() { if (dwr.engine._getObject(\"customerSessionAjaxController\") == undefined) { var p; p = {}; p.updateImpactClickId = function(p2, callback) { return dwr.engine._execute(p._path, 'customerSessionAjaxController', 'updateImpactClickId', arguments); }; p.getCustomerSession = function(p2, p3, p4, callback) { return dwr.engine._execute(p._path, 'customerSessionAjaxController', 'getCustomerSession', arguments); }; dwr.engine._setObject(\"customerSessionAjaxController\", p); } })(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() { if (dwr.engine._getObject(\"productAjaxController\") == undefined) { var p; p = {}; p.isAvailable = function(p0, callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'isAvailable', arguments); }; p.getProductsInList = function(p0, p1, p2, callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'getProductsInList', arguments); }; p.getCartQuantity = function(callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'getCartQuantity', arguments); }; p.getProductsInListBatch = function(p0, p1, p2, callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'getProductsInListBatch', arguments); }; p.getKoboReferralUrl = function(p0, callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'getKoboReferralUrl', arguments); }; p.getInsiderRecommendation = function(p0, callback) { return dwr.engine._execute(p._path, 'productAjaxController', 'getInsiderRecommendation', arguments); }; dwr.engine._setObject(\"productAjaxController\", p); } })(); /* * Copyright 2005 Joe Walker * * Licensed under the Apache License, Version 2.0 (the \"License\"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * -2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an \"AS IS\" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ if (typeof dwr == 'undefined') dwr = {};if (!dwr.util) dwr.util = {};dwr.util._escapeHtml = true;dwr.util.setEscapeHtml = function(escapeHtml) {dwr.util._escapeHtml = escapeHtml;};dwr.util._shouldEscapeHtml = function(options) {if (options && options.escapeHtml != null) {return options.escapeHtml;}return dwr.util._escapeHtml;};dwr.util.escapeHtml = function(original) {return original.replace(/&/g,'&').replace(//g,'>').replace(/\"/g,'\"').replace(/'/g,''');};dwr.util.unescapeHtml = function(original) {return original.replace(//g,'>').replace(/\"/g,'\"').replace(/'/g,\"'\").replace(/&/g,'&');};dwr.util.replaceXmlCharacters = function(original) {original = original.replace(\"&\", \"+\");original = original.replace(\"\", \"\\u203A\");original = original.replace(\"\\'\", \"\\u2018\");original = original.replace(\"\\\"\", \"\\u201C\");return original;};dwr.util.containsXssRiskyCharacters = function(original) {return (original.indexOf('&') != -1 original.indexOf('') != -1 original.indexOf('\\'') != -1 original.indexOf('\\\"') != -1);};dwr.util.onReturn = function(event, action) {if (!event) event = window.event;if (event && event.keyCode && event.keyCode == 13) action();};dwr.util.selectRange = function(ele, start, end) {ele = dwr.util._getElementById(ele, \"selectRange()\");if (ele == null) return;if (ele.setSelectionRange) {ele.setSelectionRange(start, end);}else if (ele.createTextRange) {var range = ele.createTextRange();range.moveStart(\"character\", start);range.moveEnd(\"character\", end - ele.value.length);range.select();}ele.focus();};dwr.util.byId = function() {var elems = [];for (var i = 0; i < arguments.length; i++) {var idOrElem = arguments[i];var elem;if (typeof idOrElem == 'string') {var elem = document.getElementById(idOrElem);if (document.all && elem && dwr.util._getId(elem) != idOrElem) {elem = null;var maybeElems = document.all[idOrElem];if (maybeElems.tagName) maybeElems = [maybeElems];for (var j = 0; j < maybeElems.length; j++) {if (dwr.util._getId(maybeElems[j]) == idOrElem) {elem = maybeElems[j];break;}}}}else {elem = idOrElem;}if (arguments.length == 1) {return elem;}elems.push(elem);}return elems;}dwr.util._getId = function(elem) {var elemId = elem.getAttribute(\"id\");if (dwr.util._isObject(elemId)) {elemId = elem.attributes.id.value;}return elemId;};if (typeof $ == 'undefined') {$ = dwr.util.byId;}dwr.util.toDescriptiveString = function(data, showLevels, options) {if (showLevels === undefined) showLevels = 1;var opt = {};if (dwr.util._isObject(options)) opt = options;var defaultoptions = {escapeHtml:false,baseIndent: \"\",childIndent: \"\\u00A0\\u00A0\",lineTerminator: \"\\n\",oneLineMaxItems: 5,shortStringMaxLength: 13,propertyNameMaxLength: 30};for (var p in defaultoptions) {if (!(p in opt)) {opt[p] = defaultoptions[p];}}var skipDomProperties = {document:true, ownerDocument:true,all:true,parentElement:true, parentNode:true, offsetParent:true,children:true, firstChild:true, lastChild:true,previousSibling:true, nextSibling:true,innerHTML:true, outerHTML:true,innerText:true, outerText:true, textContent:true,attributes:true,style:true, currentStyle:true, runtimeStyle:true,parentTextEdit:true};function recursive(data, showLevels, indentDepth, options) {var reply = \"\";try {if (dwr.util._isString(data)) {var str = data;if (showLevels == 0 && str.length > options.shortStringMaxLength)str = str.substring(0, options.shortStringMaxLength-3) + \"...\";if (options.escapeHtml) {var lines = str.split(\"\\n\");for (var i = 0; i < lines.length; i++) lines[i] = dwr.util.escapeHtml(lines[i]);str = lines.join(\"\\n\");}if (showLevels == 0) {str = str.replace(/\\n\\r\\t/g, function(ch) {switch (ch) {case \"\\n\": return \"\\\\n\";case \"\\r\": return \"\";case \"\\t\": return \"\\\\t\";}});}else {str = str.replace(/\\n\\r\\t/g, function(ch) {switch (ch) {case \"\\n\": return options.lineTerminator + indent(indentDepth+1, options);case \"\\r\": return \"\";case \"\\t\": return \"\\\\t\";}});}reply = '\"' + str + '\"';}else if (dwr.util._isFunction(data)) {reply = \"function\";}else if (dwr.util._isArrayLike(data)) {if (showLevels == 0) {if (data.length > 0)reply = \"[...]\";elsereply = \"[]\";}else {var strarr = [];strarr.push(\"[\");var count = 0;for (var i = 0; i < data.length; i++) {if (!(i in data) && data != \"[object NodeList]\") continue;var itemvalue = data[i];if (count > 0) strarr.push(\", \");if (showLevels == 1) {if (count == options.oneLineMaxItems) {strarr.push(\"...\");break;}}else {strarr.push(options.lineTerminator + indent(indentDepth+1, options));}if (i != count) {strarr.push(i);strarr.push(\":\");}strarr.push(recursive(itemvalue, showLevels-1, indentDepth+1, options));count++;}if (showLevels > 1) strarr.push(options.lineTerminator + indent(indentDepth, options));strarr.push(\"]\");reply = strarr.join(\"\");}}else if (dwr.util._isObject(data) && !dwr.util._isDate(data)) {if (showLevels == 0) {reply = dwr.util._detailedTypeOf(data);}else {var strarr = [];if (dwr.util._detailedTypeOf(data) != \"Object\") {strarr.push(dwr.util._detailedTypeOf(data));if (typeof data.valueOf() != \"object\") {strarr.push(\":\");strarr.push(recursive(data.valueOf(), 1, indentDepth, options));}strarr.push(\" \");}strarr.push(\"{\");var isDomObject = dwr.util._isHTMLElement(data);var count = 0;for (var prop in data) {var propvalue = data[prop];if (isDomObject) {if (propvalue == null) continue;if (typeof propvalue == \"function\") continue;if (skipDomProperties[prop]) continue;if (prop.toUpperCase() == prop) continue;}if (count > 0) strarr.push(\", \");if (showLevels == 1) {if (count == options.oneLineMaxItems) {strarr.push(\"...\");break;}}else {strarr.push(options.lineTerminator + indent(indentDepth+1, options));}strarr.push(prop.length > options.propertyNameMaxLength prop.substring(0, options.propertyNameMaxLength-3) + \"...\" : prop);strarr.push(\":\");strarr.push(recursive(propvalue, showLevels-1, indentDepth+1, options));count++;}if (showLevels > 1 && count > 0) strarr.push(options.lineTerminator + indent(indentDepth, options));strarr.push(\"}\");reply = strarr.join(\"\");}}else {reply = \"\" + data;}return reply;}catch(err) {return (err.message err.message : \"\"+err);}}function indent(count, options) {var strarr = [];strarr.push(options.baseIndent);for (var i=0; i= 1) ele = nodes.item(0);}if (ele == null) {dwr.util._debug(\"setValue() can't find an element with id/name: \" + orig + \".\");return;}dwr.util.highlight(ele, options);if (dwr.util._isHTMLElement(ele, \"select\")) {if (ele.type == \"select-multiple\" && dwr.util._isArray(val)) dwr.util._selectListItems(ele, val);else dwr.util._selectListItem(ele, val);return;}if (dwr.util._isHTMLElement(ele, \"input\")) {if (ele.type == \"radio\" ele.type == \"checkbox\") {if (nodes && nodes.length >= 1) {for (var i = 0; i < nodes.length; i++) {var node = nodes.item(i);if (node.type != ele.type) continue;if (dwr.util._isArray(val)) {node.checked = false;for (var j = 0; j < val.length; j++)if (val[j] == node.value) node.checked = true;}else {node.checked = (node.value == val);}}}else {ele.checked = (val == true);}}else ele.value = val;return;}if (dwr.util._isHTMLElement(ele, \"textarea\")) {ele.value = val;return;}if (dwr.util._isHTMLElement(ele, \"img\")) {ele.src = val;return;}if (val.nodeType) {if (val.nodeType == 9 ) val = val.documentElement;val = dwr.util._importNode(ele.ownerDocument, val, true);ele.appendChild(val);return;}if (dwr.util._shouldEscapeHtml(options)) {if (\"textContent\" in ele) ele.textContent = val.toString();else if (\"innerText\" in ele) ele.innerText = val.toString();else ele.innerHTML = dwr.util.escapeHtml(val.toString());}else {ele.innerHTML = val;}};dwr.util._selectListItems = function(ele, val) {var found = 0;var i;var j;for (i = 0; i < ele.options.length; i++) {ele.options[i].selected = false;for (j = 0; j < val.length; j++) {if (ele.options[i].value == val[j]) {ele.options[i].selected = true;found++;}}}if (found == val.length) return;for (i = 0; i < ele.options.length; i++) {for (j = 0; j < val.length; j++) {if (ele.options[i].text == val[j]) {ele.options[i].selected = true;}}}};dwr.util._selectListItem = function(ele, val) {var found = false;var i;for (i = 0; i < ele.options.length; i++) {if (ele.options[i].value == val) {ele.options[i].selected = true;found = true;}else {ele.options[i].selected = false;}}if (found) return;for (i = 0; i < ele.options.length; i++) {ele.options[i].selected = (ele.options[i].text == val);}};dwr.util.getValue = function(ele, options) {if (options == null) options = {};var orig = ele;ele = dwr.util.byId(ele);var nodes = null;if (ele == null) {nodes = document.getElementsByName(orig);if (nodes.length >= 1) ele = nodes.item(0);}if (ele == null) {dwr.util._debug(\"getValue() can't find an element with id/name: \" + orig + \".\");return \"\";}if (dwr.util._isHTMLElement(ele, \"select\")) {if (ele.type == \"select-multiple\") {var reply = new Array();for (var i = 0; i < ele.options.length; i++) {var item = ele.options[i];if (item.selected) {var valueAttr = item.getAttributeNode(\"value\");if (valueAttr && valueAttr.specified) {reply.push(item.value);}else {reply.push(item.text);}}}return reply;}else {var sel = ele.selectedIndex;if (sel != -1) {var item = ele.options[sel];var valueAttr = item.getAttributeNode(\"value\");if (valueAttr && valueAttr.specified) {return item.value;}return item.text;}else {return \"\";}}}if (dwr.util._isHTMLElement(ele, \"input\")) {if (ele.type == \"radio\") {if (nodes && nodes.length >= 1) {for (var i = 0; i < nodes.length; i++) {var node = nodes.item(i);if (node.type == ele.type) {if (node.checked) return node.value;}}}return ele.checked;}if (ele.type == \"checkbox\") {if (nodes && nodes.length >= 1) {var reply = [];for (var i = 0; i < nodes.length; i++) {var node = nodes.item(i);if (node.type == ele.type) {if (node.checked) reply.push(node.value);}}return reply;}return ele.checked;}if (ele.type == \"file\") {return ele;}return ele.value;}if (dwr.util._isHTMLElement(ele, \"textarea\")) {return ele.value;}if (dwr.util._shouldEscapeHtml(options)) {if (\"textContent\" in ele) return ele.textContent;else if (\"innerText\" in ele) return ele.innerText;}return ele.innerHTML;};dwr.util.getText = function(ele) {ele = dwr.util._getElementById(ele, \"getText()\");if (ele == null) return null;if (!dwr.util._isHTMLElement(ele, \"select\")) {dwr.util._debug(\"getText() can only be used with select elements. Attempt to use: \" + dwr.util._detailedTypeOf(ele) + \" from id: \" + orig + \".\");return \"\";}var sel = ele.selectedIndex;if (sel != -1) {return ele.options[sel].text;}else {return \"\";}};dwr.util.setValues = function(data, options) {var prefix = \"\";var depth = 100;if (options && \"prefix\" in options) prefix = options.prefix;if (options && \"idPrefix\" in options) prefix = options.idPrefix;if (options && \"depth\" in options) depth = options.depth;dwr.util._setValuesRecursive(data, prefix, depth, options);};dwr.util._setValuesRecursive = function(data, idpath, depth, options) {if (depth == 0) return;if (dwr.util._isArray(data) && data.length > 0 && dwr.util._isObject(data[0])) {for (var i = 0; i < data.length; i++) {dwr.util._setValuesRecursive(data[i], idpath+\"[\"+i+\"]\", depth-1, options);}}else if (dwr.util._isObject(data) && !dwr.util._isArray(data)) {for (var prop in data) {var subidpath = idpath idpath+\".\"+prop : prop;if (dwr.util._isObject(data[prop]) && !dwr.util._isArray(data[prop]) && !dwr.util._isDate(data[prop]) dwr.util._isArray(data[prop]) && data[prop].length > 0 && dwr.util._isObject(data[prop][0])) {dwr.util._setValuesRecursive(data[prop], subidpath, depth-1, options);}else if (typeof data[prop] == \"function\") {}else {if (dwr.util.byId(subidpath) != null document.getElementsByName(subidpath).length >= 1) {dwr.util.setValue(subidpath, data[prop], options);}}}}};dwr.util.getValues = function(data, options) {if (typeof data == \"string\" dwr.util._isHTMLElement(data)) {return dwr.util.getFormValues(data);}else {var prefix = \"\";var depth = 100;if (options != null && \"prefix\" in options) prefix = options.prefix;if (options != null && \"idPrefix\" in options) prefix = options.idPrefix;if (options != null && \"depth\" in options) depth = options.depth;dwr.util._getValuesRecursive(data, prefix, depth, options);return data;}};dwr.util.getFormValues = function(eleOrNameOrId) {var ele = null;if (typeof eleOrNameOrId == \"string\") {ele = document.forms[eleOrNameOrId];if (ele == null) ele = dwr.util.byId(eleOrNameOrId);}else if (dwr.util._isHTMLElement(eleOrNameOrId)) {ele = eleOrNameOrId;}if (ele != null) {if (ele.elements == null) {alert(\"getFormValues() requires an object or reference to a form element.\");return null;}var reply = {};var name;var value;for (var i = 0; i < ele.elements.length; i++) {if (ele[i].type in {button:0,submit:0,reset:0,image:0,file:0}) continue;if (ele[i].name) {name = ele[i].name;value = dwr.util.getValue(name);}else {if (ele[i].id) name = ele[i].id;else name = \"element\" + i;value = dwr.util.getValue(ele[i]);}reply[name] = value;}return reply;}};dwr.util._getValuesRecursive = function(data, idpath, depth, options) {if (depth == 0) return;if (dwr.util._isArray(data) && data.length > 0 && dwr.util._isObject(data[0])) {for (var i = 0; i < data.length; i++) {dwr.util._getValuesRecursive(data[i], idpath+\"[\"+i+\"]\", depth-1, options);}}else if (dwr.util._isObject(data) && !dwr.util._isArray(data)) {for (var prop in data) {var subidpath = idpath idpath+\".\"+prop : prop;if (dwr.util._isObject(data[prop]) && !dwr.util._isArray(data[prop]) dwr.util._isArray(data[prop]) && data[prop].length > 0 && dwr.util._isObject(data[prop][0])) {dwr.util._getValuesRecursive(data[prop], subidpath, depth-1, options);}else if (typeof data[prop] == \"function\") {}else {if (dwr.util.byId(subidpath) != null document.getElementsByName(subidpath).length >= 1) {data[prop] = dwr.util.getValue(subidpath);}}}}};dwr.util.addOptions = function(ele, data ) {ele = dwr.util._getElementById(ele, \"addOptions()\");if (ele == null) return;var useOptions = dwr.util._isHTMLElement(ele, \"select\");var useLi = dwr.util._isHTMLElement(ele, [\"ul\", \"ol\"]);if (!useOptions && !useLi) {dwr.util._debug(\"addOptions() can only be used with select/ul/ol elements. Attempt to use: \" + dwr.util._detailedTypeOf(ele));return;}if (data == null) return;var argcount = arguments.length;var options = {};var lastarg = arguments[argcount - 1];if (argcount > 2 && dwr.util._isObject(lastarg)) {options = lastarg;argcount--;}var arg3 = null; if (argcount >= 3) arg3 = arguments[2];var arg4 = null; if (argcount >= 4) arg4 = arguments[3];if (!options.optionCreator && useOptions) options.optionCreator = dwr.util._defaultOptionCreator;if (!options.optionCreator && useLi) options.optionCreator = dwr.util._defaultListItemCreator;options.document = ele.ownerDocument;var text, value, li;if (dwr.util._isArray(data)) {for (var i = 0; i < data.length; i++) {options.data = data[i];options.text = null;options.value = null;if (useOptions) {if (arg3 != null) {if (arg4 != null) {options.text = dwr.util._getValueFrom(data[i], arg4);options.value = dwr.util._getValueFrom(data[i], arg3);}else options.text = options.value = dwr.util._getValueFrom(data[i], arg3);}else options.text = options.value = dwr.util._getValueFrom(data[i]);if (options.text != null options.value) {var opt = options.optionCreator(options);opt.text = options.text;opt.value = options.value;ele.options[ele.options.length] = opt;}}else {options.value = dwr.util._getValueFrom(data[i], arg3);if (options.value != null) {li = options.optionCreator(options);if (dwr.util._shouldEscapeHtml(options)) {options.value = dwr.util.escapeHtml(options.value);}li.innerHTML = options.value;ele.appendChild(li);}}}}else if (arg4 != null) {if (!useOptions) {alert(\"dwr.util.addOptions can only create select lists from objects.\");return;}for (var prop in data) {options.data = data[prop];options.value = dwr.util._getValueFrom(data[prop], arg3);options.text = dwr.util._getValueFrom(data[prop], arg4);if (options.text != null options.value) {var opt = options.optionCreator(options);opt.text = options.text;opt.value = options.value;ele.options[ele.options.length] = opt;}}}else {if (!useOptions) {dwr.util._debug(\"dwr.util.addOptions can only create select lists from objects.\");return;}for (var prop in data) {if (typeof data[prop] == \"function\") continue;options.data = data[prop];if (arg3 == null) {options.value = prop;options.text = data[prop];}else {options.value = data[prop];options.text = prop;}if (options.text != null options.value) {var opt = options.optionCreator(options);opt.text = options.text;opt.value = options.value;ele.options[ele.options.length] = opt;}}}dwr.util.highlight(ele, options);};dwr.util._getValueFrom = function(data, method) {if (method == null) return data;else if (typeof method == 'function') return method(data);else return data[method];};dwr.util._defaultOptionCreator = function(options) {return options.document.createElement(\"option\");};dwr.util._defaultListItemCreator = function(options) {return options.document.createElement(\"li\");};dwr.util.removeAllOptions = function(ele) {ele = dwr.util._getElementById(ele, \"removeAllOptions()\");if (ele == null) return;var useOptions = dwr.util._isHTMLElement(ele, \"select\");var useLi = dwr.util._isHTMLElement(ele, [\"ul\", \"ol\"]);if (!useOptions && !useLi) {dwr.util._debug(\"removeAllOptions() can only be used with select, ol and ul elements. Attempt to use: \" + dwr.util._detailedTypeOf(ele));return;}if (useOptions) {ele.options.length = 0;}else {while (ele.childNodes.length > 0) {ele.removeChild(ele.firstChild);}}};dwr.util.addRows = function(ele, data, cellFuncs, options) {ele = dwr.util._getElementById(ele, \"addRows()\");if (ele == null) return;if (!dwr.util._isHTMLElement(ele, [\"table\", \"tbody\", \"thead\", \"tfoot\"])) {dwr.util._debug(\"addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: \" + dwr.util._detailedTypeOf(ele));return;}if (!options) options = {};if (!options.rowCreator) options.rowCreator = dwr.util._defaultRowCreator;if (!options.cellCreator) options.cellCreator = dwr.util._defaultCellCreator;options.document = ele.ownerDocument;var tr, rowNum;if (dwr.util._isArray(data)) {for (rowNum = 0; rowNum < data.length; rowNum++) {options.rowData = data[rowNum];options.rowIndex = rowNum;options.rowNum = rowNum;options.data = null;options.cellNum = -1;tr = dwr.util._addRowInner(cellFuncs, options);if (tr != null) ele.appendChild(tr);}}else if (typeof data == \"object\") {rowNum = 0;for (var rowIndex in data) {options.rowData = data[rowIndex];options.rowIndex = rowIndex;options.rowNum = rowNum;options.data = null;options.cellNum = -1;tr = dwr.util._addRowInner(cellFuncs, options);if (tr != null) ele.appendChild(tr);rowNum++;}}dwr.util.highlight(ele, options);};dwr.util._emptyTableCellReplacement = \"\";dwr.util._addRowInner = function(cellFuncs, options) {var tr = options.rowCreator(options);if (tr == null) return null;for (var cellNum = 0; cellNum < cellFuncs.length; cellNum++) {var func = cellFuncs[cellNum];if (typeof func == 'function') options.data = func(options.rowData, options);else options.data = func \"\";options.cellNum = cellNum;var td = options.cellCreator(options);if (td != null) {if (\"data\" in options) {if (dwr.util._isHTMLElement(options.data)) td.appendChild(options.data);else {if (dwr.util._shouldEscapeHtml(options) && typeof(options.data) == \"string\") {td.innerHTML = dwr.util.escapeHtml(options.data);}else {td.innerHTML = options.data;}}}else {td.innerHTML = dwr.util._emptyTableCellReplacement;}tr.appendChild(td);}}return tr;};dwr.util._defaultRowCreator = function(options) {return options.document.createElement(\"tr\");};dwr.util._defaultCellCreator = function(options) {return options.document.createElement(\"td\");};dwr.util.removeAllRows = function(ele, options) {ele = dwr.util._getElementById(ele, \"removeAllRows()\");if (ele == null) return;if (!options) options = {};if (!options.filter) options.filter = function() { return true; };if (!dwr.util._isHTMLElement(ele, [\"table\", \"tbody\", \"thead\", \"tfoot\"])) {dwr.util._debug(\"removeAllRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: \" + dwr.util._detailedTypeOf(ele));return;}var child = ele.firstChild;var next;while (child != null) {next = child.nextSibling;if (options.filter(child)) {ele.removeChild(child);}child = next;}};dwr.util.setClassName = function(ele, className) {ele = dwr.util._getElementById(ele, \"setClassName()\");if (ele == null) return;ele.className = className;};dwr.util.addClassName = function(ele, className) {ele = dwr.util._getElementById(ele, \"addClassName()\");if (ele == null) return;ele.className += \" \" + className;};dwr.util.removeClassName = function(ele, className) {ele = dwr.util._getElementById(ele, \"removeClassName()\");if (ele == null) return;var regex = new RegExp(\"(^\\\\s)\" + className + \"(\\\\s$)\", 'g');ele.className = ele.className.replace(regex, '');};dwr.util.toggleClassName = function(ele, className) {ele = dwr.util._getElementById(ele, \"toggleClassName()\");if (ele == null) return;var regex = new RegExp(\"(^\\\\s)\" + className + \"(\\\\s$)\");if (regex.test(ele.className)) {ele.className = ele.className.replace(regex, '');}else {ele.className += \" \" + className;}};dwr.util.cloneNode = function(ele, options) {ele = dwr.util._getElementById(ele, \"cloneNode()\");if (ele == null) return null;if (options == null) options = {};var clone = ele.cloneNode(true);if (\"idPrefix\" in options \"idSuffix\" in options) {dwr.util._updateIds(clone, options);}else {dwr.util._removeIds(clone);}ele.parentNode.insertBefore(clone, ele);return clone;};dwr.util._updateIds = function(ele, options) {if (options == null) options = {};if (dwr.util._getId(ele)) {ele.setAttribute(\"id\",(\"idPrefix\" in options options.idPrefix : \"\")+ dwr.util._getId(ele)+ (\"idSuffix\" in options options.idSuffix : \"\"));}var children = ele.childNodes;for (var i = 0; i < children.length; i++) {var child = children.item(i);if (child.nodeType == 1 ) {dwr.util._updateIds(child, options);}}};dwr.util._removeIds = function(ele) {if (dwr.util._getId(ele)) ele.removeAttribute(\"id\");var children = ele.childNodes;for (var i = 0; i < children.length; i++) {var child = children.item(i);if (child.nodeType == 1 ) {dwr.util._removeIds(child);}}};dwr.util.cloneNodeForValues = function(templateEle, data, options) {templateEle = dwr.util._getElementById(templateEle, \"cloneNodeForValues()\");if (templateEle == null) return null;if (options == null) options = {};var idpath;if (options.idPrefix != null)idpath = options.idPrefix;elseidpath = dwr.util._getId(templateEle) \"\";return dwr.util._cloneNodeForValuesRecursive(templateEle, data, idpath, options);};dwr.util._cloneNodeForValuesRecursive = function(templateEle, data, idpath, options) {if (dwr.util._isArray(data)) {var clones = [];for (var i = 0; i < data.length; i++) {var item = data[i];var clone = dwr.util._cloneNodeForValuesRecursive(templateEle, item, idpath + \"[\" + i + \"]\", options);clones.push(clone);}return clones;}elseif (dwr.util._isObject(data) && !dwr.util._isArray(data)) {var clone = templateEle.cloneNode(true);if (options.updateCloneStyle && clone.style) {for (var propname in options.updateCloneStyle) {clone.style[propname] = options.updateCloneStyle[propname];}}dwr.util._replaceIds(clone, dwr.util._getId(templateEle), idpath);templateEle.parentNode.insertBefore(clone, templateEle);dwr.util._cloneSubArrays(data, idpath, options);return clone;}return null;};dwr.util._replaceIds = function(ele, oldidpath, newidpath) {var currId = dwr.util._getId(ele);if (currId) {var newId = null;if (currId == oldidpath) {newId = newidpath;}else if (currId.length > oldidpath.length) {if (currId.substr(0, oldidpath.length) == oldidpath) {var trailingChar = currId.charAt(oldidpath.length);if (trailingChar == \".\" trailingChar == \"[\") {newId = newidpath + currId.substr(oldidpath.length);}}}if (newId) {ele.setAttribute(\"id\", newId);}else {ele.removeAttribute(\"id\");}}var children = ele.childNodes;for (var i = 0; i < children.length; i++) {var child = children.item(i);if (child.nodeType == 1 ) {dwr.util._replaceIds(child, oldidpath, newidpath);}}};dwr.util._cloneSubArrays = function(data, idpath, options) {for (prop in data) {var value = data[prop];if (dwr.util._isArray(value)) {if (value.length > 0 && dwr.util._isObject(value[0])) {var subTemplateId = idpath + \".\" + prop;var subTemplateEle = dwr.util.byId(subTemplateId);if (subTemplateEle != null) {dwr.util._cloneNodeForValuesRecursive(subTemplateEle, value, subTemplateId, options);}}}else if (dwr.util._isObject(value)) {dwr.util._cloneSubArrays(value, idpath + \".\" + prop, options);}}};dwr.util._getElementById = function(ele, source) {var orig = ele;ele = dwr.util.byId(ele);if (ele == null) {dwr.util._debug(source + \" can't find an element with id: \" + orig + \".\");}return ele;};dwr.util._isHTMLElement = function(ele, nodeName) {if (ele == null typeof ele != \"object\" ele.nodeName == null) {return false;}if (nodeName != null) {var test = ele.nodeName.toLowerCase();if (typeof nodeName == \"string\") {return test == nodeName.toLowerCase();}if (dwr.util._isArray(nodeName)) {var match = false;for (var i = 0; i < nodeName.length && !match; i++) {if (test == nodeName[i].toLowerCase()) {match = true;}}return match;}dwr.util._debug(\"dwr.util._isHTMLElement was passed test node name that is neither a string or array of strings\");return false;}return true;};dwr.util._detailedTypeOf = function(x) {var reply = typeof x;if (reply == \"object\") {reply = Object.prototype.toString.apply(x);reply = reply.substring(8, reply.length-1);}return reply;};dwr.util._isObject = function(data) {return (data && typeof data == \"object\");};dwr.util._isArray = function(data) {return (data && Object.prototype.toString.call(data)==\"[object Array]\");};dwr.util._isArrayLike = function(data) {return data&& (typeof data.length == \"number\")&& ((data.propertyIsEnumerable && data.propertyIsEnumerable(\"length\")==false) !data.constructor data!=\"[object Object]\")&& !dwr.util._isString(data)&& !dwr.util._isFunction(data)&& !data.tagName;};dwr.util._isString = function(data) {return (data && (typeof data == \"string\" Object.prototype.toString.call(data) == \"[object String]\"));};dwr.util._isFunction = function(data) {return (data && (typeof data == \"function\" Object.prototype.toString.call(data) == \"[object Function]\")&& data != \"[object NodeList]\");};dwr.util._isDate = function(data) {return (data && Object.prototype.toString.call(data)==\"[object Date]\");};dwr.util._importNode = function(doc, importedNode, deep) {var newNode;if (importedNode.nodeType == 1 ) {newNode = doc.createElement(importedNode.nodeName);for (var i = 0; i < importedNode.attributes.length; i++) {var attr = importedNode.attributes[i];if (attr.nodeValue != null && attr.nodeValue != '') {newNode.setAttribute(attr.name, attr.nodeValue);}}if (importedNode.style != null) {newNode.style.cssText = importedNode.style.cssText;}}else if (importedNode.nodeType == 3 ) {newNode = doc.createTextNode(importedNode.nodeValue);}if (deep && importedNode.hasChildNodes()) {for (i = 0; i < importedNode.childNodes.length; i++) {newNode.appendChild(dwr.util._importNode(doc, importedNode.childNodes[i], true));}}return newNode;};dwr.util._debug = function(message, stacktrace) {var written = false;try {if (window.console) {if (stacktrace && window.console.trace) window.console.trace();window.console.log(message);written = true;}else if (window.opera && window.opera.postError) {window.opera.postError(message);written = true;}}catch (ex) { }if (!written) {var debug = document.getElementById(\"dwr-debug\");if (debug) {var contents = message + \"\" + debug.innerHTML;if (contents.length > 2048) contents = contents.substring(0, 2048);debug.innerHTML = contents;}}}; if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() { if (dwr.engine._getObject(\"geographyController\") == undefined) { var p; p = {}; p.getPostCodeMap = function(p0, p1, callback) { return dwr.engine._execute(p._path, 'geographyController', 'getPostCodeMap', arguments); }; p.getSubCountries = function(p0, callback) { return dwr.engine._execute(p._path, 'geographyController', 'getSubCountries', arguments); }; p.getSuburbsForPostCode = function(p0, p1, callback) { return dwr.engine._execute(p._path, 'geographyController', 'getSuburbsForPostCode', arguments); }; p.getState = function(p0, p1, callback) { return dwr.engine._execute(p._path, 'geographyController', 'getState', arguments); }; dwr.engine._setObject(\"geographyController\", p); } })(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() { if (dwr.engine._getObject(\"shippingAjaxController\") == undefined) { var p; p = {}; p.getDeliveryDates = function(p0, p1, callback) { return dwr.engine._execute(p._path, 'shippingAjaxController', 'getDeliveryDates', arguments); }; dwr.engine._setObject(\"shippingAjaxController\", p); } })(); if (typeof dwr == 'undefined' dwr.engine == undefined) throw new Error( 'You must include DWR engine before including this file'); (function() { if (dwr.engine._getObject(\"customerAjaxController\") == undefined) { var p; p = {}; p.deleteQffMember = function(callback) { return dwr.engine._execute(p._path, 'customerAjaxController', 'deleteQffMember', arguments); }; p.bookClubOptIn = function(callback) { return dwr.engine._execute(p._path, 'customerAjaxController', 'bookClubOptIn', arguments); }; p.bookClubOptOut = function(callback) { return dwr.engine._execute(p._path, 'customerAjaxController', 'bookClubOptOut', arguments); }; p.isCustomerEmail = function(p1, p2, callback) { return dwr.engine._execute(p._path, 'customerAjaxController', 'isCustomerEmail', arguments); }; p.validateQffMemberId = function(p0, p1, callback) { return dwr.engine._execute(p._path, 'customerAjaxController', 'validateQffMemberId', arguments); }; dwr.engine._setObject(\"customerAjaxController\", p); } })(); function isBotUserAgent() { var crawlerAgentRegex = /botgoogleaolbuildbaidubingmsnduckduckgoteomaslurpyandex/i; if (crawlerAgentRegex.test(navigator.userAgent)) return true; return false; } function lazyLoadScript(url, callback) { if (isBotUserAgent()) return; var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.defer = true; script.type = 'text/javascript'; script.src = url; head.appendChild(script); script.onload = callback; } lazyLoadScript(\" \", function() { citrusAd = CitrusAd.init(\" -integration.citrusad.com/v1\"); }) var customPath = \" -resources\"; window.dataLayer = window.dataLayer []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'AW-1071893088'); (function(w, d, s, l, i) { w[l] = w[l] []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' '&l=' + l : ''; j.async = true; j.src = ' =' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-N74L7GH'); var _gaq = _gaq []; _gaq.push(['_setAccount', \"UA-413837-1\"]); _gaq.push(['_trackPageview']); _gaq.push(['_setCustomVar', 1, 'Site', \"PC\", 2]); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); (function(i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] function() { (i[r].q = i[r].q []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', \"UA-413837-3\", 'auto'); ga('send', 'pageview'); (function() { window._pxAppId = 'PXNs7aBMIv'; // Custom parameters // window._pxParam1 = \"\"; var p = document.getElementsByTagName('script')[0], s = document.createElement('script'); s.async = 1; s.src = ' '; p.parentNode.insertBefore(s, p); }()); var citrusAd = CitrusAd.init(\" -integration.citrusad.com/v1\"); var advertTrackerRaw = localStorage.getItem('advertTracker') var advertTracker = JSON.parse(advertTrackerRaw) if (advertTrackerRaw && window.location.pathname != advertTracker.pathname) { localStorage.removeItem('advertTracker') } (function() { var bk = document.createElement('script'); bk.type = 'text/javascript'; bk.async = true; bk.src = ('https:' == document.location.protocol 'https://' : 'http://') + 'static.booktopia.com.au/cart-widget/v1/booktopia-cart-widget-ext.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bk, s); })(); function getCookie(cname) { var name = cname + \"=\"; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return null; } function enhancedEcommerceAddProduct(product) { if (product) ga('enhancedEcommerce.ec:addProduct', product); } function enhancedEcommerceAddToCart(product) { if (product) { enhancedEcommerceAddProduct(product); ga('enhancedEcommerce.ec:setAction', 'add'); ga('enhancedEcommerce.send', 'event', 'UX', 'click', 'add to cart'); } } function ecEventDispatch(productData) { if (productData) { enhancedEcommerceAddProduct(productData); ga('enhancedEcommerce.ec:setAction', 'click', { list: productData.list }); // Send click with an event, then send user to product page. ga('enhancedEcommerce.send', 'event', 'UX', 'click', 'Product'); } } var advertTrackerRaw = localStorage.getItem('advertTracker') var advertTracker = JSON.parse(advertTrackerRaw) if (advertTrackerRaw && window.location.pathname != advertTracker.pathname) { localStorage.removeItem('advertTracker') } (function(a, b, c, d, e, f, g) { e['ire_o'] = c; e[c] = e[c] function() { (e[c].a = e[c].a []).push(arguments) }; f = d.createElement(b); g = d.getElementsByTagName(b)[0]; f.async = 1; f.src = a; g.parentNode.insertBefore(f, g); })('//d.impactradius-event.com/A1393524-e137-4555-83c9-d01ef05ce3901.js', 'script', 'ire', document, window); var customPath = \"/template-resources\"; function getUrlParameter(parameter) { var sPageURL = decodeURIComponent(window.location.search.substring(1)); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == parameter) { return sParameterName[1]; } } }; .icon-indicate { margin-left:28px !important; } .books-category#sub-nav { display:block ; } .fiction-books { display:block !important; } #nav-books { background-color: #075f20; font-weight: bold; } #nav-books .navLink { border-right: none !important; } @media only screen and (max-width: 991px) { .subnav.fiction-books { background: #fff !important; border-bottom: 1px solid #ccc; clear: both; display: block; height: 40px; left: 0; margin-bottom: 10px; position: absolute; width: 100%; } .subnav.fiction-books li{ background:#fff !important; } .possible.fic-book { background:#fff !important; height:72px; border-bottom:none !important; } .subnav.fiction-books li a { border:none !important; } .possible.fic-book > a { color: #075f20 !important; } } if (typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\\s+\\s+$/g, ''); }; } function isEmpty(str) { return (!str 0 === str.length); } function isBlank(str) { return (!str /^\\s*$/.test(str)); } function hasStorage() { return typeof(Storage) !== \"undefined\"; } function currentTimestamp() { var d = new Date(); return d.getTime(); } function formatShortDate(date) { try { var dd = date.getDate(); var mm = date.getMonth() + 1; var yyyy = \"\" + date.getFullYear(); return (dd < 10 \"0\" : \"\") + dd + \"/\" + (mm < 10 \"0\" : \"\") + mm + \"/\" + yyyy.substring(2, 4); } catch (ex) { return date; } } function setStateValue(name, value) { try { var topDoc = (window.parent window.parent.document : window.document); jQuery('form[name=\"state\"]', topDoc).find('input[name=\"' + name + '\"]').val(value); var ts = currentTimestamp(); jQuery('form[name=\"state\"]', topDoc).find('input[name=\"stateChangedAt\"]').val(ts); return ts; } catch (e) { return 0; } } function getStateValue(name) { var value = null; try { var topDoc = (window.parent window.parent.document : window.document); value = jQuery('form[name=\"state\"]', topDoc).find('input[name=\"' + name + '\"]').val(); } catch (e) { if (window.console && console.warn) console.warn(e); } return value; } function disable(element) { element.disabled = true; } function isCaseInsensitiveContains(compareWith, compareTo) { var indexOfWord = compareWith.toLowerCase().indexOf(compareTo.toLowerCase()) return indexOfWord !== -1 true : false; } function popupWindow(url, width, height) { window.open(url, '', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=' + width + ', height=' + height); } function isDocumentReady() { return document.readyState === \"loaded\" document.readyState === \"complete\"; } function clickHandlerDynamicElement(element, handlerString, proceedAfterClick) { proceedAfterClick = (proceedAfterClick true : false); handlerString = handlerString jQuery.noop(); if (!element) { if (window.console && console.warn) console.warn(\"Null element passed to clickHandlerDynamicElement\"); return; } var onclick = element.getAttribute(\"onclick\"); if (!(navigator.userAgent.match(/msie/i)) && onclick !== \"function\") { element.setAttribute('onclick', handlerString + ';return '); } else { element.onclick = function() { eval(handlerString); return false; }; } } function setReturnAnchor() { jQuery('#book-club-templates').on('b-modal-closed', function() { showModalContent($('#add-to-cart-templates.b-modal')); jQuery('#add-to-cart-templates').addClass('b-show-modal'); jQuery('#book-club-templates').off('b-modal-closed') }) } function showCarousel(id) { var carousel = jQuery('#' + id); carousel.siblings().hide(); carousel.show(); return (carousel.length > 0); } function numDigits(number) { var numDigits = 0; var tempNumber = number; while (tempNumber > 0) { tempNumber = parseInt(tempNumber / 10); numDigits++; } return numDigits; } function isDigit(string) { var regex = new RegExp(\"\\\\d\"); return regex.test(string); } function getThirdPartyCheckoutData(serviceName, successHandler) { try { checkoutAjaxController.getThirdPartyCheckoutData(serviceName, successHandler); } catch (e) { if (window.console && console.warn) console.warn(e); } } function startSubmit(elem) { var innerHTML = jQuery(elem).html(), elemWidth = jQuery(elem).outerWidth(), elemHeight = jQuery(elem).outerHeight(); jQuery(elem).prop('disabled', true).html('').css({ 'opacity': '0.5', 'width': elemWidth, 'height': elemHeight }).attr('data-innerhtml', innerHTML); } function endSubmit(elem) { jQuery(elem).prop('disabled', false).html(jQuery(elem).data('innerhtml')).css('opacity', '1'); } function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\\[\\]]/g, '\\\\$&'); var regex = new RegExp('[&]' + name + '(=([^&#]*)&#$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\\+/g, ' ')); } function reportCitrusClick(id, redirectUrl) { if (isBotUserAgent()) return; if (typeof citrusAd !== 'undefined' && citrusAd) { citrusAd.reportClick(id).then(function(result) { window.location.href = redirectUrl; }).catch(function(error) { console.log('error ', error); window.location.href = redirectUrl; }); } } function reportCitrusImpression(id) { if (isBotUserAgent()) return; if (typeof citrusAd !== 'undefined' && citrusAd) { citrusAd.reportImpression(id).then(function(result) {}).catch(function(error) { console.log('error ', error); }); } } function fireImpactIdentifyAndCheckClickId(customerSession) { if (currentPageNav !== \"help\") { if (customerSession.signedIn) { ire('identify', { customerId: customerSession.emarsysCustomerUid, customerEmail: customerSession.sha1Email }); } else { ire('identify', { customerId: \"\", customerEmail: \"\" }); } if (customerSession.irClickId === \"\") { ire('generateClickId', function(clickId) { customerSessionAjaxController.updateImpactClickId(clickId); if (currentPageNav === \"receipt\" && typeof impactConvert === \"function\") { impactConvert(clickId); } }); } else if (currentPageNav === \"receipt\" && typeof impactConvert === \"function\") { impactConvert(customerSession.irClickId); } } } function resetPostcode() { localStorage.removeItem('postcode'); localStorage.removeItem('suburb'); } jQuery(function() { var specialOccasionIconHtml = \"\"; if (jQuery(\"#product-browse .product-results\").length) { jQuery(\"#product-browse .product-results li\").each(function() { if (jQuery(this).find(\".in-stock\").length) { jQuery(this).find(\".image\").append(specialOccasionIconHtml); } }); } else if (jQuery(\"#manage-account.wishlist\").length) { jQuery(\"#wishlist table\").each(function() { if (jQuery(this).find(\".in-stock\").length) { jQuery(this).find(\".image > a\").append(specialOccasionIconHtml); } }); } }); function validateEmail(emailElement) { if (emailElement.checkValidity) { return emailElement.checkValidity(); } else { var re = /^(([^()[\\]\\\\.,;:\\s@\\\"]+(\\.[^()[\\]\\\\.,;:\\s@\\\"]+)*)(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/; return re.test(emailElement.value); } } function initGoogleAuth() { try { var googleClientId = document.getElementById(\"google-signin-client_id\").getAttribute(\"content\"), isGoogleSignInEnabled = (document.getElementById(\"google-signin-client_id\").dataset.enabled === 'true'); gapi.load('auth2', function() { gapi.auth2.init({ client_id: googleClientId, fetch_basic_profile: false, scope: 'profile' }).then(function() { var isSignedInGoogle = gapi.auth2.getAuthInstance().isSignedIn.get(), isSignedInBooktopia = jQuery('body').hasClass('signed-in'); if (!isSignedInBooktopia && isSignedInGoogle) { googleSignOut(); } if (!isSignedInBooktopia && isGoogleSignInEnabled) { lazyLoadScript(' ', function() { if (typeof google !== \"undefined\") { google.accounts.id.initialize({ client_id: googleClientId, callback: function(response) { jQuery( '') .append('').appendTo( 'body').submit(); } }); setTimeout(function() { google.accounts.id.prompt(); }, 5000); } }) } }, function(e) { console.warn('Google auth2 error: ', e); }); }); } catch (e) { console.log(e); return; } } function googleSignOut() { try { gapi.auth2.getAuthInstance().signOut(); } catch (e) { console.log(e); return; } } function switchTabs(tabLink) { tabLink = jQuery(tabLink); var tabId = tabLink.attr(\"data-tab\"), tabGroup = tabLink.closest(\".tabs\"); tabGroup.find(\".tab.selected\").removeClass(\"selected\"); tabLink.closest(\".tab\").addClass(\"selected\"); tabGroup.find(\".tab-content.active\").removeClass(\"active\"); tabGroup.find(\"#\" + tabId).addClass(\"active\"); } function validateForm(formId) { var jFormId = jQuery(\"#\" + formId), allInput = jFormId.find(':input'), isValid = true; allInput.each(function(i, input) { jQuery(input).one('input', function() { jQuery(this).parents('.field').removeClass('error'); jQuery(this).parents('.field').find('.input-error').remove(); }); jQuery(input).parents('.field').removeClass('error'); jQuery(input).parents('.field').find('.input-error').remove(); if (!input.validity.valid) { jQuery(input).parents('.field').addClass('error'); if (input.validity.valueMissing) jQuery(input).parents('.field').append( 'Please enter a value.'); if (input.validity.typeMismatch) jQuery(input).parents('.field').append( 'Please enter valid email address.'); isValid = false; } }); return isValid; } function escapeHtml(input) { return input.replace(//g, \">\") } function addProductToCartReload(url, productCode, quantity, binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisher, hasStockAvailable) { if (window.BKT_GLOBALS.isMobileSession) { var parentID = \"#booktopia-notification-wrapper\", responseContainerID = \"#hidden-response-from-ajax\", contentContainerID = \"#total-cart-item-mobile\"; } else { var parentID = \"#shopping-cart-popup\", responseContainerID = \"#add-cart-page-placeholder\", contentContainerID = \"#add-cart-page-content\"; } if (productPopupsV2(binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisher, hasStockAvailable)) { var data = { \"cartItem[0].pID\": productCode, \"cartItem[0].skuGuid\": productCode, \"cartItem[0].quantity\": quantity }; jQuery(parentID).find(responseContainerID).load(url + ' ' + contentContainerID, data, function() { window.location.reload(); }); } } function isCustomSearchPopulated() { var searchBox = document.getElementById('textbook-search-input'); if (!searchBox) { searchBox = document.getElementsByClassName('search-text')[0]; } if (!searchBox searchBox.value == \"Use title, ISBN or keywords\" searchBox.value.trim() == \"\") { return false; } var specialCharsArray = [\"\\u2018\", \"\\u2019\"]; for (var i = 0; i < specialCharsArray.length; i++) { searchBox.value = searchBox.value.replace(new RegExp(specialCharsArray[i], 'g'), \"'\"); } searchBox.value = searchBox.value.replace(new RegExp(\"'-.*-'\", 'g'), \"\"); return true; } function htmlEncode(value) { return $('').text(value).html(); } function scrollToElement(element, offset, speed) { $('html, body').animate({ scrollTop: element.offset().top - offset }, speed); } function lazyLoadPopup(url, className) { $.ajax({ method: \"GET\", url: url }).done(function(htmlResponse) { createModal('iframe-modal', className); $('#iframe-modal-container').html(htmlResponse); showModalContent($('#iframe-modal')); $('#iframe-modal').addClass('b-show-modal'); }); }; function validQuantity(quantity) { return quantity !== null && quantity !== \"\" && !isNaN(quantity) && quantity >= 0; } function saveCustomerFeedback(productUid, feedbackType) { var feedbackTypeStr = null; switch (feedbackType) { case 1: default: feedbackTypeStr = \"SHOPPING CART RECOMMENDATIONS\"; } customerFeedbackAjaxController.recordFeedback(productUid, feedbackTypeStr); jQuery(\".feedback-link\").text(\"Thank you!\"); jQuery(\".feedback-link\").contents().unwrap().wrap(\"\"); } function initCustomerSession(event, trigger) { var status = { savedQuantity: null, valid: false, pageIsDirty: getStateValue('pageIsDirty') === \"true\", stateChangedAt: parseInt(getStateValue('stateChangedAt')) }; if (event) { if (arguments.callee.timestamp && !event.persisted) { return null; } } status.valid = true; arguments.callee.timestamp = setStateValue('pageIsDirty', 'true'); bkSource = getParameterByName(\"bk_source\", window.location.href); bkSourceId = getParameterByName(\"bk_source_id\", window.location.href); promoCode = getParameterByName(\"promoCode\", window.location.href); customerSessionAjaxController.getCustomerSession(bkSource, bkSourceId, promoCode, updateDisplayCustomerSessionCallback); if (!event \"true\" !== status.pageIsDirty) { status.savedQuantity = parseInt(getStateValue(\"shoppingCartQty\")); if (!status.stateChangedAt (arguments.callee.timestamp - status.stateChangedAt) > 1000) { if ((status.valid = validQuantity(status.savedQuantity))) updateDisplayCartQuantity(status.savedQuantity, true); } } return status; } function updateBookClubMemberStatus(session) { if (session.signedIn && !session.wholesaleCustomer) { if (session.qualified) { jQuery('.intro-text.qualified').show(); } else { jQuery('.intro-text.not-qualified').show(); } } if (!session.signedIn) { jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr({ 'onclick': '' }); removeMemberDisplay(); } else if (session.wholesaleCustomer) { jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr({ 'onclick': 'toggleModal(\"#book-club-templates\"); displayBookClubModal(\"#book-club-not-eligible\",this);', 'href': 'javascript:void(0)' }); removeMemberDisplay(); } else if (session.signedIn && session.optIn) { jQuery('.book-club-btn').css({ 'display': 'block' }); jQuery('.book-club-buy-now').remove(); showMemberDisplay(); } else { jQuery('.book-club-btn').remove(); jQuery('.book-club-buy-now').attr({ 'onclick': 'toggleModal(\"#book-club-templates\"); displayBookClubModal(\"#book-club-join-now\",this);', 'href': 'javascript:void(0)' }); removeMemberDisplay(); } } function removeMemberDisplay() { jQuery('.has-member-price .member-sale-price').remove(); jQuery('.has-member-price .regular-price').remove(); jQuery('.has-member-price .member-price-buy-now').remove(); jQuery('.has-member-price .save.member-price').remove(); } function displayJoinBookClubModalOnRedirect() { buyBundle = getParameterByName(\"bundle\", window.location.search) if (buyBundle === null buyBundle === \"false\") { buyBundle = false; } customerSessionAjaxController.getCustomerSession(function(session) { if (session.wholesaleCustomer) { toggleModal(\"#book-club-templates\"); jQuery(\"#book-club-not-eligible\").show() } else if (!session.optIn) { toggleModal(\"#book-club-templates\"); jQuery(\"#book-club-join-now\").show() } }) } function updateDisplayCartQuantityCallback(quantity) { var savedQuantity = null; var valid = true; if ((valid = validQuantity(quantity))) updateDisplayCartQuantity(quantity, true); else { savedQuantity = parseInt(getStateValue(\"shoppingCartQty\")); updateDisplayCartQuantity(savedQuantity, false); } return valid; } function updateDisplayCartQuantity(quantity, updateState) { if (!validQuantity(quantity)) { jQuery('#shopping-cart-summary').removeClass('full'); jQuery(\"#numItemsQty\").text(\"\"); jQuery(\"#numItemsUnits\").text(\"\"); return false; } if (quantity > 0) jQuery('#shopping-cart-summary').addClass('full'); else jQuery('#shopping-cart-summary').removeClass('full'); jQuery(\"#numItemsQty\").text(quantity); jQuery(\"#numItemsUnits\").text(quantity == 1 \"item\" : \"items\"); if (updateState) setStateValue(\"shoppingCartQty\", quantity); return true; } function updateLocalEmptyCart() { setStateValue(\"shoppingCartQty\", \"0\"); } $(function() { initCustomerSession(this, 'footer'); }) function triggerSameDayDeliveryCountDown(sessionServerTime) { if (jQuery(\"#product\").length && jQuery(\"#currentTimeAEST\").length) { var serverDateTime = new Date(sessionServerTime); jQuery(\"#currentTimeAEST\").val(toTwoDigits(serverDateTime.getHours()) + \":\" + toTwoDigits(serverDateTime .getMinutes()) + \":\" + toTwoDigits(serverDateTime.getSeconds())); } } function handleKoboPlus(session) { if (session.signedIn && session.koboEBookSubscribed) { jQuery(\"body\").addClass(\"kobo-plus-member\"); } else { jQuery(\"body\").removeClass(\"kobo-plus-member\"); } }; function productPopups(binding, preOrder, availableDate, languageCodes, hasStockAvailable) { var isNotAvailableDate = (availableDate === ''); return (checkFormat(binding) && checkLanguage(languageCodes) && (!preOrder checkPreOrder()) && ( isNotAvailableDate hasStockAvailable checkAvailableInFuture(availableDate))); } function productPopupsV2(binding, preOrder, availableDate, languageCodes, supplierItemStatus, publisherName, hasStockAvailable) { var isOnDemand = (supplierItemStatus === \"OD\"); var hasCreateSpace = isCaseInsensitiveContains(publisherName, \"CreateSpace\"); var isNotAvailableDate = (availableDate === ''); return (checkFormat(binding) && checkLanguage(languageCodes) && (!preOrder checkPreOrder()) && ( isNotAvailableDate hasStockAvailable checkAvailableInFuture(availableDate)) && (!isOnDemand checkOnDemand()) && (!hasCreateSpace checkPublisherCreateSpace())); } function checkProductAvailabilityCallback(data, url, productId, productCode, quantity, binding, preOrder, availableDate, languageCodes, isBookClubProduct, hasStockAvailable) { if (!data) { alert( \"This product may have just sold out, or has become unavailable a short time ago.\\n\\nPlease select another title, search again, or click on the Author's name to see if there are any other titles by that Author that may interest you.\"); } else if (productPopups(binding, preOrder, availableDate, languageCodes, hasStockAvailable)) { if (isBookClubProduct) { customerSessionAjaxController.getCustomerSession(function(session) { if (session.wholesaleCustomer) { toggleModal(\"#book-club-templates\"); displayBookClubModal(\"#book-club-not-eligible\"); } else if (!session.optIn) { toggleModal(\"#book-club-templates\"); displayBookClubModal(\"#book-club-join-now\"); } else { addToCart(url, productCode, quantity); } }) } else { addToCart(url, productCode, quantity); } } } function checkFormat(binding) { bindingStr = binding; if (\"CD\" == binding \"CR\" == binding \"MP3\" == binding \"M3\" == binding \"C3\" == binding \"AZ\" == binding) { if (\"CR\" == binding) bindingStr = \"CD-ROM\"; else if (\"C3\" == binding) bindingStr = \"CD MP3\"; else if (\"M3\" == binding) bindingStr = \"MP3\"; else if (\"AZ\" == binding) bindingStr = \"Audio CD\"; return confirm(\"This title is NOT A BOOK. The format is \" + bindingStr + \".\\n\\nPurchase of this product is on a firm-sale, non-returnable basis.\\n\\nPlease click 'OK' if you wish to add this product to your Shopping Basket, otherwise click 'Cancel' to continue browsing.\" ); } return true; } function checkLanguage(languageCodes) { if (!languageCodes languageCodes.trim() === \"\") return true; languageCodes = languageCodes.toUpperCase(); var languagesArray = (languageCodes.indexOf(',') > -1 languageCodes.split(',') : languageCodes.split(' ')); if (languagesArray.length == 0) return true; for (var i = 0; i < languagesArray.length; i++) { if (languagesArray[i].trim() === \"ENG\") return true; } return confirm( \"This title is not in English.\\n\\nPurchase of this product is on a firm-sale, non-returnable basis.\\n\\nPlease click 'OK' if you wish to add this product to your Shopping Basket, otherwise click 'Cancel' to continue browsing.\" ); } function checkPreOrder() { return confirm( \"This title is not yet published.\\n\\nPlease pay attention to the publication date of this title.\\n\\nBooktopia is taking pre-orders at the moment. An up-front payment is required to place a pre-order.\\n\\nPress \\\"OK\\\" to place a pre-order for this title.\\nPress \\\"Cancel\\\" if you wish to wait until closer to the publication date to place your pre-order.\" ); } function checkAvailableInFuture(availableDate) { return confirm( \"Due to popular demand our supplier is rushing to provide new stock of this title.\\n\\nWe expect the title to be available from \" + availableDate + \". Complete your order now to secure your copy.\\n\\nPress \\\"OK\\\" to place an order for this title.\\nPress \\\"Cancel\\\" if you wish to wait for availability to place your order.\" ); } function checkPublisherCreateSpace() { return confirm( \"This item will be specially produced for you, is a Firm Sale and a change-of-mind cancellation cannot be accepted after the standard 1 business day cooling off period. Booktopia will not accept a return of a Print on Demand title for a change of mind.\" ); } function checkOnDemand() { return confirm( \"This item will be specially produced for you, is a Firm Sale and a change-of-mind cancellation cannot be accepted after the standard 1 business day cooling off period. Booktopia will not accept a return of a Print on Demand title for a change of mind.\" ); }; function isSearchPopulated() { var searchBox = document.getElementById('header-search-box'); if (!searchBox searchBox.value == \"SEARCH TITLE, AUTHOR OR ISBN\" searchBox.value.trim() == \"\") { return false; } var specialCharsArray = [\"\\u2018\", \"\\u2019\"]; for (var i = 0; i < specialCharsArray.length; i++) { searchBox.value = searchBox.value.replace(new RegExp(specialCharsArray[i], 'g'), \"'\"); } searchBox.value = searchBox.value.replace(new RegExp(\"'-.*-'\", 'g'), \"\"); return true; } function getKeywords() { var keywords = \"\"; if (isSearchPopulated()) keywords = document.getElementById('header-search-box').value.trim(); return keywords; } function checkLatestKeywords(theLink, productType) { keywords = getKeywords(); if (keywords && theLink.href.indexOf(\"search.epkeywords=\") > -1) { theLink.href = window.location.protocol + \"//\" + window.location.host + window.location.pathname + \"keywords=\" + encodeURIComponent(keywords) + \"&productType=\" + productType; return false; } return true; } function autoCompleteOnSelect(suggestion) { var searchForm = jQuery('#searchform'); $(this).trigger('blur'); if (suggestion.pageUrl) { window.location = suggestion.pageUrl; } else { if (suggestion.context) searchForm.find(\"select[name='productType']\").val(suggestion.context); window.location = searchForm.attr('action') + '' + searchForm.serialize() + '&suggested=L'; } } function autoCompleteTransformResult(response) { var suggestions = JSON.parse(response); return { suggestions: $.map(suggestions.suggestions, function(dataItem) { var contextName = null, data = dataItem.data; if (dataItem.context && (contextName = window.lookaheadSuffixes[dataItem.context])) { data['contextName'] = contextName; } return { value: dataItem.value, data: data, context: dataItem.context, pageUrl: dataItem.pageUrl }; }) }; } function autoCompleteFormatResult(suggestion, currentValue) { var baseFormat = jQuery.Autocomplete.formatResult(suggestion, currentValue); var contextName = null; var htmlResult = ''; if (suggestion.context && (contextName = window.lookaheadSuffixes[suggestion.context])) htmlResult += '' + baseFormat + ' ' + contextName + ''; else if (suggestion.context) htmlResult += '' + baseFormat + ' ' + suggestion.context + ''; else htmlResult += baseFormat; return htmlResult; } $(function() { window.lookaheadSuffixes = { \"ser\": \"Series\", \"cat\": \"Category\", \"prm\": \"Collection\", \"917504\": \"Books\", \"917505\": \"eBooks\", \"917506\": \"DVDs\", \"917507\": \"Audio CDs\", \"917508\": \"Magazines\", \"917510\": \"Audiobooks\", \"917503\": \"Stationery\" }; $(\"select[name='productType']\").on('change', function() { $('#header-search-box').autocomplete().setOptions({ params: { productType: this.value } }); }); }); function emarsysAddMobileTag(mobile) { if (typeof mobile != 'undefined' && mobile && \"true\" == mobile) { ScarabQueue.push(['tag', 'mobile']); } } function emarsysSetTestMode(testMode) { if (typeof testMode != 'undefined' && testMode && \"true\" == testMode) { ScarabQueue.push(['testMode']); } } function emarsysPushProductView(customerUidPk, isbn, mobile, testMode) { if (!isBlank(isbn)) { if (!isEmpty(customerUidPk)) { ScarabQueue.push(['setCustomerId', customerUidPk]); } ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['view', isbn]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); } } function emarsysPushCategoryView(customerUidPk, categoryPath, mobile, testMode) { if (!isBlank(categoryPath)) { if (!isEmpty(customerUidPk)) { ScarabQueue.push(['setCustomerId', customerUidPk]); } ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['category', categoryPath]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); } } function emarsysPushSearchTerm(customerUidPk, searchTerm, mobile, testMode) { if (!isBlank(searchTerm)) { if (!isEmpty(customerUidPk)) { ScarabQueue.push(['setCustomerId', customerUidPk]); } ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['searchTerm', searchTerm]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); } } function emarsysPushPurchase(customerUidPk, orderNo, itemArray, mobile, testMode) { if (!isBlank(orderNo)) { if (!isEmpty(customerUidPk)) { ScarabQueue.push(['setCustomerId', customerUidPk]); } ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); ScarabQueue.push(['purchase', { orderId: orderNo, items: itemArray }]); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); } } function emarsysPushDefault(customerUidPk, mobile, testMode) { if (!isEmpty(customerUidPk)) { ScarabQueue.push(['setCustomerId', customerUidPk]); } ScarabQueue.push(['cart', []]); emarsysSetTestMode(testMode); emarsysAddMobileTag(mobile); ScarabQueue.push(['go']); }; function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = \"expires=\" + d.toUTCString(); document.cookie = cname + \"=\" + cvalue + \";\" + expires + \";path=/\"; }; $(function() { $('#select-delivery-cta, #header-postcode, #lux-select-delivery-cta').on('click', function() { toggleLocationModalLUX(); }); var deliverEstimateFlag = getParameterByName(\"deliveryEstimate\", window.location.href); if (deliverEstimateFlag && deliverEstimateFlag === '1') { toggleLocationModalLUX(); } $(document).on('submit', '#delivery-estimate-form-header', function(e) { e.preventDefault(); var _this = $(this); var postcode = $(this).find('#apply-delivery-input-postcode-header').val(), suburb = $(this).find('#apply-delivery-input-suburb-header').val(); if (postcode === '' suburb === '') { $(\"#delivery-input-wrapper\").find(\".input-error\").show(); $(\"#apply-delivery-input-header\").css({ \"border\": \"1px solid red\" }); return false; } $(\"#delivery-input-wrapper\").find(\".input-error\").hide(); $(\"#apply-delivery-input-header\").css({ \"border\": \"1px solid #ccc\" }); var animateContainer = \"#delivery-location-selector\"; if (window.BKT_GLOBALS.isMobileSession) { animateContainer = \".b-modal-content\"; } $(this).parents(animateContainer).append('' + '' + ''); setTimeout(function() { if (window.BKT_GLOBALS.isMobileSession) { closeBooktopiaNotification('#booktopia-notification-wrapper'); } else { $('#delivery-location-selector').toggle(); } setPostcodeAndSuburb(postcode, suburb); initDeliveryLocation(false); _this.parents(animateContainer).find('.loader-container').fadeOut(100, function() { $(this).remove(); }); }, 2000); }); $(document).on('click', '#delivery-location-selector .cancel', function(e) { e.preventDefault(); $('#delivery-location-selector').hide(); }); $(window).on('click', function(e) { if ($(e.target).closest('#select-delivery-wrapper')[0] !== jQuery( '#select-delivery-wrapper')[0]) { $('#delivery-location-selector').hide(); } }); $(window).on('load', function() { if (window.BKT_GLOBALS.occasion.enabled && window.BKT_GLOBALS.occasion.occasionName !== \"\" && jQuery('#product').length > 0) { $.ajax({ method: \"GET\", url: '/news236.html' }).done(function(result) { content = $('').append(result).find('#content').html(); if (window.BKT_GLOBALS.isMobileSession) { $('#tab-occasion').html(content); } else { $('#delivery').html(content); } }); } }); }) function selectSuburb() { $('#apply-delivery-input-header').autocomplete({ width: 233, minChars: 3, maxHeight: 600, appendTo: $('#delivery-input-wrapper'), lookup: function(query, done) { jQuery(\"#apply-delivery-input-suburb-header\").val(query); correctPostcode = false; geographyController.getSuburbsForPostCode(\"AU\", query, function(suburbs) { var result = []; if (suburbs.length > 0) { correctPostcode = true; $('#apply-delivery-input-suburb-header').val(suburbs[0]); $('#apply-delivery-input-postcode-header').val(query); for (var i = 0; i < suburbs.length; i++) { result.push({ data: query, value: suburbs[i] }); } } else { $('#apply-delivery-input-suburb-header').val(''); $('#apply-delivery-input-postcode-header').val(''); } done({ suggestions: result }); }); }, onSelect: function(selected) { $('#apply-delivery-input-header').val(''); $('#apply-delivery-input-postcode-header').val(selected.data); $(\"#apply-delivery-input-suburb-header\").val(selected.value); setPostcodeAndSuburb(selected.data, selected.value); $('#delivery-estimate-form-header').trigger('submit'); }, formatResult: function(suggestion, currentValue) { return '' + suggestion.data + ' - ' + suggestion.value + ''; }, }); } function toggleLocationModalLUX() { var localPostcode = localStorage.getItem('postcode'); appendModalTemplate(\"#delivery-location-selector\", \"#delivery-location-selector-template\"); if (window.BKT_GLOBALS.isMobileSession) { if (localPostcode !== null) { $('#delivery-notification-modal').find('h3').text('Change your Delivery Location'); } openBooktopiaNotification(\"#delivery-notification-modal\"); } else { if (localPostcode !== null) { $('#delivery-location-selector').find('h3').text('Change your Delivery Location'); } $('#delivery-location-selector').toggle(); } selectSuburb(); } function displayDeliveryIcon() { var themeStyle = window.BKT_GLOBALS.occasion.theme, occasionName = window.BKT_GLOBALS.occasion.occasionName, style = 'style=\"' + themeStyle + '\"'; $('.delivery-icon,.arrives-by-text').remove(); var html = 'Arrives by ' + occasionName + ''; var htmlWithText = 'Arrives By ' + occasionName + ''; if (window.BKT_GLOBALS.isMobileSession) { $('.delivery-icon-pdp').remove(); $('.in-stock').closest('li.container').find('a').append(html); if ($('#product-browse').length > 0 $('#wishlist-container').length > 0) { $('.in-stock').closest('.product').find('.image a').append(html); $('.in-stock').closest('.product').find('.container-prod-details ').prepend(htmlWithText); } } else { $('.in-stock').closest('.product').find('.image a').append(html); } } function initDeliveryLocation(session) { if (window.BKT_GLOBALS.occasion.enabled !== \"true\") return false; localStorage.removeItem('inStockDeliveryForPostcode'); var isPDP = $('#product').length > 0, isCart = window.BKT_GLOBALS.currentNav === \"shopping-cart\", localPostcode = localStorage.getItem('postcode'), localSuburb = localStorage.getItem('suburb'), cutoffDate = window.BKT_GLOBALS.occasion.cutoffDate, themeStyle = window.BKT_GLOBALS.occasion.theme, occasionName = window.BKT_GLOBALS.occasion.occasionName, style = 'style=\"' + themeStyle + '\"'; if (localPostcode && localSuburb) { var postcode = localPostcode, suburb = localSuburb; } else if (session.signedIn && session.zipOrPostalCode) { var postcode = session.zipOrPostalCode, suburb = session.suburb; setPostcodeAndSuburb(postcode, suburb); } if (postcode !== undefined && suburb !== undefined) { $('#header-postcode').css({ 'display': 'flex' }); if (window.BKT_GLOBALS.isMobileSession) { $('#header-postcode').find('span').text(postcode); $('#select-delivery-cta').hide(); } else { $('#select-delivery-cta').html('' + '' + 'Deliver to ' + '' + postcode + ', ' + suburb + ' 153554b96e