// WW_frameset, muß von der jeweiligen index.html eingeschlossen werden
// Index.html muß drei Variablen belegen:
// topFrameSource, contentFrameSource, bottomFrameSource
// WW_frameset registriert Fenstergrößenänderungen und ruft danach
// index.html mit den aktuellen Fensterinhalten im QueryString auf.
// Dieser kann in index.html mittels WW_getQuery() ausgelesen werden.
// Die Argumentennamen sind top, content und bottom. Die Variablen
// topFrameSource, contentFrameSource, bottomFrameSource können dann entsprechnd
// neu belegt werden.

// Größe des oberen Frames --//
var topMin = 103;

//--Größe des unteren Frames --//
var bottMin = (isNT()) ? 15 : 21;	

var win_height = window.innerHeight;
var height_percent = (win_height/100);
var curr_width = window.innerWidth;
var curr_height = window.innerHeight;
var tmpTop = 0;
var tmpBottom = 0;
var allDefined = 0;
var checkTopHeight = true;
var checkBottomHeight = true;
var user_agent = window.navigator.userAgent;
var topName="null";
var middleName="null";
var bottomName="null";


//-- Browserabfrage   --//
function IsIE() {//	get browser type
	return user_agent.indexOf("MSIE") > 0;
}

function isNT() {
        var agt=navigator.userAgent.toLowerCase();
        return ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
}

//-- Aufruf der index.html mit entsprechendem Query - String nach Resize   --//
function checkForResize() {
	clearTimeout(timer);
	checkSources();
	
	if ((window.innerWidth != curr_width) || (window.innerHeight != curr_height)){
		
		if((topName)&&(middleName)&&(bottomName)){
		
		tmpURL=frameset_url+"?top="+topName+"&content="+middleName+"&bottom="+bottomName;
		
		}
		else
			tmpURL=frameset_url;
		window.location.href = tmpURL;
	}
	else{
		startTimeout();
	}
}



//-- Framesetberechnung  --//
if (!IsIE())
	{//--BEGIN frameset definition for Netscape
	for (i = 1; i < 100; i++)
		{
		if (checkTopHeight)
			if (Math.floor(height_percent*i) >= topMin)
				{
				tmpTop = i;
				checkTopHeight = false;
				allDefined++;
				}
		if (checkBottomHeight)
			if (Math.floor(height_percent*i) >= bottMin)
				{
				tmpBottom = i;
				checkBottomHeight = false;
				allDefined++;
				}
		if (allDefined == 2)
			{
			document.writeln("<frameset onLoad='checkSources();startTimeout(); ' rows='" + tmpTop + "%,*," + tmpBottom + "%' framespacing=0 frameborder='NO' BORDER='0'>");
			document.writeln("<frame src='" + topFrameSource + "' frameborder=0 name='up' marginwidth=0 marginheight=0 SCROLLING='NO'>");
			document.writeln("<frame src='" + contentFrameSource + "' name='content' frameborder=0 marginwidth=0 marginheight=0 noresize SCROLLING='AUTO'>");
			document.writeln("<frame src='" + bottomFrameSource + "' frameborder=0 name='bottom' marginwidth=0 marginheight=0 SCROLLING='NO'>");
			document.writeln("<\/frameset>");
			i = 100;
			}
		 
		}
	}
else
	{
	
			document.writeln("<frameset onLoad='checkSources();startTimeout();' rows='105,*,20' framespacing=0 frameborder='NO' BORDER='0'>");
			document.writeln("<frame src='" + topFrameSource + "' frameborder=0 name='up' marginwidth=0 marginheight=0 SCROLLING='NO'>");
			document.writeln("<frame src='" + contentFrameSource + "' name='content' frameborder=0 marginwidth=0 marginheight=0 noresize SCROLLING='AUTO'>");
			document.writeln("<frame src='" + bottomFrameSource + "' frameborder=0 name='bottom' marginwidth=0 marginheight=0 SCROLLING='NO'>");
			document.writeln("<\/frameset>");
	}


//-- Abfrage der aktuellen Fensterinhalte   --//

function checkSources() {

	if (window.frames[0])
		topName = window.frames[0].location.href;
	if (window.frames[1])
		middleName = window.frames[1].location.href;
	if (window.frames[2])
		bottomName = window.frames[2].location.href;
	}

function startTimeout() {
timer = setTimeout('checkForResize()',1000);
}

