//include('lib/jquery/jquery-1.3.2.js');

var minHeight = 700;
var leftWidth = 200;
var bannerHeight = 100;
var bannerBottomHeight = 20;
var bannerTotal = bannerHeight + bannerBottomHeight
var footerHeight = 60;
var bottomSpaceHeight = 10;
var mainTop = 120;
var divMargins = 10;
var marginTotal = divMargins * 2;
var debugOn = false;


setCssStyles();
changeLoadStatus();

function init()
{
	window.onresize=onResize;
	onResize();	
}

function onResize()
{
	clientHeight = jQuery(window).height();
	clientWidth = jQuery(window).width();

	repositionElements();
}

function repositionElements()
{
	jQuery("#bannerbg").width(clientWidth - marginTotal);
	jQuery("#bannerbottom").width(clientWidth  - marginTotal);
	jQuery("#main").width(clientWidth-leftWidth  - marginTotal);
	
	var localHeight = jQuery("#main").height();
	var localExtra = bannerHeight + bannerBottomHeight + footerHeight;
	var localDocumentHeight = jQuery(document).height();
	
	jQuery("#left").height(jQuery("#main").height());

	jQuery("#footer").css("top",localHeight + bannerTotal + divMargins);
	
	jQuery("#footer").width(clientWidth - marginTotal);
	jQuery("#footer").height(footerHeight);
	
	jQuery("#bottomspace").width(clientWidth - marginTotal);
	jQuery("#bottomspace").css("top",localHeight + bannerTotal + divMargins + footerHeight);
	jQuery("#bottomspace").height(bottomSpaceHeight);
	
	
	if (debugOn)
	{
		jQuery("#mainheight").text("Main Height: " + jQuery("#main").height());	
		jQuery("#localheight").text("Local Height: " + jQuery("#main").height());
		jQuery("#footerTop").text("Footer Top: " + jQuery("#footer").css('top'));
		jQuery("#documentheight").text("Document Height: " + jQuery(document).height());
	}
	
}

function setCssStyles()
{
	/* Colors */
	//jQuery("#bannerbg").css('background-color','#3d4c4c');
	jQuery("#left").css('background-color','#f2ffbf');
	jQuery("#letter").css('color','#99992e');
	//jQuery("#letter").css('color','#7f0033');
	jQuery("#banner").css('color','#e5e566');
	jQuery("#main").css('background-color','#99992e');
	jQuery("#footer").css('background-color','#3d4c4c');
	jQuery(".majorp").css('background-color','#7f0033');

	/* Rounded Corners */
	$('.majorp').corner();
	$('#main').corner();
	$('#footer').corner();
	$('#left').corner();
}

function changeLoadStatus()
{
	jQuery('.loading').hide();	
	jQuery('div:not(.loading)').show();
	
}

function include(filename)
{
	var head = document.getElementsByTagName('head')[0];
	
	script = document.createElement('script');
	script.src = filename;
	script.type = 'text/javascript';
	
	head.appendChild(script);

}
