// 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 ("whatsnew");
var url_C = new Array ("wnews");
var url_D = new Array ("saga");
var url_E = new Array ("permits","visahelp");
var url_F = new Array ("orientation","orientation-01","orientation-04","orientation_08","orientation-02","orientation-03","orientation-05","orientation07","orientation-09");
var url_G = new Array ("handbook");
var url_H = new Array ("int-night");
var url_I = new Array ("int-week");
var url_J = new Array ("int-societies","societyevents");
var url_K = new Array ("links");
var url_L = new Array ("gallery");
var url_M = new Array ("contact");

// determines the names items in the menu, including the submenu
var text_A = new Array ("International Centre Home");
var text_B = new Array ("What's New");
var text_C = new Array ("Weekly News");
var text_D = new Array ("SAGA Volunteers");
var text_E = new Array ("Visas Study Work Permits","Visas Permits Help");
var text_F = new Array ("International Student Orientation","Welcome Letter","Departure Check List","Orientation Sign-Up","Orientation Program","Airport Pick-Up Program","Cyber Pen-Pal Program","Off-Campus Housing","Temporary Accommodations");
var text_G = new Array ("International Handbook");
var text_H = new Array ("International Night");
var text_I = new Array ("International Week");
var text_J = new Array ("International Societies","Society Events");
var text_K = new Array ("Other Important Links");
var text_L = new Array ("Photo Gallery");
var text_M = new Array ("Contact Us");

// determines the flyout status of the submenus
var hideshow_E = new Array ("none","block");
var hideshow_F = new Array ("none","block");
var hideshow_J = 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://husky55.smu.ca/administration/intercen/');

// 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]){
		curloc = 10;
	}
	else if (loc==url_F[1] || loc==url_F[2] || loc==url_F[3] || loc==url_F[4] || loc==url_F[5] || loc==url_F[6] || loc==url_F[7] || loc==url_F[8]){
		curloc = 20;
	}
	else if (loc==url_J[1]){
		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 + 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 + 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 + url_D[0] + menumid2 + text_D[0] + aul );

// E
document.write('<ul class="menu"><li class="menu"><div><a href="' + 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]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_E[1]){ document.write( lia + url_E[1] + subon + text_E[1] + ali ); } else { document.write( lia + url_E[1] + suboff + text_E[1] + ali ); }
switch (loc) { case url_E[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// F
document.write('<ul class="menu"><li class="menu"><div><a href="' + url_F[0] + '.html" class="menu'); switch (loc) { case url_F[i]: document.write('thispage'); break } document.write('">' +text_F[0]+ '</a></div></li>');
if(loc==url_F[0] || loc==url_F[1] || loc==url_F[2] || loc==url_F[3] || loc==url_F[4] || loc==url_F[5] || loc==url_F[6] || loc==url_F[7] || loc==url_F[8]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_F[1]){ document.write( lia + url_F[1] + subon + text_F[1] + ali ); } else { document.write( lia + url_F[1] + suboff + text_F[1] + ali ); }
if(loc==url_F[2]){ document.write( lia + url_F[2] + subon + text_F[2] + ali ); } else { document.write( lia + url_F[2] + suboff + text_F[2] + ali ); }
if(loc==url_F[3]){ document.write( lia + url_F[3] + subon + text_F[3] + ali ); } else { document.write( lia + url_F[3] + suboff + text_F[3] + ali ); }
if(loc==url_F[4]){ document.write( lia + url_F[4] + subon + text_F[4] + ali ); } else { document.write( lia + url_F[4] + suboff + text_F[4] + ali ); }
if(loc==url_F[5]){ document.write( lia + url_F[5] + subon + text_F[5] + ali ); } else { document.write( lia + url_F[5] + suboff + text_F[5] + ali ); }
if(loc==url_F[6]){ document.write( lia + url_F[6] + subon + text_F[6] + ali ); } else { document.write( lia + url_F[6] + suboff + text_F[6] + ali ); }
if(loc==url_F[7]){ document.write( lia + url_F[7] + subon + text_F[7] + ali ); } else { document.write( lia + url_F[7] + suboff + text_F[7] + ali ); }
if(loc==url_F[8]){ document.write( lia + url_F[8] + subon + text_F[8] + ali ); } else { document.write( lia + url_F[8] + suboff + text_F[8] + ali ); }
switch (loc) { case url_F[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// G
document.write( menubegin ); switch (loc) { case url_G[i]: document.write('thispage'); break } document.write( menumid1 + url_G[0] + menumid2 + text_G[0] + aul );

// H
document.write( menubegin ); switch (loc) { case url_H[i]: document.write('thispage'); break } document.write( menumid1 + 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 + url_I[0] + menumid2 + text_I[0] + aul );

// J
document.write('<ul class="menu"><li class="menu"><div><a href="' + url_J[0] + '.html" class="menu'); switch (loc) { case url_J[i]: document.write('thispage'); break } document.write('">' +text_J[0]+ '</a></div></li>');
if(loc==url_J[0] || loc==url_J[1] || loc==url_J[2] || loc==url_J[3] || loc==url_J[4] || loc==url_J[5]){ document.write('<div><ul class="menu2">'); } else { document.write('<div style="display: none;"><ul class="menu2">'); }
if(loc==url_J[1]){ document.write( lia + url_J[1] + subon + text_J[1] + ali ); } else { document.write( lia + url_J[1] + suboff + text_J[1] + ali ); }
switch (loc) { case url_J[i]: document.write('</ul>'); break }
document.write('</div></ul>');

// K
document.write( menubegin ); switch (loc) { case url_K[i]: document.write('thispage'); break } document.write( menumid1 + 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 + url_L[0] + menumid2 + text_L[0] + aul );

// M
document.write( menubegin ); switch (loc) { case url_M[i]: document.write('thispage'); break } document.write( menumid1 + url_M[0] + menumid2 + text_M[0] + aul );

break
}
}

sectionDetect ();
 

// --------------------------------
// Related Links
document.write('<br><br><br><br>');
document.write('<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/prospectivestudents/welcome.html" target="_blank" class="menu">International Admissions</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/resoffic/" target="_blank" class="menu">Residence Life Office</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/och" target="_blank" class="menu">Off-Campus Housing</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/businessoffice/" target="_blank" class="menu">Financial Services</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/currentstudents/" target="_blank" class="menu">Current Students</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/international/" target="_blank" class="menu">International Activities Office</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/academic/writingcentre/" target="_blank" class="menu">The Writing Centre</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/academic/tesl/" target="_blank" class="menu">TESL Centre</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smusa.ca/" target="_blank" class="menu">Student Association</a></li></ul>');
document.write('<ul class="menu"><li class="menu"><a href="http://www.smu.ca/administration/eslsupport/" target="_blank" class="menu">ESL Support Services</a></li></ul>');
document.write('<br><br><div align="center"><img src="images/intcen-logo.jpg" alt="" width="110" height="90" border="0"></div>');


