function getPartyColor(code) { var result; if ('object' === typeof code) { result = new Array(); for (c in code) { result.push(partyColors[ code[c].toUpperCase() ]); } } else { result = partyColors[code]; } return result; } var partyColors = { FG : '#003399', FF : '#009900', SF : '#FF9900', LAB : '#CC0000', GP : '#000000', PBP : '#000000', AAA : '#000000', DDI : '#000000', WP : '#000000', FN : '#000000', EIR : '#000000', UL : '#000000', WUA : '#000000', CPI : '#000000', SKIA : '#000000', LRP : '#000000', TUV : '#000000', SDLP : '#000000', CON : '#000000', GNI : '#000000', DUP : '#000000', ALL : '#000000', NI21 : '#000000', UUP : '#000000', UKIP : '#000000' } function getPartyColor(code) { var result; if ('object' === typeof code) { result = new Array(); for (c in code) { result.push(getPartyColor(code[c].toUpperCase())); } } else { if ("undefined" !== typeof partyColors[code]) { result = partyColors[code]; } else { result = '#000000'; } } return result; }