var tempHtml;
var tempStr1;
var tempStr2;
if (section == null)	var section = 0;
if (level1 == null)	var level1 = "";
if (level2 == null)	var level2 = "";
if (level3 == null)	var level3 = "";
if (level4 == null)	var level4 = "";
if (level5 == null)	var level5 = "";
if (hideTop == null) var hideTop = false;
var id1 = null;
var id2 = null;
var id3 = null;
var id4 = null;
var id5 = null;
var d = document;
var str;

// JavaScript Document

var levelArray = new Array();
var idArray = new Array();

function checkStr(astr, bstr)
{
	var va = [".", "/", "_", "-"];
	for (var item in va)
		{
			if (astr.indexOf(("/" + bstr + va[item])) > -1)
				{
					return true;
				}
			if (astr.indexOf(("_" + bstr + va[item])) > -1)
				{
					return true;
				}
		}

	return false;
}

function setLevel(obj)
{
	for (var m=0; m<obj.length; m++)
		{
			if ((window['level'+(1+levelArray.length)]==undefined) || (window['level'+(1+levelArray.length)]!=''))
				{
					if (obj[m].id != window['level'+(1+levelArray.length)])
						{					
							continue;
						}
					else
						{
							//alert(obj[m].id);
							while (window['level'+(1+levelArray.length)]!=undefined)
							{
								levelArray.push(window['level'+(1+levelArray.length)]);
							}
							break;
						}
				}
			if (checkStr(link, obj[m].id))
				{
					levelArray.push(obj[m].id);
					if (typeof(obj[m].subSection)!='undefined')
						{
							setLevel(obj[m].subSection);
						}
					break;
				}
		}
}

function setLevelId(obj, index)
{
	for (var m=0; m<obj.length; m++)
		{
			if (levelArray[index] == obj[m].id)
				{
					idArray.push(m);
					if (typeof(obj[m].subSection)!='undefined')
						{
							setLevelId(obj[m].subSection, (1+index));
						}
					break;
				}
		}
}


function getLevel() {
	var obj = sectionArray[section];
	link = location.href.toString();
	setLevel(obj);
	
	for (var i=0; i<levelArray.length; i++)
		{
			window['level'+(1+i)] = levelArray[i];
		}
		
	setLevelId(obj, 0);
	for (var i=0; i<idArray.length; i++)
		{
			window['id'+(1+i)] = idArray[i];
		}
}

getLevel();
//alert(id1 + " : " + id2 + " : " + id3);
//window.status = level1 + " : " + level2 + " : " + level3 + " : " + level4;
//window.status = id1 + " : " + id2;

function genLeft()
{
	//bace on the folder name
	var obj = sectionArray[section];
	if (level1)
	{
		/*if (d.getElementById(level1))
		{
			var level1Btn = d.getElementById(level1);
			level1Btn.src = '/cc/eng/images/mainnav/' + level1 + '_on.gif';
		}
		//if (obj1[id2].subSection)
		if (d.getElementById(level1))
		{
			var level1Menu = d.getElementById(level1);
			
			//level1Menu.style.display = 'block';
		}*/
		
		if (level2)
		{
			
			if (d.getElementById(level1 + '_' + level2))
			//if (d.getElementById(level2))
			//alert(level1 + '_' + level2);
			{
				var level2Btn = d.getElementById(level1 + '_' + level2);
				//var level2Btn = d.getElementById(level2);
				level2Btn.src = '/cc/eng/images/'+ level1 +'/' + level2 + '_on.gif';
				//alert(level2Btn.style.color);
				//level2Btn.style.color = '#9D0128';
				
				/*if (level3) {
					level2Btn.style.background = 'url('+path+'images/red_arrow.gif) no-repeat 0px 3px';
				}
				else {
						level2Btn.style.background = 'url('+path+'images/red_arrow2.gif) no-repeat 0px 3px';
				}*/
			}
			
			
		}
		
		if (level3)
			{
				
				if(level2 == "progressionStudy") {
					d.getElementById('subNav').style.display = "block";
						//alert(level1 +'_' +level2 +'_'+ level3);	
					if (d.getElementById(level1 +'_' +level2 +'_'+ level3))
					{		
						var level3Btn = d.getElementById(level1 + '_' + level2 + '_' + level3);
						var obj1 = obj[id1].subSection;
						var obj2 = obj1[id2].subSection;					
						
						level3Btn.src = '/cc/eng/images/'+ level1 +'/' + level3 + '_on.gif';
						if (level1 == "hdprogram") {
							level3Btn.style.color = '#3399CC';
						}
						if (level1 == "adprogram") {
						level3Btn.style.color = '#009900';
						}
					}
				}
				
				
			}
		
		/*if (level4)
			{
				if (d.getElementById(level1 + '_' + level2 + '_' + level3 + '_' + level4))
				{					
					var level4Btn = d.getElementById(level1 + '_' + level2 + '_' + level3 + '_' + level4);
					//level4Btn.src = '/cc/eng/images/mainnav/' + level1 + '_' + level2 + '_' + level3 + '_' + level4 + '_on.gif';
					level4Btn.style.color = '#8C001B';
					level4Btn.style.background = '#FFFFFF url('+path+'images/level4tabhline_on.gif) no-repeat 5px 2px';
					level4Btn.style.borderTop = '1px solid #8C001B';
					level4Btn.style.borderLeft = '1px solid #8C001B';
					level4Btn.style.borderRight = '1px solid #8C001B';
					level4Btn.style.height = '23px';
				}
			}*/
		
		/*if (level5) {
			if (d.getElementById(level1 + '_' + level2 + '_' + level3 + '_' + level4 + '_' + level5)) {	
				var level5Btn = d.getElementById(level1 + '_' + level2 + '_' + level3 + '_' + level4 + '_' + level5);
				level5Btn.style.color = '#8C001B';
				level5Btn.style.background = '#FFFFFF url('+path+'images/level4tabhline_on.gif) no-repeat 5px 2px';
				level5Btn.style.borderTop = '1px solid #8C001B';
				level5Btn.style.borderLeft = '1px solid #8C001B';
				level5Btn.style.borderRight = '1px solid #8C001B';
				level5Btn.style.height = '23px';
			}
		}*/
		
	}
}

function genBreadcrumbs()
{
	if (level1 == "")	return;
	var obj = sectionArray[section];
	var tempHtml = '';
	
	function genA(name, link, target)
	{
		link=(link=="#")?"javascript:void(0)":link;
			
		if (id2==null) {
			
			if (link.indexOf(("index.php")) > -1) {
				
				return '<span class="breadcrumbcolor">' + name + '</span>';
			} 
			
		}
		return '<a href="'+genLink(link)+'" target="'+target+'">' + name + '</a><span class="breadcrumbspace">></span>';
	};
	
	tempHtml += genA('Home', 'index.jsp', '_top');
	
	tempHtml += genA(obj[id1].name, obj[id1].link, obj[id1].target);
	
	if (id2 != null)
	{		
		var obj1 = obj[id1].subSection;
		var obj2 = obj1[id2].subSection;	
		//alert(obj1[id2].name);
		if (id3 != null && obj1[id2].subSection && (obj2[id3].id.indexOf(("overview")) == -1 && obj2[id3].id.indexOf(("duration")) == -1 && obj2[id3].id.indexOf(("structure")) == -1 && obj2[id3].id.indexOf(("requirements")) == -1 && obj2[id3].id.indexOf(("fees")) == -1 && obj2[id3].id.indexOf(("admission")) == -1 && obj2[id3].id.indexOf(("research")) == -1))
		{		
				
						if (id4 == null) {
							
							if (obj1[id2].id == "wie" || obj1[id2].id == "esd" || obj1[id2].id == "mentorship" || obj1[id2].id == "edp" || obj1[id2].id == "membership" || obj1[id2].id == "scholarship") {
								
							}else {
								
							if (obj1[id2].id =="world") {
									
							}else {
								
								tempHtml += genA(obj1[id2].name, obj1[id2].link, obj1[id2].target);	
								//tempHtml += '<span class="breadcrumbcolor">' + obj2[id3].name + '</span>';
								}
							}
						}
						else {
							
							var obj3 = obj2[id3].subSection;
							var obj4 = obj3[id4].subSection;
							if (id5 != null) {
									var obj3 = obj2[id3].subSection;
								tempHtml += genA(obj2[id3].name, obj2[id3].link, obj2[id3].target);	
								
							}else {
								//alert(obj2[id3].name);
								var obj3 = obj2[id3].subSection;
								tempHtml += genA(obj1[id2].name, obj1[id2].link, obj1[id2].target);	
								if (obj2[id3].id == "gallery") {
								tempHtml += genA(obj2[id3].name, obj2[id3].link, obj2[id3].target);	
								}
								//tempHtml += '<span class="breadcrumbcolor">' + obj2[id3].name + '</span>';
								
							}
							
						}
			
		} else {
			//tempHtml += obj1[id2].name;
		}
	}
	
	d.write(tempHtml);
}


function genTitle()
{
	if (level1 == "")	return;
	var obj = sectionArray[section];
	var tempHtml = '';
	//tempHtml += '<img src="/cc/eng/images/'+obj[id1].id+'/'+obj1[id1].id+'_title.gif" alt="'+obj1[id2].name+'" />';
	/*if (id2 != null)
	{
		alert("dfgsfg");
		var obj1 = obj[id1].subSection;
		var obj2 = obj1[id2].subSection;
		
		//tempHtml += '<img src="/cc/eng/images/'+obj[id1].id+'/'+obj1[id2].id+'_title.gif" alt="'+obj1[id2].name+'" />';
		//alert(obj1[id3].name);
		if (id3 != null) 
		{			
			tempHtml += '<img src="/cc/eng/images/'+obj[id1].id+'/'+obj1[id2].id+'_'+obj2[id3].id+'_title.gif" alt="'+obj2[id3].name+'" />';	
		}
		else
		{
			tempHtml += '<img src="/cc/eng/images/'+obj[id1].id+'/'+obj1[id1].id+'_title.gif" alt="'+obj1[id2].name+'" />';
		}		
		//tempHtml += obj1[id2].name;
	}*/
	//tempHtml += '<img src="/cc/eng/images/'+obj[id1].id+'/'+obj1[id1].id+'_title.gif" alt="'+obj1[id1].name+'" />';
	if (id2 !=null) {
		var obj1 = obj[id1].subSection;
		var obj2 = obj1[id2].subSection;
		if (id3 != null) {
			var obj1 = obj[id1].subSection;
			var obj2 = obj1[id2].subSection;
			var obj3 = obj2[id3].subSection;
			//tempHtml += '<img src="/cc/chi/images/'+obj[id1].id+'/'+level3+'_title.gif" alt="'+obj2[id3].name+'" />';
			tempHtml += '<img src="../images/'+obj[id1].id+'/'+level3+'_title.gif" alt="'+obj2[id3].name+'" />';
		}else {
		//tempHtml += '<img src="/cc/chi/images/'+obj[id1].id+'/'+level2+'_title.gif" alt="'+obj1[id2].name+'" />';
		tempHtml += '<img src="../images/'+obj[id1].id+'/'+level2+'_title.gif" alt="'+obj1[id2].name+'" />';
		}				
	}
	
	
	
	d.write(tempHtml);
}

function genLink(i)
{
	var path = "/cc/eng/";
	
	if (!(i.indexOf('http') > -1) && !(i.indexOf('javascript') > -1) && i.indexOf('/') != 0)
	{
		var link = path + i;
	}
	else
	{
		var link = i;
	}
	
	return link;
}

function init()
{
	setBtnOver();
}


function setBtnOver()
{
	var img = d.getElementsByTagName('img');
	
	for (var i=0; i<img.length; i++)
	{
		if (img[i].className != 'btnOver')	continue;
		if (img[i].src.indexOf('_on') >= 0)	img[i].clicked = true;
		
		img[i].onmouseover = function()
		{
			if (this.clicked)	return;
			var ext = this.src.substring(this.src.length-4, this.src.length);
			
			this.src = this.src.replace(ext, '_on' + ext);
		}
		
		img[i].onmouseout = function()
		{
			if (this.clicked)	return;
			var ext = this.src.substring(this.src.length-4, this.src.length);
			
			this.src = this.src.replace('_on' + ext, ext);
		}
	}
}

function displayElective(id) {
	var btn = d.getElementById(id);
	var icon = d.getElementById(id+'Img');
	//alert(icon);
	if (btn.style.display == "block"){
		btn.style.display = "none";
		icon.style.background = 'url(../images/cross_green.gif) #FAFAFA no-repeat 5px 1px';
	}else{
		btn.style.display = "block";
		icon.style.background = 'url(../images/minus_green.gif) #FAFAFA no-repeat 5px 1px';
	}
}

function submitSearch(lang){
	document.forms[0].submit();
}

var nextImage = 0;
var total;
var timeOut;

function initFading()
{
	startFading();
	
	//clearInterval(timeOut);
	var timeCompleted = function()
	{
		nextImage ++;
		if (nextImage >= total)	nextImage = 0;
		
		startFading();
	}
	timeOut = setInterval(timeCompleted, 5000);
}

function startFading() {
  var el = document.getElementById('homeBanner').getElementsByTagName("img")[nextImage];
  total = document.getElementById('homeBanner').getElementsByTagName("img").length;
  el.style.visibility = 'visible';
  el.style.zIndex ++;
  setOpacity(el, 0);
  fadeImage(el,0);
}

function fadeImage(el, currentOpacity) {

  currentOpacity += 10;

  if (currentOpacity > 100) {
    setOpacity(el, 100);
//    var prevEl = el.previousSibling ? el.previousSibling : el.parentNode.lastChild;
//    var prevEl = document.getElementById('fading_image_container').getElementsByTagName("div")[1];
//    prevEl.style.visibility = 'hidden';
    //el.style.zIndex = 1;
  }
  else {
    setOpacity(el, currentOpacity);
    window.setTimeout(function() { fadeImage(el, currentOpacity); }, 20);
  }
}

function setOpacity(el, opacity) {

	opacity /= 100;

	el.style.opacity = opacity;
	el.style.MozOpacity = opacity;
	el.style.filter = "alpha(opacity=" + (opacity*100) + ")";

}

function genLanguage()
{
	str = '';
	str += '<div id="logoPart" class="clearfix">';
	str += '<div class="left" id="logo"><a href="/cc/eng/index.php"><img src="/cc/eng/images/logo_hkuspace.gif" alt="HKU SPACE Community College" /></a></div>';

/* Add my better space logo by Annie Kwok */
	str += '<div class="left"><a href="http://www.mybetterspace.hk" target=_blank><img src="/cc/promotion/mybetter.jpg" alt="My Better SPACE"></a></div>';

	/*str += '<div class="left"><a href="/cc/eng/aboutus/booklet.html" target="_self"><img src="/cc/eng/images/home/booklet.jpg" border="0"></a></div>'; */

	str += '<div class="left"></div>';
	
/* Add Site Search by Annie Kwok */
	str += '<div class="right search">';
        str += '<script type="text/javascript" src="http://www.google.com/jsapi"></script>';
        str += '<script type="text/javascript">';
        str += "google.load('search', '1');";
        str += 'google.setOnLoadCallback(function() {';
        str += "google.search.CustomSearchControl.attachAutoCompletion('013978796946241707904:zupkhwzkb4i', document.getElementById('q'), 'cse-search-box');";
        str += '});';
        str += '</script>';
        str += '<form action="http://www.google.com/cse" id="cse-search-box">';
        str += '<div>';
        str += '<input type="hidden" name="cx" value="013978796946241707904:zupkhwzkb4i" />';
        str += '<input type="hidden" name="ie" value="UTF-8" />';
        str += '<input type="text" name="q" id="q" autocomplete="off" size="15" value="Site Search" class="searchText" />';
        str += '<input type="submit" name="sa" value="Go" class="searchBtn">';
        str += '</div>';
        str += '</form>';
        str += '</div>';

	str += '<div class="right" id="language"><a href="javascript:changeLanguage(\'eng\');"><img src="/cc/eng/images/btn_eng.gif" alt="ENG" /></a><img class="languageBar" src="/cc/eng/images/lang_bar.gif" alt="" /><a href="javascript:changeLanguage(\'chi\');"><img src="/cc/eng/images/btn_tc.gif" alt="Chinese" /></a>';
	str += '</div>';
	
	d.write(str);
}


function genCommonlink()
{
	str = '';
	str += '<div id="commonLink" class="clearfix">';
	str += '	<div class="right"><a href="/cc/eng/index.php"><img class="btnOver" src="/cc/eng/images/home.gif" alt="Home" /></a><a href="/cc/eng/sitemap.html"><img  class="btnOver" src="/cc/eng/images/sitemap.gif" alt="sitemap" /></a><a href="http://hkuspace.hku.hk/cc/ccengfaq/index.php" target="_blank"><img  class="btnOver" src="/cc/eng/images/faq.gif" alt="FAQ" /></a><a href="/cc/eng/enquiry.html"><img  class="btnOver" src="/cc/eng/images/enquiry.gif" alt="Enquiry" /></a><a href="/cc/eng/aboutus/offices.html"><img  class="btnOver" src="/cc/eng/images/collegelocation.gif" alt="College Location" /></a><a href="https://teacher.hkuspace.hku.hk/uPortal/render.userLayoutRootNode.uP" target="_blank"><img class="btnOver" src="/cc/eng/images/teacher.gif" alt="Teacher" /></a><a href="https://learner.hkuspace.hku.hk/uPortal/render.userLayoutRootNode.uP" target="_blank"><img class="btnOver" src="/cc/eng/images/learner.gif" alt="Learner" /></a><a href="https://w1.hkuspace.hku.hk/cas/login?service=https%3a%2f%2fintranet%2ehkuspace%2ehku%2ehk%2f" target="_blank"><img class="btnOver" src="/cc/eng/images/staff.gif" alt="Staff" /></a><a href="https://alumni.hkuspace.hku.hk/" target="_blank"><img class="btnOver" src="/cc/eng/images/alumni.gif" alt="Alumni" /></a></div>';
	str += '</div>';
	
	d.write(str);
}

function genMainnav()
{
	str = '';
	str += '<div id="mainNav" class="clearfix"><a href="/cc/eng/pread/aims_info.html"><img src="/cc/eng/images/mainnav/pread.gif" alt="Pre-AD Programme" /></a><a href="/cc/eng/adprogram/choice.html"><img src="/cc/eng/images/mainnav/ad.gif" alt="AD Programmes" /></a><a href="/cc/eng/hdprogram/choice.html"><img src="/cc/eng/images/mainnav/hd.gif" alt="HD Programmes" /></a><a href="/cc/eng/aboutus/community.html"><img src="/cc/eng/images/mainnav/aboutus.gif" alt="About Us" border="0" /></a><a href="/cc/eng/application/requirements.html"><img src="/cc/eng/images/mainnav/application.gif" alt="Application and Admission" /></a><a href="/cc/eng/collegelife/engactivities.html"><img src="/cc/eng/images/mainnav/college.gif" alt="College Life" border="0" /></a><a href="/cc/eng/facilities/campuses.html"><img src="/cc/eng/images/mainnav/facilities.gif" alt="Facilities &amp; Services" /></a></div>';
	
	d.write(str);
}

function genFooterIndex()
{
	str = '';
	str += '<div id="footer" class="clearfix">';
	str += '	<div class="left"><img src="/cc/eng/images/home/footer_l.gif" alt="" /></div>';
	str += '	<div class="left " id="footerPartIndex">';
	str += '		<div class="left" id="copyRight">';
	str += '			<div>Copyright &copy; 2009 HKU SPACE. All rights reserved.</div>';
	str += '			<div class="clearfix" id="policy2">';
	str += '				<div class="left"><a href="javascript:NewWindow(\'/cc/eng/privacy.html\',\'Privacy\',\'500\',\'500\',\'yes\',\'no\')">Privacy Policy</a></div>';
	str += '				<div class="left"><img class="languageBar" src="/cc/eng/images/lang_bar.gif" alt="" /></div>';
	str += '				<div class="left"><a href="javascript:NewWindow(\'/cc/eng/publishing.html\',\'Publishing\',\'500\',\'500\',\'yes\',\'no\')">Publishing Policy</a></div>';
	str += '			</div>';
	str += '		</div>';
	str += '		<div class="right"><a href="http://hkuspace.hku.hk/" target="_blank"><img class="footerPadding" src="/cc/eng/images/home/logo_hkuspace.gif" alt="HKU SPACE" /></a><a href="http://hkuspace.hku.hk/cc/gb/index.htm" target="_blank"><img class="footerPadding" src="/cc/eng/images/home/community_collee.gif" alt="Community College Mainland Student Admission" /></a><a href="http://hkuspace.hku.hk/cidp" target="_blank"><img class="footerPadding" src="/cc/eng/images/home/top_up.gif" alt="Top-up Degree Programmes" /></a><a href="http://www.hkuspace-plk.hku.hk" target="_blank"><img src="/cc/eng/images/home/community_collee2.gif" alt="HPCC" class="footerPadding" /></a><a href=http://appahk.hkuspace.hku.hk/cc target=_blank><img src="/cc/eng/images/home/appa.jpg" border="0"></a></div>';
	str += '	</div>';
	str += '	<div class="right"><img src="/cc/eng/images/home/footer_r.gif" alt="" /></div>';
	str += '</div>';

	init();

	d.write(str);
}

function genFooter()
{
	str = '';
	str += '<div id="footer" class="clearfix">';
	str += '	<div class="left"><img src="/cc/eng/images/footer_l.gif" alt="" /></div>';
	str += '	<div class="left " id="footerPart">';
	str += '		<div class="left" id="copyRight">Copyright &copy; 2009 HKU SPACE. All rights reserved.</div>';
	str += '		<div class="right clearfix" id="policy">';
	str += '			<div class="right"><a href="javascript:NewWindow(\'/cc/eng/publishing.html\',\'Publishing\',\'500\',\'500\',\'yes\',\'no\')">Publishing Policy</a></div>';
	str += '			<div class="right"><img class="languageBar" src="/cc/eng/images/lang_bar.gif" alt="" /></div>';
	str += '			<div class="right"><a href="javascript:NewWindow(\'/cc/eng/privacy.html\',\'Privacy\',\'500\',\'500\',\'yes\',\'no\')">Privacy Policy</a></div>';
	str += '		</div>';
	str += '	</div>';
	str += '	<div class="right"><img src="/cc/eng/images/footer_r.gif" alt="" /></div>';
	str += '</div>';

	init();

	d.write(str);
}

function genLevel2title()
{
	str = '';
	str += '<div class="level2Title">';
	
	genTitle();
	
	str += '</div>';

	d.write(str);
}

function genNavAboutus()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitleAbout"><img src="../images/aboutus/aboutus_title.gif" alt="About Us" /></div>';
	str += '	<div><a href="/cc/eng/aboutus/community.html"><img src="/cc/eng/images/aboutus/community.gif" alt="About Community College" name="aboutus_community" border="0" class="btnOver" id="aboutus_community" /></a></div>';
	str += '        <div><a href="/cc/eng/aboutus/booklet.html"><img id="aboutus_booklet" src="/cc/eng/images/aboutus/booklet.gif" alt="10th Anniversary Booklet" border="0" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/director.html"><img id="aboutus_director" src="/cc/eng/images/aboutus/director.gif" alt="Message from the Director" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/principal.html"><img id="aboutus_principal" src="/cc/eng/images/aboutus/principal.gif" alt="Message from the Principal" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/vision.html"><img id="aboutus_vision" src="/cc/eng/images/aboutus/vision.gif" alt="Vision" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/figures.html"><img id="aboutus_figures" src="/cc/eng/images/aboutus/figures.gif" alt="Facts and Figures" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/path.html"><img id="aboutus_path" src="/cc/eng/images/aboutus/path.gif" alt="Progression Path" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/studying.html"><img id="aboutus_studying" src="/cc/eng/images/aboutus/studying.gif" alt="Studying at our College" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/education.html"><img id="aboutus_education" src="/cc/eng/images/aboutus/education.gif" alt="Education Talks" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/staff.html"><img id="aboutus_staff" src="/cc/eng/images/aboutus/staff.gif" alt="Staff Directory" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/offices.html"><img id="aboutus_offices" src="/cc/eng/images/aboutus/offices.gif" alt="College Offices" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/aboutus/news.html"><img id="aboutus_news" src="/cc/eng/images/aboutus/news.gif" alt="News and Events" class="btnOver" /></a></div>';
	
	str += '</div>';

	d.write(str);
}

function genNavAdprogram()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitle"><img src="../images/adprogram/adprogram_title.gif" alt="AD Programmes" /></div>';
	str += '	<div><a href="/cc/eng/adprogram/choice.html"><img id="adprogram_choice" src="../images/adprogram/choice.gif" alt="Your Choice" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/adprogram/outline.html"><img id="adprogram_outline" src="../images/adprogram/outline.gif" alt="Programme Outline" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/adprogram/progressionStudy_oversea.html"><img id="adprogram_progressionStudy" src="../images/adprogram/progressionStudy.gif" alt="Recognition &amp; Progression of Study" class="btnOver" /></a>';
	str += '		<div id="subNav">';
	str += '			<ul class="navListAD">';
	str += '				<li><a href="/cc/eng/adprogram/progressionStudy_oversea.html"><img id="adprogram_progressionStudy_oversea" class="btnOver" src="../images/adprogram/oversea.gif" alt="Overseas Universities" /></a></li>';
	str += '				<li><a href="/cc/eng/adprogram/progressionStudy_cidp.html"><img id="adprogram_progressionStudy_cidp" class="btnOver" src="../images/adprogram/cidp.gif" alt="CIDP" /></a></li>';
	str += '				<li><a href="/cc/eng/adprogram/progressionStudy_recognition.html"><img id="adprogram_progressionStudy_recognition" class="btnOver" src="../images/adprogram/recognition.gif" alt="Recognition" /></a></li>';
	str += '			</ul>';
	str += '		</div>';
	str += '	</div>';	
	str += '</div>';

	d.write(str);
}

function genNavAdprogramList()
{
	str = '';
	str += '<div class="left" id="rightList">';
	str += '	<div><img src="../images/adprogram/adprogramme.gif" alt="ASSOCIATE DEGREE PROGRAMMES" /></div>';
	str += '  <div class="greenCross">Associate of Arts</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_cm" href="/cc/eng/adprogram/choice_cm_info.html">Advertising and Creative Media</a></li>';
	str += '		<li><a id="adprogram_choice_bilingual" href="/cc/eng/adprogram/choice_bilingual_info.html">Bilingual Studies</a></li>';
	str += '        <li><a id="adprogram_choice_creativemedia" href="/cc/eng/adprogram/choice_creativemedia_info.html">Creative Studies</a></li>';
	str += '		<li><a id="adprogram_choice_english" href="/cc/eng/adprogram/choice_english_info.html">English Studies</a></li>';
	str += '		<li><a id="adprogram_choice_humanities" href="/cc/eng/adprogram/choice_humanities_info.html">Humanities</a></li>';
	str += '		<li><a id="adprogram_choice_journalism" href="/cc/eng/adprogram/choice_journalism_info.html">International Journalism and Media</a></li>';
	str += '		<li><a id="adprogram_choice_japanese" href="/cc/eng/adprogram/choice_japanese_info.html">Japanese Studies</a></li>';
	str += '		<li><a id="adprogram_choice_cultural" href="/cc/eng/adprogram/choice_cultural_info.html">Media and Cultural Studies</a></li>';
	str += '		<li><a id="adprogram_choice_music" href="/cc/eng/adprogram/choice_music_info.html">Music</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Arts in Legal Studies</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_law" href="/cc/eng/adprogram/choice_law_info.html">Law and Business</a></li>';
	str += '		<li><a id="adprogram_choice_administration" href="/cc/eng/adprogram/choice_administration_info.html">Law and Public Administration</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Business Administration</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_accounting" href="/cc/eng/adprogram/choice_accounting_info.html">Accounting</a></li>';
	str += '		<li><a id="adprogram_choice_economics" href="/cc/eng/adprogram/choice_economics_info.html">Applied Economics</a></li>';
	str += '		<li><a id="adprogram_choice_cbusiness" href="/cc/eng/adprogram/choice_cbusiness_info.html">China Business</a></li>';
	str += '		<li><a id="adprogram_choice_finance" href="/cc/eng/adprogram/choice_finance_info.html">Finance</a></li>';
	str += '		<li><a id="adprogram_choice_gbusiness" href="/cc/eng/adprogram/choice_gbusiness_info.html">Global Business</a></li>';
	str += '		<li><a id="adprogram_choice_management" href="/cc/eng/adprogram/choice_management_info.html">Management</a></li>';
	str += '		<li><a id="adprogram_choice_marketing" href="/cc/eng/adprogram/choice_marketing_info.html">Marketing</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Social Sciences</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_general" href="/cc/eng/adprogram/choice_general_info.html">General</a></li>';
	str += '		<li><a id="adprogram_choice_public" href="/cc/eng/adprogram/choice_public_info.html">Public Administration</a></li>';
	str += '		<li><a id="adprogram_choice_sociology" href="/cc/eng/adprogram/choice_sociology_info.html">Sociology</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Applied Science in Information Technology</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_bis" href="/cc/eng/adprogram/choice_bis_info.html">Business Information Systems</a></li>';
	str += '		<li><a id="adprogram_choice_compstudies" href="/cc/eng/adprogram/choice_compstudies_info.html">Computer Science</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Applied Science in Life Science</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_biological" href="/cc/eng/adprogram/choice_biological_info.html">Biological Science</a></li>';
	str += '		<li><a id="adprogram_choice_chemistry" href="/cc/eng/adprogram/choice_chemistry_info.html">Chemistry</a></li>';
	str += '		<li><a id="adprogram_choice_earth" href="/cc/eng/adprogram/choice_earth_info.html">Earth Sciences</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross">Associate of Applied Science in Physical Science</div>';
	str += '	<ul class="courseListGreen">';
	str += '		<li><a id="adprogram_choice_physics" href="/cc/eng/adprogram/choice_physics_info.html">Physics</a></li>';
	str += '		<li><a id="adprogram_choice_pchemistry" href="/cc/eng/adprogram/choice_pchemistry_info.html">Chemistry</a></li>';
	str += '		<li><a id="adprogram_choice_pearth" href="/cc/eng/adprogram/choice_pearth_info.html">Earth Sciences</a></li>';
	str += '		<li><a id="adprogram_choice_statistics" href="/cc/eng/adprogram/choice_statistics_info.html">Statistics</a></li>';
	str += '	</ul>';
	str += '	<div class="greenCross"><a id="adprogram_choice_practical" href="/cc/eng/adprogram/choice_practical_info.html">Associate of Applied Science in Practical Chinese Medicine</a></div>';
	str += '</div>';
	
	d.write(str);
}

function genNavApplication()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitleAbout"><img src="../images/application/application_title.gif" alt="Application & Admission" /></div>';
	str += '    <div><a href="/cc/eng/application/requirements.html"><img id="application_requirements" src="/cc/eng/images/application/requirements.gif" alt="Requirement" class="btnOver" name="application_requirements" /></a></div>';
	str += '    	<div><a href="/cc/eng/application/procedures.html"><img id="application_procedures" src="/cc/eng/images/application/procedures.gif" alt="Application Procedures" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/application/onlineapp.html"><img id="application_onlineapp" src="/cc/eng/images/application/onlineapp.gif" alt="Online Application" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/application/tuitionfee.html"><img id="application_tuitionfee" src="/cc/eng/images/application/tuitionfee.gif" alt="Tuition Fee" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/application/financial.html"><img id="application_financial" src="/cc/eng/images/application/financial.gif" alt="Financial Assistance" class="btnOver" /></a></div>';
	str += '</div>';

	d.write(str);
}

function genNavCollege()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitleAbout"><img src="../images/collegelife/college_title.gif" alt="College Life" /></div>';
	str += '    <div><a href="/cc/eng/collegelife/engactivities.html"><img src="/cc/eng/images/collegelife/engactivities.gif" alt="Student Activities" name="Student Actitives" border="0" class="btnOver" id="collegelife_engactivities" /></a></div>';
	str += '    	<div><a href="/cc/eng/collegelife/exchangeinternship.html"><img src="/cc/eng/images/collegelife/exchangeinternship.gif" alt="Student Exchange & Internship Programmes" border="0" class="btnOver" id="collegelife_exchangeinternship" /></a></div>';
	str += '	<div><a href="/cc/eng/collegelife/extra.html"><img id="collegelife_extra" src="/cc/eng/images/collegelife/extra.gif" alt="English Extra-curricular Activities" class="btnOver" /></a></div>';
	str += '    <div><a href="/cc/eng/collegelife/union.html"><img id="collegelife_union" src="/cc/eng/images/collegelife/union.gif" alt="Student\'s Union" class="btnOver" /></a></div>';
	str += '    <div><a href="/cc/eng/collegelife/scholarships.html"><img id="collegelife_scholarships" src="/cc/eng/images/collegelife/scholarships.gif" alt="Scholarships & Awards" class="btnOver" /></a></div>';
	str += '    <div><a href="/cc/eng/collegelife/sharing.php"><img id="collegelife_sharing" src="/cc/eng/images/collegelife/sharing.gif" alt="Student\'s Sharing" class="btnOver" /></a></div>';
	str += '    <div><a href="/cc/eng/collegelife/alumni.html"><img id="collegelife_alumni" src="/cc/eng/images/collegelife/alumni.gif" alt="Alumni" class="btnOver" /></a></div>';
	str += '</div>';

	d.write(str);
}

function genNavFacServices()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitleAbout"><img src="../images/facilities/fac_title.gif" alt="Facilities & Services" /></div>';
	str += '   <div><a href="/cc/eng/facilities/campuses.html"><img id="facilities_campuses" src="/cc/eng/images/facilities/campuses.gif" alt="Our Campuses" class="btnOver" name="Our Campuses" /></a></div>';
	str += '    	<div><a href="/cc/eng/facilities/learning.html"><img id="facilities_learning" src="/cc/eng/images/facilities/learning.gif" alt="Learning Facilities" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/facilities/counseling.html"><img id="facilities_counseling" src="/cc/eng/images/facilities/counseling.gif" alt="Students Development and Counseling Services" class="btnOver" /></a></div>';
	str += '        <div><a href="/cc/eng/facilities/badweather.html"><img id="badweather" src="/cc/eng/images/facilities/badweather.gif" alt="Bad Weather Arrangement" class="btnOver" /></a></div>';
	str += '</div>';

	d.write(str);
}

function genNavHdprogram()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitleHD"><img src="../images/hdprogram/hdprogram_title.gif" alt="HD Programmes" /></div>';
	str += '	<div><a href="/cc/eng/hdprogram/choice.html"><img id="hdprogram_choice" src="../images/hdprogram/choice.gif" alt="Your Choice" onmouseover="setBtnOver();" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/hdprogram/outline.html"><img id="hdprogram_outline" src="../images/hdprogram/outline.gif" alt="Programme Outline" onmouseover="setBtnOver();" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/hdprogram/progressionStudy_oversea.html"><img id="hdprogram_progressionStudy" src="../images/hdprogram/progressionStudy.gif" alt="Recognition &amp; Progression of Study" onmouseover="setBtnOver();" class="btnOver" /></a>';
	str += '		<div id="subNav2">';
	str += '			<ul class="navListHD">';
	str += '				<li><a href="/cc/eng/hdprogram/progressionStudy_oversea.html"><img id="hdprogram_progressionStudy_oversea" onmouseover="setBtnOver();" src="../images/hdprogram/oversea.gif" alt="Overseas Universities" class="btnOver" /></a></li>';
	str += '				<li><a href="/cc/eng/hdprogram/progressionStudy_cidp.html"><img id="hdprogram_progressionStudy_cidp" onmouseover="setBtnOver();" src="../images/hdprogram/cidp.gif" alt="CIDP" class="btnOver" /></a></li>';
	str += '				<li><a href="/cc/eng/hdprogram/progressionStudy_recognition.html"><img id="hdprogram_progressionStudy_recognition" onmouseover="setBtnOver();" src="../images/hdprogram/recognition.gif" alt="Recognition" class="btnOver" /></a></li>';
	str += '			</ul>';
	str += '		</div>';
	str += '	</div>';
	str += '</div>';

	d.write(str);
}

function genNavHdprogramList()
{
	str = '';
	str += '<div class="left" id="rightList">';
	str += '	<div><img src="../images/hdprogram/hdprogramme.gif" alt="HIGHER DIPLOMA PROGRAMMES" /></div>';
	str += '	<ul class="courseList">';
	str += '		<li><a id="hdprogram_choice_financial3" href="/cc/eng/hdprogram/choice_financial3_info.html">Accounting and Financial Information Management (Double Award)</a></li>';
	str += '		<li><a id="hdprogram_choice_governance2" href="/cc/eng/hdprogram/choice_governance2_info.html">Business (Corporate Administration &amp; Governance)</a></li>';
	str += '		<li><a id="hdprogram_choice_business3" href="/cc/eng/hdprogram/choice_business3_info.html">Business (Financial Services)</a></li>';
	str += '		<li><a id="hdprogram_choice_internation2" href="/cc/eng/hdprogram/choice_internation2_info.html">Business (International Trade)</a></li>';
	str += '		<li><a id="hdprogram_choice_marketing3" href="/cc/eng/hdprogram/choice_marketing3_info.html">Business (Marketing &amp; Management)</a></li>';
	str += '		<li><a id="hdprogram_choice_media3" href="/cc/eng/hdprogram/choice_media3_info.html">Business (Marketing &amp; Media)</a></li>';
	str += '		<li><a id="hdprogram_choice_advertising3" href="/cc/eng/hdprogram/choice_advertising3_info.html">Business (Sales, Marketing &amp; Advertising)</a></li>';
	str += '		<li><a id="hdprogram_choice_systems2" href="/cc/eng/hdprogram/choice_systems2_info.html">Business Systems</a></li>';
	str += '		<li><a id="hdprogram_choice_management3" href="/cc/eng/hdprogram/choice_management3_info.html">Corporate Communications &amp; Management</a></li>';
	str += '		<li><a id="hdprogram_choice_translation2" href="/cc/eng/hdprogram/choice_translation2_info.html">Translation and Interpretation</a></li>';
	str += '		<li><a id="hdprogram_choice_engineering2" href="/cc/eng/hdprogram/choice_engineering2_info.html">Engineering</a></li>';
	str += '		<li><a id="hdprogram_choice_infotech3" href="/cc/eng/hdprogram/choice_infotech3_info.html">Information Technology</a></li>';
	str += '		<li><a id="hdprogram_choice_library3" href="/cc/eng/hdprogram/choice_library3_info.html">Library and Information Management</a></li>';
	str += '		<li><a id="hdprogram_choice_transport3" href="/cc/eng/hdprogram/choice_transport3_info.html">Logistics and Transport Operations</a></li>';
	str += '		<li><a id="hdprogram_choice_medicines2" href="/cc/eng/hdprogram/choice_medicines2_info.html">Chinese Medicines</a></li>';
	str += '		<li><a id="hdprogram_choice_dental2" href="/cc/eng/hdprogram/choice_dental2_info.html">Dental Hygiene</a></li>';
	str += '		<li><a id="hdprogram_choice_indesign3" href="/cc/eng/hdprogram/choice_indesign3_info.html">Interior Design</a></li>';
	str += '		<li><a id="hdprogram_choice_visual3" href="/cc/eng/hdprogram/choice_visual3_info.html">Visual Communication</a></li>';
	str += '		<li><a id="hdprogram_choice_architectural3" href="/cc/eng/hdprogram/choice_architectural3_info.html">Professional Diploma in Architectural Studies</a></li>';
	str += '		<li><a id="hdprogram_choice_aviation" href="/cc/eng/hdprogram/choice_aviation_info.html">Aviation Studies</a></li>';
	str += '	</ul>';
	str += '</div>';

	d.write(str);
}

function genNavPread()
{
	str = '';
	str += '<div class="leftnav">';
	str += '	<div class="leftTitlePre"><img src="/cc/eng/images/pread/pread_title.gif" alt="Pre-AD Programme" /></div>';
	str += '	<div><a href="/cc/eng/pread/aims_info.html"><img id="pread_aims" src="/cc/eng/images/pread/aims.gif" alt="Programme Overview" class="btnOver" /></a></div>';
	str += '	<div><a href="/cc/eng/pread/outline.html"><img id="pread_outline" src="/cc/eng/images/pread/outline.gif" alt="Programme Outline" class="btnOver" /></a></div>';
	str += '</div>';

	d.write(str);
}
