//Global Variables Used throghout Code
var bannerWidth=750;
var topBannerHeight=169;
var middleBannerHeight=172;
var bottomBannerHeight=159;
var topNavWidth=216;
var topNavDown = 17;
var footerWidth = 400;
var footerHeight = 70;

function getWidth()
//This Funntion will Return the Wdith of the Window
{

var width = document.body.clientWidth;

// if (document.all) width = document.body.clientWidth;
// else if (document.layers) width = window.innerWidth;
return (width);
}
//End getWidth

function getHeight()
//This Function will Return the Height of the Window
{
var height = document.body.clientHeight;
// if (document.all) height = document.body.clientHeight;
// else if (document.layers) height = window.innerHeight;
return (height);
}
//end getHeigth()
function positionLoading()
{
	loadingTop = ((getHeight()-15)/2);
	loadingLeft = ((getWidth()-350)/2);
	moveObject('loading',loadingTop,loadingLeft);
}
function positionBanner()
//This Function will Put the Banner in the middle of the screen
{
	//Get Middle of Page Width
	left = ((getWidth()-bannerWidth)/2);
	//Get Middle of Page Height
	totalBannerHeight = topBannerHeight+middleBannerHeight+bottomBannerHeight;
	bannerTop = (((getHeight()-totalBannerHeight)/2));
	if (left < 0) left = 0;
	if (bannerTop < 0) bannerTop = 0;

	moveObject('topBanner',bannerTop,left);
	moveObject('middleBanner',bannerTop + topBannerHeight,left);
	moveObject('bottomBanner',bannerTop + topBannerHeight + middleBannerHeight,left);
}
function positionLogo()
//This Function will Position the Logo
{
	moveObject('logo',bannerTop,left);
}
function positionTopNav()
//This Function will Position the Top Navigation Bar
{
	moveObject('topNav',bannerTop + topNavDown,left + bannerWidth - topNavWidth);
}
function positionFooter()
//This Function will Position the Footer
{
	moveObject('footerMenu',totalBannerHeight + bannerTop - footerHeight,(bannerWidth-footerWidth)/2+left);
}
function positionButtons()
//This Function will Position the Buttons
{
	moveObject('attorneyProfilesImage',bannerTop+270,left+17);
	moveObject('practiceAreasImage',bannerTop+270,left+305);
	moveObject('aboutKBLawImage',bannerTop+270,left+569);
	moveObject('communityServiceImage',bannerTop+320,left+135);
	moveObject('newsAndEventsImage',bannerTop+320,left+423);
}

function moveObject(object,top2,left)
//This function is used in all others, this will move the objects. 
/* Takes the Follwoing Arguments:
	object = name of object to move;
	top2 = new top of object;
	left = new left location of object;
	This is Cross Browser Compatible;
*/
{
show(object);

	var target = document.getElementById(object);
		target.style.top = top2;
		target.style.left = left;
		
	/* if (document.all)
	//if Internet Explorer
	{
		target = document.all[object];
		target.style.top = top2;
		target.style.left = left;
	}
	else if (document.layers)
	// If Netscape
		{
			document.layers[object].top = top2;
			document.layers[object].left = left;
		} */
}
function positionPopupMenus()
//This Function will Position the Popup Menus
{
	moveObject('attorneyProfilesMenu',bannerTop+28,left+397);
	moveObject('practiceAreasMenu',bannerTop+28,left+397);
	moveObject('aboutKBLawMenu',bannerTop+28,left+397);
	moveObject('communityServiceMenu',bannerTop+28,left+397);
	moveObject('newsAndEventsMenu',bannerTop+28,left+397);
	hide('attorneyProfilesMenu');
	hide('practiceAreasMenu');
	hide('aboutKBLawMenu');
	hide('communityServiceMenu');
	hide('newsAndEventsMenu');

}
function setup()
// Main Setup Function Called by On-Load and On Resize
// This Function will handle all postioning of elemts of Home Page
{
 positionLoading();
 positionBanner();
 positionLogo();
 positionTopNav();
 positionFooter();
 positionButtons();
 positionPopupMenus();
 hide('loading');
 }


function show(object) 
//This Function will Show the Menu Contents When Hovered Over
{

	//alert(object);
	document.getElementById(object).style.visibility = 'visible';
	
/*     if (document.layers && document.layers[object]) {
        document.layers[object].visibility = 'visible';
		}
    else if (document.all) {
        document.all[object].style.visibility = 'visible';
		} else {
		document
		} */
}

function hide(object) 
//This Function will hide the menu contents on Mouse Out
{

	document.getElementById(object).style.visibility = 'hidden';

/*     if (document.layers && document.layers[object])
        document.layers[object].visibility = 'hidden';
    else if (document.all)
        document.all[object].style.visibility = 'hidden'; */
}
