You don't need the XDocument stuff for what you are doing, in the page you are opening the box from, do something like...
Code:
var okClicked = showModalDialog("myModalFileName.htm", null, "dialogWidth: 200px; dialogHeight: 150px");
if(okClicked){
// do something
}
Then in the dialogue page...
Code:
<input type="button" onclick="returnOk();" />
...
function returnOk(){
window.returnValue = true;
window.close();
}
HTH,
Chris