// This script will detect when the page is stuck in frames.
// It will ask the user if they want to open the page in
// a new window. If yes, the page is opened in a new window
// that is the full size of the users screen. The referring 
// page is not closed.
//
// Date:     12/14/1999
// Author:   David Wickersham (skeezicks@cyberdude.com)
// Version:  1.0
//
// Installation Instructions:
// 1. Copy this script into a file named frame_breakout.js.
// 2. Use a script tag to incorporate frame_breakout.js  
//    into the html page immediately after the <BODY> tag:
//    <script language="javascript" src="[path]frame_breakout.js"></script>.
//    
//    
// How It Works:
// If the top document location object is not equal to the 
// present document location object then the page is stuck
// in frames. A confirmation dialog gives the user the 
// option to break out or not. If they choose "OK", the 
// page is opened in a new browser window the full size  
// of the users screen. The referring page is not closed.
// When they close the new window the referring page will
// still be there and your page will be inside the frame.
// The firstTime switch variable keeps the user from being 
// queried again at that time.
//
// Compatibility:
// Tested on IE 5 and Netscape 4. Probably also works on
// on IE 4.

function openIt() {

  rszWidth = screen.width;
  rszHeight = screen.height;

  new_window = window.open(document.location.href,"new_window",
        "toolbar=yes,location=yes,directories=no,status=yes," +
        "menubar=yes,scrollbars=yes,resizable=yes," +
        "dependent=no,left=1,top=1," +
        "width=" + screen.Width + ",height=" + (screen.Height - 27));
  new_window.resizeTo(rszWidth, (rszHeight-27));
  new_window.moveTo(0,0);
}

var firstTime = "yes";
if (top.location !== self.location && firstTime == "yes") {
  firstTime = "no"; 
  var resp = window.confirm("You are stuck inside someone "
               + "else's frames.\nWould you like to open the "
               + "page in a new window?");
  if (resp == true) {
    openIt();
  }
}
