if (com == undefined) var com = {}; if (com.openlane == undefined) com.openlane = {}; if (com.openlane.auction == undefined) com.openlane.auction = {}; if (com.openlane.auction.watchlist == undefined) com.openlane.auction.watchlist = {}; if (com.openlane.auction.admin == undefined) com.openlane.auction.admin = {}; var ssotokenFromAPI = ''; if (ssotokenFromAPI) { com.openlane.auction.ssotoken = ssotokenFromAPI; } com.openlane.auction._baseUrl = 'https://api.kar-hosting.com/login-context-web-api'; com.openlane.auction._imolaUrl = 'https://api.kar-hosting.com/auction-engine-web-api'; com.openlane.auction._imgServerScriptUrl = 'https://img.autc.com'; com.openlane.auction.getValue = function(value) { return value ? encodeURIComponent(value) : ""; } com.openlane.auction.getLocaleStr = function(value) { var localeStr = "en"; if (com.openlane.auction.getValue(value) == "fr-ca") { localeStr = "fr"; } return localeStr; } com.openlane.auction.getContentForDocURL = function(url, callback){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imgServerScriptUrl + '/serve.php?' + 'cb=' + callback + '&doc=' + url; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction._sendServiceRequest = function(url){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction._sendRequest = function(urlComponent){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + urlComponent; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction._sendPostRequest = function(urlComponent,params){ var httpReq = new XMLHttpRequest(); httpReq.open("POST",urlComponent,true); httpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); httpReq.setRequestHeader("Accept","*/*"); httpReq.onreadystatechange = function() { if((httpReq.readyState==4) && (httpReq.status==200)) { var script = document.createElement('script'); script.type = 'text/javascript'; script.innerHTML = httpReq.responseText; document.getElementsByTagName('head')[0].appendChild(script); } }; httpReq.send(params); } com.openlane.auction._sendServiceRequest2 = function(url, jstate){ var xhr = new XMLHttpRequest(); xhr.open("GET", url); xhr.setRequestHeader("_jstate", jstate); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { var script = document.createElement('script'); script.type = 'text/javascript'; script.text = xhr.responseText; document.getElementsByTagName('head')[0].appendChild(script); }}; xhr.send(); } com.openlane.auction.getUserContext = function(orgId, privateLabelId, callback){ com.openlane.auction._getUserContext = function(status){ if("SUCCESS" == status){ if(sessvars.user_orgId && sessvars.user_privateLabelId){ //Have orgid and privateLabelId //Check if orgId/privateLabelId changed if(sessvars.user_orgId == orgId && sessvars.user_privateLabelId == privateLabelId){ if(sessvars.imolaUserLoginContext){ com.openlane.auction.executeFunctionByName(callback, "SUCCESS",new com.openlane.auction.UserLoginContext(sessvars.imolaUserLoginContext)); return true; } }else{ sessvars.$.clearMem(); } } sessvars.user_orgId = orgId; sessvars.user_privateLabelId = privateLabelId; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._baseUrl + '/login.json?' + 'callback=' + callback + '&orgid=' + orgId + '&plid=' + privateLabelId; document.getElementsByTagName('head')[0].appendChild(script); } } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/preUserLogin.json?callback=com.openlane.auction._getUserContext'; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction.getSsoUserContext = function(callback){ var orgId = ''; var plId = ''; if (orgId == undefined){ eval(callback + '("STATE_ERROR", "No organization (ORGID) id in HTTP request")'); return; } if (plId == undefined){ eval(callback + '("STATE_ERROR", "No private label id (PLID) in HTTP request")'); return; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._baseUrl + '/login.json?' + 'callback=' + callback + '&orgid=' + orgId + '&plid=' + plId; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction.getLoginContext = function(privateLabelId, callback){ com.openlane.auction._getLoginContext = function(status){ if(status == "SUCCESS"){ if(sessvars.imolaLoginContext &&(privateLabelId==sessvars.imolaLoginContext._salesVenue ) ){ com.openlane.auction.executeFunctionByName(callback, "SUCCESS",new com.openlane.auction.LoginContext(sessvars.imolaLoginContext)); //window[callback]("SUCCESS",new com.openlane.auction.LoginContext(sessvars.imolaLoginContext)); //eval(callback + '("SUCCESS",' + sessvars.imolaLoginContext +')'); }else{ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._baseUrl + '/salesVenueLogin.json?' + 'callback=' + callback + '&plid=' + privateLabelId; document.getElementsByTagName('head')[0].appendChild(script); } } } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/preLogin.json?callback=com.openlane.auction._getLoginContext'; setTimeout(function(){document.getElementsByTagName('head')[0].appendChild(script)}, 150); } //Definitions of all contexts com.openlane.auction.VehicleContext = function(ctx){ this.getPlId = function(){ return ctx.plId; } this.getCarGroupId = function() { return ctx.carGroupId; } this.getOrgIdWatching = function(){ return ctx.orgIdWatching; } this.getVehicleId = function(){ return ctx.vehicleId; } this.getVin = function(){ return ctx.vin; } this.getYear = function(){ return ctx.year; } this.getMakeName = function(){ return ctx.makeName; } this.getModelName = function(){ return ctx.modelName; } this.getSeriesName = function(){ return ctx.seriesName; } this.getInteriorColorDesc = function() { return ctx.interiorColorDesc; } this.getExteriorColorDesc = function() { return ctx.exteriorColorDesc; } this.getMileage = function(){ return ctx.mileage; } this.getEngine = function(){ return ctx.engine; } this.getGradeLabel = function(){ if (ctx.gradeLabel == undefined) { return null; } else { return ctx.gradeLabel; } } this.getGradeShortLabel = function(){ if (ctx.gradeShortLabel == undefined) { return null; } else { return ctx.gradeShortLabel; } } this.getGrade = function(){ if (ctx.grade == undefined) { return null; } else { return ctx.grade; } } this.getNotRunnable = function(){ if (ctx.notRunnable == undefined) { return null; } else { return ctx.notRunnable; } } this.getIsDriveable = function(){ if (ctx.isDriveable == undefined) { return null; } else { return ctx.isDriveable; } } this.getDisplayVHR = function(){ if (ctx.displayVHR == undefined) { return null; } else { return ctx.displayVHR; } } this.getKeys = function(){ if (ctx.keys == undefined) { return null; } else { return ctx.keys; } } this.getOdors = function(){ if (ctx.odors == undefined) { return null; } else { return ctx.odors; } } this.getManuals = function(){ if (ctx.manuals == undefined) { return null; } else { return ctx.manuals; } } this.getSellerOrgName = function(){ return ctx.sellerOrgName; } this.getThumbnailPath = function(){ return ctx.thumbnailPath; } this.isBasicListing = function(){ return ctx.isBasicListing; } this.isManualHold = function(){ return ctx.isManualHold; } this.getUserNote = function(){ return ctx.userNote; } this.getStateAbbr = function(){ return ctx.stateAbbr; } this.getUom = function(){ return ctx.uom; } this.getConditionTypeId = function(){ return ctx.conditionTypeId; } this.getMvdaCleanIndicator = function(){ return ctx.mvdaCleanIndicator; } this.getVehicleReviewed = function(){ return ctx.vehicleReviewed; } this.getVehicleChangedSinceLastReview = function(){ return ctx.vehicleChangedSinceLastReview; } this.getShowStarToBuyer = function(){ return ctx.showStarToBuyer; } this.getShowDataToBuyer = function(){ return ctx.showDataToBuyer; } this.getInspectionSourceId = function() { return ctx.inspectionSourceId; } this.getPsiOption = function() { return ctx.psiOption; } this.isPdi = function() { return ctx.pdi; } this.isPsi = function() { return ctx.psi; } this.getSellerPerformanceTotal = function() { return ctx.sellerPerformanceTotal; } this.getAutocheckConfigured = function() { return ctx.autocheckConfigured; } this.getAutocheckException = function() { return ctx.autocheckException; } this.getAutocheckDiscrepancy = function() { return ctx.autocheckDiscrepancy; } this.getSellerOrgId = function(){ return ctx.sellerOrgId; } this.getSellerAgentId = function(){ return ctx.sellerAgentId; } this.getSpecials = function() { return ctx.specials; } this.getState = function() { return ctx._jstate; } this.getProcessLocation = function() { return ctx.processLocation; } this.isInTransit = function(){ return ctx.isInTransit; } this.getLongitude = function(){ return ctx.longitude; } this.getLatitude = function(){ return ctx.latitude; } this.getGeofence = function(){ return ctx.geofence; } this.getScanDate = function(){ return ctx.scanDate; } this.getOfferedFrom = function(){ return ctx.offeredFrom; } this.addUserNote = function(note, callback){ com.openlane.auction._addUserNote = function(status, result){ if (status == 'SUCCESS'){ ctx.userNote = note; } delete com.openlane.auction._addUserNote; eval(callback + '("' + status + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/addUserNote.json?' + 'vid=' + ctx.vehicleId + '&n=' + escape(note) + '&callback=com.openlane.auction._addUserNote' + '&_jstate=' + ctx._jstate; document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.LiveBlockContext = function(ctx){ this.isClosed = function(){ return ctx.isClosed; } this.getEventId = function(){ return ctx.liveBlockEventId; } this.getSaleDate = function(){ return ctx.saleDate; } this.getRunNumber = function(){ return ctx.runNumber; } this.getLaneNumber = function(){ return ctx.laneNumber; } this.getConsignorGroup = function(){ return ctx.consignorGroup; } this.isPromotion = function(){ return ctx.isPromotion; } this.getConditionTypeId = function(){ return ctx.conditionTypeId; } this.isSold = function(){ return ctx.isSold; } this.isPostSaleInspection = function() { return ctx.postSaleInspection; } this.isJoinAllowed = function() { return ctx.joinAllowed; } this.isAutobidAllowed = function(){ return ctx.autobidAllowed; } this.simulcastEventUrl = function() { if(ctx.simulcastEventUrl != undefined) { return ctx.simulcastEventUrl; } } this.simulcastAuctionUrl = function() { if (ctx.simulcastAuctionUrl != undefined) { return ctx.simulcastAuctionUrl } } this.getAutobidAmount = function() { return ctx.autobidAmount; } this.isAutobidRemoved = function(){ return ctx.autobidRemoved; } } com.openlane.auction.RunListContext = function(ctx){ this.isClosed = function(){ return ctx.isClosed; } this.getSaleDate = function(){ return ctx.saleDate; } this.getRunNumber = function(){ return ctx.runNumber; } this.getLaneNumber = function(){ return ctx.laneNumber; } this.getConsignorGroup = function(){ return ctx.consignorGroup; } this.getConditionTypeId = function(){ return ctx.conditionTypeId; } this.isSold = function(){ return ctx.isSold; } this.isPostSaleInspection = function() { return ctx.postSaleInspection; } } com.openlane.auction.IfBidContext = function(ctx){ this.getAuctionId = function(){ return ctx.auctionId; } this.getAuctionResolveTime = function(){ return ctx.auctionResolveTime; } this.getTimeRemainingForIfBid = function() { return ctx.timeRemainingForIfBid; } this.getIfBidBuyPrice = function(){ return ctx.ifBidBuyPrice; } this.getVehicleId = function(){ return ctx.vehicleId; } //Vehicle Info this.getYear = function(){ return ctx.year; } this.getMakeName = function(){ return ctx.makeName; } this.getModelName = function(){ return ctx.modelName; } this.getSeriesName = function(){ return ctx.seriesName; } this.getVin = function(){ return ctx.vin; } this.getMileage = function(){ return ctx.mileage; } this.getInteriorColorDesc = function() { return ctx.interiorColorDesc; } this.getExteriorColorDesc = function() { return ctx.exteriorColorDesc; } this.getThumbnailPath = function(){ return ctx.thumbnailPath; } this.getSellerOrgName = function(){ return ctx.sellerOrgName; } this.isDeclineBuyAllowed = function(){ return ctx.declineBuyAllowed; } //for watchlist this.getVehicleInfo = function() { return ctx.vehicleInfo; } this.getTimeRemaining = function() { return ctx.formattedTimeRemainingForIfBid; } this.getNumberOfBids = function() { return ctx.numberOfBids; } this.getBidHistoryUrl = function() { return ctx.bidHistoryUrl; } this.getMaxBid = function() { return ctx.userMaxBid; } this.getProcessLocation = function() { return ctx.processLocation; } this.isInTransit = function(){ return ctx.isInTransit; } this.getLongitude = function(){ return ctx.longitude; } this.getLatitude = function(){ return ctx.latitude; } this.getGeofence = function(){ return ctx.geofence; } this.getScanDate = function(){ return ctx.scanDate; } this.declineIfBidBuy = function(callback){ if ( ! (com.openlane.auction._submitCallbackDeclineIfBidBuy == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackDeclineIfBidBuy = function(status, result){ delete com.openlane.auction._submitCallbackDeclineIfBidBuy; eval(callback + '("' + status + '","' + result + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/declineIfBidBuy.json?' + 'aid=' + ctx.auctionId + '&callback=com.openlane.auction._submitCallbackDeclineIfBidBuy' + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.watchlist.WatchlistContext = function(ctx){ this.getSections = function(){ return ctx.sections; } this.getSectionVehiclesPdfURL = function(loginId, effLoginId, privateLabelId, callback, section, optionalParams) { var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } return com.openlane.auction._imolaUrl + '/salesvenue/pdfExportWatchlist.api?' + 'localeStr='+localeString + '&wlsection='+section + '&plId=' + privateLabelId + '&loginId=' + loginId + '&effLgnId=' + effLoginId + '&t='+ new Date().getTime() + '&callback='+callback ; } this.getSectionVehiclesExcelURL = function(loginId, effLoginId, privateLabelId, callback, section, optionalParams) { var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } return com.openlane.auction._imolaUrl + '/salesvenue/excelExportWatchlist.api?' + 'localeStr='+localeString + '&wlsection='+section + '&plId=' + privateLabelId + '&loginId=' + loginId + '&effLgnId=' + effLoginId + '&t='+ new Date().getTime() + '&callback='+callback ; } this.getSectionFilteredVehiclesExcelURL = function(loginId, effLoginId, privateLabelId, callback, section, optionalParams, filtersArr) { var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } return com.openlane.auction._imolaUrl + '/salesvenue/excelExportWatchlist.api?' + 'localeStr='+localeString + '&wlsection='+section + '&plId=' + privateLabelId + '&loginId=' + loginId + '&effLgnId=' + effLoginId + '&t='+ new Date().getTime() + '&callback='+callback + this.getFilterParamStr(filtersArr) + this.getSortParamStr(filtersArr) ; } this.getSectionFilteredVehiclesPdfURL = function(loginId, effLoginId, privateLabelId, callback, section, optionalParams, filtersArr) { var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } return com.openlane.auction._imolaUrl + '/salesvenue/pdfExportWatchlist.api?' + 'localeStr='+localeString + '&wlsection='+section + '&plId=' + privateLabelId + '&loginId=' + loginId + '&effLgnId=' + effLoginId + '&t='+ new Date().getTime() + '&callback='+callback + this.getFilterParamStr(filtersArr) + this.getSortParamStr(filtersArr) ; } this.getFilterParamStr = function(filterArr){ var filterString = ""; if(filterArr) { if(filterArr.ac){ for (var i=0; i < filterArr.ac.length; i++) { filterString = filterString + "&ac=" + filterArr.ac[i]; } } if(filterArr.bsts){ for (var i=0; i < filterArr.bsts.length; i++) { filterString = filterString + "&bsts=" + filterArr.bsts[i]; } } if(filterArr.loc){ filterString = filterString + "&loc=" + filterArr.loc; } if(filterArr.st){ filterString = filterString + "&st=" + filterArr.st; } if(filterArr.adt){ filterString = filterString + "&adt=" + filterArr.adt; } if(filterArr.ln){ filterString = filterString + "&ln=" + filterArr.ln; } if(filterArr.slr){ filterString = filterString + "&slr=" + filterArr.slr; } if(filterArr.lbe){ filterString = filterString + "&lbe=" + filterArr.lbe; } if(filterArr.lbc){ filterString = filterString + "&lbc=" + filterArr.lbc; } if(filterArr.ab){ filterString = filterString + "&ab=" + filterArr.ab; } if(filterArr.ac){ filterString = filterString + "&ac=" + filterArr.ac; } } return filterString; } this.getSortParamStr = function(filterArr){ var sortString = ""; if(filterArr && filterArr.sort) { if(filterArr.sort.sortBy){ sortString += "&sortBy=" + filterArr.sort.sortBy; if(filterArr.sort.asc){ sortString += "&asc=" + filterArr.sort.asc; } } } return sortString; } this.getSectionVehiclesExcel = function(loginId, effLoginId, privateLabelId, callback, section, optionalParams) { var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/excelExportWatchlist.api?' + 'localeStr='+localeString + '&wlsection='+section + '&plId=' + privateLabelId + '&loginId=' + loginId + '&effLgnId=' + effLoginId + '&t='+ new Date().getTime() + '&callback='+callback ; document.getElementsByTagName('head')[0].appendChild(script); } this.setSortBy = function(sSortBy){ ctx.sortBy = sSortBy; } this.setSortAsc = function(sSortAsc){ ctx.sortAsc = sSortAsc; } this.setSortCriteria = function(sortCriteriaObj){ if(sortCriteriaObj && sortCriteriaObj.sort){ if(sortCriteriaObj.sort.sortBy){ ctx.sortBy = sortCriteriaObj.sort.sortBy; if(sortCriteriaObj.sort.asc){ ctx.sortAsc = sortCriteriaObj.sort.asc; } } } } this.clearSortCriteria = function(){ ctx.sortAsc = undefined; ctx.sortBy = undefined; } this.setFilters = function(winnowingfilters){ ctx.filters = winnowingfilters; } this.clearFilters = function(winnowingfilters){ this.filters = undefined; } this.setCriteria = function(criteriaObject){ if(criteriaObject){ if(criteriaObject.ac){ ctx.ac = criteriaObject.ac; } if(criteriaObject.bsts){ ctx.bsts = criteriaObject.bsts; } if(criteriaObject.loc){ ctx.loc = criteriaObject.loc; } if(criteriaObject.st){ ctx.st = criteriaObject.st; } if(criteriaObject.adt){ ctx.adt = criteriaObject.adt; } if(criteriaObject.ln){ ctx.ln = criteriaObject.ln; } if(criteriaObject.slr){ ctx.slr = criteriaObject.slr; } if(criteriaObject.lbe){ ctx.lbe = criteriaObject.lbe; } if(criteriaObject.lbc){ ctx.lbc = criteriaObject.lbc; } if(criteriaObject.ab){ ctx.ab = criteriaObject.ab; } if(criteriaObject.ac){ ctx.ac = criteriaObject.ac; } } } this.clearCriteria = function(){ ctx.ac = undefined; ctx.loc = undefined; ctx.st = undefined; ctx.adt = undefined; ctx.ln = undefined; ctx.slr = undefined; ctx.bsts = undefined; ctx.lbe = undefined; ctx.lbc = undefined; ctx.ab = undefined; ctx.ac = undefined; } this.getSectionVehicles = function(callback, section, optionalParams, languageCode, orgId){ var addnlParamMap = optionalParams || {"locale":"en-us"}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/fetchWatchlistSection.json?' + 'localeStr='+localeString + '&wlsection='+section + '&t='+ new Date().getTime() + '&callback='+callback + '&_jstate=' + ctx._jstate; if(languageCode != undefined) { script.src += '&languageCode=' + languageCode; } if (orgId != undefined) { script.src += '&orgId=' + orgId; } if(ctx.filters && ctx.filters.length > 0){ var filter = ctx.filters.join(","); script.src = script.src + "&filters=" + filter; } if(ctx.ac){ for (var i=0; i < ctx.ac.length; i++) { script.src = script.src + "&ac=" + ctx.ac[i]; } } if(ctx.bsts){ for (var i=0; i < ctx.bsts.length; i++) { script.src = script.src + "&bsts=" + ctx.bsts[i]; } } if(ctx.loc){ script.src = script.src + "&loc=" + ctx.loc; } if(ctx.st){ script.src = script.src + "&st=" + ctx.st; } if(ctx.adt){ script.src = script.src + "&adt=" + ctx.adt; } if(ctx.ln){ script.src = script.src + "&ln=" + ctx.ln; } if(ctx.slr){ script.src = script.src + "&slr=" + ctx.slr; } if(ctx.lbe){ script.src = script.src + "&lbe=" + ctx.lbe; } if(ctx.ab){ script.src = script.src + "&ab=" + ctx.ab; } if(ctx.ac){ script.src = script.src + "&ac=" + ctx.ac; } if(ctx.bsts){ script.src = script.src + "&bsts=" + ctx.bsts; } if(ctx.lbc){ script.src = script.src + "&lbc=" + ctx.lbc; } if(ctx.sortBy){ script.src = script.src + "&sortBy=" + ctx.sortBy; if(ctx.sortAsc){ script.src = script.src + "&asc=" + ctx.sortAsc; } } document.getElementsByTagName('head')[0].appendChild(script); } this.updateContext = function(callback){ if ( ! (com.openlane.auction._submitCBupdateWC == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCBupdateWC = function(status, result){ if (status == 'SUCCESS'){ ctx.sections = result.sections; } delete com.openlane.auction._submitCBupdateWC; eval(callback + '("' + status + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/updateWatchlistContext.json?' + 'callback=com.openlane.auction._submitCBupdateWC' + '&_jstate=' + ctx._jstate; document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.watchlist.WatchlistContext.BIDDING = 1; com.openlane.auction.watchlist.WatchlistContext.WATCHING = 2; com.openlane.auction.watchlist.WatchlistContext.PURCHASED = 3; com.openlane.auction.watchlist.WatchlistContext.LOST = 4; com.openlane.auction.watchlist.WatchlistContext.BESTOFFERS = 5; com.openlane.auction.watchlist.WatchlistContext.IFBIDS = 6; com.openlane.auction.watchlist.WatchlistContext.BASICLISTING_INTERESTED = 7; com.openlane.auction.watchlist.WatchlistContext.WATCHING_ALL = 8; com.openlane.auction.BidContext = function(ctx) { var _attribs = new Object(); this.getAuctionId = function(){ return ctx.auctionId; } this.getVehicleId = function(){ return ctx.vehicleId; } this.getVin = function(){ return ctx.vin; } this.getPrice = function(){ return ctx.bidPrice; } this.getPrevProxyBidAmt = function(){ return ctx.prevProxyBidAmt; } this.getBidPrice = function(){ return ctx.bidPrice; } this.getBuyPrice = function(){ return ctx.buyPrice; } this.getTotalPrice = function(){ return ctx.totalPrice; } this.getTotalTax = function(){ return ctx.totalTax; } this.getPaymentMethods = function(){ return ctx.paymentMethods; } this.getPaymentInstructions = function(){ return ctx.pmtInstr; } this.getPreviousBidInfo = function(){ return ctx.previousBidInfo; } this.getFordCPOIncentive = function(){ return ctx.fordCPOIncentive; } this.setFordCPOIncentive = function(f) { ctx.fordCPOIncentive = f; } this.getServiceTypes = function(){ return ctx.serviceTypes; } this.getLineItems = function(){ return ctx.lineItems; } this.getSelectedRwds = function(){ return ctx.selectedRwds; } this.getAvailableRwds = function(){ return ctx.availableRwds; } this.getRemovedRwds = function(){ return ctx.removedRwds; } this.getRwdMessageCode = function(){ return ctx.rwdMessage; } this.getTransportLineItems = function(){ return ctx.transportLineItems; } this.getBasePriceTax = function(){ return ctx.basePriceTax; } this.setBidPrice = function(p) { ctx.bidPrice = p; } this.setPaymentMethodId = function(p){ ctx.paymentMethodId = p; } this.setBranchCode = function(b){ ctx.branchCode = b; } this.setDealerOrgId = function(d){ ctx.dealerOrgId = d; } this.setDeftCreditLineAccount = function(d){ ctx.deftCreditLineAccount = d; } this.getBidIncrement = function(){ return ctx.bidIncrement; } this.setTransportPreference = function(t){ ctx.transportPreference = t; } this.setTransportMoveType = function(t){ ctx.transportMoveTypeId = t; } this.setTradeInCreditId = function(t){ ctx.tradeInCreditId = t } this.setServices = function(s){ ctx.svc = s; } this.setCoupons = function(cpn, validateCpn) { ctx.cpn = cpn; ctx.validateCpn = validateCpn; } this.setRewards = function(rwd, validateRwd) { ctx.rwd = rwd; ctx.validateRwd = validateRwd; } this.setLocale = function(locale) { ctx.locale = locale; } this.getReductionTotal = function() { return ctx.reductionTotal; } this.addAttribute = function(a, val){ _attribs[a] = val; } this.removeAttribute = function(a){ delete _attribs[a]; } this.addToWatchlist = function(w){ ctx.addToWatchlist = w; } this.getMessage = function(){ return ctx.message; } this.getRemainingAuctionTime = function() { return ctx.remainingAuctionTime; } this.getRemainingAuctionTimeAsNumber = function() { return ctx.remainingAuctionTimeAsNumber; } this.isReserveMet = function() { return ctx.reserveMet; } this.getSettlement = function(){ return ctx.settlement; } this.canRebid = function() { return ctx.canRebid; } this.getTransportEstDeliveryDays = function(){ return ctx.transportEstDeliveryDays; } this.isTitleAbsent = function(){ return ctx.titleAbsent; } this.getSellerTermsAndConditions = function(){ return ctx.sellerTermsAndConditions; } this.getTransportTermsAndConditions = function(){ return ctx.transportTermsAndConditions; } this.getTradeInCredit = function(){ return ctx.tradeInCredit; } this.submitBid = function(bidAmountEntered, callback, isHardBid, preProxyBid){ if ( ! (com.openlane.auction._submitCallbackSubmitBid == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } ctx.svc = com.openlane.auction._addTransportAsSvc(ctx.svc, ctx.transportPreference); if(com.openlane.auction._validateServices(ctx.serviceTypes, ctx.svc, _attribs) == false) { ctx.message = "Mandatory Service is not selected"; eval(callback + '("PARAM_ERROR")'); return; } com.openlane.auction._submitCallbackSubmitBid = function(status, result){ if (status == 'PARAM_ERROR' || status == 'INVALID_PAYMENT_METHOD_DETAILS') { ctx.message = result.emsg; } else if (status == 'SUCCESS' || status == 'OUTBID' || status == 'BELOW_MINIMUM' || status == 'INVALID_INCREMENT' || status == 'ABOVE_BUY_NOW' || status == 'OP_NOT_ALLOWED' || status == 'BELOW_RESERVE' || status == 'INSUFFICIENT_CREDIT'){ ctx.bidPrice = result.bidPrice; ctx.buyPrice = result.buyPrice; ctx.remainingAuctionTime = result.remainingAuctionTime; ctx.reserveMet = result.reserveMet; ctx.state = result.state; ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackSubmitBid; eval(callback + '("' + status + '")'); } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var url = com.openlane.auction._imolaUrl + '/bid.json'; var params = 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&bidAmountEntered=' + bidAmountEntered + '&isHardBid=' + isHardBid + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&callback=com.openlane.auction._submitCallbackSubmitBid' + '&_jstate=' + ctx.state + '&addtoWL=' + ctx.addToWatchlist + '&tic=' + ctx.tradeInCreditId + '&taid=' + ctx.transportTermsAndConditions['id'] + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd) + '&preProxyBid=' + preProxyBid + '&fcpoIncentive=' + ctx.fordCPOIncentive; if(com.openlane.auction.ssotoken != ''){ params += ('&x-openlane-authentication=' + encodeURIComponent(com.openlane.auction.ssotoken)); } com.openlane.auction._sendPostRequest(url,params); } this.rebid = function(bidAmountEntered, callback, isHardBid){ if(ctx.canRebid == false) { eval(callback + '("OP_NOT_ALLOWED", "Rebidding is not allowed")'); return; } if ( ! (com.openlane.auction._submitCallbackRebid == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackRebid = function(status, result){ if (status == 'PARAM_ERROR' || status == 'INVALID_PAYMENT_METHOD_DETAILS') { ctx.message = result.emsg; } else if (status == 'SUCCESS' || status == 'OUTBID' || status == 'BELOW_MINIMUM' || status == 'INVALID_INCREMENT' || status == 'ABOVE_BUY_NOW' || status == 'OP_NOT_ALLOWED' || status == 'BELOW_RESERVE' || status == 'INSUFFICIENT_CREDIT'){ ctx.bidPrice = result.bidPrice; ctx.buyPrice = result.buyPrice; ctx.remainingAuctionTime = result.remainingAuctionTime; ctx.reserveMet = result.reserveMet; ctx.state = result.state; ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackRebid; eval(callback + '("' + status + '")'); } var scriptSrc = com.openlane.auction._imolaUrl + '/rebid.json?' + 'bidAmountEntered=' + bidAmountEntered + '&isHardBid=' + isHardBid + '&taid=' + ctx.transportTermsAndConditions['id'] + '&callback=com.openlane.auction._submitCallbackRebid' + '&_jstate=' + ctx.state; var nwToken = _attribs["x-nw-token"]; if (nwToken) { scriptSrc += "&x-nw-token=" + nwToken; } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = scriptSrc; document.getElementsByTagName('head')[0].appendChild(script); } this.updateContext = function(callback){ if ( ! (com.openlane.auction._submitCallbackUpdateBidContext == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackUpdateBidContext = function(status, result){ if (status == 'SUCCESS'){ //ctx.minimumBidAmount = result.bidPrice; ctx.state = result.state; ctx.lineItems = result.lineItems; ctx.selectedRwds = result.selectedRwds; ctx.availableRwds = result.availableRwds; ctx.removedRwds = result.removedRwds; ctx.rwdMessage = result.rwdMessage; ctx.transportLineItems = result.transportLineItems; ctx.paymentMethods = result.paymentMethods; ctx.serviceTypes = result.serviceTypes; ctx.basePriceTax = result.basePriceTax; ctx.pmtInstr = result.pmtInstr; ctx.transportEstDeliveryDays = result.transportEstDeliveryDays; ctx.reductionTotal = result.reductionTotal; ctx.previousBidInfo = result.previousBidInfo; } else { ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackUpdateBidContext; eval(callback + '("' + status + '")'); } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var url = com.openlane.auction._imolaUrl + '/updateprice.json'; var params = 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&bid=' + ctx.bidPrice + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&op=bid' + '&callback=com.openlane.auction._submitCallbackUpdateBidContext' + '&_jstate=' + ctx.state + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&validateCpn=' + com.openlane.auction.getValue(ctx.validateCpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd) + '&validateRwd=' + com.openlane.auction.getValue(ctx.validateRwd) + '&localeStr=' + com.openlane.auction.getLocaleStr(ctx.locale); if(ctx.languageCode != '') { params += '&languageCode=' + ctx.languageCode; } if(com.openlane.auction.ssotoken != ''){ params += '&x-openlane-authentication=' +encodeURIComponent(com.openlane.auction.ssotoken); } com.openlane.auction._sendPostRequest(url,params); } } //Constants for TP_MOVE_TYPE_ID com.openlane.auction.BidContext.TP_MT_DOOR_TO_DOOR = 1; com.openlane.auction.BidContext.TP_MT_DOOR_TO_RAILYARD = 2; com.openlane.auction.BidContext.TP_MT_RAILYARD_TO_DOOR = 3; com.openlane.auction.BidContext.TP_MT_RAILYARD_TO_RAILYARD = 4; com.openlane.auction.BidContext.TP_MT_EXPEDITED_DOOR_TO_DOOR = 5; //Constants for ATTRIBUTES com.openlane.auction.BidContext.ATTRIB_FSLP = 'FSLP'; com.openlane.auction.BuyContext = function(ctx){ var _attribs = new Object(); this.getFordCPOIncentive = function(){ return ctx.fordCPOIncentive; } this.setFordCPOIncentive = function(f) { ctx.fordCPOIncentive = f; } this.getFpocText = function() { return ctx.fpocText; } this.getFpocButtonTooltip = function() { return ctx.fpocButtonTooltip; } this.getFpocPurchaseTypes = function() { return ctx.fpocPurchaseTypes; } this.getAuctionId = function(){ return ctx.auctionId; } this.getVehicleId = function(){ return ctx.vehicleId; } this.getVin = function(){ return ctx.vin; } this.getBuyPrice = function(){ return ctx.buyPrice; } this.getTotalPrice = function(){ return ctx.totalPrice; } this.getTotalTax = function(){ return ctx.totalTax; } this.getFpocText = function(){ return ctx.fpocText; } this.getGroundingPrice = function(){ return ctx.groundingPrice; } this.getBidPrice = function(){ return ctx.bidPrice; } this.getPaymentMethods = function(){ return ctx.paymentMethods; } this.getPaymentInstructions = function(){ return ctx.pmtInstr; } this.getServiceTypes = function(){ return ctx.serviceTypes; } this.getLineItems = function(){ return ctx.lineItems; } this.getSelectedRwds = function(){ return ctx.selectedRwds; } this.getAvailableRwds = function(){ return ctx.availableRwds; } this.getRemovedRwds = function(){ return ctx.removedRwds; } this.getRwdMessageCode = function(){ return ctx.rwdMessage; } this.getTransportLineItems = function(){ return ctx.transportLineItems; } this.getBasePriceTax = function(){ return ctx.basePriceTax; } this.getPayoutQuoteReference = function(){ return ctx.pqr; } this.setPaymentMethodId = function(p){ ctx.paymentMethodId = p; } this.setTransportPreference = function(t){ ctx.transportPreference = t; } this.setTransportMoveType = function(t){ ctx.transportMoveTypeId = t; } this.setApplySecurityDeposit = function(s){ ctx.applySecurityDeposit = s; } this.setPayoutQuoteReferenceId = function(s){ ctx.payoutQuoteReferenceId = s; } this.setAuctionBuyPriceOption = function(g){ ctx.auctionBuyPriceOptionId = g; } this.setBranchCode = function(b){ ctx.branchCode = b; } this.setDealerOrgId = function(d){ ctx.dealerOrgId = d; } this.setDeftCreditLineAccount = function(d){ ctx.deftCreditLineAccount = d; } this.setReplacementVin = function(g){ ctx.replacementVin = g; } this.setRemarketerLoginId = function(r){ ctx.remarketerLoginId = r } this.setTradeInCreditId = function(t){ ctx.tradeInCreditId = t } this.setServices = function(s){ ctx.svc = s; } this.setCoupons = function(cpn, validateCpn) { ctx.cpn = cpn; ctx.validateCpn = validateCpn; } this.setRewards = function(rwd, validateRwd) { ctx.rwd = rwd; ctx.validateRwd = validateRwd; } this.setLocale = function(locale) { ctx.locale = locale; } this.getReductionTotal = function() { return ctx.reductionTotal; } this.addAttribute = function(a, val){ _attribs[a] = val; } this.removeAttribute = function(a){ delete _attribs[a]; } this.addToWatchlist = function(w){ ctx.addToWatchlist = w; } this.getMessage = function(){ return ctx.message; } this.getSettlement = function(){ return ctx.settlement; } this.getTransportEstDeliveryDays = function(){ return ctx.transportEstDeliveryDays; } this.isTitleAbsent = function(){ return ctx.titleAbsent; } this.getSellerTermsAndConditions = function(){ return ctx.sellerTermsAndConditions; } this.getRemainingAuctionTime = function() { return ctx.remainingAuctionTime; } this.getRemainingAuctionTimeAsNumber = function() { return ctx.remainingAuctionTimeAsNumber; } this.getTransportTermsAndConditions = function(){ return ctx.transportTermsAndConditions; } this.getTradeInCredit = function(){ return ctx.tradeInCredit; } this.getRejectContext = function(){ return ctx.reject; } this.submitBuyNow = function(callback){ if ( ! (com.openlane.auction._submitCallbackBuyNow == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } ctx.svc = com.openlane.auction._addTransportAsSvc(ctx.svc, ctx.transportPreference); if(com.openlane.auction._validateServices(ctx.serviceTypes, ctx.svc, _attribs) == false) { ctx.message = "Mandatory Service is not selected"; eval(callback + '("PARAM_ERROR")'); return; } com.openlane.auction._submitCallbackBuyNow = function(status, result){ if (status == 'PARAM_ERROR' || status == 'ALREADY_PURCHASED' || status == 'AUCTION_ENDED' || status == 'OP_NOT_ALLOWED' || status == 'INSUFFICIENT_CREDIT' || status == 'INVALID_PAYMENT_METHOD_DETAILS') { ctx.message = result.emsg; } else if (status == 'SUCCESS'){ ctx.buyPrice = result.buyPrice; ctx.groundingPrice = result.groundingPrice; ctx.state = result.state; } delete com.openlane.auction._submitCallbackBuyNow; eval(callback + '("' + status + '")'); } if (ctx.applySecurityDeposit == undefined){ ctx.applySecurityDeposit = 0; } if (ctx.payoutQuoteReferenceId == undefined){ ctx.payoutQuoteReferenceId = -1; } if (ctx.auctionBuyPriceOptionId == undefined){ ctx.auctionBuyPriceOptionId = -1; } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var url = com.openlane.auction._imolaUrl + '/buy.json'; var params = 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&buy=' + ctx.buyPrice + '&asd=' + ctx.applySecurityDeposit + '&pqrid=' + ctx.payoutQuoteReferenceId + '&abpoid=' + ctx.auctionBuyPriceOptionId + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&callback=com.openlane.auction._submitCallbackBuyNow' + '&_jstate=' + ctx.state + '&addtoWL=' + ctx.addToWatchlist + '&taid=' + ctx.transportTermsAndConditions['id'] + '&rVin=' + ctx.replacementVin + '&tic=' + ctx.tradeInCreditId + '&rmktLgnId=' + ctx.remarketerLoginId + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd) + '&fcpoIncentive=' + ctx.fordCPOIncentive; if(com.openlane.auction.ssotoken != ''){ params += ('&x-openlane-authentication=' +encodeURIComponent(com.openlane.auction.ssotoken)); } com.openlane.auction._sendPostRequest(url,params); } this.updateContext = function(callback){ if ( ! (com.openlane.auction._submitCallbackUpdateContext == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackUpdateContext = function(status, result){ if (status == 'SUCCESS'){ ctx.bidPrice = result.bidPrice; ctx.groundingPrice = result.groundingPrice; ctx.state = result.state; ctx.totalPrice = result.totalPrice; ctx.totalTax = result.totalTax; ctx.lineItems = result.lineItems; ctx.selectedRwds = result.selectedRwds; ctx.availableRwds = result.availableRwds; ctx.removedRwds = result.removedRwds; ctx.rwdMessage = result.rwdMessage; ctx.transportLineItems = result.transportLineItems; ctx.paymentMethods = result.paymentMethods; ctx.serviceTypes = result.serviceTypes; ctx.basePriceTax = result.basePriceTax; ctx.pmtInstr = result.pmtInstr; ctx.transportEstDeliveryDays = result.transportEstDeliveryDays; ctx.reductionTotal = result.reductionTotal; } else { ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackUpdateContext; eval(callback + '("' + status + '")'); } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var url = com.openlane.auction._imolaUrl + '/updateprice.json'; var params = 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&bid=' + ctx.buyPrice + '&asd=' + ctx.applySecurityDeposit + '&abpoid=' + ctx.auctionBuyPriceOptionId + '&pqrid=' + ctx.payoutQuoteReferenceId + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&op=buy' + '&callback=com.openlane.auction._submitCallbackUpdateContext' + '&_jstate=' + ctx.state + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&validateCpn=' + com.openlane.auction.getValue(ctx.validateCpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd) + '&validateRwd=' + com.openlane.auction.getValue(ctx.validateRwd) + '&localeStr=' + com.openlane.auction.getLocaleStr(ctx.locale); if(ctx.languageCode != '') { params += '&languageCode=' + ctx.languageCode; } if(com.openlane.auction.ssotoken != ''){ params += '&x-openlane-authentication=' +encodeURIComponent(com.openlane.auction.ssotoken); } com.openlane.auction._sendPostRequest(url,params); } } //Constants for AUCTION_BUY_PRICE_OPTION_ID com.openlane.auction.BuyContext.ABPO_LESSEE_PURCHASE = 10; com.openlane.auction.BuyContext.ABPO_PERSONAL_BUY_PRICE = 7; com.openlane.auction.BuyContext.ABPO_GROUNDING_PRICE = 1; com.openlane.auction.BuyContext.ABPO_GROSS_PAYOFF_PRICE = 11; com.openlane.auction.BuyContext.ABPO_NON_GROUNDING_PRICE = 2; com.openlane.auction.BuyContext.ABPO_RESIDUAL_VALUE_PRICE = 14; com.openlane.auction.BuyContext.ABPO_SPECIAL_RMKTG_PRICE = 15; com.openlane.auction.BuyContext.ABPO_DEALER_PURCHASE = 12; //Constants for TP_MOVE_TYPE_ID com.openlane.auction.BuyContext.TP_MT_DOOR_TO_DOOR = 1; com.openlane.auction.BuyContext.TP_MT_DOOR_TO_RAILYARD = 2; com.openlane.auction.BuyContext.TP_MT_RAILYARD_TO_DOOR = 3; com.openlane.auction.BuyContext.TP_MT_RAILYARD_TO_RAILYARD = 4; com.openlane.auction.BuyContext.TP_MT_EXPEDITED_DOOR_TO_DOOR = 5; com.openlane.auction.BuyContext.PO_GD_PURCHASE = 1; com.openlane.auction.BuyContext.PO_EMPLOYEE_OR_CDI_INTENT = 2; //Constants for ATTRIBUTES com.openlane.auction.BuyContext.ATTRIB_FSLP = 'FSLP'; com.openlane.auction.BuyContext.PURPOSE_OF_FPOC_PURCHASE= 'pofp'; com.openlane.auction.BestOfferContext = function(ctx) { var _attribs = new Object(); this.getAuctionId = function(){ return ctx.auctionId; } this.getVehicleId = function(){ return ctx.vehicleId; } this.getVin = function(){ return ctx.vin; } this.getBidPrice = function(){ return ctx.bidPrice; } this.getBuyPrice = function(){ return ctx.buyPrice; } this.getPrice = function(){ return ctx.bestOffer; } this.getPaymentMethods = function(){ return ctx.paymentMethods; } this.getPaymentInstructions = function(){ return ctx.pmtInstr; } this.getServiceTypes = function(){ return ctx.serviceTypes; } this.getLineItems = function(){ return ctx.lineItems; } this.getSelectedRwds = function(){ return ctx.selectedRwds; } this.getAvailableRwds = function(){ return ctx.availableRwds; } this.getRemovedRwds = function(){ return ctx.removedRwds; } this.getRwdMessageCode = function(){ return ctx.rwdMessage; } this.getTransportLineItems = function(){ return ctx.transportLineItems; } this.getBasePriceTax = function(){ return ctx.basePriceTax; } this.setBestOffer = function(p) { ctx.bestOffer = p; } //this.setBidPrice = function(p) { //ctx.bidPrice = p; //} this.setComments = function(p) { ctx.comments = escape(p); } this.setPaymentMethodId = function(p){ ctx.paymentMethodId = p; } this.setBranchCode = function(b){ ctx.branchCode = b; } this.setDealerOrgId = function(d){ ctx.dealerOrgId = d; } this.setDeftCreditLineAccount = function(d){ ctx.deftCreditLineAccount = d; } this.getBidIncrement = function(){ return ctx.bidIncrement; } this.setTransportPreference = function(t){ ctx.transportPreference = t; } this.setTransportMoveType = function(t){ ctx.transportMoveTypeId = t; } this.setTradeInCreditId = function(t){ ctx.tradeInCreditId = t } this.setServices = function(s){ ctx.svc = s; } this.setCoupons = function(cpn, validateCpn) { ctx.cpn = cpn; ctx.validateCpn = validateCpn; } this.setRewards = function(rwd, validateRwd) { ctx.rwd = rwd; ctx.validateRwd = validateRwd; } this.setLocale = function(locale) { ctx.locale = locale; } this.getReductionTotal = function() { return ctx.reductionTotal; } this.addAttribute = function(a, val){ _attribs[a] = val; } this.removeAttribute = function(a){ delete _attribs[a]; } this.addToWatchlist = function(w){ ctx.addToWatchlist = w; } this.getMessage = function(){ return ctx.message; } this.getRemainingAuctionTime = function() { return ctx.remainingAuctionTime; } this.getSettlement = function(){ return ctx.settlement; } this.getTransportEstDeliveryDays = function(){ return ctx.transportEstDeliveryDays; } this.isTitleAbsent = function(){ return ctx.titleAbsent; } this.getSellerTermsAndConditions = function(){ return ctx.sellerTermsAndConditions; } this.getTransportTermsAndConditions = function(){ return ctx.transportTermsAndConditions; } this.getTradeInCredit = function(){ return ctx.tradeInCredit; } this.submitBestOffer = function(callback){ if ( ! (com.openlane.auction._submitCallbackSBO == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } ctx.svc = com.openlane.auction._addTransportAsSvc(ctx.svc, ctx.transportPreference); if(com.openlane.auction._validateServices(ctx.serviceTypes, ctx.svc, _attribs) == false) { ctx.message = "Mandatory Service is not selected"; eval(callback + '("PARAM_ERROR")'); return; } com.openlane.auction._submitCallbackSBO = function(status, result){ if (status == 'PARAM_ERROR' || status == 'INVALID_PAYMENT_METHOD_DETAILS') { ctx.message = result.emsg; } else if (status == 'SUCCESS' || status == 'BELOW_MINIMUM' || status == 'INVALID_INCREMENT' || status == 'ABOVE_BID' || status == 'ABOVE_BUY_NOW' || status == 'OP_NOT_ALLOWED' || status == 'INSUFFICIENT_CREDIT'){ ctx.bidPrice = result.bidPrice; ctx.buyPrice = result.buyPrice; ctx.remainingAuctionTime = result.remainingAuctionTime; ctx.state = result.state; ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackSBO; eval(callback + '("' + status + '")'); } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/bestOffer.json?' + 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&bestOffer=' + ctx.bestOffer + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&callback=com.openlane.auction._submitCallbackSBO' + '&_jstate=' + ctx.state + '&addtoWL=' + ctx.addToWatchlist + '&comm=' + ctx.comments + '&tic=' + ctx.tradeInCreditId + '&taid=' + ctx.transportTermsAndConditions['id'] + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd); document.getElementsByTagName('head')[0].appendChild(script); } this.updateContext = function(callback){ if ( ! (com.openlane.auction._submitCallbackUpdateSBOContext == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackUpdateSBOContext = function(status, result){ if (status == 'SUCCESS'){ //ctx.minimumBidAmount = result.bidPrice; ctx.state = result.state; ctx.lineItems = result.lineItems; ctx.selectedRwds = result.selectedRwds; ctx.availableRwds = result.availableRwds; ctx.removedRwds = result.removedRwds; ctx.rwdMessage = result.rwdMessage; ctx.transportLineItems = result.transportLineItems; ctx.paymentMethods = result.paymentMethods; ctx.serviceTypes = result.serviceTypes; ctx.basePriceTax = result.basePriceTax; ctx.pmtInstr = result.pmtInstr; ctx.transportEstDeliveryDays = result.transportEstDeliveryDays; ctx.reductionTotal = result.reductionTotal; } else { ctx.message = result.emsg; } delete com.openlane.auction._submitCallbackUpdateSBOContext; eval(callback + '("' + status + '")'); } var attribReqParams = com.openlane.auction._createAttribReqParam(_attribs); var url = com.openlane.auction._imolaUrl + '/updateprice.json'; var params = 'pmid=' + ctx.paymentMethodId + '&tid=' + ctx.transportPreference + '&tmtid=' + ctx.transportMoveTypeId + '&svc=' + ctx.svc + '&bid=' + ctx.bestOffer + '&bc=' + ctx.branchCode + '&doid=' + ctx.dealerOrgId + '&dcla=' + ctx.deftCreditLineAccount + attribReqParams + '&op=bo' + '&callback=com.openlane.auction._submitCallbackUpdateSBOContext' + '&_jstate=' + ctx.state + '&cpn=' + com.openlane.auction.getValue(ctx.cpn) + '&validateCpn=' + com.openlane.auction.getValue(ctx.validateCpn) + '&rwd=' + com.openlane.auction.getValue(ctx.rwd) + '&validateRwd=' + com.openlane.auction.getValue(ctx.validateRwd) + '&localeStr=' + com.openlane.auction.getLocaleStr(ctx.locale); com.openlane.auction._sendPostRequest(url,params); } } //Constants for TP_MOVE_TYPE_ID com.openlane.auction.BestOfferContext.TP_MT_DOOR_TO_DOOR = 1; com.openlane.auction.BestOfferContext.TP_MT_DOOR_TO_RAILYARD = 2; com.openlane.auction.BestOfferContext.TP_MT_RAILYARD_TO_DOOR = 3; com.openlane.auction.BestOfferContext.TP_MT_RAILYARD_TO_RAILYARD = 4; com.openlane.auction.BestOfferContext.TP_MT_EXPEDITED_DOOR_TO_DOOR = 5; //Constants for ATTRIBUTES com.openlane.auction.BestOfferContext.ATTRIB_FSLP = 'FSLP'; com.openlane.auction.BestOffer = function(ctx){ this.getId = function(){ return ctx.id; } this.getAuctionId = function(){ return ctx.auctionId; } this.getRemainingAuctionTime = function(){ return ctx.remainingAuctionTime; } this.getTimeRemainingForExpiry = function() { return ctx.timeRemainingForExpiry; } this.getBestOffer = function(){ return ctx.bestOffer; } this.getVehicleId = function(){ return ctx.vehicleId; } this.getStatus = function(){ return ctx.status; } this.getCounter = function(){ return ctx.counter; } this.getCounterComments = function(){ return ctx.counterComments; } this.getStartPrice = function(){ return ctx.startPrice; } this.isDeclineCounterAllowed = function(){ return (ctx.status == 3); } this.isAcceptCounterAllowed = function(){ return (ctx.status == 3); } this.getVehicleInfo = function() { return ctx.vehicleInfo; } this.getLiveBlockInfo = function() { return ctx.liveBlockInfo; } this.getRunListInfo = function() { return ctx.runListInfo; } this.getLastRun = function() { return ctx.lastRun; } this.getWinningBidUser = function() { return ctx.winningBidUser; } this.getReserveMet = function() { return ctx.reserveMet; } this.getNumberOfBids = function() { return ctx.numberOfBids; } this.getFirstRun = function() { return ctx.firstRun; } this.getWinningBid = function() { return ctx.winningBid; } this.getAuctionReducedTypeId = function() { return ctx.auctionReducedTypeId; } this.isMarketPlaceVehicle = function() { return ctx.isMarketPlaceVehicle; } this.getMarketPlaceId = function() { return ctx.marketPlaceId; } this.getCurrentIteration = function() { return ctx.currentIteration; } this.isDealerBlock = function() { return ctx.isDealerBlock; } this.isLiveBlock = function() { return ctx.isLiveBlock; } this.isRunList = function() { return ctx.isRunList; } this.isRemoveAllowed = function () { return ctx.removeAllowed; } this.isDBClosed = function() { return ctx.isDBClosed; } this.isExclusive = function() { return ctx.isExclusive; } this.isReserved = function() { return ctx.isReserved; } this.acceptCounter = function(callback){ if ( ! (com.openlane.auction._submitCallbackAcceptCounterBO == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackAcceptCounterBO = function(status, result){ delete com.openlane.auction._submitCallbackAcceptCounterBO; eval(callback + '("' + status + '","' + result + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/acceptBOCounter.json?' + 'boid=' + ctx.id + '&callback=com.openlane.auction._submitCallbackAcceptCounterBO' + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } this.declineCounter = function(callback){ if ( ! (com.openlane.auction._submitCallbackDeclineCounterBO == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackDeclineCounterBO = function(status, result){ delete com.openlane.auction._submitCallbackDeclineCounterBO; eval(callback + '("' + status + '","' + result + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/declineBOCounter.json?' + 'boid=' + ctx.id + '&callback=com.openlane.auction._submitCallbackDeclineCounterBO' + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } this.remove = function(cb){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/removeFromWL.json?' + 'vid=' + ctx.vehicleInfo.getVehicleId() + '&callback='+cb + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.watchlist.WatchingVehicle = function(ctx){ this.getAuctionId = function(){ return ctx.auctionId; } this.getRemainingAuctionTime = function(){ return ctx.remainingAuctionTime; } this.getRemainingAuctionTimeAsNumber = function() { return ctx.remainingAuctionTimeAsNumber; } this.isPreviewPeriod = function() { return ctx.isPreviewPeriod; } this.getRemainingAuctionStartTime = function(){ return ctx.remainingAuctionStartTime; } this.getAuctionStartTime = function(){ return ctx.auctionStartTime; } this.getAuctionEndTime = function(){ return ctx.auctionEndTime; } this.getMinimumBid = function(){ return ctx.minimumBid; } this.getStartPrice = function(){ return ctx.startPrice; } this.getPurchasePrice = function(){ return ctx.purchasePrice; } this.isWinningProxy = function(){ if (ctx.activeBid > 0) { return ctx.isWinningProxy; } else { return null; } } this.getVehicleInfo = function() { return ctx.vehicleInfo; } this.getLiveBlockInfo = function() { return ctx.liveBlockInfo; } this.getRunListInfo = function() { return ctx.runListInfo; } this.getLastRun = function() { return ctx.lastRun; } this.getWinningBidUser = function() { return ctx.winningBidUser; } this.getReserveMet = function() { return ctx.reserveMet; } this.getFpocText = function() { return ctx.fpocText; } this.getFpocButtonTooltip = function() { return ctx.fpocButtonTooltip; } this.getPrevProxyBidAmt = function() { return ctx.prevProxyBidAmt; } this.getAllowProxyBid = function() { return ctx.allowProxyBid; } this.getNumberOfBids = function() { return ctx.numberOfBids; } this.getBidHistoryUrl = function() { return ctx.bidHistoryUrl; } this.getFirstRun = function() { return ctx.firstRun; } this.getWinningBid = function() { return ctx.winningBid; } this.getAuctionReducedTypeId = function() { return ctx.auctionReducedTypeId; } this.isAllowToBid = function() { return ctx.biddingAllowed; } this.isAllowToBuy = function() { return ctx.buyingAllowed; } this.isMarketPlaceVehicle = function() { return ctx.isMarketPlaceVehicle; } this.getMarketPlaceId = function() { return ctx.marketPlaceId; } this.getCurrentIteration = function() { return ctx.currentIteration; } this.isDealerBlock = function() { return ctx.isDealerBlock; } this.isLiveBlock = function() { return ctx.isLiveBlock; } this.isRunList = function() { return ctx.isRunList; } this.isDBSold = function() { return ctx.isDBSold; } this.isRemoveAllowed = function () { return ctx.removeAllowed; } this.getFullStateName = function() { return ctx.fullStateName; } this.getVehicleLocationId = function() { return ctx.vehicleLocationId; } this.isDBClosed = function() { return ctx.isDBClosed; } this.isExclusive = function() { return ctx.isExclusive; } this.isReserved = function() { return ctx.isReserved; } this.getInspectionBranding = function(){ if (ctx.inspectionBranding == undefined) { return null; } else { return ctx.inspectionBranding; } } this.getActiveBid = function(){ if (ctx.activeBid == undefined) { return null; } else { return ctx.activeBid; } } this.isLemonLaw = function(){ if (ctx.isLemonLaw == undefined) { return null; } else { return ctx.isLemonLaw; } } this.remove = function(cb){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/removeFromWL.json?' + 'vid=' + ctx.vehicleInfo.getVehicleId() + '&plIdWatching=' + ctx.vehicleInfo.getPlId() + '&orgIdWatching=' + ctx.vehicleInfo.getOrgIdWatching() + '&callback='+cb + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.watchlist.BidVehicle = function(ctx){ this.getAuctionId = function(){ return ctx.auctionId; } this.getRemainingAuctionTime = function(){ return ctx.remainingAuctionTime; } this.getRemainingAuctionTimeAsNumber = function() { return ctx.remainingAuctionTimeAsNumber; } this.isPreviewPeriod = function() { return ctx.isPreviewPeriod; } this.getRemainingAuctionStartTime = function(){ return ctx.remainingAuctionStartTime; } this.getAuctionEndTime = function(){ return ctx.auctionEndTime; } this.getMinimumBid = function(){ return ctx.minimumBid; } this.getStartPrice = function(){ return ctx.startPrice; } this.getPurchasePrice = function(){ return ctx.purchasePrice; } this.getMaxBid = function(){ return ctx.maxBid; } this.isWinningProxy = function(){ if (ctx.isWinningProxy == undefined) { return null; } else { return ctx.isWinningProxy; } } this.getVehicleInfo = function() { return ctx.vehicleInfo; } this.getLiveBlockInfo = function() { return ctx.liveBlockInfo; } this.getRunListInfo = function() { return ctx.runListInfo; } this.getLastRun = function() { return ctx.lastRun; } this.getWinningBidUser = function() { return ctx.winningBidUser; } this.getReserveMet = function() { return ctx.reserveMet; } this.getFpocText = function() { return ctx.fpocText; } this.getFpocButtonTooltip = function() { return ctx.fpocButtonTooltip; } this.getPrevProxyBidAmt = function() { return ctx.prevProxyBidAmt; } this.getAllowProxyBid = function() { return ctx.allowProxyBid; } this.getNumberOfBids = function() { return ctx.numberOfBids; } this.getBidHistoryUrl = function() { return ctx.bidHistoryUrl; } this.getFirstRun = function() { return ctx.firstRun; } this.getWinningBid = function() { return ctx.winningBid; } this.getAuctionReducedTypeId = function() { return ctx.auctionReducedTypeId; } this.isAllowToBid = function() { return ctx.biddingAllowed; } this.isAllowToBuy = function() { return ctx.buyingAllowed; } this.isMarketPlaceVehicle = function() { return ctx.isMarketPlaceVehicle; } this.getMarketPlaceId = function() { return ctx.marketPlaceId; } this.getCurrentIteration = function() { return ctx.currentIteration; } this.isDealerBlock = function() { return ctx.isDealerBlock; } this.isLiveBlock = function() { return ctx.isLiveBlock; } this.isRunList = function() { return ctx.isRunList; } this.isDBClosed = function() { return ctx.isDBClosed; } this.isExclusive = function() { return ctx.isExclusive; } this.isReserved = function() { return ctx.isReserved; } this.getInspectionBranding = function(){ if (ctx.inspectionBranding == undefined) { return null; } else { return ctx.inspectionBranding; } } this.isRemoveAllowed = function () { return ctx.removeAllowed; } this.isLemonLaw = function(){ if (ctx.isLemonLaw == undefined) { return null; } else { return ctx.isLemonLaw; } } this.remove = function(cb){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/removeFromWL.json?' + 'vid=' + ctx.vehicleInfo.getVehicleId() + '&callback='+cb + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.watchlist.PurchasedVehicle = function(ctx){ this.getPurchasePrice = function(){ return ctx.purchasePrice; } this.getPurchaseDate = function(){ return ctx.purchaseDate; } this.getVehicleInfo = function() { return ctx.vehicleInfo; } this.getFpocText = function() { return ctx.fpocText; } this.isLemonLaw = function(){ if (ctx.isLemonLaw == undefined) { return null; } else { return ctx.isLemonLaw; } } this.remove = function(cb){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/salesvenue/removeFromWL.json?' + 'vid=' + ctx.vehicleInfo.getVehicleId() + '&plIdWatching=' + ctx.vehicleInfo.getPlId() + '&orgIdWatching=' + ctx.vehicleInfo.getOrgIdWatching() + '&callback='+cb + '&_jstate=' + ctx.vehicleInfo.getState(); document.getElementsByTagName('head')[0].appendChild(script); } } com.openlane.auction.SearchContext = function(ctx){ this.searchCriteria = {}; this.searchParam = {MAKE: 'makeSynonymIds', MODEL: 'modelSynonymIds', PRICE_FROM:'priceFrom', PRICE_TO: 'priceTo', DISTANCE: 'distance', ZIPCODE: 'zipcodeString', LISTING_CATEGORY:'listingCategories', ODOMETER_FROM:'mileageFrom', ODOMETER_TO:'mileageTo', YEAR_FROM:'yearFrom', YEAR_TO:'yearTo', RESULT_PER_PAGE: 'menuChoice', BLACK_BOOK_CURRENT_PRICE: 'SORT_BY_BLACK_BOOK_CURRENT_PRICE_DELTA', YEAR_MILE_PRICE: 'SORT_DYNAMIC_YEAR_1_MILEAGE_0_PRICE_0', PRICE_YEAR_MILE: 'SORT_DYNAMIC_PRICE_0_YEAR_1_MILEAGE_0', MILE_PRICE_YEAR: 'SORT_DYNAMIC_MILEAGE_0_PRICE_0_YEAR_1', SAVED_SEARCH_ID:'savedSearchId', EXCLUDE_LIGHT_LISTING:'excludeLightListing', HAS_LEATHER_PARTS:'hasLeatherParts', HAS_NAVIGATION:'hasNavigation', HAS_REAR_SEAT_ENTERTAINMENT: 'hasRearSeatEntertainment', HAS_MOON_SUN_ROOF: 'hasMoonSunroof', FIRST_RUNS: 'firstRuns', NO_FRAME_DAMAGE : 'noFrameDamage', LAST_RUNS : 'lastRuns', PRICE_REDUCED: 'priceReduced', SELLER_AGENT_ID: 'sellerAgentIds', MVDA_CLEAN: 'mvdaClean' }; this.setSortBy = function(sortBy) { this.searchCriteria['sortingCriteria'] = sortBy; }; this.addCriteria = function(criteriaName, criteriaValue) { this.searchCriteria[criteriaName] = criteriaValue; }; this.removeCriteria = function(criteriaName) { delete this.searchCriteria[criteriaName]; }; this.getMakeResults = function(){ return ctx.makeResults; }; this.getModelResults = function(){ return ctx.modelResults; }; this.getListingCategoriesResults = function(){ return ctx.listingCategories; }; this.getSearchResult = function(){ return ctx.searchResult; }; this.getSellerAgentsResults = function(){ return ctx.sellerAgents; }; this.getMakes = function(callback) { com.openlane.auction._getMakesCallBack = function(status, makeInfos){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + makeInfos.emsg + '")'); }else if(status.responseCode != 1){ ctx.makeResults = []; eval(callback + '("Fail", ' + status.responseMessage + ')'); }else{ ctx.makeResults = makeInfos.results; eval(callback + '("Success")'); } }; var date = new Date(); var url= ctx.baseUrl + '/listboxModels.api?' +'callback=com.openlane.auction._getMakesCallBack' +'&makeSynonymIds=-1' +'&format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue; this.sendRequest(url); }; this.getModels = function(makeId, callback) { com.openlane.auction._getModelsCallBack = function(status, modelInfos){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + modelInfos.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.modelResults = []; }else{ ctx.modelResults = modelInfos.results; eval(callback + '("Success")'); } }; var date = new Date(); var url= ctx.baseUrl + '/listboxModels.api?' +'callback=com.openlane.auction._getModelsCallBack' +'&makeSynonymIds='+makeId +'&format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue; this.sendRequest(url); }; this.getListingCategories = function(callback) { com.openlane.auction._getListingCategoryCallBack = function(status, listingCategories){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + listingCategories.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.listingCategories = []; }else{ ctx.listingCategories = listingCategories.results; eval(callback + '("Success")'); } }; var date = new Date(); var url= ctx.baseUrl + '/listboxListingCategory.api?' +'callback=com.openlane.auction._getListingCategoryCallBack'; +'&t='+ date.getTime() this.sendRequest(url); }; this.search = function(callback) { com.openlane.auction._searchCallBack = function(status, searchResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + searchResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.searchResult = []; }else{ ctx.searchResult = searchResult; eval(callback + '("Success")'); } }; var date = new Date(); var params = 'searchSubmit=true&newStart=true&format=json' +'&t='+ date.getTime(); for (var key in this.searchCriteria) { if (this.searchCriteria.hasOwnProperty(key)) { params += ('&' +key + '=' + this.searchCriteria[key]); } } var url= ctx.baseUrl + '/search.api?' + params + '&callback=com.openlane.auction._searchCallBack'; this.sendRequest(url); }; this.resetCriteria = function(){ this.searchCriteria = {}; }; this.getNextResults = function(callback, orgId) { com.openlane.auction._nextResultCallBack = function(status, nextResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + nextResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.searchResult = []; }else{ ctx.searchResult = nextResult; eval(callback + '("Success")'); } }; var date = new Date(); var params = 'format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue +(orgId == undefined ? '' : '&orgId=' + orgId); var url= ctx.baseUrl + '/searchNG_next.api?' + params + '&callback=com.openlane.auction._nextResultCallBack'; this.sendRequest(url); }; this.getPreviousResults = function(callback, orgId) { com.openlane.auction._previousResultCallBack = function(status, previousResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + previousResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.searchResult = []; }else{ ctx.searchResult = previousResult; eval(callback + '("Success")'); } }; var date = new Date(); var params = 'format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue +(orgId == undefined ? '' : '&orgId=' + orgId); var url= ctx.baseUrl + '/searchNG_previous.api?' + params + '&callback=com.openlane.auction._previousResultCallBack'; this.sendRequest(url); }; this.getFirstResults = function(callback, orgId) { com.openlane.auction._firstResultCallBack = function(status, firstResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + firstResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.searchResult = []; }else{ ctx.searchResult = firstResult; eval(callback + '("Success")'); } }; var date = new Date(); var params = 'format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue +(orgId == undefined ? '' : '&orgId=' + orgId); var url= ctx.baseUrl + '/searchNG_first.api?' + params + '&callback=com.openlane.auction._firstResultCallBack'; this.sendRequest(url); }; this.getLastResults = function(callback, orgId) { com.openlane.auction._lastResultCallBack = function(status, lastResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + lastResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.searchResult = []; }else{ ctx.searchResult = lastResult; eval(callback + '("Success")'); } }; var date = new Date(); var params = 'format=json' +'&t='+ date.getTime() +'&plId='+ctx.salesVenue +(orgId == undefined ? '' : '&orgId=' + orgId); var url= ctx.baseUrl + '/searchNG_last.api?' + params + '&callback=com.openlane.auction._lastResultCallBack'; this.sendRequest(url); }; this.getSellerAgents = function(callback){ com.openlane.auction._sellerAgentsCallBack = function(status, sellerAgentsResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + sellerAgentsResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.sellerAgents = []; }else{ ctx.sellerAgents = sellerAgentsResult.results; eval(callback + '("Success")'); } }; var url= ctx.baseUrl + '/listboxListingSellerAgents.api?callback=com.openlane.auction._sellerAgentsCallBack'; this.sendRequest(url); }; this.sendRequest = function(fullUrl){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = fullUrl; document.getElementsByTagName('head')[0].appendChild(script); }; } com.openlane.auction.MvdaContext = function(ctx){ this.locale = { ENGLISH: 'en-us', FRENCH: 'fr-ca', ENGLISH_CANADIAN: 'en-ca' } this.getMvdaDataResult = function(){ return ctx.mvdaDataResult; } this.getMvdaPDFUrl = function(){ return ctx.mvdaPDFUrl; } this.hasMvdaInfo = function(){ return ctx.hasDataSource; } this.isImolaMvda = function() { if(ctx.isImolaMvda != undefined) return ctx.isImolaMvda; return ""; } this.getMvdaData = function(vid, locale, callback, languageCode){ com.openlane.auction._mvdaDataCallback = function(status, mvdaDataResult){ if(status == 'SSO_TIMEOUT'){ ctx.makeResults = []; eval(callback + '("SSO_TIMEOUT", "' + mvdaDataResult.emsg + '")'); }else if(status.responseCode != 1){ eval(callback + '("Fail", ' + status.responseMessage + ')'); ctx.mvdaDataResult = []; }else{ if(mvdaDataResult.mvdaSources == undefined){ ctx.hasDataSource = false; ctx.mvdaDataResult = mvdaDataResult.generalInfo; }else{ ctx.hasDataSource = true; ctx.mvdaDataResult = mvdaDataResult.mvdaSources; } ctx.mvdaPDFUrl = mvdaDataResult.mvdaPDFUrl; eval(callback + '("Success")'); } } var url = ctx.baseUrl + '/getMVDAData.api?callback=com.openlane.auction._mvdaDataCallback'; if(this.isImolaMvda() == "true") { url = ctx.baseUrl + '/mvdaDetail.json?callback=com.openlane.auction._mvdaDataCallback'; } url += '&plId=' + ctx.salesVenue +'&vehicleId=' + vid +'&locale='+locale; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } this.sendRequest(url); } this.sendRequest = function(fullUrl){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = fullUrl; document.getElementsByTagName('head')[0].appendChild(script); }; } com.openlane.auction.ServiceContext = function () {} //Constants for ServiceType Status com.openlane.auction.ServiceContext.SVC_NOT_AVBL = -1; com.openlane.auction.ServiceContext.SVC_OPTIONAL = 0; com.openlane.auction.ServiceContext.SVC_MANDATORY = 1; //Constants for Service type Ids com.openlane.auction.ServiceContext.SVC_TYPE_PSI = 1; com.openlane.auction.ServiceContext.SVC_TYPE_TRANSPORT = 2; com.openlane.auction.ServiceContext.SVC_TYPE_10DAY_BBG = 3; com.openlane.auction.ServiceContext.SVC_TYPE_30DAY_BBG = 4; com.openlane.auction.ServiceContext.SVC_TYPE_TITLE_SHIPPING_OPTIONS = 5; com.openlane.auction.ServiceContext.SVC_TYPE_30_FOR_30_BBG = 6; com.openlane.auction.ServiceContext.SVC_TYPE_HR_PICTURE = 7; com.openlane.auction.ServiceContext.SVC_TYPE_PSI_BY_AUCTION = 8; //Constants for Service Ids com.openlane.auction.ServiceContext.SVC_OL_TRANSPORT = 3; com.openlane.auction.ServiceContext.SVC_BA_TRANSPORT = 1; com.openlane.auction.ServiceContext.SVC_SA_TRANSPORT = 2; com.openlane.auction.ServiceContext.SVC_AA_TRANSPORT = 4; com.openlane.auction.ServiceContext.SVC_10DAY_BBG = 5; com.openlane.auction.ServiceContext.SVC_NO_10DAY_BBG = 6; com.openlane.auction.ServiceContext.SVC_30DAY_BBG = 7; com.openlane.auction.ServiceContext.SVC_NO_30DAY_BBG = 8; com.openlane.auction.ServiceContext.SVC_PSI = 9; com.openlane.auction.ServiceContext.SVC_NO_PSI = 10; com.openlane.auction.ServiceContext.SVC_PSI_BYAUCTION_7 = 11; com.openlane.auction.ServiceContext.SVC_PSI_BYAUCTION_14 = 12; com.openlane.auction.ServiceContext.SVC_HOLD_FOR_PICKUP_AT_AUCTION = 13; com.openlane.auction.ServiceContext.SVC_USPS_FIRST_CLASS = 14; com.openlane.auction.ServiceContext.SVC_OVERNIGHT = 15; com.openlane.auction.ServiceContext.SVC_REGULAR_MAIL = 16; com.openlane.auction.ServiceContext.SVC_PUROLATOR_TO_BUYER = 17; com.openlane.auction.ServiceContext.SVC_PUROLATOR_COLLECT_BUYER_PAID = 18; com.openlane.auction.ServiceContext.SVC_COURIER_COLLECT_BUYER_PAID = 19; com.openlane.auction.ServiceContext.SVC_ARRANGE_DIRECTLY_WITH_AUCTION = 20; com.openlane.auction.ServiceContext.SVC_NO_TITLE_SHIPPING_OPTION = 21; com.openlane.auction.ServiceContext.SVC_BPP_BYAUCTION_FULL = 22; com.openlane.auction.ServiceContext.SVC_BPP_BYAUCTION_PARTIAL = 23; com.openlane.auction.ServiceContext.SVC_BBG_30_FOR_30 = 24; com.openlane.auction.ServiceContext.SVC_NO_BBG_30_FOR_30 = 25; com.openlane.auction.ServiceContext.SVC_HR_PICTURE = 26; com.openlane.auction.ServiceContext.SVC_NO_HR_PICTURE = 27; com.openlane.auction.ServiceContext.SVC_HR_PICTURE_TIER2 = 26; com.openlane.auction.ServiceContext.SVC_HR_PICTURE_TIER1 = 30; com.openlane.auction.ServiceContext.SVC_HR_PICTURE_TIER3 = 31; com.openlane.auction.ServiceContext.SVC_HR_PICTURE_TIER4 = 32; com.openlane.auction.ServiceContext.SVC_HR_PICTURE_TIER5 = 33; com.openlane.auction.ServiceContext.SVC_PSI_BY_AUCTION = 28; com.openlane.auction.ServiceContext.SVC_NO_PSI_BY_AUCTION = 29; //Constants for Service Attributes com.openlane.auction.ServiceContext.SVC_ATTRIB_PSI_VENDOR = 'PSI_VENDOR'; //Constants for TP_MOVE_TYPE_ID com.openlane.auction.ServiceContext.TP_MT_DOOR_TO_DOOR = '1'; com.openlane.auction.ServiceContext.TP_MT_DOOR_TO_RAILYARD = '2'; com.openlane.auction.ServiceContext.TP_MT_RAILYARD_TO_DOOR = '3'; com.openlane.auction.ServiceContext.TP_MT_RAILYARD_TO_RAILYARD = '4'; com.openlane.auction.ServiceContext.TP_MT_EXPEDITED_DOOR_TO_DOOR = '5'; //Constants for Agreement com.openlane.auction.AgreementContext = function () {} com.openlane.auction.AgreementContext.LANG_EN = 'en'; com.openlane.auction.AgreementContext.LANG_FR = 'fr'; com.openlane.auction.AgreementContext.FILE_TYPE_PDF = 'PDF'; com.openlane.auction.AgreementContext.FILE_TYPE_HTML = 'HTML'; //Constants for Locale com.openlane.auction.LocaleContext = function () {} com.openlane.auction.LocaleContext.ENGLISH_US = 'en-us'; com.openlane.auction.LocaleContext.FRENCH_CA = 'fr-ca'; com.openlane.auction.LocaleContext.ENGLISH_CA = 'en-ca'; //Constants for VDP Auction Channels com.openlane.auction.VDPContext = function () {} com.openlane.auction.VDPContext.AUC_CHANNEL_OLDB = 1; com.openlane.auction.VDPContext.AUC_CHANNEL_LIVEBLOCK = 2; com.openlane.auction.VDPContext.AUC_CHANNEL_RUNLIST = 3; //Admin api com.openlane.auction.admin.ProgramConfig = function(ctx){ this.getFeeRuleConfig = function(){ return ctx.feeRuleConfig; } } com.openlane.auction.admin.TermsOfSaleConfig = function(ctx){ this.getFeeRuleConfig = function(){ return ctx.feeRuleConfig; } this.getPaymentMethods = function(){ return ctx.paymentMethods; } } com.openlane.auction.admin.PaymentMethodConfig = function(ctx) { this.getId = function(){ return ctx.id; } this.getName = function(){ return ctx.name; } this.getFeeRuleConfig = function(){ return ctx.feeRuleConfig; } } com.openlane.auction.admin.FeeRuleConfig = function(ctx){ this.getId = function(){ return ctx.id; } this.getName = function(){ return ctx.name; } this.getDescription = function(){ return ctx.description; } this.getContractNumber = function(){ return ctx.contractNumber; } this.getEffectiveDate = function(){ return ctx.effectiveDate; } this.getExpirationDate = function(){ return ctx.expirationDate; } this.getFees = function(){ return ctx.fees; } } com.openlane.auction.admin.FeeRuleFeeConfig = function(ctx){ this.getId = function(){ return ctx.id; } this.getName = function(){ return ctx.name; } this.getDesc = function(){ return ctx.desc; } this.getType = function(){ return ctx.type; } this.getAmount = function(){ return ctx.amount; } this.getFeeMin = function(){ return ctx.feeMin; } this.getFeeCap = function(){ return ctx.feeCap; } this.getFeeTierAmounts = function(){ return ctx.feeTierAmounts; } this.getHowApplied = function(){ return ctx.howApplied; } this.getDispOnCos = function(){ return ctx.dispOnCos; } this.getTaxable = function(){ return ctx.taxable; } this.getFlowthru = function(){ return ctx.flowthru; } this.getGlAccount = function(){ return ctx.glAccount; } this.getGlPostingKey = function(){ return ctx.glPostingKey; } this.getFtGlAccount = function(){ return ctx.ftGlAccount; } this.getFtGlPostingKey = function(){ return ctx.ftGlPostingKey; } } com.openlane.auction.admin.AdminCloningContext = function(ctx){ this.getClonedVehicleId = function(){ return ctx.clonedVehicleId; } } com.openlane.auction.admin.AdminAMSCloningContext = function(ctx){ this.getClonedVehicleList = function(){ return ctx.clonedVehicleList; } } com.openlane.auction.admin.OrderPSIContext = function(ctx){ var matrixId = 0; var vendorId = 0; this.getPSIFee = function(){ return ctx.PSIFee; } this.getVendorList = function(){ return ctx.vendorList; } this.setMatrixId = function(selectedMatrixId){ this.matrixId = selectedMatrixId; } this.setVendorId = function(selectedVendorId){ this.vendorId = selectedVendorId; } this.orderPSI = function(callback){ if ( ! (com.openlane.auction._submitCBOrderPSI == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCBOrderPSI = function(status){ delete com.openlane.auction._submitCBOrderPSI; eval(callback + '("' + status + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/admin/orderPSI.json?' + 'vid=' + ctx.vehicleId + '&callback=com.openlane.auction._submitCBOrderPSI' + '&vendorOrgId='+ this.vendorId + '&_jstate=' + ctx.state; document.getElementsByTagName('head')[0].appendChild(script); } } // functions from bidbuyapi com.openlane.auction._createAttribReqParam = function(attrs){ var attribParams = ''; var attr; var attrVal; for(attr in attrs){ attrVal = attrs[attr]; if(attrVal) { attribParams = attribParams + '&'+attr+'='+attrVal; } } return attribParams; } com.openlane.auction._addTransportAsSvc = function(servicesSelected, tLoc){ var isTransportSvcSelected = false; if(servicesSelected) { for(k=0; k < servicesSelected.length; k++) { if(servicesSelected[k] == com.openlane.auction.ServiceContext.SVC_OL_TRANSPORT || servicesSelected[k] == com.openlane.auction.ServiceContext.SVC_SA_TRANSPORT || servicesSelected[k] == com.openlane.auction.ServiceContext.SVC_BA_TRANSPORT || servicesSelected[k] == com.openlane.auction.ServiceContext.SVC_AA_TRANSPORT) { isTransportSvcSelected = true; break; } } if(isTransportSvcSelected == false) { if(tLoc > 0) { servicesSelected[k] = 3; } else { servicesSelected[k] = 1; } } return servicesSelected; } else { var servicesSelected = []; if(tLoc > 0) { servicesSelected[0] = 3; } else { servicesSelected[0] = 1; } return servicesSelected; } } com.openlane.auction._validateServices = function(serviceTypes, servicesSelected, attrs){ var isMandatorySvcSelected = true; for(i = 0; i < serviceTypes.length; i++){ if(serviceTypes[i].status == com.openlane.auction.ServiceContext.SVC_MANDATORY) { isMandatorySvcSelected = false; for(j = 0; j < serviceTypes[i].services.length; j++){ if(serviceTypes[i].services[j].enabled == true) { for(k=0; k < servicesSelected.length; k++) { if(servicesSelected[k] == serviceTypes[i].services[j].id) { isMandatorySvcSelected = true; } } } } if (isMandatorySvcSelected == false) return false; } } if(isMandatorySvcSelected == true) { for(i = 0; i < serviceTypes.length; i++){ for(j = 0; j < serviceTypes[i].services.length; j++){ if(serviceTypes[i].services[j].id == 9 && serviceTypes[i].services[j].enabled == true) { for(k=0; k < servicesSelected.length; k++) { if(servicesSelected[k] == serviceTypes[i].services[j].id) { if(attrs[com.openlane.auction.ServiceContext.SVC_ATTRIB_PSI_VENDOR]) { return true; } else { return false; } } } } } } } return isMandatorySvcSelected; } com.openlane.auction.LoginContext = function(ctx){ this.profilePreference = { CONTACT_INFO: 1, NOTIFICATION: 2, DEF_BIDDING: 3 }; this.getDefaultOrg = function() { if (ctx.defaultOrg == undefined) { return null; } return ctx.defaultOrg; }; if (ctx._salesVenue==="1" || ctx._salesVenue==="29") { this.setDefaultOrg = function(defaultOrgId, callback) { com.openlane.auction._setDefaultOrg = function(status, info) { var userOrg; if (status == "SUCCESS" && sessvars.imolaLoginContext) { for (var i=0; i< sessvars.imolaLoginContext.userOrgs.length; i++) { userOrg = sessvars.imolaLoginContext.userOrgs[i]; if (userOrg.id == info.defaultOrgId) { sessvars.imolaLoginContext.defaultOrg = {"id": userOrg.id, "name": userOrg.name}; break; } } } com.openlane.auction.executeFunctionByName(callback, status, info); } var url = com.openlane.auction._baseUrl + '/defaultOrg.json?' + 'orgId=' + defaultOrgId + '&callback=com.openlane.auction._setDefaultOrg' + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; }; this.acceptedUserAgreement = function(){ return ctx.acceptedUA; }; this.getAgreement = function(){ return ctx.userAgreement; }; this.getUserOrganizations = function(){ return ctx.userOrgs; }; this.acceptUserAgreement = function(callback){ if ( ! (com.openlane.auction._submitCallbackAcceptUA == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackAcceptUA = function(status, result){ if (status == 'SUCCESS'){ ctx.acceptedUA = true; } delete com.openlane.auction._submitCallbackAcceptUA; eval(callback + '("' + status + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = ctx.imolaUrl + '/salesvenue/acceptUserAgreement.json?' + 'callback=com.openlane.auction._submitCallbackAcceptUA' + '&_jstate=' + ctx._jstate; document.getElementsByTagName('head')[0].appendChild(script); }; this.getPrivacyPolicy = function() { if (ctx.privacyPolicy == undefined) { return null; } return ctx.privacyPolicy; }; this.getLegal = function() { if (ctx.legal == undefined) { return null; } return ctx.legal; }; this.getWatchlistContext = function(callback){ var url = ctx.imolaUrl + '/salesvenue/preWatchlist.json?' + 'callback='+callback + '&t='+ new Date().getTime() + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.getVehicleDetailContext = function( vid, callback, optionalParams, languageCode){ var addnlParamMap = optionalParams || {"fetchServices":false,"fetchABPOPrices":false, "defaultOrg":-1, "locale":"en-us", "markViewed":false, "fromSI":false, "isFromLAIBidContainer":false }; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } var url = ctx.imolaUrl + '/salesvenue/vehicleDetail.json?' + 'vid='+vid + '&markViewed=' + addnlParamMap.markViewed + '&fetchServices='+addnlParamMap.fetchServices + '&abpo='+addnlParamMap.fetchABPOPrices + '&defOrgId='+addnlParamMap.defaultOrg + '&localeStr='+localeString + '&t='+ new Date().getTime() + '&fromSI=' + addnlParamMap.fromSI + '&isFromLAIBidContainer=' + addnlParamMap.isFromLAIBidContainer + '&callback='+callback + '&_jstate=' + ctx._jstate; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } com.openlane.auction._sendServiceRequest(url); }; this.getDealerGroupBidContext = function(aid, callback, languageCode, preProxyBid){ var url = ctx.imolaUrl + '/salesvenue/dgprebid.json?' + 'aid=' + aid + '&preProxyBid=' + preProxyBid + '&t='+ new Date().getTime() + '&callback=' + callback + '&_jstate=' + ctx._jstate; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } com.openlane.auction._sendServiceRequest(url); }; this.getDealerGroupBuyContext = function(aid, callback, poid, languageCode, abpoid){ var url = ctx.imolaUrl + '/salesvenue/dgprebuy.json?' + 'aid=' + aid + '&poid='+poid + '&abpoid=' + abpoid + '&t='+ new Date().getTime() + '&callback=' + callback + '&_jstate=' + ctx._jstate; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } com.openlane.auction._sendServiceRequest(url); }; this.getDealerGroupBestOfferContext = function(aid, callback){ var url = ctx.imolaUrl + '/salesvenue/dgpreBestOffer.json?' + 'aid=' + aid + '&t='+ new Date().getTime() + '&callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.getDealerGroupBasicListingContext = function(aid, callback){ var url = ctx.imolaUrl + '/salesvenue/dgpreBasicListing.json?' + 'aid=' + aid + '&t='+ new Date().getTime() + '&callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.getAuctionSearchContext = function(currentOrgid,callback, version, languageCode){ var url= ctx.searchEngineUrl + (version ? ("/" + version) : "") + '/searchContext?' +'callback='+callback +'&orgId='+currentOrgid; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } com.openlane.auction._sendServiceRequest2(url,ctx._jstate); }; this.getSearchContext = function(callback){ var url= ctx.imolaUrl + '/searchContext.json?' +'_jstate='+ctx._jstate +'&callback='+callback +'&salesVenue='+ctx._salesVenue; com.openlane.auction._sendServiceRequest(url); }; this.getMpgDataByVehicle = function(vid, callback){ var query = ctx.mpgUrl+'/mpgByVehicle.json?vehicle='+vid; query += '&callback='+callback+'&type='+1+'&_jstate='+ctx._jstate; query += '&from=vdp'; query += '&dglc=true'; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = query; document.getElementsByTagName('head')[0].appendChild(script); }; this.getMVDAContext= function(callback){ var url= ctx.imolaUrl + '/mvdaContext.json?' +'_jstate='+ctx._jstate +'&callback='+callback +'&salesVenue='+ctx._salesVenue; com.openlane.auction._sendServiceRequest(url); }; this.getProfile= function(callback, optionalProfilePrefs){ com.openlane.auction._getProfile = function(status, msg){ if(status != 'SSO_TIMEOUT'){ var profilePrefs = optionalProfilePrefs || []; var url= ctx.imolaUrl + '/salesvenue/profile.json?' +'_jstate='+ctx._jstate +'&profPrefs='+profilePrefs +'&callback='+callback; com.openlane.auction._sendServiceRequest(url); }else{ com.openlane.auction.executeFunctionByName(callback, "SSO_TIMEOUT",{"emsg": 'Session has timed out'}); } } var url= ctx.imolaUrl + '/profileLogin.json' +'?callback=com.openlane.auction._getProfile'; com.openlane.auction._sendServiceRequest(url); }; this.readLoginContext= function(){ var url = com.openlane.auction._baseUrl; url += '/readlogin.json?_jstate='+ctx._jstate; window.location = url; }; this.getSellerInterfaceContext= function(plId, callback) { var url = ctx.sellerInterfaceUrl + '/sellerInterface.json?' + 'callback=' + callback + '&plId=' + plId + '&donotcacheme=' + (new Date()).getTime(); com.openlane.auction._sendServiceRequest(url); }; this.isBuyerView = function(callback) { var url = com.openlane.auction._baseUrl + '/isBuyerView.json?' + 'callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.recalcOwnershipFeeUponDuplicateTitle = function(vid, callback){ var url = ctx.imolaUrl + '/admin/recalcOwnershipFee.json?' + 'vid=' + vid + '&t='+ new Date().getTime() + '&callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.getMBPContext = function(vid, callback){ var url= ctx.imolaUrl + '/salesvenue/mbp.json?' +'callback='+callback +'&vehicle='+vid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); }; this.getLiveBlockLinksContext = function(callback, currentOrgId){ if(sessvars.imolaLiveBlockLinksContext){ if(sessvars.user_orgId){ if(sessvars.user_orgId == currentOrgId){ com.openlane.auction.executeFunctionByName(callback, "SUCCESS",sessvars.imolaLiveBlockLinksContext); return true; } } sessvars.$.clearMem(); } if(currentOrgId){ sessvars.user_orgId = currentOrgId; } var url = ctx.imolaUrl + '/liveblock/links.json?' + 'callback=' + callback + '&_jstate=' + ctx._jstate; if(currentOrgId){ url += ("&coid=" + currentOrgId); } com.openlane.auction._sendServiceRequest(url); }; } com.openlane.auction.UserLoginContext = function(ctx){ this.profilePreference = { CONTACT_INFO: 1, NOTIFICATION: 2, DEF_BIDDING: 3 } this.readLoginContext= function(){ var url = com.openlane.auction._baseUrl; url += '/readlogin.json?_jstate='+this._jstate; window.location = url; } this.getVDPContext = function(vehicle,callback){ var url= ctx.imolaUrl + '/vdp.json?' +'callback='+callback +'&vehicle='+vehicle +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getProfile= function(callback, optionalProfilePrefs){ com.openlane.auction._getProfile = function(status, msg){ if(status != 'SSO_TIMEOUT'){ var profilePrefs = optionalProfilePrefs || []; var realUrl= ctx.imolaUrl + '/profile.json?' +'_jstate='+ctx._jstate +'&profPrefs='+profilePrefs +'&callback='+callback; com.openlane.auction._sendServiceRequest(realUrl); }else{ com.openlane.auction.executeFunctionByName(callback, "SSO_TIMEOUT",{"emsg": 'Session has timed out'}); } } var url= ctx.imolaUrl + '/profileLogin.json' +'?callback=com.openlane.auction._getProfile'; com.openlane.auction._sendServiceRequest(url); //var profilePrefs = optionalProfilePrefs || []; //var url= ctx.imolaUrl + '/profile.json?' //+'_jstate='+ctx._jstate //+'&profPrefs='+profilePrefs //+'&callback='+callback; //com.openlane.auction._sendServiceRequest(url); } this.getAuctionSearchContext= function(currentOrgid, callback, version, languageCode){ var url= ctx.searchEngineUrl + (version ? ("/" + version) : "") + '/searchContext?' +'callback='+callback +'&orgId='+currentOrgid; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } com.openlane.auction._sendServiceRequest2(url,ctx._jstate); } this.getBuyContext=function(aid,callback,poid,abpoid,pqrid,languageCode){ var url= ctx.imolaUrl + '/prebuy.json?' +'callback='+callback +'&_jstate='+ctx._jstate +'&aid='+aid +'&poid='+poid +'&abpoid='+abpoid +'&pqrid='+pqrid; if(languageCode != undefined) { url += '&languageCode='+languageCode; } if(com.openlane.auction.ssotoken != ''){ url += ('&x-openlane-authentication=' + encodeURIComponent(com.openlane.auction.ssotoken)); } com.openlane.auction._sendServiceRequest(url); } this.getBidContext= function(aid,callback, languageCode,preProxyBid){ var url= ctx.imolaUrl +'/prebid.json?' +'callback='+callback +'&aid='+aid +'&preProxyBid='+preProxyBid +'&_jstate='+ctx._jstate; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } if(com.openlane.auction.ssotoken != ''){ url += ('&x-openlane-authentication=' + encodeURIComponent(com.openlane.auction.ssotoken)); } com.openlane.auction._sendServiceRequest(url); } this.getBestOfferContext= function(aid,callback){ var url= ctx.imolaUrl +'/preBestOffer.json?' +'callback='+callback +'&aid='+aid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getIfBidAuctionVehicles= function(callback){ var url = ctx.imolaUrl + '/fetchIfBidVehicles.json?' + 'callback='+callback + '&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getVHRContext= function(vid,callback){ var url= ctx.imolaUrl + '/fetchVHRContext.json?' +'callback='+callback +'&vid='+vid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getSellerVDPContext= function(vehicle, cgc, callback, basicListing){ var url= ctx.imolaUrl + '/seller/vdp.json?' +'callback='+callback +'&vehicle='+vehicle +'&cgc='+cgc +'&bl='+basicListing +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getYMMVDPContext= function(vehicle, cgc, year, make, model, callback, basicListing){ var url= ctx.imolaUrl + '/seller/ymmVdp.json?' +'callback='+callback +'&vehicle='+vehicle +'&cgc='+cgc +'&year='+year +'&make='+make +'&model='+model +'&bl='+basicListing +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getMpgDataByVehicle= function(callback, vehicle, countryCode){ var script = document.createElement('script'); script.type = 'text/javascript'; if (vehicle == undefined){ eval(callback + '("PARAM_ERROR", "Vehicle is not specified")'); return; } var query = ctx.mpgUrl + '/mpgByVehicle.json?vehicle='+vehicle; query += '&callback='+callback+'&type='+3+'&countryCode='+countryCode+'&_jstate='+ctx._jstate; query += '&from=vdp'; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = query; document.getElementsByTagName('head')[0].appendChild(script); } this.getProgramConfig= function(programId,callback){ var url= ctx.imolaUrl + '/admin/fetchProgramConfig.json?' +'callback='+callback +'&programId='+programId; com.openlane.auction._sendServiceRequest(url); } this.getTermsOfSaleConfig= function(tosId,callback){ var url = ctx.imolaUrl + '/admin/fetchTosConfig.json?' +'callback='+callback +'&tosId='+tosId; com.openlane.auction._sendServiceRequest(url); } this.getAdminCloningContext= function(programId,vehicleId,tiSaveFlag,callback){ var url= ctx.imolaUrl + '/admin/fetchAdminCloningContext.json?' +'callback='+callback +'&programId='+programId +'&vehicleId='+vehicleId +'&tiSaveFlag='+tiSaveFlag +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getAdminAMSCloningContext= function(callback, vehicleIds, cgcIds){ var url= ctx.imolaUrl + '/seller/fetchAdminAMSCloningContext.json?' +'callback='+callback; for(var i = 0; i < vehicleIds.length; i++){ url += '&vid' + (i+1) + '=' + vehicleIds[i] ; url += '&gid' + (i+1) + '=' + cgcIds[i] ; } url +='&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getOrderPSIContext= function(vid,callback){ var url= ctx.imolaUrl + '/admin/preOrderPSI.json?' +'callback='+callback +'&vid='+vid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.cancelPSI= function(vid,callback){ var url= ctx.imolaUrl + '/admin/cancelPSI.json?' +'callback='+callback +'&vid='+vid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getBestOffers= function(callback){ var url = ctx.imolaUrl + '/fetchBestOffers.json?' + 'callback='+callback + '&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getVehicleDetailContext= function(vid, callback, optionalParams, languageCode){ var addnlParamMap = optionalParams || {"fetchServices":false, "fetchABPOPrices":false, "purchaseOption":-1, "locale":"en-us", "markViewed":false, "fromSI" : false}; var localeString = 'en'; if(addnlParamMap.locale && addnlParamMap.locale == 'fr-ca') { localeString = 'fr'; } var url = ctx.imolaUrl + '/vehicleDetail.json?' + 'vid='+vid + '&markViewed=' + addnlParamMap.markViewed + '&fetchServices='+addnlParamMap.fetchServices + '&abpo='+addnlParamMap.fetchABPOPrices + '&po='+addnlParamMap.purchaseOption + '&localeStr='+localeString + '&fromSI=' + addnlParamMap.fromSI; if(languageCode != undefined) { url += '&languageCode=' + languageCode; } url += '&callback='+callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getBasicListingContext= function(aid, callback){ var url = ctx.imolaUrl + '/preBasicListing.json?' + 'aid=' + aid + '&callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getSellerInterfaceContext= function(plId, callback) { var url = ctx.sellerInterfaceUrl + '/sellerInterface.json?' + 'callback=' + callback + '&plId=' + plId + '&donotcacheme=' + (new Date()).getTime(); com.openlane.auction._sendServiceRequest(url); } this.isBuyerView = function(callback) { var url = com.openlane.auction._baseUrl + '/isBuyerView.json?' + 'callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); } this.getLiveBlockAdminLinksContext = function(callback){ if(sessvars.imolaLiveBlockV1LinksContext){ com.openlane.auction.executeFunctionByName(callback, "SUCCESS", sessvars.imolaLiveBlockV1LinksContext); return true; }else{ var url = ctx.imolaUrl + '/liveblock/v1Links.json?' + 'callback=' + callback + '&_jstate=' + ctx._jstate; com.openlane.auction._sendServiceRequest(url); } } this.getDealerBuyoutContext= function(vehicleId, orgId, mileage, hasReplVIN, callback){ var url= ctx.imolaUrl +'/les/predealerbuyout.json?' +'callback='+callback +'&vehicleId='+vehicleId +'&orgId='+orgId +'&mileage='+mileage +'&hasReplVIN='+hasReplVIN +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } } /*com.openlane.auction.executeFunctionByName = function(functionName, context) { var args = Array.prototype.slice.call(arguments).splice(2); var namespaces = functionName.split("."); var func = namespaces.pop(); for(var i = 0; i < namespaces.length; i++) { context = context[namespaces[i]]; } return context[func].apply(this, args); }*/ com.openlane.auction.executeFunctionByName = function(functionName) { var args = new Array(arguments.length); for (var i= arguments.length; i-->0;){ if (i in arguments){ args[i]= arguments[i]; } } args.splice(0, 1); var namespaces = functionName.split("."); var func = namespaces.pop(); ns = namespaces.join('.'); if(ns == '') { ns = 'window'; } ns = eval(ns); return ns[func].apply(ns, args); } com.openlane.auction.getUserAgreement = function(callback, plid){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._baseUrl + '/userAgreement.json?' + 'callback=' + callback + '&plid=' + plid; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction.getLegalDocuments = function(callback, plid){ var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._baseUrl + '/legalDocuments.json?' + 'callback=' + callback + '&plId=' + plid; document.getElementsByTagName('head')[0].appendChild(script); } com.openlane.auction.MBPContext = function(ctx){ this.requestMBP = function(callback){ var url= com.openlane.auction._imolaUrl + '/salesvenue/requestMBP.json?' +'callback='+callback +'&vid='+ctx.vid +'&_jstate='+ctx._jstate; com.openlane.auction._sendServiceRequest(url); } } //buyout api com.openlane.auction.DealerBuyoutContext = function(ctx){ this.getVehicleId = function() { return ctx.vehicleId; } this.setVehicleId = function(vehicleId) { ctx.vehicleId = vehicleId; } this.getTotalDealerBuyoutAmount = function() { return ctx.totalDealerBuyoutAmount; } this.getTaxes = function() { return ctx.taxes; } this.getDispositionFee = function() { return ctx.dispositionFee; } this.getLateFees = function() { return ctx.lateFees; } this.getMileageOverage = function() { return ctx.mileageOverage; } this.getWearAndTear = function() { return ctx.wearAndTear; } this.getPaymentMethods = function(){ return ctx.paymentMethods; } this.getReceiptUrl = function() { return ctx.receiptUrl; } this.setOrgId = function(orgId) { ctx.orgId = orgId; } this.setPmid = function(pmid) { ctx.pmid = pmid; } this.setMileage = function(mileage) { ctx.mileage = mileage; } this.setHasReplVIN = function(hasReplVIN) { ctx.hasReplVIN = hasReplVIN; } this.submitBuyout = function(callback){ if ( ! (com.openlane.auction._submitCallbackBuyout == undefined) ){ eval(callback + '("STATE_ERROR", "Double submission attempt")'); return; } com.openlane.auction._submitCallbackBuyout = function(status, result){ if (status == 'PAYMENT_METH_NOT_FOUND' || status == 'AUCTION_ERROR') { ctx.message = result.emsg; } else if (status == 'SUCCESS'){ ctx.receiptUrl = result.receiptUrl; } delete com.openlane.auction._submitCallbackBuyout; eval(callback + '("' + status + '")'); } var script = document.createElement('script'); script.type = 'text/javascript'; script.src = com.openlane.auction._imolaUrl + '/les/dealerbuyout.json?' + 'vehicleId=' + ctx.vehicleId + '&orgId=' + ctx.orgId + '&pmid=' + ctx.pmid + '&mileage=' + ctx.mileage + '&hasReplVIN=' + ctx.hasReplVIN + '&callback=com.openlane.auction._submitCallbackBuyout' + '&_jstate=' + ctx.state; document.getElementsByTagName('head')[0].appendChild(script); } // generic vehicle Info this.getVehicleInfo = function(vid) { var url = com.openlane.auction._imolaUrl + '/genericVehicleInfo.json?' + 'vid='+vid; com.openlane.auction._sendServiceRequest(url); } } // Employee Portal Purchase com.openlane.auction.sendEmployeePurchase = function(vid, empId, fName, lName, email, phone, mobile, abpoid, callback) { var url = com.openlane.auction._imolaUrl + '/empPortal/employeePurchase.json?' + 'vid=' + vid + '&empId=' + empId + '&fName=' + fName + '&lName=' + lName + '&email=' + email + '&phone=' + phone + '&mobile=' + mobile + '&abpoid=' + abpoid + '&callback=' + callback; com.openlane.auction._sendServiceRequest(url); } /* sessvars ver 1.01 - JavaScript based session object copyright 2008 Thomas Frank This EULA grants you the following rights: Installation and Use. You may install and use an unlimited number of copies of the SOFTWARE PRODUCT. Reproduction and Distribution. You may reproduce and distribute an unlimited number of copies of the SOFTWARE PRODUCT either in whole or in part; each copy should include all copyright and trademark notices, and shall be accompanied by a copy of this EULA. Copies of the SOFTWARE PRODUCT may be distributed as a standalone product or included with your own product. Commercial Use. You may sell for profit and freely distribute scripts and/or compiled scripts that were created with the SOFTWARE PRODUCT. v 1.0 --> 1.01 sanitizer added to toObject-method & includeFunctions flag now defaults to false */ if (window.self === window.top) { // we are NOT in an iframe sessvars=function(){ var x={}; x.$={ prefs:{ memLimit:2000, autoFlush:true, crossDomain:false, includeProtos:false, includeFunctions:false }, parent:x, clearMem:function(){ for(var i in this.parent){if(i!="$"){this.parent[i]=undefined}}; this.flush(); }, usedMem:function(){ x={}; return Math.round(this.flush(x)/1024); }, usedMemPercent:function(){ return Math.round(this.usedMem()/this.prefs.memLimit); }, flush:function(x){ var y,o={},j=this.$$; x=x||top; for(var i in this.parent){o[i]=this.parent[i]}; o.$=this.prefs; j.includeProtos=this.prefs.includeProtos; j.includeFunctions=this.prefs.includeFunctions; y=this.$$.make(o); if(x!=top){return y.length}; if(y.length/1024>this.prefs.memLimit){return false} x.name=y; return true; }, getDomain:function(){ var l=location.href l=l.split("///").join("//"); l=l.substring(l.indexOf("://")+3).split("/")[0]; while(l.split(".").length>2){l=l.substring(l.indexOf(".")+1)}; return l }, debug:function(t){ var t=t||this,a=arguments.callee; if(!document.body){setTimeout(function(){a(t)},200);return}; t.flush(); var d=document.getElementById("sessvarsDebugDiv"); if(!d){d=document.createElement("div");document.body.insertBefore(d,document.body.firstChild)}; d.id="sessvarsDebugDiv"; d.innerHTML='
'+ 'sessvars.js - debug info:

'+ 'Memory usage: '+t.usedMem()+' Kb ('+t.usedMemPercent()+'%)   '+ '[Clear memory]
'+ window.name.split('\n').join('
')+'
'; d.getElementsByTagName('span')[0].onclick=function(){t.clearMem();location.reload()} }, init:function(){ var o={}, t=this; try {o=this.$$.toObject(window.name)} catch(e){o={}}; this.prefs=o.$||t.prefs; if(this.prefs.crossDomain || this.prefs.currentDomain==this.getDomain()){ for(var i in o){this.parent[i]=o[i]}; } else { this.prefs.currentDomain=this.getDomain(); }; this.parent.$=t; t.flush(); var f=function(){if(t.prefs.autoFlush){t.flush()}}; if(window["addEventListener"]){addEventListener("unload",f,false)} else if(window["attachEvent"]){window.attachEvent("onunload",f)} else {this.prefs.autoFlush=false}; } }; x.$.$$={ compactOutput:false, includeProtos:false, includeFunctions: false, detectCirculars:true, restoreCirculars:true, make:function(arg,restore) { this.restore=restore; this.mem=[];this.pathMem=[]; return this.toJsonStringArray(arg).join(''); }, toObject:function(x){ if(!this.cleaner){ try{this.cleaner=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')} catch(a){this.cleaner=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/} }; if(!this.cleaner.test(x)){return {}}; eval("this.myObj="+x); if(!this.restoreCirculars || !alert){return this.myObj}; if(this.includeFunctions){ var x=this.myObj; for(var i in x){if(typeof x[i]=="string" && !x[i].indexOf("JSONincludedFunc:")){ x[i]=x[i].substring(17); eval("x[i]="+x[i]) }} }; this.restoreCode=[]; this.make(this.myObj,true); var r=this.restoreCode.join(";")+";"; eval('r=r.replace(/\\W([0-9]{1,})(\\W)/g,"[$1]$2").replace(/\\.\\;/g,";")'); eval(r); return this.myObj }, toJsonStringArray:function(arg, out) { if(!out){this.path=[]}; out = out || []; var u; // undefined switch (typeof arg) { case 'object': this.lastObj=arg; if(this.detectCirculars){ var m=this.mem; var n=this.pathMem; for(var i=0;i 0) out.push(',\n'); this.toJsonStringArray(arg[i], out); this.path.pop(); } out.push(']'); return out; } else if (typeof arg.toString != 'undefined') { out.push('{'); var first = true; for (var i in arg) { if(!this.includeProtos && arg[i]===arg.constructor.prototype[i]){continue}; this.path.push(i); var curr = out.length; if (!first) out.push(this.compactOutput?',':',\n'); this.toJsonStringArray(i, out); out.push(':'); this.toJsonStringArray(arg[i], out); if (out[out.length - 1] == u) out.splice(curr, out.length - curr); else first = false; this.path.pop(); } out.push('}'); return out; } return out; } out.push('null'); return out; case 'unknown': case 'undefined': case 'function': if(!this.includeFunctions){out.push(u);return out}; arg="JSONincludedFunc:"+arg; out.push('"'); var a=['\n','\\n','\r','\\r','"','\\"']; arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])}; out.push(arg); out.push('"'); return out; case 'string': if(this.restore && arg.indexOf("JSONcircRef:")==0){ this.restoreCode.push('this.myObj.'+this.path.join(".")+"="+arg.split("JSONcircRef:").join("this.myObj.")); }; out.push('"'); var a=['\n','\\n','\r','\\r','"','\\"']; arg+=""; for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])}; out.push(arg); out.push('"'); return out; default: out.push(String(arg)); return out; } } }; x.$.init(); return x; }() } else { // we are in an iframe sessvars = {}; sessvars.$ = { clearMem : function(){} }; }