document.write('<script language="javascript" type="text/javascript" src="../../js/swfobject.js"></script>');

var calender_highlight = new Array();

function print_calender(lan)
{
	var html_code = "";
	if (lan == "en")
	{
	html_code += '<div style="padding-left:25px; padding-top:9px"><table width="207" border="0" cellpadding="0" cellspacing="0"><tr><td></td><td colspan="7" style="padding-left:10px"><img src="../../img/'+lan+'/can_top.gif"></td></tr>';
	html_code += '<tr valign="top"><td width="62"><div style="padding-top:9px;"><img src="../../img/'+lan+'/can_10.gif"></div><div style="padding-top:58px;"><img src="../../img/'+lan+'/can_11.gif"></div></td><td><table width="178" cellpadding="0" cellspacing="1" class="can" bgcolor="#ececec" style="font-size:12px">';
	}
	else
	{
	html_code += '<div style="padding-left:25px; padding-top:9px"><table width="207" border="0" cellpadding="0" cellspacing="0"><tr><td></td><td colspan="7" style="padding-left:10px"><img src="../../img/'+lan+'/can_top.gif"></td></tr>';
	html_code += '<tr valign="top"><td width="62"><div style="padding-top:8px;"><img src="../../img/'+lan+'/can_10.gif"></div><div style="padding-top:57px;"><img src="../../img/'+lan+'/can_11.gif"></div></td><td><table width="178" cellpadding="0" cellspacing="1" class="can" bgcolor="#ececec" style="font-size:12px">';
	}
	html_code += '<tr height="22" align="center" bgcolor="#f6f6f6">';
	html_code += '<td style="color:#cacaca;"></td>';
	html_code += '<td style="color:#cacaca;"></td>';
	html_code += '<td style="color:#cacaca;"></td>';
	html_code += '<td style="color:#cacaca;"></td>';
	for(i=15; i<=31; i++)
	{
		var x = calender_highlight.length - 1;
		var y = 0;
		var z = 1;
		if(i<=9)
		{
		var ni = "0"+i;
		}
		else
		{
		var ni = i;
		}
		while (x >= y)
		{
			if (calender_highlight[x]== "oct_"+i)
			{
				html_code += '<td bgcolor="#ffff00;"><a class="can_link10" href="../search/search.html?date=10/'+ni+'/">'+i+'</a></td>';
				x--;
				z=0;
			}
			else
			{
				x--;
			}
		}
		if (z != 0)
		{
		html_code += '<td><a class="can_link10" href="../search/search.html?date=10/'+ni+'/">'+i+'</a></td>';
		}
		if(i==10 || i==17 || i==24 || i==31)
		{
		html_code += '</tr>';
		html_code += '<tr height="22" align="center" bgcolor="#f6f6f6">';
		}
	}
	for(g=1; g<=21; g++)
	{
		var r = calender_highlight.length - 1;
		var e = 0;
		var j = 1;
		if(g<=9)
		{
		var ng = "0"+g;
		}
		else
		{
		var ng = g;
		}
		while (r >= e)
		{
			if (calender_highlight[r]== "nov_"+g)
			{
				html_code += '<td bgcolor="#ffff00;"><a class="can_link11" href="../search/search.html?date=11/'+ng+'">'+g+'</a></td>';
				r--;
				j=0;
			}
			else
			{
				r--;
			}
		}
		if (j != 0)
		{
		html_code += '<td><a class="can_link11" href="../search/search.html?date=11/'+ng+'">'+g+'</a></td>';
		}
		if(g==7||g==14)
		{
		html_code += '</tr>';
		html_code += '<tr height="22" align="center" bgcolor="#f6f6f6">';
		}
		if(g==21)
		{
		html_code += '</tr>';
		}
	}
	html_code += '</table><table width="144" cellpadding="0" cellspacing="0" class="can">';
	html_code += '<tr><td colspan="7" style="padding-top:1px"><a href="../search/search.html"><img src="../../img/'+lan+'/search_icon.gif" border="0"></a></td></tr>';
	html_code += '</table></td></tr></table></div>';
	document.write(html_code);
}

function print_leftmenu(xx)
{
var menu_link = new Array();
menu_link[1] = "../about/about.html";
menu_link[2] = "../news/news.html";
menu_link[3] = "../prog/index.html";
menu_link[4] = "../other/exhibition.html";
menu_link[5] = "../guide/guide.html";
menu_link[6] = "../gift/gift.html";
menu_link[7] = "../download/download.html";
menu_link[8] = "../prog/index.html";

var menuhtml = '<div style="position: absolute;"><script>print_calender(w)</script></div><img src="../../img/common/can_bg.png" border="0"><br>';

for(i=1; i<=8; i++)
{

if (i==xx)
{
menuhtml +='<a href="'+menu_link[i]+'"><img id="left_'+i+'" src="../../img/'+w+'/leftmenu_'+i+'_over.png" border="0"></a><br>';
}
else
{
menuhtml +='<a href="'+menu_link[i]+'"><img id="left_'+i+'" onMouseOut="imgSwap(this)" onMouseOver="imgSwap(this)" src="../../img/'+w+'/leftmenu_'+i+'_off.png" border="0"></a><br>';
}

}
menuhtml +='<div style="position:absolute;"><div style="width:265px; height:180px;z-index:1;"><img src="../../img/'+w+'/leftmenu_bottom.png" border="0"></div><div style="z-index:3;position:absolute;top:0px;left:0px;">';
menuhtml +='<form name="form_menu" method="post"><table width="265" border="0" cellpadding="0" cellspacing="0">';
if(w=="en")
{
menuhtml +='<tr>';
menuhtml +='<td width="145" style="padding:42px 0 0 35px;"><input name="sa_name1" type="text" size="18" value="Enter your name" onFocus="inputName1()"></td>';
menuhtml +='<td rowspan="2" style="padding-top:48px"><a href="javascript:checkForm()"><img src="../../img/common/sp.gif" width="50" height="30" border="0"></a></td>';
menuhtml +='</tr>';
menuhtml +='<tr>';
menuhtml +='<td style="padding-left:35px;"><input name="sa_email1" type="text" size="18" value="Email address" onFocus="inputEmail1()"></td>';
menuhtml +='</tr>';
}
else
{
menuhtml +='<tr>';
menuhtml +='<td width="145" style="padding:42px 0 0 35px;"><input name="sa_name1" type="text" size="18" value="你的名字" onFocus="inputName1()"></td>';
menuhtml +='<td rowspan="2" style="padding-top:48px"><a href="javascript:checkForm()"><img src="../../img/common/sp.gif" width="50" height="30" border="0"></a></td>';
menuhtml +='</tr>';
menuhtml +='<tr>';
menuhtml +='<td style="padding-left:35px;"><input name="sa_email1" type="text" size="18" value="電郵" onFocus="inputEmail1()"></td>';
menuhtml +='</tr>';
}
menuhtml +='<tr>';
menuhtml +='<td height="30"></td>';
menuhtml +='</tr>';
menuhtml +='</table></form>';
menuhtml +='<div id="banner" style="position: absolute; padding-left:50px;"><a href="../other/ap_guide.html"><img src="../../img/common/04.jpg" border="0"></a></div></div></div>';
menuhtml +='<table><tr>';
menuhtml +='<td height="300"></td>';
menuhtml +='</tr>';
menuhtml +='</table>';
document.write(menuhtml);
if(w=="en")
{
var so = new SWFObject("../../img/common/04_e.swf", "indexmenu", "180", "65", "8", "");
}
else
{
var so = new SWFObject("../../img/common/04_c.swf", "indexmenu", "180", "65", "8", "");
}
so.addParam("wmode", "transparent");
so.addParam("allowScriptAccess", "always");
so.write("banner");
}

function inputName1()
{
if (document.form_menu.sa_name1.value =="你的名字"||document.form_menu.sa_name1.value =="Enter your name")
{
document.form_menu.sa_name1.value="";
}
}
function inputEmail1()
{
if (document.form_menu.sa_email1.value =="電郵"||document.form_menu.sa_email1.value =="Email address")
{
document.form_menu.sa_email1.value="";
}
}

function checkForm()
{
	var temp;
	var err_msg;

	err_msg = "";
	temp=document.forms["form_menu"].sa_name1.value.replace(" ","")
	if (temp.length == 0)
	{
		if(w=="en")
		{
		err_msg += "Please enter your name.\n";
		}
		else
		{
		err_msg = "請填寫您的姓名.\n";
		}
		document.forms["form_menu"].sa_name1.focus();
	}
	
	temp=document.forms["form_menu"].sa_email1.value.replace(" ","")
	if (temp.length == 0)
	{
		if (err_msg == "")
			document.forms["form_menu"].sa_email1.focus();
		if(w=="en")
		{
		err_msg += "Please enter your e-mail address.\n";
		}
		else
		{
		err_msg += "請填寫您的電郵.\n";
		}
	}
	else if ((temp.length != 0) && (temp.indexOf("@") == -1))
	{
		if (err_msg == "")
			document.forms["form_menu"].sa_email1.focus();
			if(w=="en")
		{
		err_msg += "Please enter correct e-mail format.\n";
		}
		else
		{
		err_msg += "請填寫正確的電郵格式.\n";
		}
	}

	if (err_msg != "")
	{
		alert(err_msg);
	}
	else
	{
	var sa_name = document.forms["form_menu"].sa_name1.value;
	var sa_email = document.forms["form_menu"].sa_email1.value;
	var url = "../php/become_fd.php?s_name="+sa_name+"&s_email="+sa_email;
	document.location.href = url;
	}
}
