// *****************************************************************************
// **                                SETTINGS                                 **
// *****************************************************************************

// give image names and dimensions

//var imagePath = 'http://www.alumni.cuhk.edu.hk/chi/menu/images/';
var sitePath = 'http://www.alumni.cuhk.edu.hk/eng/';
var imagePath = sitePath + 'menu/images/';
var submenubg = imagePath + 'submenubg.gif';
var arrow = imagePath + 'pointer.gif';		// image name
var arrowWidth='13';			// image width
var arrowHeight='12';			// image height

// base target - the frame that the links are targetting
var base = '_top';


// ********************************************************************************
// **                         BUILD preload image list                           **
// ********************************************************************************
// Do not modify the following code!!
var img = new Array();
for (var i=0; i<thisMainMenu.length; i++)	{
	img[i] = imagePath + "menu_" + thisMainMenu[i][0] + "_on.gif";
}

imagesPreload(img);

// *****************************************************************************
// **                             Building Menu                               **
// *****************************************************************************

// do not alter this bit

document.write('<BASE target="' + base + '">');

// Create an open menu or close menu - do not alter
function createMenu(page)	{
	var cat;
	var link;
	for (var y=0; y<thisMainMenu.length; y++)	{
		cat = thisMainMenu[y][0];
		link = sitePath + thisMainMenu[y][1];
		if(page==cat) {
			thisSubMenu = eval(cat+"SubMenu");
			openMenu (cat,link,thisSubMenu);
		}
		else 		  closeMenu(cat,link,y);
	}
	document.write('<p class="menuitem" id="Sfont"><span id="hitefont"><b><u>Alumni Affairs Office</u></b></br>Tel: (852)2609-7861</br>Fax: (852)2603-6226</br>');
 emailE=('alumni@' + 'cuhk.edu.hk')	
  document.write(
    '<b><A id="purplelink" href="mailto:' + emailE + '">' 
    + emailE + '</a><!--<br><iframe src="http://www.alumni.cuhk.edu.hk/counter/counter.php" height=16 width=100 border=0 frameborder="0"></iframe>--></span></p>'
  )

}


// opens menu section - do not alter
function openMenu(cat,link, thisSubMenu) {
// Creating Section Title
	document.write('<a href = "' + link + '" target="_top">');
	document.write('<img src="' + imagePath + 'menu_' + cat +'_on.gif" border=0 vspace=0></a></br>');
// Creating Sub-section Title
	if (thisSubMenu.length != 0)	{
		document.write('<table background="' + submenubg + '" bgcolor="#FFF0CC" width="150" cellspacing="0" cellpadding="1" border="0"><tr><td colspan="2" height="4"><img src="../images/space.gif" width="1" height="4" border="0"></td></tr>');
		for (var x=0;x<thisSubMenu.length;x++){
			
			linkb = sitePath + thisSubMenu[x][1];
			
			document.write('<tr><td width="15" valign="top">');
			document.write('<a class="submenu" href="' + linkb + '" target="_top">');
			document.write('<img src="' + arrow + '" width="' + arrowWidth + '" height="' + arrowHeight + '" border="0" align="top">');
			document.write('</a></td><td width="135" valign="top">');
			document.write('<a class="submenu" href="' + linkb + '" target="_top">');
			document.write(thisSubMenu[x][0] + '</a><br>');
			document.write('</td></tr><tr><td colspan="2" height="4"><img src="../images/space.gif" width="1" height="4" border="0"></td></tr>');
		}
		document.write('</table>');
	}
}

// closes menu section - do not alter
function closeMenu(cat,link,y) {
	document.write('<a href = "' + link + '" target="_top" onMouseOut="imageRestore()" onMouseOver="swapImage(\'' + cat + '\',\'' + img[y] + '\')">');
	document.write('<img src="' + imagePath + 'menu_' + cat + '.gif" border="0" name="' + cat + '"></a></br>');
}

