// config
var profesoriai = {
	title: 'Profesoriai.lt - {$title}',
	min_height: 500,
	min_width: 970,
	min_footer: 350
}

// title
document.title = profesoriai.title.replace( "{$title}", document.title );

// content_height
function content_height()
{
	if( typeof document.body.style.maxHeight != "undefined" )
	{
		var e = window, a = 'inner';

		if ( !( 'innerWidth' in window ) )
		{
			a = 'client';
			e = document.documentElement || document.body;
		}
		
		var h = parseInt(e[a+'Height']);
		var w = parseInt(e[a+'Width']);
		
		// positions
		if( h < profesoriai.min_height || w < profesoriai.min_width )
		{
			set_position('absolute');
		}
		else
		{
			set_position('fixed');
		}
		
		// < --- >
		if( w < profesoriai.min_width )
		{
			document.getElementById('footer').style.width = profesoriai.min_width+'px';
			document.getElementById('header').style.width = profesoriai.min_width+'px';
			document.getElementById('nav_menu').style.width = profesoriai.min_width+'px';
		}
		else
		{
			document.getElementById('footer').style.width = '100%';
			document.getElementById('header').style.width = '100%';
			document.getElementById('nav_menu').style.width = '100%';
		}

		// min_footer
		if( h <= profesoriai.min_footer )
		{
			document.getElementById('footer').style.position = 'relative';
		}
		else
		{
			document.getElementById('footer').style.position = 'fixed';
		}
	}
}

function set_position( p )
{
	document.getElementById('header').style.position = p;
	document.getElementById('nav_menu').style.position = p;

	if( document.getElementById('submenu') )
	{
		document.getElementById('submenu').style.position = p;
	}
	
	// background
	if( p == 'fixed' )
	{
		document.body.style.backgroundAttachment = "fixed";
	}
	else
	{
		document.body.style.backgroundAttachment = "scroll";	
	}
}

window.onresize = content_height;
window.onload = content_height;

function set_content_size( css )
{
	document.getElementById('content').className = css;
}

if( typeof document.body.style.maxHeight != "undefined" )
{
	document.body.style.backgroundAttachment = "fixed";
	document.getElementById('footer').style.position = 'fixed';
}