// TRANSITION MENU REVISED APRIL 11 2008

// provides the list of page names which the JS compares in order to decide which page the user is on
var url_A = new Array ("welcome");
var url_B = new Array ("aboriginal");
var url_C = new Array ("http://www.smu.ca/athletics/welcome");
var url_D = new Array ("disabled");
var url_E = new Array ("black","black_aid","black_heritage","black_contact");
var url_F = new Array ("career");
var url_G = new Array ("chap","chap_activities","chap_food","chap_links","chap_media","chap_calendar");
var url_H = new Array ("counselling");
var url_I = new Array ("daycare");
var url_J = new Array ("food");
var url_K = new Array ("international");
var url_L = new Array ("residence");
var url_M = new Array ("code","code_code","code_report","code_hear","code_appeal","code_contact");
var url_N = new Array ("employment");
var url_O = new Array ("health");

// determines the names items in the menu, including the submenu
var text_A = new Array ("Home");
var text_B = new Array ("Aboriginal Student Advisor");
var text_C = new Array ("Athletics & Recreation");
var text_D = new Array ("Atlantic Centre");
var text_E = new Array ("Black Student Advisor","Financial Aid","Black Heritage Month","Contact");
var text_F = new Array ("Career Services");
var text_G = new Array ("Chaplaincy","Community Activities","Food Bank","Links","Multimedia","Calendar");
var text_H = new Array ("Counselling");
var text_I = new Array ("Day Care");
var text_J = new Array ("Food Services");
var text_K = new Array ("International Centre");
var text_L = new Array ("Residence");
var text_M = new Array ("Student Discipline Code","Code","Incident Reporting","Hearing Process","Appeal Process","Contact");
var text_N = new Array ("Student Employment Centre");
var text_O = new Array ("Student Health");


// determines the flyout status of the submenus
var hideshow_E = new Array ("none","block");
var hideshow_G = new Array ("none","block");
var hideshow_M = new Array ("none","block");

// gets the full path for use later 
var thisPage=String((document.location.href));

// takes the above variable and strips out the extraneous path components and 
// makes a name for the page, eg 'www.smu.ca/academic/welcome.html' becomes just 'welcome'
var loc= String((thisPage));
loc=loc.split("/");
loc=loc[loc.length-1].split(".");
loc=loc[loc.length-2];

// A URL not displaying an HTML file, eg 'www.smu.ca/academic/' returns a 'null' value to this script.
// This forces a 'null' value to assume the value of 'welcome' to display the root menu.
if (loc == null)   loc = "welcome";

if(typeof(loc)=="undefined"){ 

loc="welcome"; 

}

// CHANGE THIS!!!  \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
// CHANGE THIS!!!   \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
// CHANGE THIS!!!    \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
// CHANGE THIS!!!     \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
// CHANGE THIS!!!      V V V V V V V V V V V V V V V V

// SETS THE BASE URL
var baseURL = ('http://www.smu.ca/administration/studentservices/');

// CHANGE THIS!!!      A A A A A A A A A A A A A A A A
// CHANGE THIS!!!     / / / / / / / / / / / / / / / /
// CHANGE THIS!!!    / / / / / / / / / / / / / / / /
// CHANGE THIS!!!   / / / / / / / / / / / / / / / /
// CHANGE THIS!!!  / / / / / / / / / / / / / / / /

// (uncomment the line below for testing and troubleshooting)
// document.write (loc)

function ShowHideLayer(boxID) {
	/* Obtain reference for the selected boxID layer and its button */
	var box = document.getElementById("submenu"+boxID);
	/* find the submenu with currently open page */
	var curloc = 0;
	if (loc==url_E[1] || loc==url_E[2] || loc==url_E[3]){
		curloc = 10;
	}
	else if (loc==url_G[1] || loc==url_G[2] || loc==url_G[3] || loc==url_G[4] || loc==url_G[5]){
		curloc = 20;
	}
	else if (loc==url_M[1] || loc==url_M[2] || loc==url_M[3] || loc==url_M[4] || loc==url_M[5]){
		curloc = 30;
	}

	/* If the selected box is currently invisible, show it */
	if(box.style.display == "none" || box.style.display=="") {
		box.style.display = "block";
	}
	else {
		box.style.display = "none";
	}

/* and hide other open submenus, leaving the one with the current page open 
   (s must loop through the existing submenus - submenu40,submenu60,...)  */

//	for(var s=10; s<130; s+=10)
//	{
//		if((s != boxID) && (s != curloc))
//		{
//			var otherbox = document.getElementById("submenu"+s);
//			otherbox.style.display = "none";
//		}
//	}
}

var menubegin = ('<ul class="menu"><li class="menu"><a class="menu')
var menumid1 = ('" href="')
var menumid2 = ('.html">')
var aul = ('</a></li></ul>')

var lia = ('<li class="menu2"><a href="')
var suboff = ('.html" class="menu2">')
var subon = ('.html" class="menu2thispage">')
var ali = ('</a> &#8226;</li>')

// this function takes the value of loc 
// and compares it to all the contents of the arrays until it finds a match.

function sectionDetect()
{
for(var i=0; i<20; i++)
{

/* and hide other open submenus, leaving the one with the current page open 
   (s must loop through the existing submenus - submenu40,submenu60,...)  */

//	for(var s=10; s<130; s+=10)
//	{
//		if((s != boxID) && (s != curloc))
//		{
//			var otherbox = document.getElementById("submenu"+s);
//			otherbox.style.display = "none";
//		}
//	}
//}

// this function takes the value of loc 
// and compares it to all the contents of the arrays until it finds a match.

// A
document.write( menubegin ); switch (loc) { case url_A[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_A[0] + menumid2 + text_A[0] + aul );

// B
document.write( menubegin ); switch (loc) { case url_B[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_B[0] + menumid2 + text_B[0] + aul );

// C
document.write( menubegin ); switch (loc) { case url_C[i]: document.write('thispage'); break } document.write( menumid1 + url_C[0] + menumid2 + text_C[0] + aul );

// D
document.write( menubegin ); switch (loc) { case url_D[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_D[0] + menumid2 + text_D[0] + aul );

// E
document.write('<ul class="menu"><li class="menu"><div><a href="' + baseURL + url_E[0] + '.html" class="menu'); switch (loc) { case url_E[i]: document.write('thispage'); break } document.write('">' +text_E[0]+ '</a></div></li>');
if(loc==url_E[0] || loc==url_E[1] || loc==url_E[2] || loc==url_E[3]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_E[1]){ document.write( lia + baseURL + url_E[1] + subon + text_E[1] + ali ); } else { document.write( lia + baseURL + url_E[1] + suboff + text_E[1] + ali ); }
if(loc==url_E[2]){ document.write( lia + baseURL + url_E[2] + subon + text_E[2] + ali ); } else { document.write( lia + baseURL + url_E[2] + suboff + text_E[2] + ali ); }
if(loc==url_E[3]){ document.write( lia + baseURL + url_E[3] + subon + text_E[3] + ali ); } else { document.write( lia + baseURL + url_E[3] + suboff + text_E[3] + ali ); }
switch (loc) { case url_E[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// F
document.write( menubegin ); switch (loc) { case url_F[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_F[0] + menumid2 + text_F[0] + aul );

// G
document.write('<ul class="menu"><li class="menu"><div><a href="' + baseURL + 'chaplaincy/' + url_G[0] + '.html" class="menu'); switch (loc) { case url_G[i]: document.write('thispage'); break } document.write('">' +text_G[0]+ '</a></div></li>');
if(loc==url_G[0] || loc==url_G[1] || loc==url_G[2] || loc==url_G[3] || loc==url_G[4] || loc==url_G[5]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_G[1]){ document.write( lia + baseURL + 'chaplaincy/' + url_G[1] + subon + text_G[1] + ali ); } else { document.write( lia + baseURL + 'chaplaincy/' + url_G[1] + suboff + text_G[1] + ali ); }
if(loc==url_G[2]){ document.write( lia + baseURL + 'chaplaincy/' + url_G[2] + subon + text_G[2] + ali ); } else { document.write( lia + baseURL + 'chaplaincy/' + url_G[2] + suboff + text_G[2] + ali ); }
if(loc==url_G[3]){ document.write( lia + baseURL + 'chaplaincy/' + url_G[3] + subon + text_G[3] + ali ); } else { document.write( lia + baseURL + 'chaplaincy/' + url_G[3] + suboff + text_G[3] + ali ); }
if(loc==url_G[4]){ document.write( lia + baseURL + 'chaplaincy/' + url_G[4] + subon + text_G[4] + ali ); } else { document.write( lia + baseURL + 'chaplaincy/' + url_G[4] + suboff + text_G[4] + ali ); }
if(loc==url_G[5]){ document.write( lia + baseURL + 'chaplaincy/' + url_G[5] + subon + text_G[5] + ali ); } else { document.write( lia + baseURL + 'chaplaincy/' + url_G[5] + suboff + text_G[5] + ali ); }
switch (loc) { case url_G[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// H
document.write( menubegin ); switch (loc) { case url_H[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_H[0] + menumid2 + text_H[0] + aul );

// I
document.write( menubegin ); switch (loc) { case url_I[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_I[0] + menumid2 + text_I[0] + aul );

// J
document.write( menubegin ); switch (loc) { case url_J[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_J[0] + menumid2 + text_J[0] + aul );

// K
document.write( menubegin ); switch (loc) { case url_K[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_K[0] + menumid2 + text_K[0] + aul );

// L
document.write( menubegin ); switch (loc) { case url_L[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_L[0] + menumid2 + text_L[0] + aul );

// M
document.write('<ul class="menu"><li class="menu"><div><a href="' + baseURL + url_M[0] + '.html" class="menu'); switch (loc) { case url_M[i]: document.write('thispage'); break } document.write('">' +text_M[0]+ '</a></div></li>');
if(loc==url_M[0] || loc==url_M[1] || loc==url_M[2] || loc==url_M[3] || loc==url_M[4] || loc==url_M[5]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_M[1]){ document.write( lia + baseURL + url_M[1] + subon + text_M[1] + ali ); } else { document.write( lia + baseURL + url_M[1] + suboff + text_M[1] + ali ); }
if(loc==url_M[2]){ document.write( lia + baseURL + url_M[2] + subon + text_M[2] + ali ); } else { document.write( lia + baseURL + url_M[2] + suboff + text_M[2] + ali ); }
if(loc==url_M[3]){ document.write( lia + baseURL + url_M[3] + subon + text_M[3] + ali ); } else { document.write( lia + baseURL + url_M[3] + suboff + text_M[3] + ali ); }
if(loc==url_M[4]){ document.write( lia + baseURL + url_M[4] + subon + text_M[4] + ali ); } else { document.write( lia + baseURL + url_M[4] + suboff + text_M[4] + ali ); }
if(loc==url_M[5]){ document.write( lia + baseURL + url_M[5] + subon + text_M[5] + ali ); } else { document.write( lia + baseURL + url_M[5] + suboff + text_M[5] + ali ); }
switch (loc) { case url_M[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// N
document.write( menubegin ); switch (loc) { case url_N[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_N[0] + menumid2 + text_N[0] + aul );

// O
document.write( menubegin ); switch (loc) { case url_O[i]: document.write('thispage'); break } document.write( menumid1 + baseURL + url_O[0] + menumid2 + text_O[0] + aul );


break
}
}

sectionDetect ();
 

// Delete the line below if the site doesn't need a related links table.
// If it needs a related links table then complete the table below
// this remains commented out until the development site shows some signs of going live
document.write('<br><br><ul class="menu"><li class="menu"><b>Related Links</b></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/orientation" target="_blank">Student Orientation</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/resoffic/" target="_blank">Residence Department</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.campusdish.com/en-us/CA/SaintMarys" target="_blank">Food Services- ARAMARK</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smusa.ca/" target="_blank">SMUSA</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/academic/writingcentre/" target="_blank">The Writing Centre</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/studentservices/photoblog/" target="_blank">Photo Blog</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/eslsupport/" target="_blank">ESL Support Services</a></li></ul>');
 
// UNCOMMENT the lines below if the site uses a RELATED LINKS table. 


