// JavaScript Document

// menu arrays
menuArray = new Array ("about", "invbank", "hedgefunds", "partners", "contact", "careers" );
menuSnTitle = new Array("About Us", "Investment Banks", "Hedge Funds", "Partners", "Contact Us", "Careers");

nav_about = new Array(
"About Us", "abt_intro.html", 0,
"History", "abt_history.html", 1,
"What's New", "abt_news.html", 1,
"What's New", "abt_news_05.html", 0,
"What's New", "abt_news_04.html", 0,
"Career", "abt_career.html", 1,
"Current Openings", "abt_currentopen.html", 0,
"Press Kit", "abt_presskit.html", 1
);

nav_invbank = new Array(
"For Investment Banks", "invb_intro.html", 0,
"Audiovisual", "invb_audiovisual.html", 1,
"Networks", "invb_networking.html", 1,
"Telecoms", "invb_telecoms.html", 1,
"Special Events", "invb_spevents.html", 1
);


nav_hedgefunds = new Array(
"For Hedge Funds", "hfund_intro.html", 0,
"Redbox", "hfund_redbox.html", 1,
"Getting you started", "hfund_audiovisual.html", 1,
"Running your technology", "hfund_networking.html", 1,
"Hedge Fund System Growth", "hfund_telecoms.html", 1,
"Business Continuity Planning", "hfund_bcplanning.html", 1,
"Special Events", "hfund_spevents.html", 1

);


nav_partners = new Array(
"Partners",  "partners.html", 0,
"One Space", "#onespace", 1,
"Amulet Hotkey", "#amulet", 1,
"IP Trade", "#iptrade", 1,
"Microsoft", "#microsoft", 1,
"Cisco", "#cisco", 1,
"PCCW", "#pccw", 1,
"Research In Motion", "#rim", 1,
"Infocomm", "#infocomm", 1,
"Beauchamp Financial", "#beauchamp", 1
);

nav_contact = new Array(
"Hong Kong", "contactus.html", 0,
"Hong Kong", "contactus_hk.html", 1,
"Tokyo", "contactus_tokyo.html", 1,
"Singapore", "contactus_sg.html", 1
);
/*
nav_partners = new Array(
"Amulet Hotkey", "ptrs_hotkey.html", 1,
"Beauchamp Finance Technology", "ptrs_beauchamp.html", 1,
"PCCW", "ptrs_pccw.html", 1,
"One Space", "ptrs_onespace.html", 1,
"Microsoft Gold Certified Partner", "ptrs_microsoft.html", 1,
"Infocomm - CAVSP", "ptrs_infocomm.html", 1
);
*/
/*
nav_career = new Array(
"Career", "career.html", 0
);
*/

// menu settings - on / off


function genLevel2Menu(){
	var divObj = document.getElementById("div_navigation");
	var url = String(window.location);
	var doc = url.substr(url.lastIndexOf("/")+1,url.length-url.lastIndexOf("/"));
	var navHTML = '';
	var subtitle = '';
	if (divObj) {
		leftNavArray = eval("nav_" + menuArray[document.snID]);
		for (var i=0; i<leftNavArray.length; i+=3) {
			
			if (leftNavArray[i+1]==doc) subtitle = leftNavArray[i];
			
			if (leftNavArray[i+2]==1) {
				
				
				var idLabel = i;
				
				//special treatment for redbox
				if (leftNavArray[i]=="Redbox") {
					if ( String(window.location).indexOf(leftNavArray[i+1]) == -1 ) {
						action = "onmouseover=\"this.className='navItemOn'\" onmouseout=\"this.className='navItemOff'\" class='navItemOff' onclick=\"window.location='"+leftNavArray[i+1]+"';\"";
						navHTML += "<div id='div_nav_" + idLabel + "' "+action+"><img src='images/redbox.png'/></div>";
											
					} else {
						navHTML += "<div id='div_nav_" + idLabel + "' class='navItemOn'><img src='images/redbox.png'/></div>"
					}
				} else {
					
					if ( String(window.location).indexOf(leftNavArray[i+1]) == -1 ) {
						action = "onmouseover=\"this.className='navItemOn'\" onmouseout=\"this.className='navItemOff'\" class='navItemOff' onclick=\"window.location='"+leftNavArray[i+1]+"';\"";
						navHTML += "<div id='div_nav_" + idLabel + "' "+action+">" + leftNavArray[i] +"</div>";
											
					} else {
						navHTML += "<div id='div_nav_" + idLabel + "' class='navItemOn'>" + leftNavArray[i] +"</div>"
					}
				}
				
	
				
			}
	
			
		}
		divObj.innerHTML = navHTML;
		if (navHTML == "") {
			divObj.style.display="none";
			divObj = document.getElementById("div_insideImage");
			divObj.style.paddingTop= "5px";
		}
	}

	/*
	//update title
	divObj = document.getElementById("div_snTitle");
	divObj.innerHTML = menuSnTitle[document.snID];
	
	//update subtitle
	divObj = document.getElementById("div_snSubtitle");
	divObj.innerHTML = subtitle;
	
	*/
	
	// tilte become subtitle
	divObj = document.getElementById("div_snTitle");
	
	//special for redbox
	if (subtitle == "Redbox") {
		subtitle = "<img src='images/redbox_big.png'>";
		divObj.style.opacity=1;
		divObj.style.filter = 'alpha(opacity=100)';
	
	}
	divObj.innerHTML = subtitle;
	
	// highlight top level
	var topNav_imgID = "top_nav" + document.snID;
	var imgObj = document.getElementById(topNav_imgID);
	imgName = String(imgObj.src).split(".jpg");
	imgObj.src = imgName[0] + "_on.jpg";
}

function fn_chgTopNavImg(imgObj, state){
	var topNav_imgID = "top_nav" + document.snID;
	if (imgObj.id==topNav_imgID) return;
	if (state==1) {
		imgName = String(imgObj.src).split(".jpg");
		imgObj.src = imgName[0] + "_on.jpg";
	} else {
		imgName = String(imgObj.src).split("_on.jpg");
		imgObj.src = imgName[0] + ".jpg";
	}
}




document.menuItemsLoaded=true;
document.menuItemsGenerated=false;


function showMainSWF(url, width, height)
{
	text='';

	if (url.indexOf(".swf")>0)
	{

		text+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
		text+='<param name="movie" value="'+url+'" />';
		text+='<param name="quality" value="high" />';
		text+='<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
		text+='</object>';

	}else{

		text+='<img src="'+url+'" width="'+width+'" height="'+height+'">';

	}

	var swfObj = document.getElementById("main_swf");	
	swfObj.innerHTML=text;
}