<?php session_start();
header('X-Frame-Options: SAMEORIGIN');
include "../conf/conn.php";
if (@$_GET["action"] == "load") {
	if (@$_SESSION["Tusername"]) {
		$url = "e-shop.php?page=5";
		echo "<script>";
		echo "window.location.href='$url'";
		echo "</script>";
	} else {
		$url = "e-shop.php?page=2";
		echo "<script>";
		echo "window.location.href='$url'";
		echo "</script>";
	}}
// page jump check
@$page = $_SESSION["page"];
if (@$_GET["page"]) {$page = $_GET["page"];}
$_SESSION["page"] = 0;
//echo $page;
//The following was originally a test for page redirection,
//I find the redirect unnecessary and google reported the page has create trash data
//I remove the redirect but leave some of the element('jump')
if (!@$_SESSION['jump']) {$jump = 0;} else { $jump = 1;}
if (@$_GET['id']) {
	$_SESSION['jump'] = 1;
	$_SESSION["p_id"] = $_GET["id"];
	$_SESSION["page"] = 6;
	$page = 6;

	$letterSetP_id = [1, 2, 3, 92];
	//if the url contain id paramater(product id)and designLetterSet,and the id is within listed numbers,we include letterset.php and kill e-shop.php
	if (isset($_GET['designLetterSet']) && in_array($_SESSION["p_id"], $letterSetP_id)) {
		$_SESSION['page'] = 0;
		// header("Location: http://{$_SERVER['HTTP_HOST']}/includes/webapps/letterset/letterset.php");
		include_once "../includes/webapps/letterset/letterset.php";
		die();
	}
}

/*
 *Original function on below
 */
// if(!@$_SESSION['jump']){$jump=0;}else{$jump=1;}
// if(@$jump==0){
// 	if(@$_GET['id']){
// 	$url = 'includes/product_select.php?id='.$_GET["id"].'&name='.$_GET["name"];
// 	$_SESSION['jump']=1;
// 	echo "<script language='javascript'
// 	type='text/javascript'>";
// 	echo "window.location.href='$url'";
// 	echo "</script>";  }
// }

?>


<!DOCTYPE html>
<html lang="en">
  <head>
  <meta name="keywords" content="Handmade Chocolates; Pastries; High Quality Ingredients; Gift; Wedding Banquet; Wedding Favor">
<meta name="h1" content="ABOUT SAYVOUR,Contact Us">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="icon" href="../img/icon/sayvour-icon.ico" type="image/x-icon">
<link rel="shortcut icon" href="" type="image/x-icon"> -->
<link rel="apple-touch-icon" sizes="180x180" href="http://jcshelleshop2.artech-system.com/img/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="http://jcshelleshop2.artech-system.com/img/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="http://jcshelleshop2.artech-system.com/img/favicon/favicon-16x16.png">
<link rel="manifest" href="http://jcshelleshop2.artech-system.com/img/favicon/site.webmanifest">
<script>
function addcart(){
<!-- Facebook Pixel Code -->


!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?

n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;

n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;

t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,

document,'script','https://connect.facebook.net/en_US/fbevents.js');

fbq('init', '1251610718262776');

fbq('track', "PageView");

fbq('track', 'AddToCart');

<noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=1251610718262776&ev=PageView&noscript=1" /></noscript>

<!-- End Facebook Pixel Code -->}
</script>

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W7ZQ3TF');</script>
<!-- End Google Tag Manager -->
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');

fbq('init', '1251610718262776');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1251610718262776&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->


<?php
if (isset($_GET["id"])) {
	$p_id = mysqlSecurity($conn, $_GET["id"]);
	$query = "select * from products where id='$p_id'";
	//echo $query;
	$result = mysqli_query($conn, $query);
	$row = mysqli_fetch_assoc($result);
	echo '
	<title>' . $row["name"] . '</title>
	<meta property="og:url" content="http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '" />
	<meta property="og:type" content="website" />
	<meta property="og:title" content="' . $row["zh_name"] . '" />
	<meta name="description" property="og:description"  content="Sayvour is an artisan confectionary specialising in handmade chocolates and pastries by using high quality ingredients from around the world." />
	<meta property="og:image" content="' . $row["image"] . '" />
	<meta property="og:image:url" content="' . $row["image"] . '" />';
}
?>

    <!-- load CSS -->
    <link href="bootstrap-3.3.6-dist/css/bootstrap.css" rel="stylesheet" type="text/css">
    <link href="bootstrap-3.3.6-dist/css/bootstrap-theme.css" rel="stylesheet" type="text/css">
	<link href="css/child-style.css" rel="stylesheet" type="text/css">
    <!-- Custom CSS -->
    <link href="css/simple-sidebar.css" rel="stylesheet">

    <!--Google reCaptcha's API-->
    <script>
        var CaptchaCallback = function () {
            var reCaptChaElements = document.querySelectorAll(".g-recaptcha");
            Object.keys(reCaptChaElements).forEach(function(key){
                var currForm = reCaptChaElements[key];
                while(currForm = currForm.parentNode){
                    if(currForm.nodeName == 'FORM') break;
                }
                var verify = currForm.querySelector('textarea[ng-model="reCaptchaCheck"]');
                if(verify == null){
                    currForm.querySelector('input[name="submit"]').setAttribute('disabled',true);
                }
                grecaptcha.render(reCaptChaElements[key], {
                    'sitekey' : '6LenKhYUAAAAAIwseMuOsziCxRQ5bxg5-gals1Cv',
                    'callback': reCaptchaVerify.bind(null,key)
                    }
                );
            })
        };

        function reCaptchaVerify(key,response){
            var captchas = document.querySelectorAll('.g-recaptcha-response');
            var currForm = captchas[key];
            while(currForm = currForm.parentNode){
                if(currForm.nodeName == 'FORM') break;
            }
            if(response === captchas[key].value){
                var verify = currForm.querySelector('textarea[ng-model="reCaptchaCheck"]');
                if(verify != null){
                    verify.value = 'true';
                    var $e = angular.element(verify);
                    $e.triggerHandler('input');
                } else {
                    currForm.querySelector('input[name="submit"]').removeAttribute('disabled');
                }
            }
        }
    </script>
    <script src="https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit" async defer></script>

    <!--Google reCaptcha's DIV styling-->
     <style>
      @media screen and (max-width: 575px){
           #rc-imageselect, .g-recaptcha {
               transform:scale(0.69);
               -webkit-transform:scale(0.69);
               transform-origin:0 0;
               -webkit-transform-origin:0 0;
            }
        }
    </style>

  </head>

  <body>


<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W7ZQ3TF"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->


  <script>function gender(){document.getElementById( 'gender' ).value = 2;} </script>
  <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-85255031-1', 'auto');
  ga('send', 'pageview');
  </script>


  	<!-- top list -->
  	<?php include "includes/aboutus-topbar.php";?>
  	<!-- end top list -->




    <!-- body -->
    <div class="container" id="container-wrap" style="width: 100%;padding-right: 0px;padding-left: 0px;">





            <!-- main page -->
            <!-- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 animate-show"> -->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 ">
                <div class="tab-content">

                    <?php
//echo "page is ".$page;
if (isset($_GET['cs_info'])):
	include "includes/cs_info.php";
else:

?>

                  <?php include "includes/aboutus-details.php"?>


                    <?php endif;?>

                    </div>
                </div>
            </div>
        </div>
            <!-- end main page -->
    </div>
    <!-- end body-->
	<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-57997cf4862a16ef"></script>

  </body>
  <?php include "includes/footer.php";
mysqli_close($conn);?>
  <!-- load js -->



<!-- jQuery -->

<?php if ($page == "10") {
	//The follow script is a twist to stop user change language on verify page.
	//To prevent unexpected data entry and confusion
	//(changing lang won't POST data to the next page)
	$stopChangeLangScript = <<<'EOD'
    <script>
        var changeLangBtn = document.querySelector('#change_lang');
        changeLangBtn.addEventListener('click',function(ev){
            ev.preventDefault();
            alert('如需要更換語言，請先離開訂單確認頁面。\n貨品資料會保留在你的購物車內。');
        });
    </script>
EOD;
	echo $stopChangeLangScript;
}
?>

<script src="js/left-sidebar/jquery.js"></script>

  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">

  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
  <script>
  	var d = new Date();
    var n = d.getHours();
	var x = d.getDay();
	if(x >5){
    if(n > 16){
    $('#datepicker').datepicker({ beforeShowDay: noSunday,
         minDate: '+3' ,
		 dateFormat : "yy-mm-dd"

    });
    $('#datepicker1').datepicker({ beforeShowDay: noSunday,
         minDate: '+3' ,
		 dateFormat : "yy-mm-dd"
    });
	}else{
	$('#datepicker').datepicker({ beforeShowDay: noSunday,
         minDate: '+2' ,
		 dateFormat : "yy-mm-dd"

    });
    $('#datepicker1').datepicker({ beforeShowDay: noSunday,
         minDate: '+2' ,
		 dateFormat : "yy-mm-dd"
    });
	}}else{
	if(n > 16){
    $('#datepicker').datepicker({ beforeShowDay: noSunday,
         minDate: '+4' ,
		 dateFormat : "yy-mm-dd"

    });
    $('#datepicker1').datepicker({ beforeShowDay: noSunday,
         minDate: '+4' ,
		 dateFormat : "yy-mm-dd"
    });
	}else{
	$('#datepicker').datepicker({ beforeShowDay: noSunday,
         minDate: '+3' ,
		 dateFormat : "yy-mm-dd"

    });
    $('#datepicker1').datepicker({ beforeShowDay: noSunday,
         minDate: '+3' ,
		 dateFormat : "yy-mm-dd"
    });
	}}
	function noSunday(date){
		var day = date.getDay();
		return [(day > 0), ''];
	};
  </script>

<!-- Bootstrap Core JavaScript -->
<script src="js/left-sidebar/bootstrap.min.js"></script>

<!-- Menu Toggle Script -->
<script>
<?php
if ($page == 1) {
	echo '$("#wrapper2").toggleClass("toggled2");';
}
if ($page == 7) {
	echo '$("#wrapper2").toggleClass("toggled2");';
}
?>

$(function() {
$("#menu-toggle").click(function(e) {
$("#wrapper2").toggleClass("toggled2",false);
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});

$(window).resize(function(){

$("#wrapper").toggleClass("toggled",false);

});


$("#container-wrap").click(function() {
$("#wrapper").toggleClass("toggled",false);
});

$("#account").click(function(e) {
$("#wrapper2").toggleClass("toggled2",false);
e.preventDefault();
$("#wrapper3").toggleClass("toggled3");
});

$(window).resize(function(){

$("#wrapper3").toggleClass("toggled3",false);

});


$("#container-wrap").click(function() {
$("#wrapper3").toggleClass("toggled3",false);
});

<!-- cart-toggle --!>

$("#cart-toggle").click(function(e) {
$("#wrapper").toggleClass("toggled",false);
$("#wrapper3").toggleClass("toggled3",false);
e.preventDefault();
$("#wrapper2").toggleClass("toggled2");
});

$(window).resize(function(){
$("#wrapper2").toggleClass("toggled2",false);

});


$("#container-wrap").click(function() {
$("#wrapper2").toggleClass("toggled2",false);
});

});



</script>



   <script>
jQuery(document).ready(function(){
    // This button will increment the value
    $('.qtyplus').click(function(e){
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        fieldName = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+fieldName+']').val());
        // If is not undefined
        if (!isNaN(currentVal)) {
            // Increment
            $('input[name='+fieldName+']').val(currentVal + 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+fieldName+']').val(0);
        }
    });
    // This button will decrement the value till 0
    $(".qtyminus").click(function(e) {
        // Stop acting like a button
        e.preventDefault();
        // Get the field name
        fieldName = $(this).attr('field');
        // Get its current value
        var currentVal = parseInt($('input[name='+fieldName+']').val());
        // If it isn't undefined or its greater than 0
        if (!isNaN(currentVal) && currentVal > 1) {
            // Decrement one
            $('input[name='+fieldName+']').val(currentVal - 1);
        } else {
            // Otherwise put a 0 there
            $('input[name='+fieldName+']').val(1);
        }
    });
});

    </script>
</html>