<!doctype html>
<!--[if IE 6]><html id="ie6" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if IE 7]><html id="ie7" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if IE 8]><html id="ie8" dir="ltr" lang="zh-TW"><![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html dir="ltr" lang="zh-TW">
<!--<![endif]-->
<head>
<!--[if lt IE 9]><script src="/js/html5.js"></script><![endif]-->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=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="/less/<?# webTemplates ?>/main.less" rel="stylesheet/less">
<link href="/less/<?# webTemplates ?>/layout.less" rel="stylesheet/less">
<link href="/css/<?# webTemplates ?>/main.css" rel="stylesheet">
<link href="/css/<?# webTemplates ?>/layout.css" rel="stylesheet">
<link href="/css/<?# webTemplates ?>/product.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 ?>';
</script>
<?# headHTML ?>
</head>
<body<?# JumpBody ?>>
<?# bodyTopHTML ?>
<div class="webBox" style="<?# JumpStyle ?>">
<?# JumpHTML ?>
<?# JumpScript ?>
<div class="wrapper">
    <?# header ?>
    <div class="pos_rel" id="sub_banner">
        <?# banner ?>
        <div class="pos_rel d_flex" id="page_title">
			<div class="workframe">
				<h2 class="talign_sm_left talign_center txt_white_5 pag_tit"><?# CategoryName ?></h2>
				<div class="waylink">
					<ol class="talign_sm_left talign_center nowrap_box">
						<li class="d_inblock"><a class="d_inblock txt_white_5" href="/" title="首頁">首頁</a></li>
						<li class="d_inblock"><a class="d_inblock txt_white_5" href="<?# htLink4 ?>" title="產品">產品</a></li>
						<php:repeater id="listR">
						<template>
						<li class="d_inblock"><a class="d_inblock txt_white_5" href="<?# Link ?>" title="<?# Name ?>"><?# Name ?></a></li>
						</template>
						</php:repeater>
						<li class="d_inblock talign_center txt_white_5"><?# ProductName ?></li>
					</ol>
				</div>
			</div>
        </div>
    </div>
	<div class="pos_rel" id="wrap">
		<div class="workframe">
			<aside class="pos_rel">
				<ul class="talign_center nowrap_box" id="category_nav">
					<li<?# categoryClass ?>><h4 class="pos_rel"><a class="d_inblock" href="<?# htLink4 ?>" title="全部產品">全部產品</a></h4></li>
					<php:repeater id="listC">
					<template>
					<li<?# className ?> data-type="1">
						<h4 class="pos_rel"><a class="d_inblock" href="<?# link ?>" title="<?# CategoryName ?>"><?# CategoryName ?></a><?# iLabel ?></h4>
						<?# SubList ?>
					</li>
					</template>
					</php:repeater>
				</ul>
			</aside>
			<div id="content_wrap">
				<div class="nowrap_box" id="productdetail">
					<div class="col_xl_6 d_xl_inblock" id="imglist">
						<div class="col_xl_11 img_box">
							<div><a class="d_inblock" href="<?# IconImage ?>" data-fancybox="gallery" title="<?# ProductName ?>"><img class="img_cover" src="<?# IconImage ?>" alt="<?# ProductName ?>" /></a></div>
							<php:repeater id="listPI">
							<template>
							<div><a class="d_inblock" href="<?# Image ?>" data-fancybox="gallery"><img class="img_cover" src="<?# Image ?>"></a></div>
							</template>
							</php:repeater>
						</div>
					</div>
					<div class="col_xl_6 d_xl_inblock" id="productinfo">
						<div class="effect_box" id="detail_title">
							<a class="d_inblock bg_secondary_5 txt_white_5 time" href="<?# CategoryLink ?>"><?# CategoryName ?></a>
							<div class="d_block"><h1 class="d_inblock txt_secondary_5 title"><?# ProductName ?></h1></div>
						</div>
						<div class="txt price_box"<?# sellStyle ?>>
                            <p class="d_inblock price"<?# priceStyle ?>><span class="d_inblock txt_num">&#36;</span><font class="d_inblock txt_num"><?# Price ?></font></p>
                            <p class="d_inblock old"<?# oldPriceStyle ?>><span class="d_inblock txt_num">&#36;</span><font class="d_inblock txt_num"><?# OldPrice ?></font></p>
                        </div>
						<article class="txt"><?# Introduction ?></article>
						<p class="nowrap_box txt"<?# NoStyle ?>><label class="d_inblock">編號</label><font class="d_inblock"><?# ProductNO ?></font></p>
                        <p class="nowrap_box txt" id="orderfunction"<?# orderStyle ?>>
                            <label class="d_inblock">數量</label>
                            <a class="d_inblock bg_black_3 txt_white_4 talign_center limit" href="javascript:void(0);" data-action="plusBtn" data-type="1">-</a>
                            <input class="d_inblock talign_center" type="text" id="q" name="q" value="1">
                            <a class="d_inblock bg_black_3 txt_white_4 talign_center" href="javascript:void(0);" data-action="plusBtn" data-type="2">+</a>
                        </p>
						<div class="nowrap_box txt" id="buy_btns">
							<a class="col_6 d_inblock talign_center bg_primary_5 txt_white_5 addcar" id="buy" href="javascript:void(0);" title="加入購物車"<?# orderStyle ?>>加入購物車</a>
							<a class="col_6 d_inblock talign_center bg_complement_5 txt_white_5 ask" href="<?# askLink ?>" title="諮詢此商品">諮詢此商品</a>
						</div>
					</div>
				</div>
				<div class="nowrap_box" id="google_shere">
					<div class="row col_xs_offset_6 d_xs_inblock"><?# GoogleSearch ?></div>
					<div class="row col_xs_offset_6 d_xs_inblock" id="community">
						<ul class="talign_xs_right nowrap_box">
							<li class="d_inblock"><div class="fb-share-button" data-href="<?# RelLink ?><?# REQUESTURI ?>" data-layout="button" data-size="small"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2F<?# RelLink ?><?# REQUESTURI ?>%2F&amp;src=sdkpreparse" class="fb-xfbml-parse-ignore">分享</a></div></li>
							<li class="d_inblock"><a href="https://twitter.com/share" class="twitter-share-button" data-lang="zh-tw" data-dnt="true">推文</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script></li>
							<li class="d_inblock"><div class="line-it-button" data-lang="zh_Hant" data-type="like" data-url="<?# RelLink ?><?# REQUESTURI ?>" data-share="true" style="display: none;"></div></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
    <div id="tabs_box">
        <div class="workframe">
            <div id="productTabs">
                <ul class="talign_center nowrap_box tabs">
                    <php:repeater id="listT">
                    <template>
                    <li class="d_inblock"><a class="d_block" href="#tab<?# NO ?>"><?# Title ?></a></li>
                    </template>
                    </php:repeater>
                    <li class="d_inblock"<?# SpStyle ?>><a class="d_block" href="#tabSp">規格</a></li>
                </ul>
                <div id="tabs_container">
                    <php:repeater id="listD">
                    <template>
                    <div id="tab<?# NO ?>" class="tab_content"><?# Description ?></div>
                    </template>
                    </php:repeater>
                    <div id="tabSp" class="tab_content"<?# SpStyle ?>><?# Specification ?></div>
                </div>
            </div>
        </div>
    </div>
    <?# footer ?>
</div>
</div>
</body>
</html>
<script src="/js/less.min.js" ></script>
<script>
	$(function(){
		$('#imglist .img_box').slick({
			autoplay: true,
			dots: false,
			arrows: false,
			fade: true
		});
		
		$('#orderfunction a[data-action="plusBtn"]').click(function(){
			var num = $(this).parent().children('input').val();
			num = ($(this).data('type') == '1') ?(parseInt(num) - 1):(parseInt(num) + 1);
			if(num < 1) num = 1;
			
			$(this).parent().children('input').val(num);
		});
		
		$('a#buy').click(function(){
			var re = /^[0-9]+$/;
			if(!re.test($('#q').val()) || $('#q').val() == "0"){
				alert("購買數量只能輸入大於0的阿拉伯數字!!");
				$('#q').focus();
				return false;
			}
			$.ajax({
				url: '/ajax/cart.php',
				async: false,
				type: 'POST',
				data: {'do':'add','id':'<?# ProductID ?>','q':$('#q').val()},
				dataType: 'json',
				context: $(this),
				success: function(JData){
					alert(JData["msg"]);
					location.href = (JData["err"] == "0") ?'<?# htLink7 ?>':location.href;
				},
				error:function(){
					alert('系統異常!請重新整理頁面再試一次!');
					location.href = location.href;
				}
			});
		});
		
		// 預設顯示第一個 Tab
		var _showTab = 0;
		$('#productTabs').each(function(){
			var $tab = $(this);
			var $defaultLi = $('ul.tabs li', $tab).eq(_showTab).addClass('active');
			$($defaultLi.find('a').attr('href')).siblings().hide();
			$('ul.tabs li', $tab).click(function() {
				var $this = $(this),
				_clickTab = $this.find('a').attr('href');
				$this.addClass('active').siblings('.active').removeClass('active');
				$(_clickTab).stop(false, true).fadeIn().siblings().hide();
				return false;
			}).find('a').focus(function(){
				this.blur();
			});
		});
	});
	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);// 相容IE
	};
</script>