var incURL = null;
var reportURL = "/frameCapture.jsp?"
var framerURL = null;
var destURL = null;

window.onload = framebreaker;

function framebreaker()
{
	if (self.parent.frames.length != 0)
		breakframe();
}

function breakframe()
{
	framerURL = document.referrer;
	destURL = document.location.href;
	top.location = destURL;
	
	// FIXME: temporarily turning off the "You've been framed" page, just getting out of the frame for now
	
	destURL = destURL.replace(/&/g,"%26");
	destURL = destURL.replace(/=/g,"%3d");
	reportURL += "framer=" + framerURL + "&";
	reportURL += "destURL=" + destURL;
	top.location = reportURL;
	
}

function getParams()
{
	var paramstr = (incURL.indexOf("?") > 0) ? incURL.split("?")[1] : null;
	var params;
	
	if (paramstr)
	{
		params = paramstr.split("&");
		if (params.length == 2)
		{
			framerURL = params[0].split("=")[1];
			destURL = params[1].split("=")[1];
			return 2;
		}
		else if (params.length == 1)
		{
			framerURL = null;
			destURL = params[0].split("=")[1];
			return 1;
		}
	}
	
	return 0;
}