//--------------------------------------------//
// [SubPage.js] -- class for SubPage Object
//--------------------------------------------//
// MUST include pageEssential.js
// MUST implements:
// 1) getHeader()
// 2) getMenu()
// 3) getBody()
// 4) getFooter()
//--------------------------------------------//
// functions sequence:	(x) -- private 	[x] -- public		<x> -- constructor
//
// [1] spMakeHeader
// [2] spMakeMenu
// [3] spMakeBody
// [4] makeFooter
//
// <5> SubPage

var SUB_MENU_LEFT = 0;
var SUB_MENU_TOP = 80;

//--------------------------------------------//
//						header maker 
//--------------------------------------------//
// input: none.
// output: HTML string of page header
//--------------------------------------------//
function spMakeHeader()
{
	var logo = makeLink("main.html", makeImage("images/subpages/ris_logo.gif", 170, 40, 0));
	var logoCell = makeCell(logo, "valign=top width=170");

	var spacer = makeSpacer(214, 1);
	var spacerCell = makeCell(spacer, "valign=top width=214");	

	var feedbacklink = makeLink("javascript:popup('http://ris-systech2.its.yale.edu/ris/feedback/checkflash.html','340','500')", makeImage("images/comments2.gif", 90, 30, 0));
	var feedbackCell = makeCell(feedbacklink, "valign=bottom width=90 align=right");
	
	var searchBox = shMakeSearch();
	var searchBoxCell = makeCell(searchBox, "align=right valign=top");

	var homelink = makeLink("main.html", makeImage("images/subpages/home_sublink.gif", 42, 30, 0));
	var homeCell = makeCell(homelink, "valign=bottom width=42");

	var rows = new Array(logoCell, spacerCell, searchBoxCell, feedbackCell, homeCell);
	document.writeln( makeTable(rows, "border=0 cellspacing=0; cellpadding=0 width=774") );
}

//--------------------------------------------//
//						menu maker 
//--------------------------------------------//
// input: none.
// output: HTML string of menu header
//--------------------------------------------//
function spMakeMenu()
{
	var main = new MainMenu(this.sid, true);
	var sub = new SubMenu(this.sid, this.id, SUB_MENU_LEFT, SUB_MENU_TOP, true);
	main.printMenu();
	sub.printMenu();
}




//--------------------------------------------//
//						Main Grahpic maker 
//--------------------------------------------//
// input: none.
// output: empty string
//--------------------------------------------//
function spPrintMainGraphic()
{
	var actions = "onMouseOver=\"" + smGetHideAction() + "\"";
	var str = makeLink("#",
						makeImage("images/subpages/sbanner_" + this.sid + "_1.gif", 258, 51) +
						makeImage("images/subpages/sbanner_" + this.sid + "_2.gif", 258, 51) +
						makeImage("images/subpages/sbanner_" + this.sid + "_3.gif", 258, 51),
						actions);
	document.writeln(str);
}




//--------------------------------------------//
//						body maker 
//--------------------------------------------//
// input: none.
// output: empty string
//--------------------------------------------//
function spMakeBody()
{}

//--------------------------------------------//
//						footer maker 
//--------------------------------------------//
// input: none.
// output: empty string
//--------------------------------------------//
function spMakeFooter()
{}


//--------------------------------------------//
//						Constructor
//--------------------------------------------//
// input: [id] -- page id 
// output: SubPage Object
//--------------------------------------------//
function SubPage(sectionIndex, pageIndex)
{
	this.sid = sectionIndex + "";
	this.id = pageIndex + "";
	this.printHeader = spMakeHeader;
	this.printMenu   = spMakeMenu;
	this.printBody   = spMakeBody;
	this.printFooter = spMakeFooter;
}
