yes and yes..
1.) have a look at pdp's javascript spider http://www.gnucitizen.org/projects/javascript-spider/launch.htm . That actually works without even needing to be on the same domain. but basically you spider the site by pulling a page then parsing out all href="blah". Only keep the ones on the same domain.
2.) this sends it to a function of your choice defined by callBack = "sendPage";
request.onreadystatechange = function() {
if (this.readyState==4) {
var pulled_info = this.responseText;
eval(callBack+"(pulled_info,"+counter+");");
} taken from an API of mine, that i'll probably clean up and release tomorrow since microsoft decided not to patch IE's mhtml bug. =.=
You'll have to use #2 anyway, to do #1 and find the links
-maluc