<script type="text/javascript" src="../scripts/popup.js"></script>
inside popup.js
-----------------
function map(func) {
var i,j,o;
var results = [];
if (typeof(func)=="string") {
func = new Function('$_',func);
}
for (i=1; i<arguments.length; i++) {
o = arguments[i];
if (isArray(o)) {
for (j=0; j<o.length; j++) {
results[results.length] = func(o[j]);
}
}
else if (isObject(o)) {
for (j in o) {
results[results.length] = func(o[j]);
}
}
else {
results[results.length] = func(o);
}
}
return results;
};