// ======================================================================================
// Global parameter to the wcms path
// ======================================================================================
var m_strWCMSPath = '/WCMS35';

// ======================================================================================
// Refresh the loginFrame so the user see if he's logged in after new registration
// ======================================================================================
function UpdateLoginFrame()
{
	var oLoginFrame = parent.document.getElementById('anmeldung_iframe');
	if(oLoginFrame != null)
	{
		oLoginFrame.src = m_strWCMSPath + '/WebUser/LoginPage.aspx';
	}
}

function LoadInFrame(strUrl)
{
	// set correct seperator if we have already parameters or not
	if(strUrl.indexOf('?') == -1)
	{
		strSeparator='?';
	}
	else
	{
		strSeparator='&';
	}

	//CAUTION: strUrl Page may not be cached by IE / NS! Because if we
	// do something in another page when we reload this page, 
	// the dont change their content (it's cached)
	// See: <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
	if(document.getElementById('m_MainFrame') == null)
	{
		parent.document.getElementById('m_MainFrame').src = strUrl + strSeparator + GetFirmCustId();
	}
	else
	{
		document.getElementById('m_MainFrame').src = strUrl + strSeparator + GetFirmCustId();
	}
}

function GetFirmCustId()
{
	// add firmCustId parameter
	if(document.getElementById('m_FirmCustId') == null)
	{
		return 'FirmCustId=' + parent.document.getElementById('m_FirmCustId').value;
	}
	else
	{
		return 'FirmCustId=' + document.getElementById('m_FirmCustId').value;
	}
}

function AdaptIFrameHeight(FrameId)
{	// adapt height of the frame, that no scrollbars are shown scroll to the end
	oMainFrame = window.parent.document.getElementById(FrameId);
	
	if(oMainFrame == null)
	{
		alert("Frame "+FrameId+" not found");
	}
	else
	{
		nFullSizeHeight = 500;
		oMainFrame.height = nFullSizeHeight;
		
		window.scrollTo(0, 10000000);
		
		var nScrollTop;
		if (self.pageYOffset) // all except Explorer
		{
			nScrollTop = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
			// Explorer 6 Strict
		{	
			nScrollTop = document.documentElement.scrollTop;
		}
		else if (document.body) // all other Explorers
		{
			nScrollTop = document.body.scrollTop;
		}
		nNewHeight = Math.round(nFullSizeHeight) + Math.round(nScrollTop);
			
		window.scrollTo(0,0);
		
		if(nNewHeight < nFullSizeHeight)
		{
			nNewHeight = nFullSizeHeight;			
		}
		
		// set Frame - height
		oMainFrame.height = nNewHeight;
	}
}

