
var mainMenuList =
[
	[ "Architecture", "index.html" ],
	[ "Project Management", "projectManagement.html" ],
	[ "Biz Analysis", "BusinessAnalysis.html" ],
	[ "Enterprise", "Enterprise.html" ],
	[ "Other", "Other.html" ],
	[ "References", "References.html" ]
];

var architectureMenuList =
[
	[ "Introduction", "index.html" ],
	[ "Roles &amp; Responsibilities", "architectureRole.html" ],
	[ "Requirements", "architectureRequirements.html" ],
	[ "Domains", "architectureDomains.html" ],
	[ "Relationship Matrix", "RelMatrix.html" ],
	[ "Technical", "Technical.html" ]
];

var projectManagementMenuList =
[
	["Introduction", "projectManagement.html"],
	["Estimating", "Estimating.html"],
	["Risk Management", "RiskManagement.html"]
];

var businessAnalysisMenuList =
[
	["Introduction", "BusinessAnalysis.html"]
];

var enterpriseMenuList =
[
	[ "Introduction", "Enterprise.html" ]
];

var OtherMenuList =
[
	["Introduction", "Other.html" ],
	["Consulting Economics", "consultingEconomics.html"],
	["Large Projects", "LargeProjects.html" ]
];

var TechnicalMenuList = 
[
	["Introduction", "Technical.html" ],
	["OR Mapping", "ORMapping.html" ]
];


function printBanner()
{
	document.write("<DIV CLASS=\"Banner\">");
	document.write("<h1 class=\"banner\">Software Architecture Notes</h1>")
	document.write("</DIV>");
}


function resizeHandler()
{	
//	if( isNetscape() )
//	{
//		var loc = document.location;
//		document.location = "";
//		document.location = loc;
//	}
}

function printMainMenu( menuName )
{
	printMenu( mainMenuList, menuName );
}

function printArchitectureMenu( menuName )
{
	printSubMenu( architectureMenuList, menuName );
}

function printProjectManagementMenu( menuName )
{
	printSubMenu( projectManagementMenuList, menuName );
}

function printBusinessAnalysistMenu( menuName )
{
	printSubMenu( businessAnalysisMenuList, menuName );
}

function printEnterpriseMenu( menuName )
{
	printSubMenu( enterpriseMenuList, menuName );
}

function printOtherMenu( menuName )
{
	printSubMenu( OtherMenuList, menuName );
}

function printTechnicalMenu( menuName )
{
	printSubMenu( TechnicalMenuList, menuName );
}


function printSubMenu( menuList, currentItemName )
{
    printAMenu( menuList, currentItemName, "subMenu" );
}


function printMenu( menuList, currentItemName )
{
    printAMenu( menuList, currentItemName, "menu" );
}


function printAMenu( menuList, currentItemName, className)
{
	var cookieLabelUrls = convertCookiesToAssociativeArray();
	document.write( "\t<DIV CLASS=\""+ className + "\">" );
	for( var i = 0 ; i < menuList.length ; i++ )
	{
		var label = menuList[i][0];
		var url = menuList[i][1];
		var cookieUrl = cookieLabelUrls[ label ];
		// alert( "Looked up : " + label + " and found " + cookieUrl );
		if( cookieUrl != null )
		{
			url = cookieUrl;
		}
		if( label == currentItemName )
		{
			printLabel( label, i );
		}
		else
		{
			printMenuItem( label, url, i );
		}
	}
	document.write( "\t</DIV>");
}

function printLabel( labelText, i )
{
	if (i > 0)
	{
		document.write("<div class=\"menuDivider\" > &#8226;</div>");
	}
	document.write( "<DIV CLASS=\"LABELITEM\">" );
	document.write( labelText ) ;
	document.write( " </DIV>" );
}

function printMenuItem( labelText, url, i )
{
	if (i > 0)
	{
		document.write("<div class=\"menuDivider\" > &#8226;</div>");
	}
	document.write( "<DIV CLASS=\"MENUITEM\">" );
	document.write( "<A HREF=" + url +">"+ labelText + " </A>" );
	document.write( "</DIV>" );
}


function printBodyPreamble()
{
	document.write( "<TABLE ALIGN=\"CENTER\">\n");
	document.write( "<TR>\n");
	document.write( "<TD>\n" );
	document.write( "<DIV CLASS=\"MAIN\"; STYLE=\"WIDTH : 700px ; BACKGROUND-COLOR : WHITE; COLOR : BLACK;\" >" );
}

function printBodyPostamble()
{
	document.write( "<DIV ALIGN=\"LEFT\"; CLASS=\"FOOTER\">\n" );
	document.write( "Questions? Comments? Email me at <A HREF=\"mailto:architect@softwarearchitecturenotes.com\">architect@softwarearchitecturenotes.com</A>");
	document.write( "</DIV>\n" );
	document.write( "</DIV>\n" );
	document.write( "</TD>\n" );
	document.write( "</TR>\n" );
	document.write( "</TABLE>\n" );
}

function isNetscape()
{
	if( navigator["appName"] == "Netscape" )
	{
		return true;
	}
	return false;
}

function computeWidthPhrase( numBoxes, marginSize )
{
	var result = "undefined width phrase";
	if( navigator["appName"] == "Netscape" )
	{
		result = (window.document.width  - ( 2 * numBoxes ) * marginSize - 20 ) / numBoxes;
		result = result + "px";
	}
	else
	{
		result = 100 / numBoxes - .5;
		result = result + "%";
	}
	return result;
}

function setSubPage( topPageName, subPageUrl )
{
	// alert( "Setting : " + topPageName + ", " + subPageUrl );
	document.cookie = topPageName + "=" + subPageUrl;
}

function convertCookiesToAssociativeArray()
{
	var result = new Object();
	
	var cookiesArray = document.cookie.split( ";" );
	for( var i = 0 ; i < cookiesArray.length ; i++ )
	{
		var labelUrlPair = cookiesArray[i].split( "=" );
		result[ labelUrlPair[0] ] = labelUrlPair[1];
		// alert( "Found : " + labelUrlPair[0] + ", " + labelUrlPair[1] );
	}
	
	
	
	return result;
}







function printPageWidth()
{
	document.write( "page width = " + screen.availWidth + "<BR />" );
	document.write( "window width = " + window.document.width  + "<BR />");
	document.write( "width phrase = " + computeWidthPhrase( 3, 0 ) );
}

function printBrowser()
{
	document.write( navigator["appName"] );
}

function alertWindowProperties()
{
	var thing = screen;
	var message = "Properties:\n";
	if( thing == null )
	{
		message = "No thing";
	}
	for( var propertyName in thing )
	{
		var propertyValue = thing[propertyName];
		if( propertyValue != null )
		{
			message += propertyName + ": " + thing[propertyName] + "\n";
		}
	}
	alert( message );
}

function printEmptyBoxes()
{
	numBoxes = 10;
	margin = 1;
	wide = computeWidth( numBoxes, margin );	
	for( i = 0 ; i < numBoxes ; i++ )
	{
		document.write( "\t\t<DIV STYLE = \"TEXT-ALIGN : CENTER; FLOAT : LEFT; BORDER : " + margin + "px SOLID BLACK; WIDTH : " + wide + "px\" >" );
		document.write( "\t\t\tLabel" );
		document.write( "\t\t</DIV>" );
	}
}

function computeWidth( numBoxes, marginSize )
{
	availWidth = screen.availWidth;
	if( navigator["appName"] == "Netscape" )
	{
		availWidth = availWidth - (2 * numBoxes ) * marginSize;
		availWidth = availWidth - 8;
	}
	else
	{
		availWidth = availWidth - 4;
	}
	wide = (availWidth - 40) / numBoxes;
	return wide;
}


/*
function printSmallLabel( label )
{
	document.write( "\t\t<DIV class=\"NavigationButton\">" );
	document.write( "\t\t\t" + label );
	document.write( "\t\t</DIV>" );
}


function printSmallButton( label, url )
{
	document.write( "\t\t<DIV class=\"NavigationButton\">" );
	document.write( "\t\t\t<A HREF=" + url + ">" + label + "</A>" );
	document.write( "\t\t</DIV>" );
}

function printSmallButtonOrLabel( currentPage, label, url )
{
	//alert( "printSmallButtonOrLabel, currentPage = " + currentPage + " label = " + label + " url = " + url );
	if( currentPage == label )
	{
		printSmallLabel( label );
	}
	else
	{
		printSmallButton( label, url );
	}
}


function printBigButton( label, url )
{
	//alert( "printBigButton label = " + label + " url = " + url );
	document.write( "\t\t<DIV class=\"BigNavigationButton\">" );
	var line = "\t\t\t<A HREF=" + url + ">" + label + "</A>";
	//alert( "line = " + line );
	document.write( line );
	document.write( "\t\t</DIV>" );
}


function printBigLabel( label)
{
	document.write( "\t\t<DIV class=\"BigNavigationButton\">" );
	document.write( "\t\t\t" + label );
	document.write( "\t\t</DIV>" );
}


function printBigButtonOrLabel( currentPage, label, url )
{
	//alert( "printBigButtonOrLabel, currentPage = " + currentPage + " label = " + label + " url = " + url );
	if( currentPage == label )
	{
		printBigLabel( label );
	}
	else
	{
		printBigButton( label, url );
	}
}



function printNavigation( currentPage )
{
	document.write( "\t<DIV STYLE=\"BORDER-LEFT : 1px SOLID BLUE; BACKGROUND-COLOR : YELLOW;\" >" );

	printSmallButtonOrLabel( currentPage, "HOME", "index.html" );
	printSmallButtonOrLabel( currentPage, "Pictures", "PICTURES.HTM" );
	printSmallButtonOrLabel( currentPage, "Team Chicago", "http://www.teamchicagosoccer.org/ " );
	printSmallButtonOrLabel( currentPage, "IWSL", "http://www.iwsl.com/ " );

	printBigButtonOrLabel( currentPage, "Old Announcements","OLDANNOUNCEMENTS.HTM" );
	printBigButtonOrLabel( currentPage, "Illinois Youth Soccer", "http://www.iysa.org/ " );

	document.write( "\t</DIV>" );
}

	<DIV STYLE="BORDER-LEFT : 1px SOLID BLUE; BACKGROUND-COLOR : YELLOW;" >
		<DIV class="NavigationButton">
			HOME
		</DIV>
		<DIV class="NavigationButton">			
			<A HREF=PICTURES.HTM>Pictures</A>
		</DIV>
		<DIV class="NavigationButton">
			<A HREF=http://www.teamchicagosoccer.org/ >Team Chicago</A>
		</DIV>
		<DIV class="NavigationButton">
			<A HREF=http://www.iwsl.com/ >IWSL</A>
		</DIV>
		<DIV class="BigNavigationButton">
			<A HREF=OLDANNOUNCEMENTS.HTM>Old Announcements</A>
		</DIV>
		<DIV class="BigNavigationButton">
			<A HREF=http://www.iysa.org/ >Illinois Youth Soccer</A>
		</DIV>
	</DIV>

function printBall( floatDirection)
{
	document.write( "\t\t<DIV STYLE = \"FLOAT : " + floatDirection + ";\" >" );
	document.write( "\t\t\t<IMG SRC=\"BALL2.GIF\">" );
	document.write( "\t\t</DIV>" );
}



function printBanner()
{
	document.write( "\t<DIV STYLE=\"COLOR : BLUE; FONT-SIZE : 50px; FONT-WEIGHT : 700; TEXT-ALIGN : CENTER; " );
//	document.write( "\t\tHEIGHT : 120px; BORDER : 1px SOLID BLUE; WIDTH = 100%\">" );
	document.write( "\t\tHEIGHT : 120px;  \">" );

	printBall( "LEFT" );
	printBall( "RIGHT" );


	document.write( "\t\t2004<BR />" );
	document.write( "\t\tEARTHQUAKES<BR />" );

	document.write( "\t</DIV>" );
}
*/
