//-----------------------------------------------------------------------------------
// 
// frame.js
//
// Copyright ©2006 Intervisual Software Ltd.
//
// This file contains a script to check if an HTML page is being loaded directly
// into the browser.  If so, it reloads the page inside the appropriate container
// ASP page.
//
//-----------------------------------------------------------------------------------

if (parent.location.href==document.location.href)
{
	// Page is same as parent, so not in container page.
	
	var section;		// Name of section within site
	var filename;		// Name of HTML file
	var fullname;		// Full URL of page
	var pos;				// Position within string
	
	fullname=document.location.href;				// Get full URL
	pos=fullname.lastIndexOf("/");					// Find last '/'
	filename=fullname.substring(pos+1);			// Filename is what follows it
	fullname=fullname.substring(0,pos);			// Chop off filename
	pos=fullname.lastIndexOf("/");					// Find next last '/'
	section=fullname.substring(pos);				// Section name is what follows it
	
	// Load the container ASP page for the section with the HTML file within it
	if (section=="/general")
		location.href="/default.asp?page="+filename;
	else
		location.href=section+"/index.asp?page="+filename;
}

