var links_main = new Array(
                        new Link("Parish", "http://www.srol.org"),
			new Link("School Home", "/home.htm"),
			
			new Link("Mission Statement", "/missionstatement.htm"),
			new Link("History", "/history.htm"),
			new Link("Admissions", "/admissions.htm"),
			new Link("Financial Information", "/financial.htm"),
			new Link("Academics", "/academics.htm"), 
			new Link("Faculty", "/faculty.htm"),
			new Link ("Calendar", "/calendar.htm"), 
			new Link("For Students", "/cgi-bin/studentsInfo.pl"),
			new Link("For Parents", "/cgi-bin/parentsInfo.pl"),
			new Link("CARES Program","/cares.htm"),
			new Link("School Closings","/cgi-bin/schoolClosings.pl"),
			new Link("Home & School Assoc", "/hsa.htm"), 
			new Link("LIMAS", "/limas.htm"), 
			new Link("CYO", "http://www.srol.org/Default2.aspx"), 
			new Link("Directions", "/directions.htm"),
                        new Link("Admin", "/adminOptions.htm"),
			new Link("Contact", "/contact.htm"));
		
var links_academics = new Array(
			 
			new Link("Curriculum", "/curriculum.htm"),
			new Link("Religious Training", "/religious.htm"), 
			new Link("Accreditation", "/accreditation.htm"));

var links_faculty = new Array( 
			new Link("Update Class Info", "/class_login.htm")); 
		 
var links_students = new Array( 
			new Link("Student Websites", "/student_websites.htm"), 
			new Link("Photos", "/cgi-bin/images.pl"),
                   new Link("Class Information", "/class_info.htm"),
		   new Link("Stationery Lists","/stationery.doc"),
		   new Link ("Summer Reading List","/summerreading.doc"));

var links_parents = new Array(
			new Link("Principal's Letter", "/princ_letter.htm"),
			new Link("PIC Newsletter", "/pic.htm"),
			new Link("Dress Code", "/dresscode.htm"), 
			new Link("Communication", "/communication.htm"),
			new Link("Attendance", "/attendance.htm"),
			new Link("Lunch Program", "/lunch_program.htm"),
			new Link("Lunch Rules", "/LunchRules.doc"),
			new Link("Personal Develop.", "/personal_develop.htm"),
                        new Link("Bullying Prevention", "/bully_prevent.htm"),
			new Link("Health and Safety", "/health_safety.htm"),
			new Link("Forms", "/forms.htm"),
			new Link("School Handbook", "/handbook.doc"),
 			new Link("Parent Websites", "/parent_websites.htm"));
                        

var links_cyo = new Array(
			new Link("Schedules/Results", "/cyo_schedules_results.htm"), 
                        new Link("Directions", "/cyo_directions.htm"), 
			new Link("Hospitality", "/cyo_hospitality.htm"), 
			new Link("Community Service", "/cyo_community_service.htm"),
                        new Link("Events", "/cyo_events.htm"),
                        new Link("News", "/cyo_events.htm"),
			new Link("Photos", "/cyo_photos.htm"),
                        new Link("CYO Admin", "/cyo_login.htm"));


			

var child_links = new Array(
			new ChildLink("/academics.htm", links_academics),
                  	new ChildLink("/faculty.htm", links_faculty), 
			new ChildLink("/cgi-bin/studentsInfo.pl", links_students),
			new ChildLink("/cgi-bin/parentsInfo.pl", links_parents));
			

function ChildLink(address, children)
{
	this.address = address;
	this.children = children;
}

function Link(display_name, url_name)
{
	this.display_name = display_name;
	this.url_name = url_name;
}

/* generate top and left border */
function border_gen(subtitle, parent)
{
   var top_border = title_gen(subtitle);
   var left_menu = dyn_menu_gen(parent);

   document.write(top_border, left_menu);
}
/* Menu generating function */ 

function dyn_menu_gen(parent) 
{ 
	/* Resolve the location */ 
	var loc=String(this.location); 
	loc=loc.split("/"); 
	loc=loc[loc.length-1].split("."); 
	if (loc[loc.length-1] == "pl")
        {
           loc="/cgi-bin/" + loc[loc.length-2] + ".pl"; 
        }
        else
        {
	   loc="/"+loc[loc.length-2]+".htm";
        }

	var first_line = String('<div class="leftmenu"> <br> <div class="leftinnermenu">');
	var last_line = String('<br> <br> <br> <p class="borderP">425 Pennsylvania Ave <br> ' +
		'North Wales, PA 19454 <br> ' +
		'(215) 699-8831' +
		'<br> <br> ' +
		'<center> <a href=http://freelogs.com/stats/s/srol/><img border=0  src=http://srol.freelogs.com/counter/index.php?u=srol&s=smplst ALIGN=middle BORDER=0 HSPACE=4 VSPACE=2></a> <br><a href=http://freelogs.com/links/s/srol/ title=Free Hit Counter><font size=1>Free Hit Counter</font></a> </center>' +
		' </p> </div>'); 
	var feedback_line = String('<A HREF=mailto:pbrumbaugh@srol.org?subject=Feedback>Email Feedback</A>');

	var middle = '';
	for(var i=0; i<links_main.length; i++) 
	{ 
		middle += String('<A href=' + links_main[i].url_name + '>' + links_main[i].display_name + ' </A> <br> ');	
 		/* look for child links */
		for (var x=0; x<child_links.length; x++)
		{ 
			if ((loc==child_links[x].address || parent==child_links[x].address) && 
				links_main[i].url_name ==child_links[x].address)
			{
				/* found child - need to add all child links */
				for(var y=0; y<child_links[x].children.length; y++)
				{		
					middle += String('&nbsp&nbsp&nbsp<A href=' + child_links[x].children[y].url_name + '>' + child_links[x].children[y].display_name + '</A> <br> ');
				}
			}
		}
		
	} 
  	return (first_line + middle +feedback_line + last_line);	
} 


/* Generate title area */
function title_gen(subtitle)
{
	var title = String('<div class=title> <IMG alt="St. Rose of Lima Header" height=123 src="/images/srolHeader.jpg"> </div>');
 	return title;
 
       /* var title = String('<div class="title"> <h1 class="mainH1" > St. Rose of Lima School<br> ' + subtitle + '</h1> </div>'); 
	var title_left = String('<div class="titleleftimage"> <IMG alt="St. Rose of Lima School Logo" border=0 height="125" src="/images/SRLshieldSmall.gif" width="115">');	
	var title_right = String('<div class="titlerightimage"> <IMG alt="St. Rose of Lima" border=0 height="125" src="/images/rose.gif" width="115"></div>');

	return (title); */
	
}

			
	
