/**
restores frameset where necessary
making sure there is environment for frameset persistence
*/

ctad_included("frame_restore.js");
ctad_require("functions.js","frame_restore.js");

if (!parent.CTAD_FRAMESET && (CTAD_SETTINGS["persist_force_frameset"] ||  getAPIHandle()) ) { 

	//reload after a timer gap to execute in different context
	if (window.location.href.indexOf("index.htm")!=-1){
		window.setTimeout(function(){window.location.href = "indexfs.html";},10);
	}else{
		window.setTimeout(function(){window.location.href = "../indexfs.html?url="+window.location.href;},10);
	}
	
	//try to stop the rest of the code executing 
	if (typeof(window.stop)=="function"){
		window.stop();
	}
	
	//and in IE
	if (typeof(document.execCommand)!="undefined"){ //not a function for some reason
		document.execCommand("Stop");
	}
}
