
function getInnerHeight()
{
	var h = -1;

	//alert('lowfidelity owns business mate!');

	//IE
	if(!window.innerHeight)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		h = window.innerHeight;
	}
	

	if(h <= 0) 
		return -1;
	
	return h;
	
}		





function getInnerWidth()
{
	var w = -1;

//		alert('lowfidelity owns business mate!');

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
	}
	

	if(w <= 0) 
		return -1;	//moellbrooklyn we got a problem
		
	return w;
}		


// This function resizes an IFrame object to fit its content.
function resizeIframeToFitContent(iframe) 
{
    // The IFrame tag must have a unique ID attribute.
  	return;
}



//alarms user if internetexplorer was found
function alarmOnIEX6()
{
	var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	//var isOldVersion = navigator.appVersion.substring(0,1) < 5;	
	
	if(isIE6)
	{
		var url = "http://www.bernhard-raab.at/wordpress/?p=71&KeepThis=true&TB_iframe=true&width=400&height=200";
		tb_show("Browser Check", url);
	}
		
		
	return;
}


function isOldBrowser()
{
	var isIE8 = navigator.userAgent.toLowerCase().indexOf('msie 8') != -1;
	var isIE7 = navigator.userAgent.toLowerCase().indexOf('msie 7') != -1;
	var isIE6 = navigator.userAgent.toLowerCase().indexOf('msie 6') != -1;
	var isOldVersion = navigator.appVersion.substring(0,1) < 5;
	
	//all nice browsers return appVerison 5. except iex8, it returns 4 but also it's "msie 8" tag
	if(!isIE8 && !isIE7 && !isIE6 && isOldVersion)
		return true;
	
	return false;	
}


function alarmOnOldBrowser()
{
	if(isOldBrowser())
	{
		var url = "http://www.bernhard-raab.at/wordpress/?p=71&KeepThis=true&TB_iframe=true&width=400&height=250";
		tb_show("Browser Check", url);
	}
}



function alignGuiMinimal()
{			
				
	var h = getInnerHeight();
	var w = getInnerWidth();
	//var w = document.getElementById("tblVCenter").getAttribute("width");
	
	//set main table height
	//if(h > 600)
	{		
		document.getElementById("tblVCenter").setAttribute("height", h);
		//document.getElementById("tblMain").setAttribute("height", h);
	}
	
	
	//set bgimage table width. max 1280 px	
	if(w > 1280)
	{
		document.getElementById("tblMainImage").setAttribute("width", 1280);
	}
	else
	{
		document.getElementById("tblMainImage").setAttribute("width", w);					
	}
	
	//resize the yellow border to fit the background image	
	//document.getElementById("tblMainImage").setAttribute("height", 	document.getElementById("img1").getAttribute("height"));
	//document.getElementById("tblMainImage").height = 250;
	
	//set height of iFrame containing textstuff
	
	var nContentHeight = 200;
	if(h >= 800)
		nContentHeight = 300;

	document.getElementById("frmContent").setAttribute("height", nContentHeight);
	//$('#frmContent').height = 600;
	
			
	
}


function getYPos( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


function alignContentFrame()
{
	//calc and set content iframe height. should touch bottom of screen
	var objBottomButton = document.getElementById("imgMnuLogin");
	var objContentFrame = document.getElementById("frmContent");
	var objBody = document.getElementById("_body");
	
	//this is the minimum height the window needs. if it's less, the v-scrollbar is shown
	//the height of the content frame is set to at least the bottom of the bottom-button (kunden-login)
	var nMinHeight = parseInt(getYPos(objBottomButton),10) + parseInt(objBottomButton.getAttribute("height"),10);
	var nWndHeight = getInnerHeight();
	
	
	//######################
	//DISABLED FOR NOW
	//#######################
	//if we got some room left down to the bottom, we stretch the iframe down
	/*
	if(nMinHeight < nWndHeight)
	{		
		var space = getInnerHeight() - nMinHeight;
		var frmHeight = parseInt(objContentFrame.style.height.replace("px",""), 10);	
		var frmNuHeight = space + frmHeight - 20;  //we need some air at the bottom, yeah!
	
		objContentFrame.style.height = (frmNuHeight + "px");
		//alert(objContentFrame.style.height);
	}
	*/
}


function alignGui()
{								
	var h = getInnerHeight();
	var w = getInnerWidth();
	//var w = document.getElementById("tblVCenter").getAttribute("width");
	

	//this is the main table, surrounding everything else
	//we set it's height to 100%
	var tblVAlign = document.getElementById("tblVCenter");
	tblVAlign.setAttribute("height", h);
	
	//document.getElementById("tblMain").setAttribute("height", h);			
	//set height of iFrame containing textstuff	
	//var nContentHeight = 200;
	//if(h >= 800) nContentHeight = 300;

	//get the 3 main rows for height calculation of the iFrame with the text
	/*var tblTitle = document.getElementById("tblTitle");
	var tblMainImage = document.getElementById("tblMainImage");	
	var tblSpacer = document.getElementById("tblSpacer");	
	
	
	var nContentHeight = h - tblTitle.getAttribute("height") - tblMainImage.getAttribute("height") - tblSpacer.getAttribute("height");
	*/
	//we set the iframe's height to totalheight - 20%
	//document.getElementById("frmContent").setAttribute("height", nContentHeight  - h / 100 * 20);	
	//the horizontal green line is set to a height of total - 10 %
	//document.getElementById("tblHorizontalGreenLine").setAttribute("height", nContentHeight - h / 100 * 17);
	//alert("h: " + h);
		
}


function hideIFrame()
{
	//this effect is disabled in current version.
	//see main.htm button click events and events.js
	$('#frmContent').fadeOut('slow');
}

function showIFrame()
{
	//this effect is disabled in current version.
	//see main.htm button click events and events.js
	$('#frmContent').fadeIn('slow');
}

function showGalleria(strGallery, strTitle)
{	
	//strGallery = "idontknow";
	var url = "/fotogalerie/galleria_iframe.php?strGallery=" + strGallery + "&KeepThis=true&TB_iframe=true&width=800&height=800";
	//alert(url);
	tb_show(strTitle, url);
}
