//var imgDomPath = "/charles";
var imgDomPath = "http://www.charles.com.hk";

function print07TopColorLine() {
	var strTCL;
	
	strTCL ='<table cellSpacing=0 cellPadding=0 border=0 align=center>';
	strTCL+='  <tr>';
	strTCL+='    <td bgcolor="#005079"><div id=divPicBrdLRB><img src="' + imgDomPath + '/images/spacer.gif" width=192 height=12></div></td>';
	strTCL+='    <td bgcolor="#347AC1"><div id=divPicBrdRB><img src="' + imgDomPath + '/images/spacer.gif" width=481 height=12></div></td>';
	strTCL+='    <td bgcolor="#BAA2E1"><div id=divPicBrdRB><img src="' + imgDomPath + '/images/spacer.gif" width=150 height=12></div></td>';
	strTCL+='    <td bgcolor="#5E4641"><div id=divPicBrdRB><img src="' + imgDomPath + '/images/spacer.gif" width=90 height=12></div></td>';
	strTCL+='  </tr>';
	strTCL+='</table>';

	strTCL+='<table cellSpacing=0 cellPadding=0 border=0 align=center>';
	strTCL+='  <tr>';
	strTCL+='    <td width=193><div id=divPicBrdLRB><a href="http://www.charles.com.hk/home.html"><img src="' + imgDomPath + '/images/logocw.gif" border=0></a></div></td>';
	strTCL+='    <td><div id=divPicBrdRB><img src="' + imgDomPath + '/images/sky_tree_cf.jpg"></div></td>';
	strTCL+='    <td><div id=divPicBrdRB><img src="' + imgDomPath + '/images/860864W140.jpg"></div></td>';
	strTCL+='    <td><div id=divPicBrdRB><img src="' + imgDomPath + '/images/860864W244.jpg"></div></td>';
	strTCL+='  </tr>';
	strTCL+='</table>';							
	document.write(strTCL);
}

function print07LeftNav(wp, wp2) {
	document.write('<div id=divPicBrdL>');
	document.write('<table cellSpacing=0 cellPadding=0 border=0>');
        document.write('  <tr><td bgcolor="#9F478D"><a href="http://www.taylor.com.hk/charles/diary.php" class=navLM>charles@charles.com.hk</a></td></tr>');
        document.write('  <tr><td bgcolor="#AF619F"><a href="http://www.taylor.com.hk/charles/diary.php" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 福如日誌</a></td></tr>');
        if (wp == 11) {
        	document.write('  <tr><td bgcolor="#D693C8" class=leftNavSub>');
        	printDiaryLeftMenu(wp, wp2);
        	//document.write('日誌暫停開放');
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#AF619F"><a href="http://www.charles.com.hk/about/charles/article_1989.html" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 昔日文章</a></td></tr>');
        document.write('  <tr><td bgcolor="#409120"><a href="http://www.taylor.com.hk/charles/wedding_sophia.php?picFrom=0&picTo=7" class=navLM>fiona@charles.com.hk</a></td></tr>');
        document.write('  <tr><td bgcolor="#58A839"><a href="http://www.taylor.com.hk/charles/wedding_sophia.php?picFrom=0&picTo=7" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 台北蘇菲雅結婚照</a></td></tr>');
        if (wp == 21) {
        	document.write('  <tr><td bgcolor="#74C653" class=leftNavSub>');
        	printSophiaLeft(0);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#58A839"><a href="http://www.taylor.com.hk/charles/wedding_louvre.php?picFrom=0&picTo=12&picCol=2" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 香港羅浮宮結婚照</a></td></tr>');
        if (wp == 22) {
        	document.write('  <tr><td bgcolor="#74C653" class=leftNavSub>');
        	printSophiaLeft(1);
        	document.write('</td></tr>');
        }
        //document.write('  <tr><td bgcolor="#58A839"><a href="http://www.charles.com.hk/wedding/temp.html" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 6.30 結婚大日</a></td></tr>');
        if (wp == 23) {
        	document.write('  <tr><td bgcolor="#74C653" class=leftNavSub>');
        	printSophiaLeft(1);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#DD3165"><a href="http://www.taylor.com.hk/charles/diary.php?selWho=Sophia" class=navLM>sophia@charles.com.hk</a></td></tr>');
        document.write('  <tr><td bgcolor="#ed5a87"><a href="http://www.taylor.com.hk/charles/diary.php?selWho=Sophia" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 昕昕的成長日記</a></td></tr>');
        if (wp == 51) {
        	document.write('  <tr><td bgcolor="#fb9db9" class=leftNavSub>');
        	printDiaryLeftMenu(wp, wp2);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#1299e6"><a href="http://www.taylor.com.hk/charles/diary.php?selWho=Natalie" class=navLM>natalie@charles.com.hk</a></td></tr>');
        document.write('  <tr><td bgcolor="#54b8f2"><a href="http://www.taylor.com.hk/charles/diary.php?selWho=Natalie" class=navLM><img src="' + imgDomPath + '/images/spacer.gif" width=8 height=1 border=0>- 琪琪的成長日記</a></td></tr>');
        if (wp == 61) {
        	document.write('  <tr><td bgcolor="#a5dbf9" class=leftNavSub>');
        	printDiaryLeftMenu(wp, wp2);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#FFA132"><a href="http://www.taylor.com.hk/charles/hiking.php" class=navLM>hongkong walk</a></td></tr>');
        if (wp == 31) {
        	document.write('  <tr><td bgcolor="#F9C88F" class=leftNavSub>');
        	printHKWalkLeft(wp2);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#0B6EA1"><a href="http://www.taylor.com.hk/charles/trips.php?year=11&wtrip=0&pfr=0&pto=12&col=2&ary=1" class=navLM>go somewhere@world</a></td></tr>');
        if (wp == 41) {
        	document.write('  <tr><td bgcolor="#4C9EC8" class=leftNavSub>');
        	printTripsLeftMenu(0);
        	document.write('</td></tr>');
        }
        document.write('  <tr><td bgcolor="#76211a"><a href="http://www.charles.com.hk/about/jumptocharles.html" class=navLM>about jump.to/charles</a></td></tr>');
        document.write('  <tr><td><a href="http://www.beijing2008.cn" target=_blank><img src="' + imgDomPath + '/images/menu2008.jpg" width=192 border=0></a></td></tr>');
        //document.write('  <tr><td style="background-color:#4E96E7"><img src="' + imgDomPath + '/images/spacer.gif" width=191 height=114></td></tr>');
        document.write('  <tr><td><img src="' + imgDomPath + '/images/860864CR02.jpg" class=divPicBrdB></td></tr>');
        document.write('  <tr><td><img src="' + imgDomPath + '/images/860864CR03.jpg" class=divPicBrdB></td></tr>');
        document.write('</table>');
        document.write('</div>');
}

function print07MidHomePic() {
	var strMHP;
	
	var homepAry = new Array();
	var m=-1;
	
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep01.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep02.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep03.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep04.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep05.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep06.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep07.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep08.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep09.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep10.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep11.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep12.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep13.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep14.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep15.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep16.jpg", active:true}
	homepAry[++m] = {ImgS:imgDomPath + "/images/homep17.jpg", active:true}
	
	var r = getRemainder(homepAry.length);
	
	strMHP ='<table cellSpacing=0 cellPadding=0 border=0>';
        strMHP+='<tr><td><div id=divPicBrdLRB><img src="' + homepAry[r].ImgS + '"></div></td></tr>';
        //strMHP+='<tr><td bgcolor="#005079"><div id=divPicBrdLRB><img src="' + imgDomPath + '/images/spacer.gif" width=90 height=14></div></td></tr>';
	strMHP+='</table>';
	document.write(strMHP);
}

function print07MidSlidStory() {
	var strMSS;
	
	strMSS ='<div id=slideStory>';
	strMSS+='<table cellspacing=0 cellpadding=0 border=0 width=100%>';
	strMSS+='  <tr>';
	strMSS+='    <td align=center valign=top width=50% class=tdSlideStory><SCRIPT language="JavaScript">document.write(returnHomeBottom1stCol(0));</SCRIPT></td>';
	strMSS+='    <td width=1><img src="' + imgDomPath + '/images/spacer.gif" width=1 height=198></td>';
	strMSS+='    <td align=center valign=top width=50% class=tdSlideStory><SCRIPT language="JavaScript">document.write(returnHomeBottom1stCol(2));</SCRIPT></td>';
	strMSS+='  </tr>';
	strMSS+='</table>';
	strMSS+='</div>';
	
	document.write(strMSS);
}

function print07MidDiaryBox() {
	var strMDB;
	var dbyl = diarydb.length-1;
	var dbml = diarydb[dbyl].dMonth.length-1;
	var dbdl = diarydb[dbyl].dMonth[dbml].dDay.length;
	
	strMDB ='<div id=hmMidBox>';
	strMDB+='<table cellspacing=0 cellpadding=0 border=0 style="font-size:10px">';
	strMDB+='  <tr><td style="font-size:12px; line-height:18px">Daily Blog</td></tr>';
	document.write(strMDB);
	
	for (q=1; q<8; q++) {
		dbdl = dbdl - 1;
		if (dbdl < 0) {
			dbml = dbml - 1;
			if (dbml < 0) {
				dbyl = dbyl - 1;
				dbml = diarydb[dbyl].dMonth.length - 1;
			}
			dbdl = diarydb[dbyl].dMonth[dbml].dDay.length - 1;
		}
		document.write("<tr>");
		document.write('  <td style="font-size:12px; color:white; line-height:17px">' + diarydb[dbyl].dYear + "-" + diarydb[dbyl].dMonth[dbml].month + "-" + diarydb[dbyl].dMonth[dbml].dDay[dbdl].day + ' : <a href="http://www.taylor.com.hk/charles/diary.php?selYear=' + dbyl + '&selMonth=' + dbml + '#d' + diarydb[dbyl].dMonth[dbml].month + diarydb[dbyl].dMonth[dbml].dDay[dbdl].day + '">' + diarydb[dbyl].dMonth[dbml].dDay[dbdl].topic + "</a></td>");
		//document.write('  <td style="font-size:12px; color:white; line-height:17px">日誌暫停開放</td>');
		document.write("</tr>");
	}
	
	document.write('</table>');
	document.write('</div>');
}

function printSophiaPhotos() {
	var strMDB;
	var dbyl = diarydb.length-1;
	var dbml = diarydb[dbyl].dMonth.length-1;
	var dbdl = diarydb[dbyl].dMonth[dbml].dDay.length;
	
	strMDB ='<div id=hmSophiaPhotos>';
	strMDB+='<table cellspacing=0 cellpadding=0 border=0>';
	document.write(strMDB);
	document.write('<tr><td><img src=about/images/photobar.jpg></td></tr>');
	document.write('</table>');
	document.write('</div>');
}

function printDiaryHighlights(snum) {
	var dbyl = diarydb.length-1;
	var dbml = diarydb[dbyl].dMonth.length-1;
	var dbdl = diarydb[dbyl].dMonth[dbml].dDay.length;
	var rr = 1;
	
	document.write('<div id=hmDiaryHL>');
	//if (readCookie('loginchenblog') == 'fypyky') {
	//	document.write('<table cellspacing=0 cellpadding=0 border=0>');
	//	for (q=1; q<=snum; q++) {
	//		dbdl = dbdl - 1;
	//		if (dbdl < 0) {
	//			dbml = dbml - 1;
	//			if (dbml < 0) {
	//				dbyl = dbyl - 1;
	//				dbml = diarydb[dbyl].dMonth.length - 1;
	//			}
	//			dbdl = diarydb[dbyl].dMonth[dbml].dDay.length - 1;
	//		}
	//		document.write("<tr>");
	//		document.write("  <td>");
	//		printDiaryDetailDaily(dbyl, dbml, dbdl);
	//		//document.write("日誌暫停開放，如想繼續瀏覽，請與我們聯絡：fyccharles@hotmail.com");
	//		document.write("  </td>");
	//		document.write("</tr>");
	//	}
	//	document.write('</table>');	
	//} else {
		print07LoginForm("diary.php");
	//}

	document.write('</div>');
}

function countdowntoJune30 () {
	var now = new Date();
	var event = new Date("Jun 30 2006 00:00:01");
	var seconds = (event - now) / 1000;
	var minutes = seconds / 60;
	var hours = minutes / 60;
	var days = hours / 24;
	days = Math.round(days);
	return days;
}

function print07MidSlidTrips() {
	var tY = tripsdb.length-1;
	var tJ = tripsdb[tY].gowhere.length-1;
	
	document.write('');
	document.write('<table cellspacing=0 cellpadding=0 border=1>');
	for (a=0; a<5; a++) {
		
		document.write('  <tr>');
		document.write('    <td>');
		document.write('      <table cellspacing=0 cellpadding=0 border=0>');
		document.write('        <tr>');
		document.write('          <td>' + tY + '</td>');
		document.write('        </tr>');
		document.write('      </table>');
		document.write('    </td>');
		document.write('    <td>' + tripsdb[tY].gowhere[tJ].title + '</td>');
		document.write('  </tr>');
	}
	document.write('');
	document.write('</table>');
	document.write('');
}

function print07LoginForm(linkurl) {
	document.write('<form action="http://www.taylor.com.hk/charles/' + linkurl + '" method="post">');
	document.write('<table cellspacing=0 cellpadding=0 border=0>');
	document.write('  <tr><td width=36 class="black12">用戶：</td><td><input type="text" name="username" class="black12" size=15></td></tr>');
	document.write('  <tr><td width=36 class="black12">密碼：</td><td><input type="password" name="password" class="black12" size=15></td></tr>');
	document.write('  <tr><td width=36 class="black12"></td><td align=right><input value="發送" type="submit" name="red12"></td></tr>');
	document.write('</table>');
	document.write('</form>');
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}