//	Start for submenu
var timer = 0;
var offx = 0;
var lng = "";

function showSubmenu(n){
	for (i=0;i<=4;i++){eval("sm"+i+".style.visibility = 'hidden'");}

	if (n != ""){
		eval(n+".style.visibility='visible'");
	}
}

function hideSubmenu(){
	for (i=0;i<=4;i++){
		eval("sm"+i+".style.visibility = 'hidden'");
	}
}

function DelayHide(){
	if (timer > 0){
		clearTimeout(timer);
	}
//	setTimeout("hideSubmenu()",5000);
	hideSubmenu();
}

function ClearLayerTimeOut(){
	if (timer > 0){
		clearTimeout(timer);
	}
}
//	End for submenu

function printSubmenu(lg){	
//	variable for the content of submenu
	var com_pro = "";
	var com_str = "";	
	var garment = "";
	var textiles = "";
	var toys = "";	
	var non_elc = "";	
	var com_soo = "";
	var all_con = "";
	var ema_for = "";	
	
	switch(lg){
	//	TC
		case 'TC':
			com_pro = "公司簡介";
			com_str = "公司架構";	
			//pro_gar = "服裝";
			pro_tex = "紡織品";
			pro_toy = "玩具";	
			non_elc = "非磁性骨傳導";	
			com_soo = "即將來臨";
			all_con	= "聯絡方法";
			ema_for = "客戶意見";	
			lng = "_tc";
			break;
	//	SC	
		case 'SC':
			com_pro = "公司简介";
			com_str = "公司架构";	
			//pro_gar = "服装";
			pro_tex = "纺织品";
			pro_toy = "玩具";	
			non_elc = "非磁性骨传导";	
			com_soo = "即将来临";
			all_con	= "联络方法";
			ema_for = "客户意见";	
			lng = "_sc";			
			break;
	//	EN
//		case 'EN':	
		default:
			com_pro = "Company Profile";
			com_str = "Company Structure";	
			//pro_gar = "Garment";
			pro_tex = "Textiles";
			pro_toy = "Toys";	
			non_elc = "Non-Electromagnetic";	
			com_soo = "Coming Soon";
			all_con	= "All Contract Information";
			ema_for = "Email Form";
			lng = "";
			break;		
	}	

	offx = (document.body.offsetWidth - 820 ) / 2;
	offx = offx + 20;		

	document.write('<div id="sm0" name="sm0" style="position:absolute; width:175px; height:62px; z-index:1; visibility: hidden; left: ' + offx + 'px; top: 100px;">');
	document.write('  <table width="100%"border="0" cellpadding="0" cellspacing="0" class="cntTopic12White">');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm0\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm0\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'" onClick="winRedirect(\'CP\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Company Profile</td>');
	document.write('			  <td height="20" class="cntTopic12Noline">' + com_pro + '</td>');
	document.write('			</tr>');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm0\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm0\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'"  onClick="winRedirect(\'CS\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Company Structure</td>');
	document.write('			  <td height="20" class="cntTopic12Noline">' + com_str + '</td>');
	document.write('    </tr>');
	document.write('  </table>');
	document.write('</div>');		
	
	offx = (document.body.offsetWidth - 820 ) / 2;
	offx = offx + 20 + 184 +14.5;		
	
	document.write('<div id="sm1" name="sm1" style="position:absolute; width:175px; height:62px; z-index:1; visibility: hidden; left: ' + offx + 'px; top: 100px;">');
	document.write('  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cntTopic12White">');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	//document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	//document.write('			</tr>');
	//document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'" onClick="winRedirect(\'G\')">');
	//document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Garment</td>');
	//document.write('			  <td height="20" class="cntTopic12Noline">' + pro_gar + '</td>');
	//document.write('			</tr>');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'"  onClick="winRedirect(\'TE\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Textiles</td>');
	document.write('			  <td height="20" class="cntTopic12Noline">' + pro_tex + '</td>');	
	document.write('			</tr>');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();" onMouseOut="hideSubmenu();"><td colspan="2" height="1" bgcolor="#FFFFFF"></td></tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'"  onClick="winRedirect(\'TO\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Toys</td>');
	document.write('			  <td height="20" class="cntTopic12Noline">' + pro_toy + '</td>');		
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();" onMouseOut="hideSubmenu();"><td colspan="2" height="1" bgcolor="#FFFFFF"></td></tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm1\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'"  onClick="winRedirect(\'NE\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Non-Electromagnetic</td>');	
    document.write('			  <td height="20" class="cntTopic12Noline">' + non_elc + '</td>');			
	document.write('    </tr>');
	document.write('  </table>');
	document.write('</div>');
	
	offx = (document.body.offsetWidth - 820 ) / 2;
	offx = offx + 20 + 184 +14.5 + 184 +14.5;		
	
	document.write('<div id="sm2" name="sm2" style="position:absolute; width:175px; height:25px; z-index:1; visibility: hidden; left: ' + offx + 'px; top: 100px;">');
	document.write('  <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="cntTopic12White">');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm2\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');	
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm2\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'">');
	document.write('			  <td width="25"></td>');	
//	document.write('			  <td height="20" class="cntTopic12Noline">Coming Soon</td>');
    document.write('			  <td height="20" class="cntTopic12Noline">' + com_soo + '</td>');		
	document.write('			</tr>');
    document.write('  </table>');
	document.write('</div>');	
	
	offx = (document.body.offsetWidth - 820 ) / 2;
	offx = offx + 20 + 184 +14.5 + 184 +14.5 + 184 + 14.5;		

	document.write('<div id="sm3" name="sm3" style="position:absolute; width:175px; height:62px; z-index:1; visibility: hidden; left: ' + offx + 'px; top: 100px;">');
	document.write('  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="cntTopic12White">');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm3\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm3\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'" onClick="winRedirect(\'ACI\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">All Contact Information</td>');
    document.write('			  <td height="20" class="cntTopic12Noline">' + all_con + '</td>');			
	document.write('			</tr>');
	document.write('			<tr onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm3\');ClearLayerTimeOut();" onMouseOut="hideSubmenu()" >');
	document.write('				<td colspan="2" height="1" bgcolor="#FFFFFF"></td>');
	document.write('			</tr>');
	document.write('			<tr bgcolor="#E6E6E6" onMouseOver="this.style.cursor=\'hand\';showSubmenu(\'sm3\');ClearLayerTimeOut();this.bgColor=\'#FA7A1C\'" onMouseOut="hideSubmenu();this.bgColor=\'#E6E6E6\'"  onClick="winRedirect(\'EF\')">');
	document.write('			  <td width="25"></td>');
//	document.write('			  <td height="20" class="cntTopic12Noline">Email Form</td>');
    document.write('			  <td height="20" class="cntTopic12Noline">' + ema_for + '</td>');		
	document.write('			</tr>');
	document.write('  </table>');
	document.write('</div>');		
	
	offx = (document.body.offsetWidth - 820 ) / 2;
	offx = offx + 20 + 184 +14.5 + 184 +14.5 + 184 + 14.5 + 55;		

	document.write('<div id="sm4" name="sm4" style="position:absolute; width:120px; height:30px; z-index:1; visibility: hidden; left: ' + offx + 'px; top: 30px;">');
	document.write('  <table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2" class="table_bdr">');
	document.write('			<tr>');
	document.write('			  <td height="25" class="undercon">Under Construction</td>');
	document.write('			</tr>');
    document.write('  </table>');
	document.write('</div>');			
}

function winRedirect(c){
	var lnk;
	
	switch(c){
		case 'CP':	//	Garment
			lnk = "./profile" + lng + ".html";
			break;
		case 'CS':	//	Textiles
			lnk = "./structure" + lng + ".html";		
			break;			
		case 'G':	// Garment
			lnk = "./garment" + lng + ".html";
			break;
		case 'TE':	//	Textiles
			lnk = "./textiles" + lng + ".html";		
			break;			
		case 'TO':	//	Toys
			lnk = "./toys" + lng + ".html";		
			break;	
		case 'NE':	//	Non-Electromagnetic
			window.open("http://www.mtechm.com","NonElec","");
			break;				
		case 'ACI':	//	Contact Us
			lnk = "./contactus" + lng + ".html";		
			break;		
		case 'EF':	//	Form for email
			lnk = "./form" + lng + ".asp";		
			break;					
	}
	
	if (c != "NE")	window.location = lnk;
}

function popWin(path, w, h){
	day = new Date();
	id = day.getTime();
	
	path = "./images/" + path;	
	eval("page" + id + " = window.open(path, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width="+w+",height="+h+"');");
}	

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->