// JavaScript Document $.ajaxSetup({ data: { security_token: '777', send_site: 'uss' } }); var full_page_url = ["modelFull.aspx", "bidnoFull.aspx", "exhibitFull.aspx", "cornerFull.aspx"]; var image_url = ["modelImg.aspx", "exhibitImg.aspx", "bidnoImg.aspx", "cornerImg.aspx"]; var image_detail_url = ["modelThumb.aspx", "exhibitThumb.aspx", "bidnoThumb.aspx", "cornerThumb.aspx"]; var api_base_url = 'https://iauc.jjonlinesystems.com/extension_api_bid_cud.php'; var api_base_url_search = 'https://iauc.jjonlinesystems.com/extension_api_search.php'; var api_base_url_other = 'https://iauc.jjonlinesystems.com/extension_api_others.php'; $('body').on('keypress', 'input[name = "bids_value"]', function (e) { var code = e.keyCode || e.which; if (code == 46) { alert("Decimal Character is not allowed !"); return false; } }); function return_bk_color(login_id) { if (login_id == "deen") { return "rgba(8,226,103,1)"; } else if (login_id == "auran") { return "rgba(224, 139, 11, 1)"; } else if (login_id == "qasam") { return "rgba(255, 193, 7, 1)"; } else if (login_id == "noor") { return "rgba(208, 208, 27, 1)"; } return "darkSeaGreen"; } function not_empty(value) { if (value == "" || value.length == 0) { alert("Bid value can not empty!"); return 1; } } $('body').on('change', '#jans_user_country', function () { localStorage.setItem('jancountry', $(this).val()); }); function is_image_view(url) { var is_true = false; image_url.forEach(function (value) { if (url.indexOf(value) >= 0) { is_true = true; } }); return is_true; } function is_image_detail_view(url) { var is_true = false; image_detail_url.forEach(function (value) { if (url.indexOf(value) >= 0) { is_true = true; } }); return is_true; } function is_full_image_view(url) { var is_true = false; full_page_url.forEach(function (value) { if (url.indexOf(value) >= 0) { is_true = true; } }); return is_true; } function check_model_name(_m) { var ori_name = _m; if (_m == "nothing") { // do nothing } else { for (var i = 0; i < model_map.length; i++) { if (_m.indexOf(model_map[0][i]) == 0) { // perfect match _m = model_map[0][i]; continue; } } } //console.log(_m); return _m; } var model_map = [ ["ZEST SPARK"], ["ZEST"], ["YRV"], ["YPSILON"], ["X-TRAIL"], ["WRX STI"], ["WRX S"], ["WIZARD"], ["WISH"], ["WINGROAD"], ["WINDOM"], ["WILL VS"], ["WILL VI"], ["WAKE"], ["WAGON R STINGRAY"], ["WAGON R SOLIO"], ["WAGON R RR"], ["WAGON R PLUS"], ["WAGON R"], ["VOXY"], ["VOLVO XC9"], ["VOLVO XC7"], ["VOLVO XC6"], ["VOLVO V9"], ["VOLVO V7"], ["VOLVO V6"], ["VOLVO V5"], ["VOLVO V4"], ["VOLVO S8"], ["VOLVO S6"], ["VOLVO S4"], ["VOLVO OTHER"], ["VOLVO CROSS COUNTRY"], ["VOLVO C7"], ["VOLVO C3"], ["VOLVO 94"], ["VOLVO 85"], ["VOLVO 85"], ["VOLVO 76"], ["VOLVO 24"], ["VOLTZ"], ["VOLKSWAGEN OTHER"], ["VOLKSWAGEN CC"], ["VIVIO"], ["VITZ"], ["VITA"], ["VISTA ARDEO"], ["VIGOR"], ["VIEWT"], ["VIANO"], ["VEZEL"], ["VEROSSA"], ["VERISA"], ["VELLFIRE HYBRID"], ["VELLFIRE"], ["VANGUARD"], ["VANETTE VAN"], ["VANETTE TRUCK"], ["VANEO"], ["VANAGON"], ["VAMOS HOBIO PRO"], ["VAMOS HOBIO"], ["VAMOS"], ["V-CLASS"], ["URBAN UNIMOG"], ["U.S.A. OTHER"], ["U.K. OTHER"], ["TWINGO"], ["TWIN"], ["TUNDRA"], ["TT ROADSTER"], ["TT COUPE"], ["TRITON"], ["TREZIA"], ["TRAVIQ"], ["TRANSPORTER"], ["TRAILER OTHER"], ["TOYOTA OTHER"], ["TOYOTA CLASSIC"], ["TOYOACE ROUTE VAN"], ["TOYOACE"], ["TOWNACE WAGON"], ["TOWNACE VAN"], ["TOWNACE TRUCK"], ["TOWNACE NOAH"], ["TOWN BOX"], ["TOURING HIACE"], ["TOUAREG"], ["TORNEO"], ["TOPPO BJ"], ["TOPPO"], ["TODAY"], ["TITAN TRUCK"], ["TITAN DASH"], ["TITAN"], ["TIIDA LATIO"], ["TIIDA"], ["TIGUAN"], ["THOR"], ["THE GREAT"], ["THE BEETLE CABRIOLET"], ["THE BEETLE"], ["THAT’S"], ["TERRANO REGULUS"], ["TERRANO"], ["TERIOS LUCIA"], ["TERIOS KID"], ["TERIOS"], ["TEANA"], ["TANTO EXE"], ["TANTO"], ["TANK"], ["TACOMA"], ["SYLPHY"], ["SWIFT SPORT"], ["SWIFT"], ["SUZUKI OTHER"], ["SUPRA"], ["SUPER GREAT"], ["SUPER DOLPHIN"], ["SUNNY TRUCK"], ["SUNNY"], ["SUCCEED WAGON"], ["SUCCEED VAN"], ["SUCCEED"], ["STREAM"], ["STEPWAGON SPADA"], ["STEPWAGON"], ["STELLA"], ["STARLET"], ["STAGEA"], ["SPRINTER VAN"], ["SPRINTER TRUENO"], ["SPRINTER CARIB"], ["SPRINTER"], ["SPLASH"], ["SPIANO"], ["SPARKY"], ["SPADE"], ["SPACIA CUSTOM Z"], ["SPACIA CUSTOM"], ["SPACIA"], ["SOLIO BANDIT"], ["SOLIO"], ["SOARER"], ["SMART K"], ["SMART FORTWO COUPE"], ["SMART FOR FOUR"], ["SMART COUPE"], ["SLS AMG"], ["SKYLINE CROSSOVER"], ["SKYLINE"], ["SILVIA"], ["SIENTA"], ["SIENNA"], ["SHUTTLE"], ["SHARAN"], ["SERENA"], ["SEQUOIA"], ["SCRUM WAGON"], ["SCRUM TRUCK"], ["SCRUM"], ["SCIROCCO"], ["SCENIC"], ["SC43"], ["SAVANNA RX-"], ["SAMBAR VAN"], ["SAMBAR TRUCK"], ["SAMBAR DIAS"], ["SAI"], ["SAFARI"], ["SABER"], ["S66"], ["S2000"], ["S-MX"], ["S-CLASS"], ["S-CLASS"], ["S-CLASS"], ["S-CARGO"], ["RYOGA"], ["RVR"], ["RUSH"], ["ROVER VANDEN PLAS"], ["ROSA"], ["ROOX"], ["ROOMY"], ["ROCKY"], ["ROADSTER"], ["RIESSE II"], ["RIESSE"], ["RIDGELINE"], ["RENAULT OTHER"], ["REGIUS ACE VAN"], ["REGIUS"], ["RAV4L"], ["RAV4J"], ["RAV"], ["RAUM"], ["RASHEEN"], ["RAPIDE"], ["RANGE ROVER VOGUE"], ["RANGE ROVER SPORT"], ["RANGE ROVER EVOQUE COUPE"], ["RANGE ROVER EVOQUE CONVERTIBLE"], ["RANGE ROVER EVOQUE"], ["RANGE ROVER"], ["RACTIS"], ["R-CLASS"], ["QUON"], ["QUATTROPORTE"], ["PUNTO EVO"], ["PUNTO"], ["PULSAR"], ["PROUDIA"], ["PRONARD"], ["PROGRES"], ["PROFIA"], ["PROCEED MARVIE"], ["PROCEED"], ["PROBOX WAGON"], ["PROBOX VAN"], ["PROBOX"], ["PRIUS PHV"], ["PRIUS ALPHA"], ["PRIUS"], ["PRIMERA WAGON"], ["PRIMERA"], ["PRESIDENT"], ["PRESAGE"], ["PREMIO"], ["PREMACY"], ["PRELUDE"], ["PORTE"], ["POLO GTI"], ["POLO"], ["PLEO PLUS"], ["PLEO NESTA"], ["PLEO CUSTOM"], ["PLEO"], ["PLATZ"], ["PIXIS VAN"], ["PIXIS TRUCK"], ["PIXIS SPACE"], ["PIXIS MEGA"], ["PIXIS JOY"], ["PIXIS EPOCH"], ["PINO"], ["PERTNER"], ["PASSO SETTE"], ["PASSO"], ["PASSAT WAGON"], ["PASSAT VARIANT"], ["PASSAT CC"], ["PASSAT ALLTRACK"], ["PASSAT"], ["PAO"], ["PANDA"], ["PANAMERA"], ["PALETTE SW"], ["PALETTE"], ["PAJERO MINI"], ["PAJERO IO"], ["PAJERO"], ["OVERSEAS NISSAN OTHER"], ["OUTLANDER PHEV"], ["OUTLANDER"], ["OUTBACK"], ["OTTI"], ["OTHER"], ["ORTHIA"], ["OPTI"], ["OPA"], ["ODYSSEY HYBRID"], ["ODYSSEY"], ["ODYSSEY"], ["NV350CARAVAN VAN"], ["NV200VANETTE WAGON"], ["NV200VANETTE VAN"], ["NV150AD"], ["NV100CLIPPER VAN"], ["NV100CLIPPER RIO"], ["NT45"], ["NT100CLIPPER TRUCK"], ["NOTE"], ["NOAH"], ["NISSAN UD"], ["NISSAN OTHER"], ["NISSAN DIESEL OTHER"], ["NEW PANDA"], ["NEW BEETLE CABRIOLET"], ["NEW BEETLE"], ["NEW BARCHETTA"], ["NAKED"], ["NADIA"], ["N-WGN CUSTOM"], ["N-WGN"], ["N-ONE"], ["N-BOX SLASH"], ["N BOX PLUS CUSTOM"], ["N BOX PLUS"], ["N BOX CUSTOM"], ["N BOX"], ["MUSTANG"], ["MURANO"], ["MULTIPLA"], ["MU WIZARD"], ["MR-S"], ["MR WAGON"], ["MOVE LATTE"], ["MOVE CONTE"], ["MOVE CANBUS"], ["MOVE"], ["MONDEO"], ["MOCO"], ["MOBILIO SPIKE"], ["MOBILIO"], ["MITSUBISHI OTHER"], ["MITSUBISHI FUSO OTHER"], ["MISTRAL"], ["MIRAI"], ["MIRAGE"], ["MIRA WALKTHROUGH VAN"], ["MIRA GINO"], ["MIRA E:S"], ["MIRA CUSTOM"], ["MIRA COCOA"], ["MIRA AVY"], ["MIRA"], ["MINICAB-MIEV"], ["MINICAB VAN"], ["MINICAB TRUCK"], ["MINICA"], ["MINI"], ["MILLENIA"], ["MIGHTY BOY"], ["MIDGETII"], ["MERCEDES BENZ OTHER"], ["MEGANE"], ["MEDIUM CLASS"], ["MAZDA SPEED AXELA"], ["MAZDA SPEED ATENZA"], ["MAX"], ["MARKII WAGON"], ["MARKII QUALIS"], ["MARKII BLIT"], ["MARK X ZIO"], ["MARK X"], ["MARK II"], ["MARCH"], ["MACAN"], ["M-CLASS"], ["LX57"], ["LX47"], ["LUTECIA"], ["LUPO"], ["LUCRA CUSTOM"], ["LUCRA"], ["LUCE"], ["LOGO"], ["LITEACE WAGON"], ["LITEACE VAN"], ["LITEACE TRUCK"], ["LITEACE NOAH"], ["LINCOLN TOWNCAR"], ["LINCOLN OTHER"], ["LINCOLN NAVIGATOR"], ["LINCOLN MKX"], ["LINCOLN LIMOUSINE"], ["LIFE DUNK"], ["LIFE"], ["LIBERTY"], ["LEVORG"], ["LEGNUM"], ["LEGEND"], ["LEGACY TOURING WAGON"], ["LEGACY LANCASTER"], ["LEGACY B"], ["LEAF"], ["LE SEYDE"], ["LAUREL"], ["LATIO"], ["LARGO"], ["LAPUTA"], ["LANDY"], ["LAND ROVER DISCOVERY"], ["LAND ROVER DEFENDER"], ["LAND CRUISER PRADO"], ["LAND CRUISER 8"], ["LAND CRUISER 7"], ["LAND CRUISER 6"], ["LAND CRUISER 10"], ["LAND"], ["LANCER WAGON"], ["LANCER CEDIA WAGON"], ["LANCER CARGO"], ["LANCER"], ["LAFESTA"], ["KUGA"], ["KOLEOS"], ["KLUGER L"], ["KLUGER"], ["KLUGER"], ["KLUGER"], ["KIZASHI"], ["KEI WORKS"], ["KEI SPORT"], ["KANGOO"], ["JUKE"], ["JOURNEY BUS"], ["JIMNY WIDE"], ["JIMNY SIERRA"], ["JIMNY"], ["JETTA"], ["JEEP WRANGLER UNLIMITED"], ["JEEP WRANGLER"], ["JEEP RENEGADE"], ["JEEP PATRIOT"], ["JEEP GRAND CHEROKEE"], ["JEEP COMPASS"], ["JEEP CHEROKEE"], ["JEEP"], ["JAPAN OTHER"], ["JAGUAR OTHER"], ["JADE"], ["ITALY OTHER"], ["ISUZU OTHER"], ["ISIS"], ["IS F"], ["IPSUM"], ["INTEGRA"], ["INSPIRE"], ["INSIGHT EXCLUSIVE"], ["INSIGHT"], ["INFINITI Q4"], ["INFINITI OTHER"], ["IMPREZA XV HYBRID"], ["IMPREZA XV"], ["IMPREZA WRX"], ["IMPREZA SPORTS WAGON"], ["IMPREZA SPORTS HYBRID"], ["IMPREZA SPORTS"], ["IMPREZA G"], ["IMPREZA ANESIS"], ["IMPREZA"], ["IGNIS"], ["I-MIEV"], ["HUSTLER"], ["HUMMER H"], ["HUMMER H"], ["HUMMER H"], ["HR-V"], ["HORIZON"], ["HOMY VAN"], ["HOMY COACH"], ["HINO TRUCK"], ["HINO RANGER"], ["HINO RAINBOW"], ["HINO OTHER"], ["HILUX SURF"], ["HILUX SPORTS PICK UP"], ["HILUX PICK UP"], ["HILUX"], ["HILLMAN MINX"], ["HIJET TRUCK"], ["HIJET CARGO"], ["HIJET CADDIE"], ["HIACE WAGON"], ["HIACE VAN"], ["HIACE TRUCK"], ["HIACE REGIUS"], ["HIACE COMMUTER"], ["HARRIER HYBRID"], ["HARRIER"], ["GRANVIA"], ["GRANDIS"], ["GRANDE PUNTO"], ["GRAND SCENIC"], ["GRAND HIACE"], ["GRAND ESCUDO"], ["GRAN TURISMO"], ["GRAN SPORT"], ["GRACE"], ["GOLF WAGON"], ["GOLF VARIANT"], ["GOLF TOURAN"], ["GOLF R VARIANT"], ["GOLF R"], ["GOLF GTI"], ["GOLF GTE"], ["GOLF CABRIOLET"], ["GOLF CABRIO"], ["GOLF ALLTRACK"], ["GOLF"], ["GMC YUKON"], ["GMC SUBURBAN"], ["GMC SIERA"], ["GMC SAVANA"], ["GLORIA WAGON"], ["GLORIA"], ["GLK-CLASS"], ["GLC-CLASS"], ["GLA-CLASS"], ["GLA-CLASS"], ["GL-CLASS"], ["GIULIETTA"], ["GIGA"], ["GHOST"], ["GHIBLI"], ["GELANDEWAGEN"], ["GALUE20"], ["GALUE II"], ["GALLARDO"], ["GALANT FORTIS SPORT BACK"], ["GALANT FORTIS"], ["GALANT"], ["GAIA"], ["G-CLASS"], ["FUSO TRUCK"], ["FUNCARGO"], ["FUGA HYBRID"], ["FUGA"], ["FREELANDER"], ["FREELANDER"], ["FREED SPIKE HYBRID"], ["FREED SPIKE"], ["FREED PLUS HYBRID"], ["FREED PLUS"], ["FREED HYBRID"], ["FREED"], ["FORWARD V"], ["FORWARD JUSTON"], ["FORWARD"], ["FORKLIFT"], ["FORESTER"], ["FORD OTHER"], ["FOCUS"], ["FLAIR WAGON CUSTOM STYEL"], ["FLAIR WAGON"], ["FLAIR CUSTOM STYLE"], ["FLAIR CROSSOVER"], ["FLAIR"], ["FJ CRUISER"], ["FJ CRUISER"], ["FIT SHUTTLE HYBRID"], ["FIT SHUTTLE"], ["FIT HYBRID"], ["FIT ARIA"], ["FIGHTER MIGNON"], ["FIGHTER"], ["FIGARO"], ["FIAT OTHER"], ["FARGO VAN"], ["FAMILIA VAN"], ["FAMILIA S-WAGON"], ["FAMILIA"], ["FAIRLADY Z"], ["F-TYPE"], ["F-PACE"], ["F-15"], ["EXPLORER SPORT TRAC"], ["EXPLORER"], ["EXPERT"], ["EXPEDITION"], ["EXIGE"], ["EXIGA CROSSOVER"], ["EXIGA"], ["EXCURSION"], ["EVERY WAGON"], ["EVERY LANDY"], ["EVERY"], ["EURO VAN"], ["EUNOS50"], ["EUNOS ROADSTER"], ["EUNOS COSMO"], ["ESTIMA T"], ["ESTIMA LUCIDA"], ["ESTIMA L"], ["ESTIMA HYBRID"], ["ESTIMA EMINA"], ["ESTIMA"], ["ESSE"], ["ESQUIRE"], ["ESCUDO"], ["ESCAPE"], ["EOS"], ["ELYSION PRESTIGE"], ["ELYSION"], ["ELISE"], ["ELGRAND"], ["ELF UT"], ["ELF TRUCK"], ["ELEMENT"], ["ELAN"], ["EK WAGON"], ["EK SPORT"], ["EK SPACE CUSTOM"], ["EK SPACE"], ["EK CUSTOM"], ["EK CLASSY"], ["EK ACTIVE"], ["EFINI RX-"], ["EDIX"], ["EDGE"], ["ECOSPORT"], ["ECONOLINE"], ["ECLIPSE"], ["E-CLASS STATIONWAGON"], ["E-CLASS"], ["E-CLASS"], ["E-35"], ["DYNA URBAN SUPPORTER"], ["DYNA TRUCK"], ["DYNA ROUTE VAN"], ["DUTRO"], ["DUET"], ["DUALIS"], ["DODGE VIPER"], ["DODGE RAM"], ["DODGE NITRO"], ["DODGE MAGNUM"], ["DODGE JC"], ["DODGE DURANGO"], ["DODGE CHARGER"], ["DODGE CHARENGER"], ["DISCOVERY"], ["DISCOVERY"], ["DISCOVERY"], ["DION"], ["DINGO"], ["DIAS WAGON"], ["DIAMANTE"], ["DEMIO"], ["DELTA TRUCK"], ["DELICA VAN"], ["DELICA TRUCK"], ["DELICA STAR WAGON"], ["DELICA SPACE GEAR"], ["DELICA D:"], ["DELICA D:"], ["DELICA D:"], ["DELICA CARGO"], ["DEFENDER"], ["DAYZ ROOX"], ["DAYZ"], ["DATSUN TRUCK"], ["DATSUN PICK UP"], ["DAIMLER"], ["CULTUS"], ["CUBE CUBIC"], ["CUBE"], ["CROWN VAN"], ["CROWN STATIONWAGON"], ["CROWN SEDAN"], ["CROWN MAJESTA"], ["CROWN HYBRID"], ["CROWN ESTATE"], ["CROWN COMFORT"], ["CROWN"], ["CROSS ROAD"], ["CROSS GOLF"], ["CRESTA"], ["CR-Z"], ["CR-X DELSOL"], ["CR-X"], ["CR-V"], ["COSMO SPORT"], ["CORSA"], ["CORONA PREMIO"], ["CORONA EXIV"], ["CORONA"], ["COROLLA VAN"], ["COROLLA TOURING WAGON"], ["COROLLA SPACIO"], ["COROLLA RUNX"], ["COROLLA RUMION"], ["COROLLA LEVIN"], ["COROLLA II"], ["COROLLA FIELDER"], ["COROLLA CERES"], ["COROLLA AXIO"], ["COROLLA"], ["COPEN"], ["COO"], ["CONTINENTAL"], ["CONSTRUCTION EQUIP FARMMACHINE"], ["CONDOR"], ["COMO"], ["COMFORT"], ["COLT PLUS"], ["COLT"], ["COASTER BIG VAN"], ["COASTER"], ["CLS-CLASS SHOOTING BRAKE"], ["CLS-CLASS"], ["CLIPPER VAN"], ["CLIPPER TRUCK"], ["CLIPPER RIO"], ["CLA-CLASS SHOOTING BRAKE"], ["CLA-CLASS SHOOTING BRAKE"], ["CLA-CLASS"], ["CLA-CLASS"], ["CIVILIAN BUS"], ["CIVIC HYBRID"], ["CIVIC FERIO"], ["CIVIC"], ["CITY"], ["CIMA"], ["CHRYSLER YPSILON"], ["CHRYSLER VOYAGER"], ["CHRYSLER PT CRUISER"], ["CHRYSLER GRAND VOYAGER"], ["CHRYSLER 300C"], ["CHRYSLER 30"], ["CHIFFON"], ["CHEVROLET TRAILBLAZER"], ["CHEVROLET TAHOE"], ["CHEVROLET SUBURBAN"], ["CHEVROLET SILVERADO"], ["CHEVROLET MW"], ["CHEVROLET IMPARA"], ["CHEVROLET HHR"], ["CHEVROLET EXPRESS"], ["CHEVROLET ELCAMINO"], ["CHEVROLET CRUSE"], ["CHEVROLET CORVETTE"], ["CHEVROLET CAPTIVA"], ["CHEVROLET CAPRICE"], ["CHEVROLET CAMARO"], ["CHEVROLET C-150"], ["CHEVROLET C-1"], ["CHEVROLET BLAZER"], ["CHEVROLET AVALANCHE"], ["CHEVROLET ASTRO"], ["CHERRY"], ["CHASER"], ["CHARIOT GRANDIS"], ["CHARIOT"], ["CERVO"], ["CENTURY"], ["CELSIOR"], ["CELICA"], ["CEFIRO"], ["CEDRIC"], ["CAYMAN"], ["CAYENNE"], ["CAST"], ["CARRY TRUCK"], ["CAROL"], ["CARINA SURF"], ["CARINA"], ["CARAVAN MICROBUS"], ["CARAVAN ELGRAND"], ["CARAVAN COACH"], ["CARAVAN BUS"], ["CARAVAN"], ["CAPTUR"], ["CAPPUCCINO"], ["CAPELLA WAGON"], ["CAPA"], ["CANTER GUTS"], ["CANTER"], ["CANADA HONDA OTHER"], ["CAMRY GRACIA SEDAN"], ["CAMRY GRACIA"], ["CAMRY"], ["CAMROAD"], ["CAMI"], ["CALIFORNIA T"], ["CALIFORNIA"], ["CALDINA VAN"], ["CALDINA"], ["CADILLAC STS"], ["CADILLAC SRX CROSSOVER"], ["CADILLAC SRX"], ["CADILLAC SEVILE"], ["CADILLAC FLEETWOOD"], ["CADILLAC ESCALADE EXT"], ["CADILLAC ESCALADE"], ["CADILLAC CTS"], ["CADILLAC CONCOURS"], ["C-HR"], ["C-CLASS STATIONWAGON"], ["C-CLASS STATIONWAGON"], ["C-CLASS"], ["C-CLASS"], ["BUICK ROADMASTER"], ["BRONCO"], ["BREVIS"], ["BRAWNY VAN"], ["BRAWNY TRUCK"], ["BOXSTER"], ["BORA"], ["BOON"], ["BONGO VAN"], ["BONGO TRUCK"], ["BONGO FRIENDEE"], ["BLUEBIRD SYLPHY"], ["BLUEBIRD"], ["BLADE"], ["BIKE TRIKE OTHER"], ["BIGHORN"], ["BIG THUMB"], ["BIANTE"], ["BELTA"], ["BEGO"], ["BEETLE"], ["BEAT"], ["BALENO"], ["B-CLASS"], ["AZ-WAGON CUSTOM STYLE"], ["AZ-WAGON"], ["AZ-OFFROAD"], ["AXELA SPORT"], ["AXELA HYBRID"], ["AXELA"], ["AVEVSIS WAGON"], ["AVENSIS SEDAN"], ["AVENIR SALUT"], ["AVENIR"], ["AVANCIER"], ["AUTOZAM AZ-"], ["AURIS"], ["ATRAI WAGON"], ["ATRAI"], ["ATRAI"], ["ATLAS TRUCK"], ["ATENZA WAGON"], ["ATENZA SPORT WAGON"], ["ATENZA SPORT"], ["ATENZA SEDAN"], ["ASTRA"], ["ARTEON"], ["ARISTO"], ["AQUA"], ["ALTO WORKS"], ["ALTO TURBO RS"], ["ALTO LAPIN CHOCOLAT"], ["ALTO LAPIN"], ["ALTO ECO"], ["ALTO"], ["ALTEZZA GITA"], ["ALTEZZA"], ["ALPHARD V"], ["ALPHARD HYBRID"], ["ALPHARD G"], ["ALPHARD"], ["ALLION"], ["ALLEX"], ["ALFA SPORTWAGON"], ["ALFA SPIDER"], ["ALFA ROMEO MITO"], ["ALFA ROMEO 4C"], ["ALFA GT"], ["ALFA BRERA"], ["ALFA 15"], ["ALFA 15"], ["ALFA 14"], ["ALCYONE"], ["AIRWAVE"], ["AIRTREK"], ["AD VAN"], ["AD EXPERT"], ["ACTY VAN"], ["ACTY TRUCK"], ["ACCORD WAGON"], ["ACCORD TOURER"], ["ACCORD HYBRID"], ["ACCORD"], ["ABARTH 595C"], ["ABARTH 59"], ["ABARTH 500C"], ["ABARTH 50"], ["ABARTH 12"], ["A-CLASS"], ["650S"], ["540C"], ["500X"], ["500S"], ["500C"], ["180SX"] ]; function get_month_selected(month) { var obj = { 'Dec': '12', 'Jan': '01', 'Feb': '02', 'Mar': '03', 'Apr': '04', 'May': '05', 'Jun': '06', 'Jul': '07', 'Aug': '08', 'Sep': '09', 'Oct': '10', 'Nov': '11' } return obj[month]; } function get_date_formate(date) { var date = date.split('-'); return date[2] + '-' + date[1] + '-' + date[0]; } ///////////////////// //////// Car Detail page// ///////////////////////// $('body').on('keypress', '.add_bits_data', function (e) { var current_view_page = window.location.href; var self_obj = $(this).parent().parent(); var is_show_bids_value = 0; var auction_date_fetch = ""; var uss_time = ""; var uss_is_correction = 0; if ($(self_obj).hasClass("teisei")) { uss_is_correction = 1; } try { //fetching date var _auction_date = $(self_obj).find(".aaDate").text(); uss_time = _auction_date; var url = window.location.href; if (is_full_image_view(url)) { _auction_date = $('#MainContents_Exhibit_GridArea').find("td.aaDate").text(); if ($('#MainContents_Exhibit_GridArea').find("tr.teisei").length != 0) { uss_is_correction = 1; } uss_time = _auction_date; } _auction_date = _auction_date.split("["); _auction_date = _auction_date[0].split("[End]"); _auction_date = _auction_date[0].split("[--:--]"); _auction_date = _auction_date[0].split("temp"); if (Array.isArray(_auction_date)) { _auction_date = _auction_date[0]; } _auction_date = _auction_date.split(" "); var _month = _auction_date[0].trim(); _month = get_month_selected(_month); _auction_date = _auction_date[1]; _auction_date = _auction_date.split("."); var _day = _auction_date[0].trim(); if (_day.length == 1) { _day = "0" + _day; } //console.log(_auction_date[1]); var _year = "20" + _auction_date[1].trim(); auction_date_fetch = _year + "-" + _month + "-" + _day; //selected date// var _selected_date = $(".jans_auction_date").val(); _selected_date = _selected_date.split("-"); //name are reverse of array index var _s_month = _selected_date[1].trim(); if (_s_month.length == 1) { _s_month = "0" + _s_month; } var _s_day = _selected_date[0].trim(); if (_s_day.length == 1) { _s_day = "0" + _s_day; } var _s_year = _selected_date[2].trim(); //console.log(_s_year + " == " + _year + " => " + _month + " == " + _s_month + " => " + _day + " == " + _s_day); if (_s_year == _year && _month == _s_month && _day == _s_day) { is_show_bids_value = 1; //console.log("Equal"); } else { is_show_bids_value = 0; //console.log("Not Equal"); } //console.log(is_show_bids_value); } catch (error) { } book_mark_data(self_obj, 0); var key = e.which; if (key == 13) { /* var price_value = ""; $(self_obj).find("#bids_value").each(function () { price_value = $(this).val(); }); var return_value = not_empty(price_value); if (return_value == 1) { return false; } */ /// var action = "insert"; var username = $("#janusername").val(); var password = $("#janpassword").val(); var jans_auction_date = $(".jans_auction_date").val(); //var jans_auction_dates = jans_auction_date.split('-'); //jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1]; jans_auction_date = get_date_formate(jans_auction_date); if (Date.parse(auction_date_fetch)) { jans_auction_date = auction_date_fetch; } else { //it will save entry in case of wrong date format $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { selected_date: jans_auction_date, curr_date: new Date().toISOString().slice(0, 10), ext_view: current_view_page, user_id: username, action: "save_error_log" }, success: function (data) { } }); } var jans_country = $('#jans_user_country').val(); var url = window.location.href; if (is_full_image_view(url)) { book_mark_data(self_obj, 44); var obj = $('#MainContents_Exhibit_GridArea'); /// var jans_bid_price = []; $('body').find("#bids_value").each(function () { jans_bid_price.push($(this).val()); }); var jans_bid_marks = []; $('body').find("#remarks").each(function () { jans_bid_marks.push($(this).val()); }); var info = $(obj).find('td.bidNo').html(); if (info) { info = info.split("
"); } var auction_company = []; if (info && info[1]) auction_company.push("USS " + info[1].trim()); var lot_no = ""; if (info && info[0]) lot_no = info[0]; var lot_no1 = ''; var lot_no2 = lot_no; var modelyear = []; var grade = []; var inspection = []; var transactionstatus = []; var cc = ''; var carname = []; try { var modal_name_clone = $(obj).find("td.model").clone(); var grade_name_clone = $(modal_name_clone).find("div").detach(); modal_name_clone = $(modal_name_clone).text(); grade_name_clone = $(grade_name_clone).text(); modal_name_clone = modal_name_clone.trim(); grade_name_clone = grade_name_clone.trim(); modal_name_clone = check_model_name(modal_name_clone); carname.push(modal_name_clone); grade.push(grade_name_clone); } catch (err) { } //carname_1 = check_model_name(carname_1); var year = $(obj).find("td.mYear").text(); if (year) modelyear.push(year); var mileage = []; var shifts = []; var startprice = []; var info1 = $(obj).find("td.shift").html(); if (info1) { info1 = info1.split("
"); shifts.push(info1[0]); cc = info1[1]; } var info1 = $(obj).find("td.mile").html(); if (info1) { info1 = info1.split("
"); mileage.push(info1[0]); inspection.push(info1[1]); } var info1 = $(obj).find("td.color").text(); var color_name = info1; var info1 = $(obj).find("td.cType").text(); if (info1) { info1 = info1.split(" "); info1 = info1[0]; } var type = info1; var info1 = $(obj).find("td.price").text(); if (info1) { info1 = info1.split("----"); transactionstatus.push(info1[0]); var stp = info1[1]; if (stp) stp = stp.replace(',', ''); startprice.push(stp); } ////////////////////////////////////////////////////////////////////////////////////////////////////// $.ajax({ type: 'POST', url: api_base_url, crossDomain: true, async: true, data: { action: action, username: username, password: password, jans_auction_date: jans_auction_date, jans_country: jans_country, auction_company: auction_company, lot_no1: lot_no1, lot_no2: lot_no2, modelyear: modelyear, carname: carname, grade: grade, ctype: type, cc: cc, color: color_name, 'shift': shifts, inspection: inspection, mileage: mileage, jans_bid_price: jans_bid_price, remark: jans_bid_marks, start_price: startprice, extension_view: current_view_page, extension_version: "USS_2", uss_time: uss_time, uss_is_correction: uss_is_correction }, success: function (data) { ///////////////////////////////////////////////// if (isNaN(data)) { // console.log("Error on insertion"); alert(data); } else { //set seen car // var img_path = $(".imgTag"); if (img_path) { img_path = img_path[1]; img_path = $(img_path).attr("src"); img_path = img_path.replace("Front", "ThumbFront"); img_path = img_path.replace("_0", "_T"); var arr_ = localStorage.getItem("hide_arr"); if (img_path && img_path.length >= 2) { if (arr_) { arr_ = JSON.parse(arr_); if (arr_.indexOf(img_path) == -1) { arr_.push(img_path); } } else { arr_ = []; arr_.push(img_path); } localStorage.setItem("hide_arr", JSON.stringify(arr_)); } } //end seen car // var hr_name = get_country_class(jans_country); var sh_cntry = $("#jans_user_country option:selected").text(); var show_bid_name = sh_cntry + ' ( ' + username + ' ) '; var bk_color = return_bk_color(username); var data_key = data; var add_bid = '
 
' + '' + '' + '' + '
'; var obj_checking = $('#MainContents_Exhibit_GridArea'); var obj = $('#MainContents_Exhibit_GridArea'); var info_bid_no = $(obj).find('td.bidNo').html(); var c_name=""; if (info_bid_no) { info_bid_no = info_bid_no.split("
"); c_name = info_bid_no[1]; info_bid_no = info_bid_no[0]; c_name = c_name.trim(); } //console.log(is_show_bids_value); var info = $(obj).find('td.bidNo').html(); if (info) { info = info.split("
"); } var c_name_ori = ""; if (info && info[1]) { c_name_ori = info[1].trim(); } var lot_no = ""; if (info && info[0]) lot_no = info[0]; if (lot_no == info_bid_no && c_name_ori == c_name ) { //if(is_show_bids_value == 1 ) //{ $(".show_already_existing_bids_full").parent().append(add_bid); sort_user_bids($(".show_already_existing_bids_full").parent()); //} } //////// $("#jancurrentprice").text(jans_bid_price); if (localStorage.getItem('jantotalbids') == '') var count = 1; else var count = parseInt(localStorage.getItem('jantotalbids')) + 1; localStorage.setItem('jantotalbids', count); $("#janstotalbids").text(count); //////// } //////////////////////COde to change the color of inserting bid for limits 333/////////////////////////////////////// cars_data_list = []; cars_data_list.push({ name: auction_company[0], lot_no: lot_no2, date: jans_auction_date }); $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { action: "get_user_bids", username: localStorage.getItem("janusername"), data: JSON.stringify(cars_data_list) }, success: function (data) { data = JSON.parse(data); if (data) { data = data.data; for (var key in data) { var row = data[key]; row.bid_price = parseInt(row.bid_price); if (!isNaN(row.bid_price)) { row.bid_price = parseInt(row.bid_price); if (row.bid_price > 500) { row.bid_price = row.bid_price / 10000; } if (parseInt(row.bid_price) < parseInt(row.min) || parseInt(row.bid_price) > parseInt(row.max)) { row.uss_color = "red"; $('#jans_pre_id' + data_key).parent('div').css({ 'background-color': row.uss_color }); } } } } } }); ////////////////////END////////////////////////////////////// ///////////////////////////////////////////////// }, error: function (error) { alert("Error on Sending Request!"); // console.log(error); } }); } else { /// var jans_bid_price = []; $(self_obj).find("#bids_value").each(function () { jans_bid_price.push($(this).val()); }); var jans_bid_marks = []; $(self_obj).find("#remarks").each(function () { jans_bid_marks.push($(this).val()); }); var info = $(self_obj).find('.bidNo').html(); if (info) { info = info.split("
"); } var auction_company = []; if (info && info[1]) auction_company.push("USS " + info[1].trim()); var lot_no = ""; if (info && info[0]) lot_no = info[0]; var lot_no1 = ''; var lot_no2 = lot_no; var modelyear = []; var grade = []; var inspection = []; var transactionstatus = []; var cc = ''; var year = $(self_obj).find(".mYear").text(); if (year) modelyear.push(year); var mileage = []; var shifts = []; var startprice = []; var info1 = $(self_obj).find(".shift").html(); if (info1) { info1 = info1.split("
"); shifts.push(info1[0]); cc = info1[1]; } var info1 = $(self_obj).find(".mile").html(); if (info1) { info1 = info1.split("
"); mileage.push(info1[0]); inspection.push(info1[1]); } var info1 = $(self_obj).find(".color").text(); var color_name = info1; var info1 = $(self_obj).find(".cTypeDir").text(); var type = info1; var info1 = $(self_obj).find(".price").text(); if (info1) { info1 = info1.split("----"); transactionstatus.push(info1[0]); var stp = info1[1]; if (stp) stp = stp.replace(',', ''); startprice.push(stp); } var carname = []; try { var info1 = $(self_obj).find(".carLink").text(); var modal_name_clone = $(self_obj).find(".carLink").clone(); var grade_name_clonse = $(modal_name_clone).find("span").detach(); modal_name_clone = $(modal_name_clone).text(); grade_name_clonse = $(grade_name_clonse).text(); modal_name_clone = modal_name_clone.trim(); grade_name_clonse = grade_name_clonse.trim(); modal_name_clone = check_model_name(modal_name_clone); carname.push(modal_name_clone); grade.push(grade_name_clonse); } catch (err) { } ////////////////////////////////////////////////////////////////////////////////////////////////////// $.ajax({ type: 'POST', url: api_base_url, crossDomain: true, async: true, data: { action: action, username: username, password: password, jans_auction_date: jans_auction_date, jans_country: jans_country, auction_company: auction_company, lot_no1: lot_no1, lot_no2: lot_no2, modelyear: modelyear, //carname: carname, grade: grade, ctype: type, carname: carname, cc: cc, //crate: grade, // ext: ext_color, //inter: color: color_name, //color_no: color_no, 'shift': shifts, //ac: ac, //chassiscode: chassiscode, inspection: inspection, mileage: mileage, jans_bid_price: jans_bid_price, // car_detail_url: car_detail_url, remark: jans_bid_marks, start_price: startprice, extension_view: current_view_page, extension_version: "USS_2", uss_time: uss_time, uss_is_correction: uss_is_correction }, success: function (data) { if (isNaN(data)) { // console.log("Error on insertion"); alert(data); } else { var hr_name = get_country_class(jans_country); var sh_cntry = $("#jans_user_country option:selected").text(); var show_bid_name = sh_cntry + ' ( ' + username + ' ) '; var bk_color = return_bk_color(username); var data_key = data; var add_bid = '
 
' + '' + '' + '' + '
'; // if(is_show_bids_value == 1 ) // { $(self_obj).find(".show_already_existing_bids").append(add_bid); //} sort_user_bids(self_obj); //////// $("#jancurrentprice").text(jans_bid_price); if (localStorage.getItem('jantotalbids') == '') var count = 1; else var count = parseInt(localStorage.getItem('jantotalbids')) + 1; localStorage.setItem('jantotalbids', count); $("#janstotalbids").text(count); //////// } //////////////////////////CODE TO change color after inserting bid//////////////////////////////////////// cars_data_list = []; cars_data_list.push({ name: auction_company[0], lot_no: lot_no2, date: jans_auction_date }); $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { action: "get_user_bids", username: localStorage.getItem("janusername"), data: JSON.stringify(cars_data_list) }, success: function (data) { data = JSON.parse(data); if (data) { data = data.data; for (var key in data) { var row = data[key]; row.bid_price = parseInt(row.bid_price); if (!isNaN(row.bid_price)) { row.bid_price = parseInt(row.bid_price); if (row.bid_price > 500) { row.bid_price = row.bid_price / 10000; } if (parseInt(row.bid_price) < parseInt(row.min) || parseInt(row.bid_price) > parseInt(row.max)) { row.uss_color = "red"; $('#jans_pre_id' + data_key).parent('div').css({ 'background-color': row.uss_color }); } } } } } }); ///////////////////////////END/////////////////////////////////////// }, error: function (error) { alert("Error on Sending Request!"); // console.log(error); } }); } ////////////////////////////////////////////////////////////////////////////////////////////////////// } }); ////user login and get user assaign countries//////////////////// $('body').on('click', '#janlogin_user', function () { ///alert('logn again'); var action = "countries"; var username = $("#janusername").val(); var password = $("#janpassword").val(); /// $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { action: action, username: username, password: password }, success: function (data) { if (data == "1" || data == "2") { if (data == "2") { alert("Userename OR Password is Incorrect!"); } else { alert("Countries is not in your rights"); } } else { $("#jans_user_country").html(data); localStorage.setItem('janusername', username); localStorage.setItem('janpassword', password); localStorage.setItem('jancountrylist', data); } }, }); /// /////////// var action = "set_token"; $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { action: action, username: username, password: password }, success: function (data) { var obj = jQuery.parseJSON(data); localStorage.setItem('jans_user_login_id', obj.user_id); localStorage.setItem('jans_user_login_token', obj.token); }, }); ////////// }); function sort_user_bids(obj) { $(obj).find(".bid-header").sort(function (a, b) { a = $(a).find(".already_bid_value"); b = $(b).find(".already_bid_value"); var contentA = parseInt($(a).val()); if (contentA == 'x' || contentA == 'X' || contentA == 'xx' || contentA == 'XX') { contentA = 0; } var contentB = parseInt($(b).val()); if (contentB == 'x' || contentB == 'X' || contentB == 'xx' || contentB == 'XX') { contentB = 0; } if (contentA > 500) { contentA = contentA / 10000; } if (contentB > 500) { contentB = contentB / 10000; } return (contentA > contentB) ? -1 : (contentA < contentB) ? 1 : 0; }).appendTo(obj); } //it's function which will return Type and auction date in Image View Only // function get_image_detail_data(obj) { var url = window.location.href; var href = ""; var main_obj_one = ""; try { //type// main_obj_one = $(obj).find(".info1").find("div").eq(0).text(); //end // } catch (ex) { } try { var td = $(obj).find('.imgRow'); if ($(td).find('.imgIcon').children().length >= 1) { var td_obj = td; td = $(td).find('a').eq(1); if (td.length == 0) { td = $(td_obj).find('a').eq(0); } console.log(td[0]); //td = $(td).find('a').eq(1); } else { td = $(td).find('a'); } href = $(td).attr('href'); url = url.split('en'); url = url[0] + href; } catch (ex) { } var params = {}; url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (s, k, v) { params[k] = v }); params['__VIEWSTATE'] = $('#__VIEWSTATE').val(); params['__VIEWSTATEGENERATOR'] = $('#__VIEWSTATEGENERATOR').val(); params['AAResultOpen'] = $('#AAResultOpen').val(); params['AAResultType'] = $('#AAResultType').val(); params['AATermOpen'] = $('#AATermOpen').val(); params['Corner'] = $('#Corner').val(); params['Aircon'] = $('#Aircon').val(); params['AuctionTerm'] = $('#AuctionTerm').val(); params['BrandCode'] = $('#BrandCode').val(); params['BrandScrollTop'] = $('#BrandScrollTop').val(); params['CarCategoryNo'] = $('#CarCategoryNo').val(); params['CarType'] = $('#CarType').val(); params['CarTypeMatch'] = $('#CarTypeMatch').val(); params['CarTypeText'] = $('#CarTypeText').val(); params['Color'] = $('#Color').val(); params['CommercialType'] = $('#CommercialType').val(); params['DisplacementFrom'] = $('#DisplacementFrom').val(); params['DisplacementTo'] = $('#DisplacementTo').val(); params['Drive'] = $('#Drive').val(); params['ExInf'] = $('#ExInf').val(); params['ExKeyList'] = $('#ExKeyList').val(); params['FinalPriceFrom'] = $('#FinalPriceFrom').val(); params['FinalPriceTo'] = $('#FinalPriceTo').val(); params['Grade'] = $('#Grade').val(); params['GradeMatch'] = $('#GradeMatch').val(); params['GradeText'] = $('#GradeText').val(); params['ImportedHandle'] = $('#ImportedHandle').val(); params['ImportedModelYearFrom'] = $('#ImportedModelYearFrom').val(); params['ImportedModelYearTo'] = $('#ImportedModelYearTo').val(); params['ImportedType'] = $('#ImportedType').val(); params['IsEquipAW'] = $('#IsEquipAW').val(); params['IsEquipLeather'] = $('#IsEquipLeather').val(); params['IsEquipNavi'] = $('#IsEquipNavi').val(); params['IsEquipPS'] = $('#IsEquipPS').val(); params['IsEquipPW'] = $('#IsEquipPW').val(); params['IsEquipSR'] = $('#IsEquipSR').val(); params['ListMode'] = $('#ListMode').val(); params['MaxListRow'] = $('#MaxListRow').val(); params['MaxRow'] = $('#MaxRow').val(); params['MileageFrom'] = $('#MileageFrom').val(); params['MileageTo'] = $('#MileageTo').val(); params['MileageType'] = $('#MileageType').val(); params['MileType'] = $('#MileType').val(); params['ModelScrollTop'] = $('#ModelScrollTop').val(); params['ModelYearFrom'] = $('#ModelYearFrom').val(); params['ModelYearTo'] = $('#ModelYearTo').val(); params['Mot'] = $('#Mot').val(); params['OrderNo'] = $('#OrderNo').val(); params['PageNo'] = $('#PageNo').val(); params['RecordNo'] = $('#RecordNo').val(); params['Score'] = $('#Score').val(); params['ScrollTop'] = $('#ScrollTop').val(); params['SearchFlow'] = $('#SearchFlow').val(); params['SearchType'] = $('#SearchType').val(); params['Shift'] = $('#Shift').val(); params['SortNo'] = $('#SortNo').val(); params['StartPriceFrom'] = $('#StartPriceFrom').val(); params['StartPriceTo'] = $('#StartPriceTo').val(); params['Tieup'] = $('#Tieup').val(); params['TieupWeek'] = $('#TieupWeek').val(); params['Uss'] = $('#Uss').val(); params['UssWeek'] = $('#UssWeek').val(); if (!url.indexOf("cornerImg.aspx") >= 0) { //newly added// params['KaijoCode'] = $('#KaijoCode').val(); params['ViewTarget'] = $('#ViewTarget').val(); params['AuctionCountTxt'] = $('#AuctionCountTxt').val(); params['CanShare'] = $('#CanShare').val(); params['BackPath'] = $('#BackPath').val(); params['FavBranchCode'] = $('#FavBranchCode').val(); params['FilterFavMark'] = $('#FilterFavMark').val(); params['UssWeek'] = $('#UssWeek').val(); //end // } $.ajax({ type: 'POST', url: url, async: false, headers: { Accept: 'text/html, application/xhtml+xml, image/jxr, */*', 'Content-Type': 'application/x-www-form-urlencoded' }, data: params, success: function (response) { car_detail = response; try { //it will find out chassis_code OR type from object // var obj_one = $(response); var type_code = $(obj_one).find("td.cType").text(); // console.log("Object recireed"); // console.log(type_code); if (type_code) { type_code = type_code.split(" "); type_code = type_code[0]; } //auction date // var _auction_date_var = $(obj_one).find("td.aaDate").text(); var uss_time = _auction_date_var; _auction_date_var = _auction_date_var.split("["); _auction_date_var = _auction_date_var[0].split("[End]"); _auction_date_var = _auction_date_var[0].split("[--:--]"); _auction_date_var = _auction_date_var[0].split("temp"); if (Array.isArray(_auction_date_var)) { _auction_date_var = _auction_date_var[0]; } if (main_obj_one) { main_obj_one = main_obj_one.replace(/ /g, "_"); //console.log(main_obj_one + " => " + type_code); localStorage.setItem(main_obj_one, type_code); localStorage.setItem(main_obj_one + "_date", _auction_date_var); } //end // //get modal and grade // var modal_name_clone = $(obj_one).find("td.model").clone(); var grade_name_clone = $(modal_name_clone).find("div").detach(); modal_name_clone = $(modal_name_clone).text(); grade_name_clone = $(grade_name_clone).text(); // console.log(modal_name_clone); // console.log(grade_name_clone); modal_name_clone = modal_name_clone.trim(); grade_name_clone = grade_name_clone.trim(); localStorage.setItem(main_obj_one + "_modal_name", modal_name_clone); localStorage.setItem(main_obj_one + "_grade_name", grade_name_clone); //end // //console.log("ok1"); } catch (error) { } } }); } ///////////////submit bids///////// //photo only view// $('body').on('keypress', '.item', function (e) { var current_view_page = window.location.href; book_mark_data(this, 1); var key = e.which; if (key == 13) { /* var price_value = ""; $(this).find("#bids_value").each(function () { price_value = $(this).val(); }); var return_value = not_empty(price_value); if (return_value == 1) { return false; } */ //alert("hello1"); /// if ($(this).find(".already_bid_value").is(':focus')) { return false; } var uss_is_correction = 0; if ($(this).hasClass("teisei")) { uss_is_correction = 1; } var uss_time = $(this).find(".num").parent().find(".col1").text(); var my_this = $(this); var action = "insert"; var username = $("#janusername").val(); var password = $("#janpassword").val(); var jans_auction_date = $(".jans_auction_date").val(); // var jans_auction_dates = jans_auction_date.split('-'); // jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1]; jans_auction_date = get_date_formate(jans_auction_date); var jans_country = $('#jans_user_country').val(); /// var jans_bid_price = []; $(this).find("#bids_value").each(function () { jans_bid_price.push($(this).val()); }); var jans_bid_marks = []; $(this).find("#remarks").each(function () { jans_bid_marks.push($(this).val()); }); var info = $(this).find('.info1 div').first().text(); info = info.split('No'); var company = info[0]; var auction_company = []; auction_company.push("USS " + company.trim()); var lot_no = info[1]; if (lot_no) lot_no = lot_no.replace('.', ''); var lot_no1 = ''; var lot_no2 = lot_no; var modelyear = []; var grade = []; var inspection = []; var transactionstatus = ''; var cnt = 1; $(this).find(".info2 div ul li:nth-child(1)").each(function () { var vl = $(this).text(); if (cnt == 1) { vl = vl.replace('[Year]', ''); modelyear.push(vl); } if (cnt == 2) { vl = vl.replace('[Score]', ''); //grade.push(vl); } if (cnt == 3) { vl = vl.replace('[Inspect]', ''); inspection.push(vl); } if (cnt == 4) { transactionstatus = vl; } cnt++; }); var mileage = []; var shifts = []; var startprice = []; cnt = 1; $(this).find(".info2 div ul li:nth-child(2)").each(function () { var vl = $(this).text(); if (cnt == 1) { vl = vl.replace('[Odo.]', ''); mileage.push(vl); } if (cnt == 2) { vl = vl.replace('[T/M]', ''); shifts.push(vl); } //if(cnt == 3) //inspection.push(vl); cnt++; }); ////////////// cnt = 1; $(this).find(".info2 div ul li:nth-child(3)").each(function () { var vl = $(this).text(); if (cnt == 2) { vl = vl.replace(',', ''); startprice.push(vl); } cnt++; }); var carname = []; var type = ""; var main_name_of_car = $(this).find(".info1").find("div").eq(0).text(); if (main_name_of_car) { main_name_of_car = main_name_of_car.replace(/ /g, "_"); type = localStorage.getItem(main_name_of_car); if (type && type.length >= 2) { /*if (get_image_detail_data(this)) { type = localStorage.getItem(main_name_of_car); }*/ } else { get_image_detail_data(this); type = localStorage.getItem(main_name_of_car); } localStorage.removeItem(main_name_of_car); } //end // try { var modal_name_clone = localStorage.getItem(main_name_of_car + "_modal_name"); var grade_name_clone = localStorage.getItem(main_name_of_car + "_grade_name"); localStorage.removeItem(main_name_of_car + "_modal_name"); localStorage.removeItem(main_name_of_car + "_grade_name"); var existing_car_name = $(this).find(".info1").find("div").eq(1).text(); existing_car_name = existing_car_name.trim(); if (modal_name_clone.length < 1) { modal_name_clone = existing_car_name; grade_name_clone = existing_car_name; } modal_name_clone = check_model_name(modal_name_clone); carname.push(modal_name_clone); grade.push(grade_name_clone); } catch (err) { } try { var auction_date_fetch = ""; var _auction_date = localStorage.getItem(main_name_of_car + "_date"); localStorage.removeItem(main_name_of_car + "_date"); _auction_date = _auction_date.split(" "); var _month = _auction_date[0].trim(); _month = get_month_selected(_month); _auction_date = _auction_date[1]; _auction_date = _auction_date.split("."); var _day = _auction_date[0].trim(); if (_day.length == 1) { _day = "0" + _day; } var _year = "20" + _auction_date[1].trim(); auction_date_fetch = _year + "-" + _month + "-" + _day; // console.log(auction_date_fetch); //selected date// var _selected_date = $(".jans_auction_date").val(); _selected_date = _selected_date.split("-"); //name of variable are reverse of array index// var _s_month = _selected_date[1].trim(); if (_s_month.length == 1) { _s_month = "0" + _s_month; } var _s_day = _selected_date[0].trim(); if (_s_day.length == 1) { _s_day = "0" + _s_day; } var _s_year = _selected_date[2].trim(); //it will set by default auction date from car auction page// if (Date.parse(auction_date_fetch)) { jans_auction_date = auction_date_fetch; } else { //it will save entry in case of wrong date format $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { selected_date: jans_auction_date, curr_date: new Date().toISOString().slice(0, 10), ext_view: current_view_page, user_id: username, action: "save_error_log" }, success: function (data) { } }); } } catch (ex) { } ///////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// $.ajax({ type: 'POST', url: api_base_url, crossDomain: true, async: true, data: { action: action, username: username, password: password, jans_auction_date: jans_auction_date, jans_country: jans_country, auction_company: auction_company, lot_no1: lot_no1, lot_no2: lot_no2, modelyear: modelyear, carname: carname, grade: grade, ctype: type, //cc: cc, crate: grade, // ext: ext_color, //inter: //color: color_name, //color_no: color_no, 'shift': shifts, //ac: ac, //chassiscode: chassiscode, inspection: inspection, mileage: mileage, jans_bid_price: jans_bid_price, // car_detail_url: car_detail_url, remark: jans_bid_marks, start_price: startprice, //aimage: aimage, //fimage: fimage, //rimage: rimage, // ex_document: ex_document, // ex_note: ex_note, // ex_vehicle_history:ex_vehicle_history, // ex_drive:ex_drive, //ex_accessories:ex_accessories, //ex_fuel: ex_fuel, // ex_seats: ex_seats, //ex_load_capacity: ex_load_capacity, //ex_registeration_month: ex_registeration_month, //ex_doors: ex_doors, extension_view: current_view_page, extension_version: "USS_2", uss_time: uss_time, uss_is_correction: uss_is_correction }, success: function (data) { if (isNaN(data)) { //console.log("Error on insertion"); alert(data); } else { var hr_name = get_country_class(jans_country); var sh_cntry = $("#jans_user_country option:selected").text(); var show_bid_name = sh_cntry + ' ( ' + username + ' ) '; var bk_color = return_bk_color(username); var data_key = data; var add_bid = '
 
' + '' + '' + '' + '
'; //car type/chasssis code // var is_show_bids_value = 0; try { //console.log(_s_year + " == " + _year + " => " + _month + " == " + _s_month + " => " + _day + " == " + _s_day); if (_s_year == _year && _month == _s_month && _day == _s_day) { is_show_bids_value = 1; //console.log("Equal"); } else { is_show_bids_value = 0; //console.log("Not Equal"); } } catch (error) { } // if(is_show_bids_value == 1) // { $(my_this) .append(add_bid); //} sort_user_bids(my_this); //////// $("#jancurrentprice").text(jans_bid_price); if (localStorage.getItem('jantotalbids') == '') var count = 1; else var count = parseInt(localStorage.getItem('jantotalbids')) + 1; localStorage.setItem('jantotalbids', count); $("#janstotalbids").text(count); //////// } //////////////////////COde to change the color of inserting bid for limits 333/////////////////////////////////////// cars_data_list = []; cars_data_list.push({ name: auction_company[0], lot_no: lot_no2, date: jans_auction_date }); $.ajax({ type: 'POST', url: api_base_url_other, crossDomain: true, async: true, data: { action: "get_user_bids", username: localStorage.getItem("janusername"), data: JSON.stringify(cars_data_list) }, success: function (data) { data = JSON.parse(data); if (data) { data = data.data; for (var key in data) { var row = data[key]; row.bid_price = parseInt(row.bid_price); if (!isNaN(row.bid_price)) { row.bid_price = parseInt(row.bid_price); if (row.bid_price > 500) { row.bid_price = row.bid_price / 10000; } if (parseInt(row.bid_price) < parseInt(row.min) || parseInt(row.bid_price) > parseInt(row.max)) { row.uss_color = "red"; $('#jans_pre_id' + data_key).parent('div').css({ 'background-color': row.uss_color }); } } } } } }); ////////////////////END////////////////////////////////////// }, error: function (error) { alert("Error on Sending Request!"); // console.log(error); } }); ////////////////////////////////////////////////////////////////////////////////////////////////////// } }); ///////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////// $('body').on('click', '.jans_ext_bid', function (e) { var username = $("#janusername").val(); var password = $("#janpassword").val(); var action = "delete_existing_bids"; var pare_div = $(this).parent(); pre_bid_id = $(pare_div).find(".jans_pre_id").val(); var r = confirm("Are you sure you want to delete this bid?"); if (r == true) { $.ajax({ type: 'POST', url: api_base_url, crossDomain: true, async: true, data: { action: action, id: pre_bid_id, username: username, password: password }, success: function (data) { var obj = jQuery.parseJSON(data); if (obj.success == true) { var ccc_o = $(this).parent().parent().parent().find(".input_bid_value_append").text(); // alert("dddd.." + ccc_o); $(this).parent().parent().parent().find(".input_bid_value_append").empty(); $(pare_div).hide(); } alert(obj.msg); }, }); } }); ///////////////////////////////////////// //it will update bids value ///////////////////////////////////////// $('body').on('keypress', '.bid-header', function (e) { var key = e.which; if (key == 13) { // event.preventDefault(); var pre_bid_price = $(this).find(".jans_pre_price").val(); var pre_bid_remarks = $(this).find(".jans_pre_ramarks").val(); var pre_bid_id = $(this).find(".jans_pre_id").val(); var username = $("#janusername").val(); var password = $("#janpassword").val(); var country = $("#jans_user_country").val(); var action = "update"; var this_obj = this; var prnt = $(this).parent().find("#bids_value"); ///////////// $.ajax({ type: 'POST', url: api_base_url, crossDomain: true, async: true, data: { action: action, jans_bid_price: pre_bid_price, remarks: pre_bid_remarks, id: pre_bid_id, username: username, password: password, jans_country: country }, success: function (data) { if(data == "Lot Number already transfered.You can not chnage the price") { alert(data); } else { ////////////////////// var hr_name = get_country_class(country); var sh_cntry = $("#jans_user_country option:selected").text(); var current_view_page = window.location.href; if (is_full_image_view(current_view_page)) { var class_name = 'flag flag ' + hr_name; $(this_obj).find(".flag").removeAttr('class').attr('class', class_name); $(this_obj).find("label").text(sh_cntry); if ($(this_obj).find("label").find(".update_tick").length == 0) { $(this_obj).find("label").append(''); } } else { var class_name = 'flag flag ' + hr_name; $(this_obj).find(".jans_ext_bid_cntry").find("span").removeAttr('class').attr('class', class_name); $(this_obj).find(".jans_ext_bid_cntry").next().text(sh_cntry); if ($(this_obj).find(".jans_ext_bid_cntry").parent().find(".update_tick").length == 0) { $(this_obj).find(".jans_ext_bid_cntry").parent().append(''); } } $(prnt).val(pre_bid_price); } }, }); ///////////// } }); ////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// function load_un_sold_cars() { var action = "insert"; var username = $("#janusername").val(); var password = $("#janpassword").val(); var jans_auction_date = $(".jans_auction_date").val(); jans_auction_date = get_date_formate(jans_auction_date); // if (Date.parse(auction_date_fetch)) { // jans_auction_date = auction_date_fetch; //} var jans_country = $('#jans_user_country').val(); //#MainContents_Exhibit_GridAreas var obj = document.querySelectorAll('#MainContents_Exhibit_GridArea'); var info = $(obj).find('td.bidNo').html(); if (info) { info = info.split("
"); } var auction_company = []; if (info && info[1]) auction_company.push("USS " + info[1].trim()); var lot_no = ""; if (info && info[0]) lot_no = info[0]; var lot_no1 = ''; var lot_no2 = lot_no; var carname = []; var modelyear = []; var mileage = []; try { var modal_name_clone = $(obj).find("td.model").clone(); var grade_name_clone = $(modal_name_clone).find("div").detach(); modal_name_clone = $(modal_name_clone).text(); grade_name_clone = $(grade_name_clone).text(); modal_name_clone = modal_name_clone.trim(); grade_name_clone = grade_name_clone.trim(); modal_name_clone = check_model_name(modal_name_clone); carname.push(modal_name_clone); grade.push(grade_name_clone); } catch (err) { } var year = $(obj).find("td.mYear").text(); if (year) modelyear.push(year); var info1 = $(obj).find("td.mile").html(); if (info1) { info1 = info1.split("
"); mileage.push(info1[0]); } console.log(auction_company, carname, modelyear, mileage); } ///////// $('body').on('click', '#toggle', function () { $(".main-user").toggleClass("tgl"); $("#slide").toggleClass("tgl"); }); //////// function get_country_class(country_id) { var obj = { 10: 'flag tanzania', 12: 'flag zambia', 14: 'flag south-africa', 17: 'flag uae', 19: 'flag pakistan', 20: 'flag kenya', 21: 'flag uk', 23: 'flag japan', 209: 'flag south-africa', 212: 'flag namibia', 213: 'flag botswana', 214: 'flag mozambique', 267: 'flag japan', 279: 'flag uganda', 282: 'flag pakistan', 284: 'flag japan-online', 297: 'flag zimbabwe', 317: 'flag pakistan', 322: 'flag chili', 335: 'flag kenya', 353: 'flag lesotho', 359: 'flag swaziland', 363: 'flag Dominica', 387: 'flag south-africa', 391: 'flag dominican', 396: 'flag mongolia', 410: 'flag uganda', 419: 'flag uk', 462: 'flag philippines', 467: 'flag namibia', 480: 'flag botswana', 486: 'flag newzealand', 496: 'flag uae', 524: 'flag philippines', 534: 'flag uk', 535: 'flag japan' } return obj[country_id]; } function getUrlVars(url) { var vars = {}; if (url && url.length != 0) { var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) { vars[key] = value; }); } return vars; } function book_mark_data(self_obj, type) { var href = ""; if (type == 44) { href = $("#MainForm").attr("action"); } else if (type == 0) { href = $(self_obj).find(".carLink").parent().attr("href"); } else { href = $(self_obj).find(".carImg").parent().attr("href"); } var params = {}; href = getUrlVars(href); var key_list = ""; if (href && href.ExKey) { params['ExKey'] = href.ExKey; key_list = href.ExKey; } var fav_id = $("#image_hidden_value").val(); if (href && href.RecordNo) { params['RecordNo'] = href.RecordNo; } params['__VIEWSTATE'] = $('#__VIEWSTATE').val(); params['__VIEWSTATEGENERATOR'] = $('#__VIEWSTATEGENERATOR').val(); params['AAResultOpen'] = $('#AAResultOpen').val(); params['AAResultType'] = $('#AAResultType').val(); params['AATermOpen'] = $('#AATermOpen').val(); params['Aircon'] = $('#Aircon').val(); params['AuctionTerm'] = $('#AuctionTerm').val(); params['BrandCode'] = $('#BrandCode').val(); params['BrandScrollTop'] = $('#BrandScrollTop').val(); params['CarCategoryNo'] = $('#CarCategoryNo').val(); params['CarType'] = $('#CarType').val(); params['CarTypeMatch'] = $('#CarTypeMatch').val(); params['CarTypeText'] = $('#CarTypeText').val(); params['Color'] = $('#Color').val(); params['CommercialType'] = $('#CommercialType').val(); params['DisplacementFrom'] = $('#DisplacementFrom').val(); params['DisplacementTo'] = $('#DisplacementTo').val(); params['Drive'] = $('#Drive').val(); params['ExInf'] = $('#ExInf').val(); params['ExKeyList'] = $('#ExKeyList').val(); params['FinalPriceFrom'] = $('#FinalPriceFrom').val(); params['FinalPriceTo'] = $('#FinalPriceTo').val(); params['Grade'] = $('#Grade').val(); params['GradeMatch'] = $('#GradeMatch').val(); params['GradeText'] = $('#GradeText').val(); params['ImportedHandle'] = $('#ImportedHandle').val(); params['ImportedModelYearFrom'] = $('#ImportedModelYearFrom').val(); params['ImportedModelYearTo'] = $('#ImportedModelYearTo').val(); params['ImportedType'] = $('#ImportedType').val(); params['IsEquipAW'] = $('#IsEquipAW').val(); params['IsEquipLeather'] = $('#IsEquipLeather').val(); params['IsEquipNavi'] = $('#IsEquipNavi').val(); params['IsEquipPS'] = $('#IsEquipPS').val(); params['IsEquipPW'] = $('#IsEquipPW').val(); params['IsEquipSR'] = $('#IsEquipSR').val(); params['ListMode'] = $('#ListMode').val(); params['MaxListRow'] = $('#MaxListRow').val(); params['MaxRow'] = $('#MaxRow').val(); params['MileageFrom'] = $('#MileageFrom').val(); params['MileageTo'] = $('#MileageTo').val(); params['MileageType'] = $('#MileageType').val(); params['MileType'] = $('#MileType').val(); params['ModelScrollTop'] = $('#ModelScrollTop').val(); params['ModelYearFrom'] = $('#ModelYearFrom').val(); params['ModelYearTo'] = $('#ModelYearTo').val(); params['Mot'] = $('#Mot').val(); params['OrderNo'] = $('#OrderNo').val(); params['PageNo'] = $('#PageNo').val(); params['RecordNo'] = $('#RecordNo').val(); params['Score'] = $('#Score').val(); params['ScrollTop'] = $('#ScrollTop').val(); params['SearchFlow'] = $('#SearchFlow').val(); params['SearchType'] = $('#SearchType').val(); params['Shift'] = $('#Shift').val(); params['SortNo'] = $('#SortNo').val(); params['StartPriceFrom'] = $('#StartPriceFrom').val(); params['StartPriceTo'] = $('#StartPriceTo').val(); params['Tieup'] = $('#Tieup').val(); params['TieupWeek'] = $('#TieupWeek').val(); params['Uss'] = $('#Uss').val(); params['UssWeek'] = $('#UssWeek').val(); var url_arr = window.location.href; url_arr = url_arr.split("/"); var replace_url = ""; if (url_arr && url_arr[4]) { replace_url = url_arr[4]; } var book_url = "http://www.cis6200.jp/cis/" + replace_url + "/en/etc/addBookmark.ashx?BookType=0"; $.ajax({ type: 'POST', url: book_url, crossDomain: true, data: { ExKeyList: key_list }, success: function (data) { $.ajax({ type: 'POST', url: "http://www.cis6200.jp/cis/" + replace_url + "/en/etc/setFavoriteMark.ashx?MarkNoList=" + fav_id + "&IsFavoriteMark=true", crossDomain: true, data: params, success: function (data) { var url_12 = "http://www.cis6200.jp/cis/" + replace_url + "/en/request/addBookmark.aspx?BookType=0&FavResultType=1&ExKeyList=" + key_list + "&ListSelectCount=1"; $.ajax({ type: 'GET', url: url_12, crossDomain: true, success: function (data) { }, error: function (err) { console.log(err); } }); }, error: function (err) { console.log(err); } }); }, error: function (err) { console.log(err); } }); } //}); //////////////// $('body').on('click', '.janresetcounter', function () { localStorage.setItem('jantotalbids', 0); $("#janstotalbids").text(0); }); //////////////// function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } var is_simple_photo = localStorage.getItem("is_simple_photo"); if (is_simple_photo != 1) { localStorage.setItem("is_simple_photo", 0); } $("#janusername").val(localStorage.getItem('janusername')); $("#janpassword").val(localStorage.getItem('janpassword')); $("#jans_user_country").html(localStorage.getItem('jancountrylist')); $("#jans_user_country").val(localStorage.getItem('jancountry')); $("#janstotalbids").text(localStorage.getItem('jantotalbids')); if (is_simple_photo == 1) { $('#is_photo_only').prop('checked', true); } else { $('#is_photo_only').prop('checked', false); } var date_save = localStorage.getItem('januserauctiondate'); var store_time = ""; try { var store_time = getCookie("date_time_store"); if (store_time.length != 0) { $("#datepicker").css({ "background-color": "yellowGreen" }); $("#change_lock_icon").attr("src", "http://ussext.jjonlinesystems.com/images/lock.png"); } //console.log(store_time); } catch (ex) { console.log("purchase.html = > $cookie is not defined"); } if (date_save && date_save != null && date_save.length >= 5 && store_time && store_time.length != 0) { $(".jans_auction_date").val(date_save); try { try { setTimeout(function () { $("#datepicker").Zebra_DatePicker({ format: 'd-m-Y' }); //114//11-09-19---Start $('#datepicker').Zebra_DatePicker({ format: 'd-m-Y', onSelect: function (date) { var date_store = localStorage.getItem('januserauctiondate'); if (date_store == date) { $("#datepicker").css({ "background-color": "yellowGreen" }); $(".change_date").find("img").attr("src", "http://ussext.jjonlinesystems.com/images/lock.png"); } else { $("#datepicker").css({ "background-color": "white" }); $(".change_date").find("img").attr("src", "http://ussext.jjonlinesystems.com/images/unlock.png"); } } }); //114//11-09-19---Start }, 2000); } catch (ex) { console.log("Zebra DatePicker"); } } catch (ex) { console.log("ajax => Datepicker is not loaded"); } } else { try { $(document).ready(function () { try { setTimeout(function () { $("#datepicker").Zebra_DatePicker({ format: 'd-m-Y' }); //114//11-09-19---Start $('#datepicker').Zebra_DatePicker({ format: 'd-m-Y', onSelect: function (date) { var date_store = localStorage.getItem('januserauctiondate'); if (date_store == date) { $("#datepicker").css({ "background-color": "yellowGreen" }); $(".change_date").find("img").attr("src", "http://ussext.jjonlinesystems.com/images/lock.png"); } else { $("#datepicker").css({ "background-color": "white" }); $(".change_date").find("img").attr("src", "http://ussext.jjonlinesystems.com/images/unlock.png"); } } }); //114//11-09-19---Start }, 2000); } catch (ex) { console.log("Zebra DatePicker"); } }); } catch (ex) { console.log("ajax => Datepicker is not loaded"); } } $('body').on('click', '.change_date', function () { localStorage.setItem('januserauctiondate', $(".jans_auction_date").val()); //114//11-09-19---Start var src_path = $(this).find("img").attr("src"); if (src_path == "http://ussext.jjonlinesystems.com/images/lock.png") { $("#datepicker").css({ "background-color": "white" }); $(this).find("img").attr("src", "http://ussext.jjonlinesystems.com/images/unlock.png"); } else { $("#datepicker").css({ "background-color": "yellowGreen" }); $(this).find("img").attr("src", "http://ussext.jjonlinesystems.com/images/lock.png"); } //114//11-09-19--End var today = new Date(); var today_1 = new Date(); today_1.setDate(today_1.getDate() + 1); today_1.setHours(0); today_1.setMinutes(0); today_1.setSeconds(0); var diff = (today_1.getTime() - today.getTime()) / 1000; diff /= (60 * 60); var hours = Math.abs(Math.round(diff)); hours = parseInt(hours) * 60; try { var h = hours / 1440; //$.cookie('date_time_store', '1', {expires: hours/1440}); document.cookie = "date_time_store=" + 1 + ";expires=" + h + ";path=/"; } catch (err) { console.log("document.cookie is not working"); } });