/*
 * mainScript.js
 */

var loginOpen = false;

function setLayout() {
    var i = document.body.clientHeight - 200;
    if ( i < 0 ) { i = 0; }
	document.getElementById('myMarge').style.height        = i;

    var i = document.body.clientHeight - 160 - 34 - 200;
    if ( i < 0 ) { i = 0; }
    document.getElementById('contentCell').style.height    = i;

    var totHeight = document.body.scrollHeight - 2;
    var visHeight = document.body.clientHeight;

	var totWidth  = document.body.scrollWidth - 2;
	var visWidth  = document.body.clientWidth;

    if ( totHeight > visHeight ) {
        document.body.scroll = "yes";
        var i = document.body.scrollHeight - 160 - 34;
        if ( i < 0 ) { i = 0; }
	    document.getElementById('contentFrame').style.height   = i;
    
        var i = document.body.scrollHeight - 360;
        if ( i < 0 ) { i = 0; }
	    document.getElementById('tblAlphaLeft').style.position = "absolute";
	    document.getElementById('tblAlphaLeft').style.top      = i;
    
    } else {
        document.body.scroll = "no";
        var i = document.body.clientHeight - 160 - 34;
        if ( i < 0 ) { i = 0; }
	    document.getElementById('contentFrame').style.height   = i;
    
        var i = document.body.clientHeight - 360;
        if ( i < 0 ) { i = 0; }
        document.getElementById('tblAlphaLeft').style.position = "absolute";
	    document.getElementById('tblAlphaLeft').style.top      = i;    
    }

	document.getElementById('updateStatus').style.top     = totHeight - 25;
	document.getElementById('updateStatus').style.left    = visWidth  - 140;
	document.getElementById('updateStatus').style.display = "block";
	document.getElementById('updateStatus').style.width   = 120;

	window.status = "Welkom bij Alpha-Groep Oud-Beijerland";
	return( true );
}

function goTo( url ){	
	window.location.href = url;
	return( true );
}

function goToFrame( url ) {
	parent.location.href = url;
	return( true );
}

function openLogin() {
	closeTrees();
	loginOpen = true;
	document.getElementById('frmLogin').className = "frmLoginVisible";
//	document.getElementById('frmLogin').style.top = currButton.top;
	return( true );
}

function closeLogin() {
	loginOpen = false;
	document.getElementById('frmLogin').className = "frmLoginHidden";
	return( true );
}

function switchLogin() {
	if (loginOpen)
	{
		closeLogin();
	} else {
		openLogin();
	}
}
