<!doctype html>
<html dir="ltr" lang="zh-TW">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?# webTitle ?></title>	
<meta name="author" content="<?# webTitle ?>" />
<meta name="copyright" content="<?# webName ?>版權所有" />
<meta name="description" content="<?# webDescription ?>" />
<meta name="distribution" content="Taiwan" /> 
<meta name="keywords" content="<?# webKeyword ?>" />
<meta name="format-detection" content="telephone=no" />
<meta property="og:url" content="<?# RelLink ?><?# REQUESTURI ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?# ogTitle ?>" />
<meta property="og:description" content="<?# ogDescription ?>" />
<meta property="og:image" content="<?# ogImage ?>" />
<link href="/css/<?# webTemplates ?>/main.css" rel="stylesheet">
<link href="/css/<?# webTemplates ?>/layout.css" rel="stylesheet">
<link href="/css/webmap.css" rel="stylesheet">
<script src="/jquery/jquery-1.10.js"></script>
<script>
	if('<?# alertMsg ?>' != ''){
		alert('<?# alertMsg ?>');
		if ('<?# goBack ?>' == 'Y') history.back();
	}
	if ('<?# locationHref ?>' != '') location.href = '<?# locationHref ?>';

	var jsonA = '<?# jsonA ?>';
	var jsonN = '<?# jsonN ?>';
	var jsonF = '<?# jsonF ?>';
	var jsonP = '<?# jsonP ?>';
	var jsonB = '<?# jsonB ?>';

	function createList(json, htLink, areaName) {
		var li = $('<li></li>');
		li.append($('<p></p>').addClass('title').append($('<a></a>').attr('href', htLink).attr('title', areaName).text(areaName)));
		var ul = $('<ul></ul>');
		var ary = JSON.parse(json);
		$.each(ary, function(a, b) {
			var liL = $('<li></li>').addClass('typeL');
			liL.append($('<p></p>').append($('<a></a>').attr('href', b.link).attr('title', b.title).html('<i class="fa"></i>'+b.title)));
			if (b.aryS.length > 0) {
				var ulD = $('<ul></ul>');
				$.each(b.aryS, function(c, d){
					ulD.append($('<li></li>').addClass('typeD').append($('<a></a>').attr('href', d.link).attr('title', d.title).html('<i class="fa"></i>'+d.title)));
				});
				liL.append(ulD);
			}
			ul.append(liL);
		});
		li.append(ul);
		$('#jsonUL').append(li);
	}
	function createPBList(json, parent, typeClass, aryType) {
		$.each(json, function (a, b) {
			var li = $('<li></li>').addClass(typeClass);
			li.append($('<p></p>').append($('<a></a>').attr('href', b.link).attr('title', b.title).html('<i class="fa"></i>' + b.title)));
			if (b[aryType] && b[aryType].length > 0) {
				var ulD = $('<ul></ul>');
				createPBList(b[aryType], ulD, 'typeD', aryType);
				li.append(ulD);
			}
			if (b.arySC && b.arySC.length > 0) {
				var ulL2 = $('<ul></ul>');
				createPBList(b.arySC, ulL2, 'typeL', aryType);
				li.append(ulL2);
			}
			parent.append(li);
		});
	}
	$(function(){
		//list版
		if ('<?# flagC ?>' == '0') $('#listUL>li').eq(6).remove();
		if ('<?# flagB ?>' == '0') $('#listUL>li').eq(5).remove();
		if ('<?# flagP ?>' == '0') $('#listUL>li').eq(4).remove();
		if ('<?# flagF ?>' == '0') $('#listUL>li').eq(3).remove();
		if ('<?# flagN ?>' == '0') $('#listUL>li').eq(2).remove();
		if ('<?# flagA ?>' == '0') $('#listUL>li').eq(1).remove();
		//json版
		if ('<?# flagA ?>' == '1') createList(jsonA, '<?# htLink1 ?>', '文章區');
		if ('<?# flagN ?>' == '1') createList(jsonN, '<?# htLink2 ?>', '最新消息');
		if ('<?# flagF ?>' == '1') createList(jsonF, '<?# htLink3 ?>', '問與答');
		if ('<?# flagP ?>' == '1') {
			var liP = $('<li></li>');
			liP.append($('<p></p>').addClass('title').append($('<a></a>').attr('href', '<?# htLink4 ?>').attr('title', '產品').text('產品')));
			var ulP = $('<ul></ul>');
			var aryP = JSON.parse(jsonP);
			createPBList(aryP, ulP, 'typeL', 'arySP');
			liP.append(ulP);
			$('#jsonUL').append(liP);
		}
		if ('<?# flagB ?>' == '1') {
			var liB = $('<li></li>');
			liB.append($('<p></p>').addClass('title').append($('<a></a>').attr('href', '<?# htLink5 ?>').attr('title', '影音相本').text('影音相本')));
			var ulB = $('<ul></ul>');
			var aryB = JSON.parse(jsonB);
			createPBList(aryB, ulB, 'typeL', 'arySB');
			liB.append(ulB);
			$('#jsonUL').append(liB);
		}
		if('<?# flagC ?>' == '1'){
			var liC = $('<li></li>');
			liC.append($('<p></p>').addClass('title').append($('<a></a>').attr('href', '<?# htLink6 ?>').attr('title', '聯絡我們').text('聯絡我們')));
			$('#jsonUL').append(liC);
		}
	});
</script>
<?# headHTML ?>
</head>
<body<?# JumpBody ?>>
<?# bodyTopHTML ?>
<div class="webBox" style="margin: 0; padding: 0; border: 0; width: 100%;<?# JumpStyle ?>">
<?# JumpHTML ?>
<?# JumpScript ?>
<div class="wrapper" id="Sitemap">
	<?# header ?>
		<div class="waylink">
			<ol>
				<li><a title="首頁" href="/">首頁</a></li>
				<li>網站地圖</li>
			</ol>
		</div>
	<?# banner ?>
	<div class="wrap type3 workframe">
		<div class="contentMain">
			<div id="sideNav" class="catBox"><div class="bgTxt title">WEBMAP <div><h1>網站地圖</h1></div></div></div>
			<ul id="jsonUL">
				<li><p class="title"><a href="/" title="首頁">首頁</a></p></li>
			</ul>
		</div>
	</div>
	<?# footer ?>
</div>
</div>
</body>
</html>
<script>
	document.body.oncopy = event => {
		event.preventDefault();
		let textFont,
		copyFont = window.getSelection(0).toString();
		textFont = (copyFont.length > 10) ? copyFont + '\n\n' + '原文網址: <?# webTitle ?> <?# RelLink ?><?# REQUESTURI ?>\n' + '著作權歸作者所有。商業轉載請聯絡作者獲得授權，非商業轉載請註明出處。' : copyFont;
		return (event.clipboardData) ? event.clipboardData.setData('text', textFont) : window.clipboardData.setData('text', textFont);
	};
</script>