<!--
///////////////////////////////
// MVSD frames.js
// Version: 1.0.0 10-12-2004
// Preconditions:
//		-	none
// Dependencies:
//		- Frameset must exist and must contain functionality to request the name of the page from the url, otherwise the 
//			redirect will occur, but the page which includes this file will not appear in the frame.
//			(Or that page, is the default sourcefile for that frame.)
// Description:
//	Checks if a page is loaded inside its frame. If its not, it will load the frame and itself in it.
//	The page will send its filename in the url of the frameset, so that the frameset knows that this page
//	is to be loaded in the appropriate frame.
//	
///////////////////////////////

function loadInFrameset(framesetpage)
{	// Loads the current page in the specified frameset.
	// If no frameset is defined, the default is used.

	if (!framesetpage) 
	{	// framesetpage is undefined: set to default
		framesetpage="main.htm"; 
	}
	
	thispage=window.location.href;
	
	if (thispage.indexOf('://')<0) 
	{	// if the substring '://' is missing, add it to the beginning
		thispage="://"+thispage;
	};
	
	prefix = thispage.substring(0,thispage.lastIndexOf('://'));	// prefix is the substring before '://'
	suffix = thispage.substring(thispage.lastIndexOf('://')+3,thispage.length); // suffix is the substring after '://'
	
	// get parent page
	parentpage=parent.location.href;
	if (parentpage.indexOf('?')>0) parentpage=parentpage.substring(0,parentpage.indexOf('?')); // strip part after first occurence of '?'	
	parentpage=parentpage.substring(parentpage.lastIndexOf('/')+1,parentpage.length); // strip part before last occurence of '/'
	
	if (parent.location.href == window.location.href || parentpage.toUpperCase() != framesetpage.toUpperCase()) 
	{	// if window is not loaded into parent or parent is not the specified parent, reload
		parent.location.href = framesetpage+"?"+prefix+"&&&"+suffix
	}
}
// -->
