// JavaScript Document

//These globals are used to store div elements
var DEFAULT_DIV;
var VISIBLE_DIV;


///////////////////////////////////////////////////////////////////////
//	InitializePage
///////////////////////////////////////////////////////////////////////
//	CALLED WITH:	pg	- (string) name of the page in format "pageXX"
//	RETURNS:		nothing
//	PURPOSE:		This function writes all of the common data to the
//					page.  The background is set, including the unique
//					background image for each page.  This function also 
//					writes the header, footer and copyright html, thereby
//					keeping all that info in one place for editing.
///////////////////////////////////////////////////////////////////////
function InitializePage(pg, visDiv) {
	var elemMain = document.getElementById("MainContent");
	DEFAULT_DIV = document.getElementById(visDiv);
	VISIBLE_DIV = document.getElementById(visDiv);	
	
	//set background styles
	elemMain.style.backgroundRepeat		= "no-repeat";
	elemMain.style.backgroundColor		= "#ffffff";
	elemMain.style.backgroundPosition	= "center bottom";
	
	//set background image
	switch(pg) {
		case "page01" :
			elemMain.style.backgroundImage = "url(images/Thill-Media-BG-Page-01.jpg)";			
			break;		
		case "page02" :
			elemMain.style.backgroundImage = "url(images/Thill-Media-BG-Page-02.jpg)";
			break;		
		case "page03" :
			elemMain.style.backgroundImage = "url(images/Thill-Media-BG-Page-03.jpg)";
			break;		
		case "page04" :
			elemMain.style.backgroundImage = "url(images/Thill-Media-BG-Page-04.jpg)";			
			break;
		case "page05" :
			elemMain.style.backgroundImage = "url(images/Thill-Media-BG-Page-05.jpg)";
			break;
	}
	
	//write header and footer copy
	WriteHeader();
	WriteFooter();
	WriteCopyright();
}

///////////////////////////////////////////////////////////////////////
//	WriteHeader
///////////////////////////////////////////////////////////////////////
//	CALLED WITH:	nothing
//	RETURNS:		nothing
//	PURPOSE:		Writes html to the header.
///////////////////////////////////////////////////////////////////////
function WriteHeader() {
	writeDiv = document.getElementById("Header");
	writeDiv.innerHTML	= '<a href="index.html"><img src="images/Thill-Media-Name-Header.jpg" /></a>'
						+ '<span>'
						+ '<a href="Thill-Media-Portfolio.html">Portfolio</a>&nbsp;&nbsp;:&nbsp;&nbsp;'
						+ '<a href="Thill-Media-Process.html">Process</a>&nbsp;&nbsp;:&nbsp;&nbsp;'
						+ '<a href="Thill-Media-People.html">People</a>'
						+ '</span>'
						+ '<div class="clear"><img src="images/bg_black_1px.gif" /></div>';
}

///////////////////////////////////////////////////////////////////////
//	WriteFooter
///////////////////////////////////////////////////////////////////////
//	CALLED WITH:	nothing
//	RETURNS:		nothing
//	PURPOSE:		Writes html to the footer.
///////////////////////////////////////////////////////////////////////
function WriteFooter() {
	writeDiv = document.getElementById("Footer");
	writeDiv.innerHTML	= '<p><span style="font-weight:bold;">Thill Media</span> 125 East 31st Street, 3rd Floor, Kansas City, MO 64108 &ndash; 816.842.2162</p>'
						+ '<a href="Thill-Media-Contact.html"><span style="margin-left:15px;">Contact Thill Media</span></a>';
}

///////////////////////////////////////////////////////////////////////
//	WriteCopyright
///////////////////////////////////////////////////////////////////////
//	CALLED WITH:	nothing
//	RETURNS:		nothing
//	PURPOSE:		Writes html to the copyright section.
///////////////////////////////////////////////////////////////////////
function WriteCopyright() {
	writeDiv = document.getElementById("Border_Bottom");
	writeDiv.innerHTML	= '<p>&copy; 2008 <strong>Thill Media LLC</strong> &ndash; All rights reserved.</p>';
}

///////////////////////////////////////////////////////////////////////
//	ShowHide
///////////////////////////////////////////////////////////////////////
//	CALLED WITH:	show	- (string) name of a div
//	RETURNS:		nothing
//	PURPOSE:		Shows or hides the "show" div, depending on its
//					current state.
///////////////////////////////////////////////////////////////////////
function ShowHide(show) {
	var showDiv = document.getElementById(show);
	
	if(showDiv != VISIBLE_DIV){	
		VISIBLE_DIV.style.display = "none";
		showDiv.style.display = "block";
		VISIBLE_DIV = showDiv;
	}else{
		showDiv.style.display = "none";
		DEFAULT_DIV.style.display = "block";
		VISIBLE_DIV = DEFAULT_DIV;
	}
}


			