<!DOCTYPE HTML>
<html lang="zh-TW">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Looknow!</title>
        <!-- jQuery -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

        <!-- Latest compiled and minified CSS -->
        <!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"-->
        <link rel="stylesheet" href="<?php echo asset('css/bootstrap.css'); ?>">

        <!-- Optional theme -->
        <!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"-->
        <link rel="stylesheet" href="<?php echo asset('css/bootstrap-theme.css'); ?>">

        <!-- Latest compiled and minified JavaScript -->
        <!--script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script-->

        <!-- Latest compiled and minified JavaScript -->
        <script src="<?php echo asset('js/bootstrap.js'); ?>"></script>
        <script src="<?php echo asset('js/jquery.mousewheel.js'); ?>"></script>
        <script src="<?php echo asset('js/scroll.js'); ?>"></script>  
        <!-- customized css -->
        <link rel="stylesheet" href="<?php echo $_FRONTCONST['LOOKNOW_CSS']; ?>">

        <!--Waterfall-->
<?php /*        <link rel="stylesheet" href="<?php echo asset('css/reset.css'); ?>">
        <link rel="stylesheet" href="<?php echo asset('css/waterfall.css'); ?>">
        <script src="<?php echo asset('js/libs/handlebars/handlebars.js'); ?>"></script>
        <script src="<?php echo asset('js/libs/jquery.easing.js'); ?>"></script>
        <script src="<?php echo asset('js/waterfall.min.js'); ?>"></script>
*/ ?>
<script>

////////Ajax////////
function islike(article_id){
        var elementId = "ARTICLE_" + article_id;
        var user_id = "<?php echo Session::get('userId'); ?>";
        var URLs = "<?php echo URL::to('admin/front/islike'); ?>";
        $.get(URLs, {"article_id":article_id, "user_id":user_id}, function(likeOrNot){
                if(likeOrNot >0)
                        document.getElementById(elementId).setAttribute("src","<?php echo asset('images/icons/icon_like_on.png'); ?>");
        });
}
</script>

 <?php $__env->startSection('header'); ?>

 <?php echo $__env->yieldSection(); ?>
    </head>
    <body>
        <nav  id="menu"  class="navbar navbar-looknow navbar-fixed-top" style="z-index: 34; height:70px;">
            <!--div class="container"-->
                <div class="navbar-header">
                    <a style="margin-top:10px;" class="navbar-brand dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                        <!--span class="glyphicon glyphicon-menu-hamburger" aria-hidden="true"></span-->
			<img class="unactive" src="<?php echo asset('images/icons/icon_menu.png'); ?>" />
                    </a>
                    <ul class="dropdown-menu mini_menu" aria-labelledby="dropdownMenu1">
                        <div>
		<?php foreach($_FRONTCONST["HEADER_BUTTONS"] as $headerButton): ?>
                <li><a href="<?php echo URL::to('admin/front/?cid='.$headerButton->id.'#anchor'); ?>"><?php echo $headerButton->title; ?></a></li>
                <?php endforeach; ?>
                        <!--li style="padding-top:10px;"><a href="#">Action</a></li>
                        
                        <li id="test"><a href="#">FASHION</a></li>
                        <li><a href="#">MAKE</a></li>
                        <li><a href="#">OUTFIT</a></li>
                        <li><a href="#">FOOD</a></li>
                        <li><a href="#">SPORT</a></li-->
                        <li role="separator" class="divider"></li>
                        <li><a href="<?php echo URL::to('admin/front/lookers#lookers'); ?>">LOOKERS</a></li>
                        <li><a href="<?php echo URL::to('admin/front/brandlist/1'); ?>">BRANDS</a></li>
                        <li><a href="<?php echo URL::to('admin/front/about'); ?>">ABOUT</a></li>

                        </div>
                        <img class="mini_menu_style" src="<?php echo asset('images/icons/mini_menu.png'); ?>">
                    </ul>
                </div>
			<a id ="logo" class="menu_logo" href="<?php echo URL::to('admin/front'); ?>"></a>

                <form class="navbar-form navbar-right" action="<?php echo URL::to('admin/front/searchresult'); ?>" method="get">
		      <input type="text" class="navbar-text" placeholder="Search for..." name = "searchContent" hidden>
		      <a class="menu_icon menu_search hidden-sm hidden-xs" href="#" onclick="$(this).closest('form').submit()"><!--span class="glyphicon glyphicon-search" aria-hidden="true"></span--></a>
                    <a onclick="return(chk_login());" class="menu_icon menu_cart" href="<?php echo URL::to('admin/front/cart/1'); ?>"><!--span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span--></a>
                    <a class="navbar-text" href="#"><!--span class="glyphicon glyphicon-user" aria-hidden="true"></span--></a>
                    <a class="menu_icon menu_member dropdown-toggle" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                        <!--span class="glyphicon glyphicon-user" aria-hidden="true"></span-->
		    </a>
		    <ul class="dropdown-menu pull-right" aria-labelledby="dropdownMenu2">
			<?php if(Session::get('userId')==1): ?>
                        <li><a class="member_icon" id = "login_dialog">LOGIN</a></li>
			<?php else: ?>
                       <li><a class="member_icon" id = "logout_dialog" href="<?php echo URL::to('admin/front/logout'); ?>">LOGOUT</a></li>
			<?php endif; ?>	
			<?php if(Session::get('userId') !=1 || !Session::has('userId')): ?>
                        <li><a class="member_icon" href="<?php echo URL::to('admin/front/profile'); ?>">身份：<?php echo Session::get('userName'); ?></a></li>
			<?php endif; ?>	
		    </ul>

		
                </form><!--/.navbar-collapse -->
            <!--/div-->
        </nav>

        <!--div class="container inline-content">
	<a href="<?php echo URL::to('admin/front'); ?>">
            <img src="<?php echo $_FRONTCONST['LOGO']; ?>">
	</a>
        </div-->
        <div id="menu2" class="navbar navbar-looknow navbar-fixed-top hidden-sm hidden-xs text-center" style="min-height: 45px;top:70px;box-shadow:1px 2px 1px #555;">
            <ul class="nav nav-pills">
		<?php foreach($_FRONTCONST["HEADER_BUTTONS"] as $headerButton): ?>
                <li><a href="<?php echo URL::to('admin/front/?cid='.$headerButton->id.'#anchor'); ?>" class="category" data-id="<?php echo $headerButton->id; ?>"><?php echo $headerButton->title; ?></a></li>
		<?php endforeach; ?>
            </ul>
        </div>
<?php /*        <div class="container">	*/ ?>

        <!--div class="col-md-12" style="background-color: rgb(249, 247, 241);margin-top:-50px;padding-top:50px;"-->
            <!-- content -->
		<?php $__env->startSection('content'); ?>

		<?php echo $__env->yieldSection(); ?>
            <div class="col-md-12 footer_info">
                <div class="fanpage" style="position: fixed;bottom: -190px;z-index: 999;width:450px; background-color: #fff;">
                    <div class="col-md-12" style="width:100%;">
                        <!--div class="col-md-2">
                            <img style="margin: 0 auto;display: block;max-width: 100%;" src="<?php echo asset('images/icons/looknowfanpage.png'); ?>">
                        </div>
                        <div class="col-md-10">
                            <div class="fb-page" data-href="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts"><a href="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts">Gapure</a></blockquote></div></div>
                        </div-->
                    </div>
                </div>
                
            </div>

            <div class="col-md-4 col-md-offset-4 " id="since" style="clear: both;padding: 20px;">
                    <div class="media" style="    width: 100%;">
                        
                        <img style="margin: 0 auto;display: block;" src="<?php echo asset('images/icons/since.png'); ?>">
                        
                    </div>
                </div>


<?php /*
            <div class="col-xs-12 footer_info">
                <div class="col-md-offset-4 col-md-4 fanpage" style="top:250px;">
                    <div class="col-md-12" style="width:100%;">
                        <div class="col-md-2">

                            <img style="margin: 0 auto;display: block;max-width: 100%;" src="<?php echo asset('images/icons/looknowfanpage.png'); ?>">
                        </div>
                        <div class="col-md-10">
                            <div class="fb-page" data-href="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts" data-small-header="true" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="false"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts"><a href="https://www.facebook.com/gapure.official?ref=ts&amp;fref=ts">Gapure</a></blockquote></div></div>
                        </div>
                    
                    </div>
                </div>
                
            </div>

            <div class="col-md-4 col-md-offset-4 " id="since" style="padding-bottom:20px;">
                    <div class="media" style="    width: 100%;">
                        
                        <img style="margin: 0 auto;display: block;" src="<?php echo asset('images/icons/since.png'); ?>">
                        
                    </div>
            </div>
*/ ?>
<?php if(Session::get('userId') == 1): ?>
<!--login wraper-->

<?php if($errors->any()): ?>
<div class="col-xs-12 login_wraper">
<?php else: ?>
<div class="col-xs-12 login_wraper hidden">
<?php endif; ?>
    <div class="col-md-6 col-md-offset-3 login" style="background-color:#fff;top:15%;padding:20px;">
        <div class="col-lg-12 page_title text-center" style="border:1px solid #555;height:100%;">
              <div class="col-lg-10 col-lg-offset-1">
                <h2>LOGIN</h2>
              </div>
              <div class="col-lg-12">
                  <hr class="point">
              </div>
              <div class="col-lg-10 col-lg-offset-1">
                <div style="margin-bottom:0px;">
                    <a href="#" id="fb-login" class="btn btn_looknow_fb col-xs-12 times btn-lg" style="margin-bottom:15px;">LOGIN WITH FACEBOOK</a>
                    <p style="color:#aaa;">或使用LOOKNOW帳號登入/註冊</p>
                </div>
              </div>

                <div class="col-lg-12" style="margin-top: -15px;">
                  <hr class="point">
                <?php if($errors->any()): ?>
                  <div class="col-lg-10 col-lg-offset-1 alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>錯誤!</strong> <?php echo $errors->first(); ?>

                  </div>
                <?php endif; ?>
                </div>

                <div class="col-lg-10 col-lg-offset-1">
                  <form action="<?php echo URL::to('admin/front/login'); ?>" method="post" accept-charset="utf-8" style="padding-bottom:30px;">
                      <div class="form-group">
                        
                        <input style="height:45px;" type="text" class="form-control" name="UserAccount" id="exampleInputEmail1" placeholder="電子信箱/帳號">
                      </div>
                      <div class="form-group">
                      
                        <input style="height:45px;" type="password" class="form-control" name="password" id="exampleInputPassword1" placeholder="密碼">
                      </div>
                      
                      
                      <input type="submit" class="btn btn-default" value = "登入/註冊" />
                    </form> 
              </div>

        </div>
    </div>        
</div>
<?php endif; ?>
<!---------------->

        <script language="JavaScript">
           $(window).load(function(){
                $('#myModal').modal('show');
            });
////FB///////////
            window.fbAsyncInit = function() {
                    FB.init({
                    appId      : '558716530932928',
                    xfbml      : true,
                    version    : 'v2.4'
                    });

//////////
            function updateButton(response){
                  var button = document.getElementById('fb-auth'), r = [], check = 1;

                  if (response.status === 'connected') {
                      FB.api('/me?fields=name,id,gender,email', function(response) {
                      for (var key in response) {
                          r.push(response[key]);
                  }
                  console.log(r);
                                var url = "<?php echo URL::to('admin/front/fblogin'); ?>" + '/'+ r;
        //`                        var url = "http://106.187.42.25/looknow/jack/looknow/public/admin/user/fblogin" + '/'+ r;
                                window.location.href= url;
                     });
                  }
                else
                 {
                        FB.login(function(response) {
                                Log.info('FB.login callback', response);
                        });
                 }
                }
                document.getElementById("fb-login").onclick = function(){
                        FB.getLoginStatus(updateButton);
                        FB.Event.subscribe('auth.statusChange', updateButton);
                }
            };

                  (function(d, s, id){
                     var js, fjs = d.getElementsByTagName(s)[0];
                     if (d.getElementById(id)) {return;}
                     js = d.createElement(s); js.id = id;
                     js.src = "//connect.facebook.net/en_US/sdk.js";
                     fjs.parentNode.insertBefore(js, fjs);
                   }(document, 'script', 'facebook-jssdk'));

//////////////
</script>

<script>
            $(function(){
                $(window).resize(function(){    
                    menu_width = $('#menu').width() - 50;
                    $('#logo').css('left',menu_width/2);
                });
                $(document).ready(function(){           
                    menu_width = $('#menu').width() - 50;
                    $('#logo').css('left',menu_width/2);
                });
            });
</script>

<script>
function chk_login(){
   var user_id ="<?php echo Session::get('userId'); ?>";
   if(user_id == '1' ){
	$('.login_wraper').removeClass('hidden');
	$('.hidelogin').fadeIn();
	return false;
   }
}
//////ajax/////////
function oneAction(thisObject,object_id,action,blogger_id){
   var user_id ="<?php echo Session::get('userId'); ?>";
   if(user_id == '1' ){
	$('.login_wraper').removeClass('hidden');
	$('.hidelogin').fadeIn();
	return false;
   }
   else{
        var elementId = thisObject +'_' +object_id;
        var likeNum = '#like_' +object_id;
        var user_id = "<?php echo Session::get('userId'); ?>";
        var URLs = "<?php echo URL::to('admin/front/oneAction'); ?>";
        $.get(URLs, {"object":thisObject ,"object_id":object_id,"action":action, "user_id":user_id,"blogger_id":blogger_id}, function(showview){
                if(showview['show'] >0)
                        $("#"+elementId).attr("src","<?php echo asset('images/icons/icon_like_on.png'); ?>");
                        //document.getElementById(elementId).setAttribute("src","<?php echo asset('images/icons/icon_like_on.png'); ?>");
                else {
                    console.log(elementId);
                    document.getElementById(elementId).setAttribute("src","<?php echo asset('images/icons/icon_like_off.png'); ?>");
                }
                $(likeNum).text(showview['num']);
        });
    }
}

        //動態調整FANPAGE高度跟置中
        /*    
           $(function(){
                $(window).resize(function(){    
                    x = $('.fanpage').innerHeight();
                    y = $('#since').innerHeight();
                    z = (x - y)/2;
                    $('#since').css('margin-top',z);
                });
                $(document).ready(function(){           
                    x = $('.fanpage').innerHeight();
                    y = $('#since').innerHeight();
                    z = (x - y)/2;
                    $('#since').css('margin-top',z);
                });
            });
*/
</script>
<script>        

        //遮罩

        $('.screen').mouseenter(function(){
            $(this).children('.cover').fadeIn("fast");
        });

        $('.screen').mouseleave(function(){
            $(this).children('.cover').fadeOut("fast");
        });

/*	$(function(){
                $(window).resize(function(){    
                    coverheight = ($('.cover').innerHeight() - 118)/2;
                    $('.cover').children('img').css('marginTop',coverheight);
                });
                $(document).ready(function(){           
                    coverheight = ($('.cover').innerHeight() - 118)/2;
                    $('.cover').children('img').css('marginTop',coverheight);
                });
            });
*/

        //點黑色遮罩，隱藏LOGIN
        $('.login').mouseenter(function(){
            $('.login_wraper').removeClass( "hidelogin" );
        });

        $('.login').mouseleave(function(){
            $('.login_wraper').addClass( "hidelogin" );
        });

        $('.login').click(function(){
            $('.login_wraper').css('display','block');

        });

        $('.login_wraper').click(function(){
            $('.hidelogin').fadeOut();
        });
        
	$('#login_dialog').click(function(){
	$('.login_wraper').removeClass('hidden');
		$('.hidelogin').fadeIn();
	});

        $(function(){
                $('body').mousewheel(function(event, delta){
                    // delta 若是負值是滾輪往下滾；反之則是滾輪往上滾
                    console.log(delta);
                    if(delta <= 0){
                        $('#menu2').stop().animate({top:'-45px'},"fast");  
                    }
                    else {
                        $('#menu2').stop().animate({top:'70px'},"fast");

                    }
                });
        });

        $(function(){
                $(window).scroll(function(){ 
                    x = $(window).scrollTop()+$(window).height();
                    y = $('html').height();

/*                    if(x - y >= 0){
                        $('.fanpage').animate({bottom:'115px',opacity:'1'},"fast");
                    }
                    else {
                        $('.fanpage').animate({bottom:'-190px',opacity:'0'},"fast");
                    }
*/
                 });
                //$('body').css('float','left');
         });


        $(function(){
                $(window).resize(function(){    
                    body_width = $('html').width();
                    d = body_width - 450;
                    $('.fanpage').css('left',d/2);
                });
                $(document).ready(function(){           
                    body_width = $('html').width();
                    d = body_width - 450;
                    $('.fanpage').css('left',d/2);
                });
            });

    </script>

    </body>
</html>

