function getOpenerTopBTFrame(){
	if( top.opener ){
		var curWindow = top.opener;
		while( curWindow != top.opener.top){
			if( curWindow.isTopBTFrame ){
				return curWindow;
			} else {
				curWindow = curWindow.parent;
			}
		}
		return top.opener.top;
	}
	return null;
}

function getTopBTFrame(){
	var curWindow = window;
	while( curWindow != top){
		if( curWindow.isTopBTFrame ){
			return curWindow;
		} else {
			curWindow = curWindow.parent;
		}
	}
	return top;
}

var topBTFrame = getTopBTFrame();
var openerTopBTFrame;
if( topBTFrame.isTopBTFrame ) {
	openerTopBTFrame = null;
} else {
	openerTopBTFrame = getOpenerTopBTFrame();
}
