/*
* This notice must be untouched at all times.

============= META ==================
@name : jaxWidgets_FrameBuster.js  
@version : 0.11 
@copyright (c) 2005 Sarat Pediredla. All rights reserved.
@last-modified: 27/06/2005
@url : http://sarat.xcelens.co.uk/jaxWidgets
@latest-version-url : http://sarat.xcelens.co.uk/jaxWidgets/latest/
======================================

============== DESCRIPTION =============
The frame buster is a a little widget that prevents other
sites from showing your site in nested frames.

The code is copyright of Peter-Paul Koch and ripped off from http://www.quirksmode.org/js/framebust.html
=========================================

============= FEATURES ==================
- Uses jaxXML markup tags to specify designer friendly tags in HTML (.NET style)
============================================

============= CHANGELOG ==================
29 June 2005 [12:41 PM]
Modified script to work on Internet explorer by removing adding
a script node and simply eval() the expression to bust out of frames!!!
==========================================

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For more details on the GNU Lesser General Public License,
see http://www.gnu.org/copyleft/lesser.html
*/

// Register object
jaxWidgets.FrameBuster = function()
{
	// Settings
	var strPage = "http://www.enchanted-isle.com";       // The page to open when the frames are busted. Better if relative path to http root of webserver
	
	// Create frame buster
	this.load = function(element)
	{
		// Standard function to parse the custom jax tag
		this.parseTag(element);

		// This ONE line does it??
		eval("if (!(top == self)) top.location.replace('"+this.strPage+"');");	
	};
		
	this.registerWithEngine = function(_Validator)
	{
		var tag = "FrameBuster";
		var handler = _FrameBuster;
		_Engine.registerWidget(tag, handler);
	};
	
	this.parseTag = function(element)
	{
		if(element.getAttribute("Page"))
			this.strPage = element.getAttribute("Page");
	}
}
	
var _FrameBuster = new jaxWidgets.FrameBuster();
_FrameBuster.registerWithEngine(_FrameBuster);


