wlWDCDateArr = new Array(20040624,20040625,20040628,20040629,20040630,20040701,20040702,20040705,20040706,20040707,20040708,20040709,20040712,20040713,20040714,20040715,20040716,20040719,20040720,20040721,20040722,20040723,20040726,20040727,20040728,20040729,20040730,20040802,20040803,20040804,20040805,20040806,20040809,20040810,20040811,20040812,20040813,20040816,20040817,20040818,20040819,20040820,20040823,20040824,20040825,20040826,20040827,20040830,20040831,20040901,20040902,20040903,20040906,20040907,20040908,20040909,20040910,20040913,20040914,20040915,20040916,20040917,20040920,20040921,20040922,20040923,20040924,20040927,20040928,20040929,20040930,20041001,20041004,20041005,20041006,20041007,20041008,20041011,20041012,20041013,20041014,20041015,20041018,20041019,20041020,20041021,20041022,20041025,20041026,20041027,20041028,20041029,20041101,20041102,20041103,20041104,20041105,20041108,20041109,20041110,20041111,20041112,20041115,20041116,20041117,20041118,20041119,20041122,20041123,20041124,20041125,20041126,20041129,20041130,20041201,20041202,20041203,20041206,20041207,20041208,20041209,20041210,20041213,20041214,20041215,20041216,20041217,20041220,20041221,20041222,20041223,20041224,20041229,20041230,20041231,20050104,20050105,20050106,20050107,20050110,20050111,20050112,20050113,20050114,20050117,20050118,20050119,20050120,20050121,20050124,20050125,20050127,20050128,20050131,20050201,20050202,20050203,20050204,20050207,20050208,20050209,20050210,20050211,20050214,20050215,20050216,20050217,20050218,20050221,20050222,20050223,20050224,20050225,20050228,20050301,20050302,20050303,20050304,20050307,20050308,20050309,20050310,20050311,20050314,20050315,20050316,20050317,20050318,20050321,20050322,20050323,20050324,20050329,20050330,20050331,20050401,20050404,20050405,20050406,20050407,20050408,20050411,20050412,20050413,20050414,20050415,20050418,20050419,20050420,20050421,20050422,20050426,20050427,20050428,20050429,20050502,20050503,20050504,20050505,20050506,20050509,20050510,20050511,20050512,20050513,20050516,20050517,20050518,20050519,20050520,20050523,20050524,20050525,20050526,20050527,20050530,20050531,20050601,20050602,20050603,20050606,20050607,20050608,20050609,20050610,20050614,20050615,20050616,20050617,20050620,20050621,20050622,20050623,20050624,20050627,20050628,20050629,20050630,20050701,20050704,20050705,20050706,20050707,20050708,20050711,20050712,20050713,20050714,20050715,20050718,20050719,20050720,20050721,20050722,20050725,20050726,20050727,20050728,20050729,20050801,20050802,20050803,20050804,20050805,20050808,20050809,20050810,20050811,20050812,20050815,20050816,20050817,20050818,20050819,20050822,20050823,20050824,20050825,20050826,20050829,20050830,20050831,20050901,20050902,20050905,20050906,20050907,20050908,20050909,20050912,20050913,20050914,20050915,20050916,20050919,20050920,20050921,20050922,20050923,20050926,20050927,20050928,20050929,20050930,20051003,20051004,20051005,20051006,20051007,20051010,20051011,20051012,20051013,20051014,20051017,20051018,20051019,20051020,20051021,20051024,20051025,20051026,20051027,20051028,20051031,20051101,20051102,20051103,20051104,20051107,20051108,20051109,20051110,20051111,20051114,20051115,20051116,20051117,20051118,20051121,20051122,20051123,20051124,20051125,20051128,20051129,20051130,20051201,20051202,20051205,20051206,20051207,20051208,20051209,20051212,20051213,20051214,20051215,20051216,20051219,20051220,20051221,20051222,20051223,20051228,20051229,20051230,20060103,20060104,20060105,20060106,20060109,20060110,20060111,20060112,20060113,20060116,20060117,20060118,20060119,20060120,20060123,20060124,20060125,20060127,20060130,20060131,20060201,20060202,20060203,20060206,20060207,20060208,20060209,20060210,20060213,20060214,20060215,20060216,20060217,20060220,20060221,20060222,20060223,20060224,20060227,20060228,20060301,20060302,20060303,20060306,20060307,20060308,20060309,20060310,20060313,20060314,20060315,20060316,20060317,20060320,20060321,20060322,20060323,20060324,20060327,20060328,20060329,20060330,20060331,20060403,20060404,20060405,20060406,20060407,20060410,20060411,20060412,20060413,20060418,20060419,20060420,20060421,20060424,20060426,20060427,20060428,20060501,20060502,20060503,20060504,20060505,20060508,20060509,20060510,20060511,20060512,20060515,20060516,20060517,20060518,20060519,20060522,20060523,20060524,20060525,20060526,20060529,20060530,20060531,20060601,20060602,20060605,20060606,20060607,20060608,20060609,20060613,20060614,20060615,20060616,20060619,20060620,20060621,20060622,20060623,20060626,20060627,20060628,20060629,20060630,20060703,20060704,20060705,20060706,20060707,20060710,20060711,20060712,20060713,20060714,20060717,20060718,20060719,20060720,20060721,20060724,20060725,20060726,20060727,20060728,20060731,20060801,20060802,20060803,20060804,20060807,20060808,20060809,20060810,20060811,20060814,20060815,20060816,20060817,20060818,20060821,20060822,20060823,20060824,20060825,20060828,20060829,20060830,20060831,20060901,20060904,20060905,20060906,20060907,20060908,20060911,20060912,20060913,20060914,20060915,20060918,20060919,20060920,20060921,20060922,20060925,20060926,20060927,20060928,20060929,20061002,20061003,20061004,20061005,20061006,20061009,20061010,20061011,20061012,20061013,20061016,20061017,20061018,20061019,20061020,20061023,20061024,20061025,20061026,20061027,20061030,20061031,20061101,20061102,20061103,20061106,20061107,20061108,20061109,20061110,20061113,20061114,20061115,20061116,20061117,20061120,20061121,20061122,20061123,20061124,20061127,20061128,20061129,20061130,20061201,20061204,20061205,20061206,20061207,20061208,20061211,20061212,20061213,20061214,20061215,20061218,20061219,20061220,20061221,20061222,20061227,20061228,20061229,20070102,20070103,20070104,20070105,20070108,20070109,20070110,20070111,20070112,20070115,20070116,20070117,20070118,20070119,20070122,20070123,20070124,20070125,20070129,20070130,20070131,20070201,20070202,20070205,20070206,20070207,20070208,20070209,20070212,20070213,20070214,20070215,20070216,20070219,20070220,20070221,20070222,20070223,20070226,20070227,20070228,20070301,20070302,20070305,20070306,20070307,20070308,20070309,20070312,20070313,20070314,20070315,20070316,20070319,20070320,20070321,20070322,20070323,20070326,20070327,20070328,20070329,20070330,20070402,20070403,20070404,20070405,20070410,20070411,20070412,20070413,20070416,20070417,20070418,20070419,20070420,20070423,20070424,20070426,20070427,20070430,20070501,20070502,20070503,20070504,20070507,20070508,20070509,20070510,20070511,20070514,20070515,20070516,20070517,20070518,20070521,20070522,20070523,20070524,20070525,20070528,20070529,20070530,20070531,20070601,20070604,20070605,20070606,20070607,20070608,20070612,20070613,20070614,20070615,20070618,20070619,20070620,20070621,20070622,20070625,20070626,20070627,20070628,20070629,20070702,20070703,20070704,20070705,20070706,20070709,20070710,20070711,20070712,20070713,20070716,20070717,20070718,20070719,20070720,20070723,20070724,20070725,20070726,20070727,20070730,20070731,20070801,20070802,20070803,20070806,20070807,20070808,20070809,20070810,20070813,20070814,20070815,20070816,20070817,20070820,20070821,20070822,20070823,20070824,20070827,20070828,20070829,20070830,20070831,20070903,20070904,20070905,20070906,20070907,20070910,20070911,20070912,20070913,20070914,20070917,20070918,20070919,20070920,20070921,20070924,20070925,20070926,20070927,20070928,20071001,20071002,20071003,20071004,20071005,20071008,20071009,20071010,20071011,20071012,20071015,20071016,20071017,20071018,20071019,20071022,20071023,20071024,20071025,20071026,20071029,20071030,20071031,20071101,20071102,20071105,20071106,20071107,20071108,20071109,20071112,20071113,20071114,20071115,20071116,20071119,20071120,20071121,20071122,20071123,20071126,20071127,20071128,20071129,20071130,20071203,20071204,20071205,20071206,20071207,20071210,20071211,20071212,20071213,20071214,20071217,20071218,20071219,20071220,20071221,20071224,20071227,20071228,20071231,20080102,20080103,20080104,20080107,20080108,20080109,20080110,20080111,20080114,20080115,20080116,20080117,20080118,20080121,20080122,20080123,20080124,20080125,20080129,20080130,20080131,20080201,20080204,20080205,20080206,20080207,20080208,20080211,20080212,20080213,20080214,20080215,20080218,20080219,20080220,20080221,20080222,20080225,20080226,20080227,20080228,20080229,20080303,20080304,20080305,20080306,20080307,20080310,20080311,20080312,20080313,20080314,20080317,20080318,20080319,20080320,20080325,20080326,20080327,20080328,20080331,20080401,20080402,20080403,20080404,20080407,20080408,20080409,20080410,20080411,20080414,20080415,20080416,20080417,20080418,20080421,20080422,20080423,20080424,20080428,20080429,20080430,20080501,20080502,20080505,20080506,20080507,20080508,20080509,20080512,20080513,20080514,20080515,20080516,20080519,20080520,20080521,20080522,20080523,20080526,20080527,20080528,20080529,20080530,20080602,20080603,20080604,20080605,20080606,20080610,20080611,20080612,20080613,20080616,20080617,20080618,20080619,20080620,20080623,20080624,20080625,20080626,20080627,20080630,20080701,20080702,20080703,20080704,20080707,20080708,20080709,20080710,20080711,20080714,20080715,20080716,20080717,20080718,20080721,20080722,20080723,20080724,20080725,20080728,20080729,20080730,20080731,20080801,20080804,20080805,20080806,20080807,20080808,20080811,20080812,20080813,20080814,20080815,20080818,20080819,20080820,20080821,20080822,20080825,20080826,20080827,20080828,20080829,20080901,20080902,20080903,20080904,20080905,20080908,20080909,20080910,20080911,20080912,20080915,20080916,20080917,20080918,20080919,20080922,20080923,20080924,20080925,20080926,20080929,20080930,20081001,20081002,20081003,20081006,20081007,20081008,20081009,20081010,20081013,20081014,20081015,20081016,20081017,20081020,20081021,20081022,20081023,20081024,20081027,20081028,20081029,20081030,20081031,20081103,20081104,20081105,20081106,20081107,20081110,20081111,20081112,20081113,20081114,20081117,20081118,20081119,20081120,20081121,20081124,20081125,20081126,20081127,20081128,20081201,20081202,20081203,20081204,20081205,20081208,20081209,20081210,20081211,20081212,20081215,20081216,20081217,20081218,20081219,20081222,20081223,20081224,20081229,20081230,20081231,20090102,20090105,20090106,20090107,20090108,20090109,20090112,20090113,20090114,20090115,20090116,20090119,20090120,20090121,20090122,20090123,20090127,20090128,20090129,20090130,20090202,20090203,20090204,20090205,20090206,20090209,20090210,20090211,20090212,20090213,20090216,20090217,20090218,20090219,20090220,20090223,20090224,20090225,20090226,20090227,20090302,20090303,20090304,20090305,20090306,20090309,20090310,20090311,20090312,20090313,20090316,20090317,20090318,20090319,20090320,20090323,20090324,20090325,20090326,20090327,20090330,20090331,20090401,20090402,20090403,20090406,20090407,20090408,20090409,20090414,20090415,20090416,20090417,20090420,20090421,20090422,20090423,20090424,20090427,20090428,20090429,20090430,20090501,20090504,20090505,20090506,20090507,20090508,20090511,20090512,20090513,20090514,20090515,20090518,20090519,20090520,20090521,20090522,20090525,20090526,20090527,20090528,20090529,20090601,20090602,20090603,20090604,20090605,20090609,20090610,20090611,20090612,20090615,20090616,20090617,20090618,20090619,20090622,20090623,20090624,20090625,20090626,20090629,20090630,20090701,20090702,20090703); wlWDCPriceArr = new Array(0,0,0,0,0,0,0,15.3,15.38,15.59,15.69,15.5,15.29,15.39,15.4,15.43,15.49,15.39,15.29,15.08,14.82,14.83,15.09,15.12,15.04,15.11,15.15,15.16,15.33,15.41,15.51,15.52,15.51,15.47,15.39,15.28,15.02,15,15.22,15.31,15.35,15.31,15.25,15.25,15.19,15.24,15.29,15.3,15.43,15.53,15.46,15.36,15.36,15.48,15.44,15.45,15.48,15.62,15.67,15.54,15.39,15.39,15.32,15.34,15.29,15.32,15.28,15.28,15.19,15.23,15.21,15.17,15.27,15.5,15.47,15.39,15.27,15.41,15.37,15.43,15.36,15.27,15.09,15.04,15,15.14,14.92,14.68,14.57,14.71,14.96,15,14.91,15.02,15.28,15.39,15.4,15.38,15.44,15.48,15.44,15.48,15.48,15.46,15.25,15.56,15.46,15.3,15.28,15.42,15.43,15.53,15.61,15.75,15.7,15.82,15.81,15.88,15.95,15.75,15.81,15.85,15.61,15.67,15.7,15.88,15.92,15.97,15.97,16.07,16.2,16.32,16.5,16.63,16.43,16.61,16.65,16.87,16.9,16.99,17.04,17.22,17.03,17.08,17.39,17.13,16.98,16.93,16.97,16.9,17.17,17.31,16.96,17.04,16.92,16.96,16.78,17.12,17.3,16.9,17.09,16.95,16.95,16.86,16.61,16.78,17.2,16.91,16.79,16.7,16.87,16.65,16.66,16.85,16.79,16.89,16.85,16.75,16.98,16.86,16.73,16.44,16.65,16.7,16.6,16.67,16.52,16.72,16.54,16.42,16.35,16.3,16.22,16.25,16.19,16.51,16.4,16.25,16.14,16.12,16.2,16.1,16.07,16.1,16.15,15.99,15.7,15.89,15.8,15.9,16.06,16.14,16.24,16.3,16.22,16.38,16.08,16,15.98,16.22,16.31,16.45,16.65,16.69,16.63,16.4,16.45,16.65,16.75,16.62,16.78,16.89,16.77,16.75,16.75,16.81,16.8,17.05,17.12,17.18,17.18,17.2,17.39,17.24,17.32,17.46,17.52,17.35,17.6,17.59,17.67,17.56,17.51,17.47,17.37,17.7,17.77,17.74,17.85,17.9,18.2,18.1,17.8,17.71,17.71,17.7,17.73,17.58,17.67,17.38,17.19,17.17,17.32,17.57,17.57,17.48,17.55,17.7,18,17.97,18.29,18.01,18,18.07,17.9,17.33,17.6,17.64,17.4,17.34,17.4,17.48,17.43,17.55,17.57,17.37,17.35,17.33,17.2,17.29,17.39,17.42,17,16.97,17.09,17.11,17.24,17.07,17.1,17.2,17.3,17.43,17.18,17.3,17.21,17.19,16.77,16.85,16.74,16.92,16.97,16.85,16.97,16.8,16.71,16.59,16.42,16.19,16.24,16.45,16.47,16.51,16.24,16.54,16.46,16.45,16.35,16.41,16.35,16.15,16.27,16.35,16.23,16.28,16.61,16.75,16.61,16.9,16.85,17.04,17.03,17.1,17.12,17.13,17.26,17.24,17.35,17.34,17.47,17.5,17.4,17.23,17.3,17.18,17.19,17.03,17.06,16.87,16.9,17,17.02,17.05,17.01,17.04,16.91,17.1,17.51,17.47,17.57,17.66,17.6,17.82,17.92,17.9,17.98,18.02,18.16,18,18.24,18.18,17.95,17.91,17.82,17.92,17.74,17.73,17.54,17.6,17.34,17.48,17.71,17.35,17.33,17.55,17.75,17.56,17.71,17.95,17.7,17.57,17.65,17.07,17.05,17.17,17.22,17.32,17.5,17.31,17.18,16.95,16.9,17.04,17.16,17.42,17.61,17.67,17.8,17.56,17.79,17.5,17.7,17.75,17.78,17.6,17.52,17.57,17.4,17.43,17.42,17.32,17.33,17.16,17.14,17.21,17.25,17.38,17.5,17.54,17.4,17.1,17.44,17.3,17.39,17.5,17.4,17.14,17.18,17,16.95,16.9,16.75,16.82,16.85,16.88,17.03,16.95,16.93,17.1,16.86,16.9,16.97,17.1,17.11,17.45,17.16,17.05,16.98,16.92,17.1,16.95,16.72,16.7,16.47,16.65,16.5,16.39,16.31,16.34,16.53,16.25,16.48,16.77,17.12,17.01,17.17,16.92,17.26,17,17.01,17.1,17.16,17.05,16.95,17.12,17.17,17.13,17.25,17.41,17.31,17.48,17.33,17.06,17.24,17.43,17.74,17.72,17.9,17.8,17.79,17.85,17.62,17.58,17.61,17.47,17.78,17.8,17.66,17.78,17.8,18.25,18.16,18.4,18.4,18.35,18.65,18.35,18.3,18.61,17.94,17.91,18.1,18.26,18.33,18.4,18.65,18.51,18.59,18.7,18.7,18.15,18.09,18.38,18.16,18.25,18.27,18.1,18.32,18.2,18.2,18.28,18.37,18.16,18.16,18.15,18.28,18.46,18.65,18.7,18.4,18.48,18.37,18.15,18.15,18.45,18.63,18.82,18.97,18.99,19,19.21,19.3,19.37,19.62,19.6,18.99,18.9,18.75,18.6,18.83,18.7,18.94,19.12,19.12,19.03,18.85,18.6,18.57,18.63,18.67,18.75,18.57,18.5,18.62,18.6,18.5,18.36,18.39,18.46,18.67,18.85,19.08,19,19.4,19.71,19.64,19.65,19.72,19.57,19.53,19.45,19.22,19.03,19.05,19.09,19,18.86,18.99,19.07,19.15,19.4,19.3,19.25,19.28,19.39,19.65,20,20.42,20.75,20.99,20.69,20.45,20.5,20.68,20.4,20.68,20.58,20.76,20.98,21.1,20.88,20.8,20.95,20.72,21.02,21.25,21.62,21.7,22.15,22.46,22.31,22.49,22.49,22.57,22.59,22.38,23,23.1,23.08,23.08,22.91,23.06,22.71,22.61,22.79,22.8,23.4,23.1,22.75,22.26,21.75,21.47,21.28,20.67,21.3,21.37,21.2,21.63,21.72,21.67,21,21.4,20.81,20.9,20.81,20.35,20.98,21.23,20.96,20.54,20.4,20.43,20.57,20.65,21.06,21.27,21.14,21.55,21.5,21.28,20.9,21.07,20.93,20.97,21.08,21.42,21.4,21.3,21.44,20.97,21,20.74,21.32,21.61,22.14,22.09,21.92,22.07,22.11,21.86,21.44,21.3,21.19,21.08,21.05,21.12,20.85,20.84,20.48,20.39,20.37,20.83,20.77,21.45,21.65,21.75,21.94,21.85,21.46,21.12,20.9,20.9,20.9,20.9,20.3,20.65,21.1,20.95,20.75,20.72,20.48,20,20,19.96,20,20.05,20.04,20.15,20.01,19.9,19.82,19.99,19.99,19.8,19.7,19.72,19.64,19.62,19.61,19.52,19.6,19.65,19.5,19,19.24,19.05,18.89,19.1,19.05,18.75,19.03,18.99,19.65,19.1,19.38,19.19,18.69,18.74,18.66,19.16,19.49,19.78,20.2,20.15,20.4,20.99,20.63,20.79,20.93,20.99,21.38,21.3,21.45,21.55,21.24,21.35,21.1,21.26,21.6,21.51,20.9,21.32,21.59,21.3,21.29,21.56,21.74,21.52,21.7,21.4,21.45,21.55,21.22,20.96,20.92,21.36,21.66,22,22.05,21.8,21.54,21.77,21.72,21.64,21.24,21.51,21.81,22.1,22,21.93,21.84,21.8,22.05,21.56,21.09,21.21,21.19,20.4,20.4,19.77,20.11,20.65,20.44,20.41,20.83,20.63,20.72,20.59,20.89,21.27,20.8,20.36,20.61,20.44,20.96,21.09,20.92,21.66,21.71,21.61,21.95,21.6,21.07,20.77,19.57,20.29,20.6,20.55,21.1,21.28,21.13,20.85,21,21,20.15,19.81,19.29,18.95,19.09,19.05,18.55,18.38,18.28,18.18,18.24,18.01,17.8,16.6,17,18.16,19,18.26,18.3,18.5,19.28,19.26,18.91,18.1,18.33,18.68,17.9,18.57,18.2,18.55,18.33,18.5,18.84,18.18,17.82,17.4,17.45,17.67,18.05,17.8,17.5,17.02,17.23,17.65,18.3,16.85,17.1,16.65,17.25,16.9,17.23,16.58,16.88,18,17.78,18.28,18.6,17.58,17.2,17.8,17.82,18.54,18.32,18.07,18.2,18.44,18.1,17.72,17.8,17.44,17.97,18.23,18,17.8,18.45,18.38,18.31,17.9,17.9,18.2,18.24,18.05,18.45,18.38,18.01,17.73,17.78,17.5,17.66,17.44,17.62,17.85,17.63,17.22,17.44,17.15,17.25,17.4,17.56,17.32,17.23,17.49,17.06,16.9,16.85,17.16,17.25,17.45,16.99,17.11,16.9,16.65,17.08,17.15,17.1,16.83,16.75,16.5,16.99,16.71,17.28,16.9,16.28,15.8,15.48,15.64,16.1,16.23,15.8,15.78,15.2,14.96,14.7,14.15,14.21,15.06,15,15.72,15.92,16.9,17.48,16.15,16.47,15.82,16.54,16.18,16.25,15.89,16.11,16.7,16.95,16.72,16.88,17.15,16.52,15.85,16.25,16.35,15.69,16.15,16.01,16,16.8,16.66,16.1,17,17.29,17.38,17.72,17.98,17.65,17.25,18.33,17.84,18.12,17.83,17.56,17.25,17.1,17.38,17.15,18,18.8,18,18,17.73,17.3,17.3,16.64,17.56,18.08,18.06,17,17.42,17.25,16.27,14.78,16.52,15.48,16.68,15.85,16.65,17.03,17.39,15.8,14.8,13.34,14.24,14.4,13.55,14.85,16.4,16.17,15.78,16.5,15.2,14.2,14,14.55,14.51,14.25,14.5,14.65,13.79,14.08,13.67,13.24,13.06,14.15,14.45,14.45,14.98,15,14.24,13.6,13.14,13.22,13.75,13.04,13.49,14.05,13.55,13.41,13.18,13.05,13.3,12.86,12.7,13.54,13.4,13.2,13.05,12.95,13.27,13.15,13.2,13.51,13.66,13.81,13.82,13.09,12.6,12.29,12.2,12.25,12.23,11.77,12.76,11.96,12.1,11.98,12.25,12.04,12.1,12.1,10.6,10.34,10.6,11.3,11.15,11.28,11.05,10.77,10.65,10.3,9.8,9.98,10.1,9.82,9.6,9.75,10.25,10.65,10.25,10.5,9.92,9.67,9.2,8.9,9.35,9.3,9.57,10.2,10.19,10.53,10.15,10.21,10.27,10.39,10.4,10.58,10.47,10.3,10.05,10,10.22,10.15,10.06,10.03,9.89,10.05,10.57,11.06,10.57,11,10.92,10.99,10.31,10.09,10.25,10.23,10.23,10.45,10.6,10.73,10.53,10.8,10.81,10.69,10.27,10.16,10.06,10.14,10,9.51,9.6,9.61,9.96,10.22,10.13,10.04,9.87,10.32,10.61,10.67,10.95,11.38,11.64,12.35,11.85,11.38,11.62,11.58,11.47,11.68,11.73,11.33,11.01,11.21,11.01,10.92,10.55,11.07,11.23,11.32,11.49,11.38,10.96,11.25,11.12); wlWDCLastPrice = 11.12; // asAtDate must be a string of type yyyymmdd // function returns price, or -1 if out of range function getHistoricalPrice(asAtDate,asxCode) { var count = wlWDCDateArr.length; var date = parseInt(asAtDate); if (date > wlWDCDateArr[count-1] || date < wlWDCDateArr[0]) return -1; var lower = 0; var upper = count-1; var index = parseInt(upper/2); var curDate; // binary search for date while(upper - lower > 1) { curDate = wlWDCDateArr[index]; if (curDate == date) return wlWDCPriceArr[index]; if (curDate > date) upper = index; else lower = index; index = parseInt((upper+lower)/2); } // Make sure that what we've found is actually the right day. if (wlWDCDateArr[upper] == date) { return wlWDCPriceArr[upper]; } else { return -1; } if (wlWDCDateArr[lower] == date) { return wlWDCPriceArr[lower]; } else { return -1; } }