Gracias por la respuesta, lo probé y funciona a la perfección.
A lo que me refería con reemplazar es como hacer una especie de "switch" pero trabajando con el array de arriba. Puedo hacer un bloque de if() con substr y while pero gastaría demasiado espacio y tengo mucho código en array:
Código Javascript
:
Ver originalvar esfera = [
[
['A', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/548635_298256880289238_993382868_n.jpg', '298256880289238'],
['B', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-ash3/598850_298256890289237_478614916_n.jpg', '298256890289237'],
['C', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-prn1/23872_298256900289236_1940759013_n.jpg', '298256900289236'],
['D', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-snc6/254254_298256926955900_1213955725_n.jpg', '298256926955900'],
['E', 'http://sphotos-d.ak.fbcdn.net/hphotos-ak-snc6/183813_298256943622565_742728769_n.jpg', '298256943622565'],
['F', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-prn1/559622_298256946955898_1573844477_n.jpg', '298256946955898'],
['G', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/563979_298256950289231_823991634_n.jpg', '298256950289231'],
['H', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash3/552326_298256956955897_1576081640_n.jpg', '298256956955897'],
['I', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/320374_298256966955896_1807730120_n.jpg', '298256966955896'],
['J', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-prn1/149843_298256976955895_849542244_n.jpg', '298256976955895'],
['K', 'http://sphotos-d.ak.fbcdn.net/hphotos-ak-prn1/32332_298256986955894_732974388_n.jpg', '298256986955894'],
['L', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash3/553603_298256990289227_2021539574_n.jpg', '298256990289227'],
['M', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/553793_298256996955893_880652486_n.jpg', '298256996955893'],
['N', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash3/581634_298257003622559_737464779_n.jpg', '298257003622559'],
['O', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-snc7/578406_298257006955892_1293677946_n.jpg', '298257006955892'],
['P', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-prn1/643877_298257043622555_1347730065_n.jpg', '298257043622555'],
['Q', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash4/407665_298257070289219_291228970_n.jpg', '298257070289219'],
['R', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash3/557785_298257093622550_1881638415_n.jpg', '298257093622550'],
['S', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-snc6/185018_298257110289215_1716106049_n.jpg', '298257110289215'],
['T', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-snc6/222447_298257116955881_1752243842_n.jpg', '298257116955881'],
['U', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash3/550174_298257126955880_1557061980_n.jpg', '298257126955880'],
['V', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-snc6/222430_298257133622546_2113165194_n.jpg', '298257133622546'],
['W', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-snc7/384858_298257146955878_729021692_n.jpg', '298257146955878'],
['X', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash4/400303_298257156955877_1783531610_n.jpg', '298257156955877'],
['Y', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash3/545364_298257160289210_1759111284_n.jpg', '298257160289210'],
['Z', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-snc6/269861_298257166955876_458116389_n.jpg', '298257166955876']
],
[
['A', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash4/485104_511130415564974_1237921148_n.png', '511130415564974'],
['B', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-ash4/184888_511130425564973_1205372950_n.png', '511130425564973'],
['C', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-snc7/407713_511130435564972_678737091_n.png', '511130435564972'],
['D', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-prn1/62218_511130445564971_1925189884_n.png', '511130445564971'],
['E', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/604004_511130468898302_1831282194_n.png', '511130468898302'],
['F', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash4/482902_511130492231633_155733978_n.png', '511130492231633'],
['G', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-prn1/603935_511130498898299_341421741_n.png', '511130498898299'],
['H', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-prn1/536672_511130505564965_764405925_n.png', '511130505564965'],
['I', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash4/378396_511130512231631_503987318_n.png', '511130512231631'],
['J', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-prn1/21818_511130515564964_960014379_n.png', '511130515564964'],
['K', 'http://sphotos-d.ak.fbcdn.net/hphotos-ak-snc7/305606_511130522231630_1809189925_n.png', '511130522231630'],
['L', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-ash4/378447_511130535564962_2099806009_n.png', '511130535564962'],
['M', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash3/561517_511130565564959_882048593_n.png', '511130565564959'],
['N', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-snc7/374541_511130598898289_1804632177_n.png', '511130598898289'],
['O', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash3/533833_511130605564955_693180702_n.png', '511130605564955'],
['P', 'http://sphotos-d.ak.fbcdn.net/hphotos-ak-prn1/522426_511130618898287_954080016_n.png', '511130618898287'],
['Q', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-prn1/148144_511130625564953_2101433825_n.png', '511130625564953'],
['R', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-ash3/548922_511130635564952_683876059_n.png', '511130635564952'],
['S', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-prn1/68379_511130652231617_883537376_n.png', '511130652231617'],
['T', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/532257_511130658898283_417158099_n.png', '511130658898283'],
['U', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-prn1/558838_511130665564949_966007244_n.png', '511130665564949'],
['V', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash3/46182_511130682231614_1339028943_n.png', '511130682231614'],
['W', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-ash3/59067_511130692231613_1407293597_n.png', '511130692231613'],
['X', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-ash3/546909_511130702231612_1486627249_n.png', '511130702231612'],
['Y', 'http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/263537_511130708898278_569633544_n.png', '511130708898278'],
['Z', 'http://sphotos-g.ak.fbcdn.net/hphotos-ak-ash3/579100_511130712231611_1769538387_n.png', '511130712231611']
],
[
['A', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-snc7/306004_511119865566029_389506212_n.jpg', '511119865566029'],
['B', 'http://sphotos-e.ak.fbcdn.net/hphotos-ak-ash3/536476_511119875566028_1947540138_n.jpg', '511119875566028'],
['C', 'http://sphotos-c.ak.fbcdn.net/hphotos-ak-ash3/546979_511119885566027_1976400563_n.jpg', '511119885566027'],
['D', 'http://sphotos-b.ak.fbcdn.net/hphotos-ak-prn1/540137_511119892232693_1232029942_n.jpg', '511119892232693'],
['E', 'http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn1/532185_511119902232692_1641252075_n.jpg', '511119902232692'],
['F', 'http://sphotos-f.ak.fbcdn.net/hphotos-ak-snc6/230023_511119918899357_1698017634_n.jpg', '511119918899357'],
...
]
];
Es decir, si se detectó la "A" en el string, debe reemplazarlo por "5028" (está con 'A' al comienzo del array).