﻿function genTeamate(number){
	var show_no_of_teamate = number;
	var teamate = new Array();
	var img_path = new Array();
	var team_no = "";
	
	for (var i=0; i<show_no_of_teamate; i++){
		teamate[i]=Math.floor(Math.random()*contact.length);
		var repeat = 1;
		if (i>0){
			while (repeat == 1){
				repeat = 0;
				for (j=0; j<(teamate.length-1); j++){
					if (teamate[i] == teamate[j]){
						teamate[i]=Math.floor(Math.random()*contact.length);
						teamate[i]=Math.floor(Math.random()*10);
						repeat = 1;
						break;
					}
				}
			}
		}
		if (contact[contact[teamate[i]]][0] == "GM Office") {			img_path[i] = "gmo";
		} else if (contact[contact[teamate[i]]][0] == "Admin") {		img_path[i] = "admin";
		} else if (contact[contact[teamate[i]]][1] == "HK") {
			if (contact[contact[teamate[i]]][0] == "Control") {			img_path[i] = "control";
			} else if (contact[contact[teamate[i]]][0] == "Sales") {	img_path[i] = "sales";
			}
		} else {
			img_path[i] = "SZ";
		}
	}
	//gen code
	for (var i=0; i<show_no_of_teamate; i++){
		document.write('                                <tr>');
		document.write('                                  <td width="1%" valign="top"><img src="img/contact/'+img_path[i]+'/'+contact[contact[teamate[i]]][9]+'" width="58" height="58"></td>');
		document.write('                                  <td align="left" valign="top" class="content" style="padding-left:5px "><span class="title_blue"><strong>'+contact[contact[teamate[i]]][4]+'</strong></span><br>');
		document.write('                                    TEL: '+contact[contact[teamate[i]]][6]+'<br>');
		document.write('                                    FAX: '+contact[contact[teamate[i]]][7]+'<br>');
		document.write('                                    <a href="mailto:'+contact[contact[teamate[i]]][8]+'" class="content">'+contact[contact[teamate[i]]][8]+'</a></td>');
		document.write('                                </tr>');
		if (i != (show_no_of_teamate-1)){
			document.write('                                <tr><td colspan="2" style="background-image:url(img/dash.jpg); background-repeat:repeat-x; background-position:center "><img src="img/spacer.gif" width="1" height="15"></td></tr>');
		}
	}
}


//---- Important Notices START ------
document.write('				  <table width="100%"  border="0" cellspacing="0" cellpadding="0">');
document.write('                    <tr><td height="25" valign="bottom" class="box_title" style="padding-left:10px "><img src="img/icon1.jpg" width="34" height="21" align="absbottom"> 最新消息</td></tr>');
document.write('                    <tr>');
document.write('                      <td style="padding-bottom:10px "><table  border="0" cellpadding="0" cellspacing="0">');
document.write('                          <tr>');
document.write('                            <td width="10" align="left"><img src="img/border_top_l.jpg" width="10" height="10"></td>');
document.write('                            <td width="625" style="background-image:url(img/border_top.jpg); background-repeat:repeat-x; background-position:top "><img src="img/spacer.gif" width="1" height="10"></td>');
document.write('                            <td width="18" align="right"><img src="img/border_top_r.jpg" width="18" height="10"></td>');
document.write('                          </tr>');
document.write('                          <tr>');
document.write('                            <td align="left" style="background-image:url(img/border_l.jpg); background-repeat:repeat-y; background-position:left "><img src="img/spacer.gif" width="10" height="1"></td>');
document.write('                            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">');

// Data 1
document.write('                                <tr><td class="title_blue"><img src="img/point.jpg" width="5" height="5" hspace="2" align="absmiddle"> 24/08/2007 </td></tr>');
document.write('                                <tr><td class="content">“漫畫放題館”網站啟用, 方便大家更易認識和理解放題館的服務和環境。</td></tr>');
//document.write('                                <tr><td align=right><img src="img/arrow_1.jpg" width="12" height="11" hspace="2" align="absmiddle"><a class="content" href="#">詳情</a></td></tr>');


// separate line
document.write('                                <tr><td style="background-image:url(img/dash.jpg); background-repeat:repeat-x; background-position:center "><img src="img/spacer.gif" width="1" height="10"></td></tr>');

// Data 2
document.write('                                <tr><td class="title_blue"><img src="img/point.jpg" width="5" height="5" hspace="2" align="absmiddle"> 24/08/2007 </td></tr>');
document.write('                                <tr><td class="content">添置最新 DVD、 LCD TV 讓讀者觀看最新電影及動畫, 免費PSP/NDS及手提電話充電服務。<br><br><br></td></tr>');
//document.write('                                <tr><td align=right><img src="img/arrow_1.jpg" width="12" height="11" hspace="2" align="absmiddle"><a class="content" href="#">詳情</a></td></tr>');


document.write('                            </table></td>');
document.write('                            <td align="right" style="background-image:url(img/border_r.jpg); background-repeat:repeat-y; background-position:right "><img src="img/spacer.gif" width="18" height="1"></td>');
document.write('                          </tr>');
document.write('                          <tr>');
document.write('                            <td align="left"><img src="img/border_bottom_l.jpg" width="10" height="15"></td>');
document.write('                            <td style="background-image:url(img/border_bottom.jpg); background-repeat:repeat-x; background-position:bottom "><img src="img/spacer.gif" width="1" height="15"></td>');
document.write('                            <td align="right"><img src="img/border_bottom_r.jpg" width="18" height="15"></td>');
document.write('                          </tr>');
document.write('                      </table></td>');
document.write('                    </tr>');
document.write('                  </table>');
//---- Important Notices END ------



