/*

frameworks.js
Copyright (c)2008-2011 johnlawson.tel
All Rights Reserved
   
*/

// DYNAMIC LAYOUT
var topHeight = 105;
var listPadding = 0;
var scrollBarSpacing = 0;
function resize()
{
	// GET NEW BOUNDS
	viewport();

	var shadow = 10;
	if( document.getElementById( 'controlTop' ).innerHTML == 'HIDE' )
	{
		// TOP
		//document.getElementById( 'top' ).style.width  = screenWidth + 'px';
		//document.getElementById( 'top' ).style.height = topHeight + 'px';
		var toggleWidth = 45;
		//document.getElementById( 'controlTop' ).style.left = ( ( ( ( screenWidth /2 ) - ( toggleWidth / 2 ) ) - getScrollBarWidth() + ( shadow / 2 ) ) ) + 'px';
		//document.getElementById( 'controlTop' ).style.top  = ( topHeight - ( shadow + 5 ) ) + 20 + 'px';

		if( ( webkit == true ) && ( mode != 'map' ) )
		{
			listPadding = 30;
			scrollBarSpacing = 10;
		}
		else
		{
			var listPadding = 0;
			var scrollBarSpacing = 0;	
		}

		// LIST
		//document.getElementById( 'listContainer' ).style.top    = topHeight + 20 + 'px';
		//document.getElementById( 'listContainer' ).style.width  = screenWidth + 'px';
		//document.getElementById( 'listContainer' ).style.height = ( screenHeight - topHeight ) + 'px';
		
		//document.getElementById( 'list' ).style.width  = ( screenWidth - scrollBarSpacing - ( listPadding * 2 ) ) + 'px';
		//document.getElementById( 'list' ).style.height = ( screenHeight - ( topHeight + 20 ) ) + 'px';
		
		if( ( webkit == true ) && ( mode != 'map' ) )
		{
			//document.getElementById( 'list' ).style.paddingLeft  = listPadding + 'px';
			//document.getElementById( 'list' ).style.paddingRight = listPadding + 'px';
		}
		else
		{
			var listPadding = 0;
			var scrollBarSpacing = 0;	
			//document.getElementById( 'list' ).style.paddingLeft  = listPadding + 'px';
			//document.getElementById( 'list' ).style.paddingRight = listPadding + 'px';
		}

		//document.getElementById( 'controlCard' ).style.left = -15 + 'px';
		//document.getElementById( 'controlCard' ).style.top  = ( topHeight + 105 ) + 'px';
		//document.getElementById( 'controlMap'  ).style.left = -15 + 'px';
		//document.getElementById( 'controlMap'  ).style.top  = ( topHeight + 255 ) + 'px';
	}
	else
	{
		// TOP
		//document.getElementById( 'top' ).style.width  = screenWidth + 'px';
		//document.getElementById( 'top' ).style.height = topHeight + 'px';
		var toggleWidth = 45;
		//document.getElementById( 'controlTop' ).style.left = ( ( ( ( screenWidth /2 ) - ( toggleWidth / 2 ) ) - getScrollBarWidth() + ( shadow / 2 ) ) ) + 'px';
		//document.getElementById( 'controlTop' ).style.top  = -15 + 'px';

		if( ( webkit == true ) && ( mode != 'map' ) )
		{
			listPadding = 30;
			scrollBarSpacing = 10;
		}
		else
		{
			var listPadding = 0;
			var scrollBarSpacing = 0;	
		}

		// LIST
		//document.getElementById( 'listContainer' ).style.top    = 0 + 'px';
		//document.getElementById( 'listContainer' ).style.width  = screenWidth + 'px';
		//document.getElementById( 'listContainer' ).style.height = screenHeight + 'px';

		//document.getElementById( 'list' ).style.width  = ( screenWidth - scrollBarSpacing - ( listPadding * 2 ) ) + 'px';
		//document.getElementById( 'list' ).style.height = screenHeight + 'px';
		
		if( ( webkit == true ) && ( mode != 'map' ) )
		{
			//document.getElementById( 'list' ).style.paddingLeft  = listPadding + 'px';
			//document.getElementById( 'list' ).style.paddingRight = listPadding + 'px';
		}
		else
		{
			var listPadding = 0;
			var scrollBarSpacing = 0;	
			//document.getElementById( 'list' ).style.paddingLeft  = listPadding + 'px';
			//document.getElementById( 'list' ).style.paddingRight = listPadding + 'px';
		}

		//document.getElementById( 'controlCard' ).style.left = -15 + 'px';
		//document.getElementById( 'controlCard' ).style.top  = 105 + 'px';
		//document.getElementById( 'controlMap'  ).style.left = -15 + 'px';
		//document.getElementById( 'controlMap'  ).style.top  = 255 + 'px';
	}
	
	// SPLASH SCREEN
	var splashHeaderHeight      = 100;
	var splashLowerMiddleHeight = 200;
	var splashFooterHeight      = 100;
	var splashUpperMiddleHeight = screenHeight - ( splashHeaderHeight + splashLowerMiddleHeight + splashFooterHeight );
/*
	document.getElementById( 'splashHeader' ).style.width       = screenWidth + 'px';
	document.getElementById( 'splashHeader' ).style.height      = splashHeaderHeight + 'px';

	document.getElementById( 'splashUpperMiddle' ).style.width  = screenWidth + 'px';
	document.getElementById( 'splashUpperMiddle' ).style.height = splashUpperMiddleHeight + 'px';
	
	document.getElementById( 'splashLowerMiddle' ).style.width  = screenWidth + 'px';
	document.getElementById( 'splashLowerMiddle' ).style.height = splashLowerMiddleHeight + 'px';
	
	document.getElementById( 'splashFooter' ).style.width       = screenWidth + 'px';
	document.getElementById( 'splashFooter' ).style.height      = splashFooterHeight + 'px';
*/
	// ADJUST WINDOW POSITION
	//windowRePos();
	
	if( typeof resizeSplash == 'function' )
	{ 
		resizeSplash();
	}
}
window.onresize = function()
{
	resize();
	return false;
};
resize();

