// This function checks to see if the current page is in a frame.
// If it is, it redirects the browser to make the current page the
// top level page, thus eliminatig the frameset. This will typically 
// be called by the page.onload() event handler.

//MB SC00002883:
//If we're in a greybox iframe we don't want to bust
function inGreybox() {
	if(window.parent.jQuery) {
		var greyboxes = window.parent.jQuery.find("[id^='GB_frame']");
		var box;
		var frameUrl;
		var selfUrl;
		for(var i=0; i < greyboxes.length; i++) {
			var box = greyboxes[i];
			frameUrl = window.parent.frames[box.name].location;
			//frameUrl = window.parent.frames[i].location;
			selfUrl = window.self.location;
			//Should only return true if our URL matches the URL of one of the greyboxes
			if(frameUrl==selfUrl) {
				return true;
			}
		}
	}
	return false;
}

function bustOutOfFrameset() {
	if ((window.parent != window.self) && !inGreybox()){
		window.parent.location = window.self.location;
	}
}

