function dumpFrameTree( oOb, alWarn ) {
if( !window.oWinOut ) {
if( !oOb || !oOb.location || !oOb.navigator ) { window.defaultStatus = 'Non-fatal error: Frame Tree Script was not passed a valid window object.'; if( alWarn ) { alert( window.defaultStatus ); } return; }
window.defaultStatus = ''; window.onfalWarn = alWarn; window.frameNameList = ['_blank','_self','_parent','_top','_media','_search','_content'];
window.onerror = function () {
oWinOut.document.writeln( '<li><font color="#ff0000"><b>Access violation error ocurred attempting to access this frame<br>Could not complete - frames span multiple domains or a frame did not contain an HTML based document.<br>------------ Script forced to abort ------------</b></font></li>\n</table></body></html>' );
oWinOut.document.close();
window.defaultStatus = 'Fatal error: Frame Tree Script aborted with \'access denied\' errors. Further scripts may not run.';
if( window.onfalWarn ) { alert( window.defaultStatus ); }
return true;
}
window.oWinOut = window.open('','frtroutwin','menus=0,scrollbars=1,toolbar=0,status=1,resizable=1');
window.top.focus(); var onBase = true; oWinOut.document.open();
oWinOut.document.writeln( '<html><head><title>Frame structure</title><style type="text/css"><!--\na { color: #7777ff; text-decoration: none; }\ntd { background-color:#000000;color:#ffffff; }\n--></style></head><body bgcolor="#770000" text="#ffffff"><table border="0" cellpadding="4" cellspacing="0"><tr><td>\n<hr>\n<h1>Frame structure</h1>\n<ul>' );
} else { var onBase = false; }
var isDup = false;
if( oOb.name ) {
for( var x = 0; x < window.frameNameList.length; x++ ) {
if( window.frameNameList[x] == oOb.name ) {
window.defaultStatus = 'WARNING: Frame Tree Script detected duplicate or invalid frame name: ' + oOb.name; var isDup = true; if( window.onfalWarn ) { alert( window.defaultStatus ); } break;
} }
window.frameNameList[window.frameNameList.length] = oOb.name;
}
oWinOut.document.writeln( '<li>' + ( isDup ? 'Warning - duplicate or invalid name detected! ' : '' ) + ( oOb.name ? 'Frame named \'' + oOb.name + '\'' + ( ( oOb == window.top ) ? 'or \'_top\'' : '' ) : ( oOb == window.top ) ? 'Frame named \'_top\'' : 'Unnamed frame' ) + ' containing <a href="' + oOb.location.href + '" title="' + oOb.location.href + '" target="_blank">' + ( ( oOb.document && oOb.document.title ) ? 'document titled \'' + oOb.document.title + '\'</a>.</li>' : 'unnamed document</a>.</li>' ) );
if( oOb.frames && oOb.frames.length ) {
oWinOut.document.writeln( '<ul>' );
for( var x = 0; x < oOb.frames.length; x++ ) { dumpFrameTree( oOb.frames[x] ); }
oWinOut.document.writeln( '</ul>' );
}
if( onBase ) {
oWinOut.document.writeln( '</ul>\n<hr>\n</td></tr></table></body></html>' );
oWinOut.document.close(); window.oWinOut = false; window.onerror = function () {};
}
}