<!-- <div class="masthead">
	<div class="row">
		<div class="col-lg-12 nav-left">
			<h3 class="text-muted">OASE
				<div class="pull-right"> 
					<a href="#register">註冊 <i class="fa fa-pencil"></i></a>
					<a href="#login">登入 <i class="fa fa-bolt"></i></a>
				</div>
			</h3>
		</div>
	</div>
	<ul class="nav nav-justified">
	  <li class="selected"><a href="#news"><i class="fa fa-star"></i> 最新活動</a></li>
	  <li><a href="#productlist"><i class="fa fa-th"></i> 飲品列表</a></li>
	  <li><a href="#storelist"><i class="fa fa-thumb-tack"></i> 分店列表</a></li>
	  <li><a href="#about"><i class="fa fa-quote-right"></i> 關於我們</a></li>
	  <li><a href="#term"><i class="fa fa-truck"></i> 服務條款</a></li>
	</ul>
</div> -->

<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
	<div class="navbar-header">
	  <div class="nav navbar-nav visible-xs row text-center">
		<a href="#productlist"><i class="fa fa-beer fa-huge"></i></a>
		<a href="#storelist"><i class="fa fa-map-marker fa-huge"></i></a>
		<a href="#news"><i class="brand" data-placement="left" rel="tooltip" title="綠洲"></i></a>
		<a href="#shopcart"><i class="fa fa-shopping-cart fa-huge"><span id="shopbadge" class="badge alert-danger"></span></i></a>
		<a id="login" href="#login" class="hidden" data-placement="right" rel="tooltip" title="登入"><i class="fa fa-sign-in fa-huge"></i></a>
		<a id="logout" style="cursor: pointer;" class="hidden" data-placement="right" rel="tooltip" title="登出" data-toggle="modal" data-target="#logoutconfirm"><i class="fa fa-sign-out fa-huge"></i></a>
	  </div>
	</div>
	<div class="navbar-collapse collapse">
	  <ul class="nav navbar-nav">
		<a class="navbar-brand brand" href="#news" data-placement="left" rel="tooltip" title="綠洲"></a>
		<li><a href="#productlist"><i class="fa fa-beer fa-lg"></i> 飲品</a></li>
		<li><a href="#storelist"><i class="fa fa-map-marker fa-lg"></i> 店鋪</a></li>
		<li><a href="#shopcart"><i class="fa fa-shopping-cart fa-lg"></i> 購物 <span id="shopbadge" class="badge alert-danger"></span></a></li>
		<li id="login" class="hidden"><a href="#login" data-placement="right" rel="tooltip" title="登入"><i class="fa fa-sign-in fa-lg"></i></a></li>
		<li id="logout" class="hidden"><a style="cursor: pointer;" data-placement="right" rel="tooltip" title="登出" data-toggle="modal" data-target="#logoutconfirm"><span id="name"></span> <i class="fa fa-sign-out fa-lg"></i></a></li>
	  </ul>
	</div>
  </div>
</div>
<!-- Modal -->
<div class="modal fade" id="logoutconfirm" role="dialog" aria-labelledby="logout_Label" aria-hidden="true">
	<div class="modal-dialog modal-sm">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				<h4 class="modal-title" id="logout_Label">登出</h4>
			</div>
			<div class="modal-body">
				<h4><i class="fa fa-info-circle"></i> 您確定要登出嗎?</h4>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="logout()">確定</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
  $().showUp('.navbar', {
	upClass: 'navbar-hide',
	downClass: 'navbar-show'
  });
  $(function(){
	$('[rel="tooltip"]').tooltip();
  });
  var url = "http://www.meigic.tw/oaseadmin/oaseadmin/checkapi/?type=isloggedin";
  if($.cookie('PHPSESSID') != undefined && $.cookie('PHPSESSID') != '')
	url += "&sessionid=" + $.cookie('PHPSESSID');
  $.get( url, function(data) {
	if(data == 0) {
		$("[id=login]").removeClass('hidden');
		$("[id=logout]").addClass('hidden');
		$("[id=name]").html('');
	} else {
		$("[id=login]").addClass('hidden');
		$("[id=logout]").removeClass('hidden');
		getname(function onComplete(name) {
			$("[id=name]").html(name);
		});
	}
	getshopcartcount(function onComplete(count) {
		if(count > 0)
			$("[id=shopbadge]").html(count);
		else
			$("[id=shopbadge]").html('');
	});
  });
  function logout() {
	var url = "http://www.meigic.tw/oaseadmin/oaseadmin/logoutapi/";
	if($.cookie('PHPSESSID') != undefined && $.cookie('PHPSESSID') != '')
		url += "?sessionid=" + $.cookie('PHPSESSID');
	$.get( url, function(data) {
		$.removeCookie('PHPSESSID', { path: '/' });
		if(currentpara[0] == 'shopcart')
			location.reload();
		else
			ajaxload("#header", "ajax/header.html");
	});
  }
  function getname(onCompleteEvent) {
	var url = "http://www.meigic.tw/oaseadmin/oaseadmin/getapi/?type=name";
	if($.cookie('PHPSESSID') != undefined && $.cookie('PHPSESSID') != '')
		url += "&sessionid=" + $.cookie('PHPSESSID');
	$.get( url, function(data) {
		var info = data.split(":");
			if(info[0] == "success")
				onCompleteEvent(info[1]);
	});
  }
  function getshopcartcount(onCompleteEvent) {
	var url = "http://www.meigic.tw/oaseadmin/oaseadmin/shopcartapi/?type=get_temp_order_count";
	if($.cookie('PHPSESSID') != undefined && $.cookie('PHPSESSID') != '')
		url += "&sessionid=" + $.cookie('PHPSESSID');
	$.get( url, function(data) {
		var info = data.split(":");
			if(info[0] == "success") {
				onCompleteEvent(info[1]);
			}
	});
  }
</script>