<nav class="navbar navbar-findcond navbar-fixed-top header-layout">
	<div class="pt_main_hdr" id="header_change">
		<div class="navbar-header">
			<?php if ($pt->page != 'login') { ?>
			<!--<ul class="nav navbar-nav">
				<li>
				   <div id="open_slide" class="pt_opn_sid_menu">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z" /></svg>
				   </div>
				</li>
			</ul>-->
			<?php } ?>
			<a class="navbar-brand logo-img" href="{{LINK }}" itemprop="url">
				<?php if ((!empty($pt->get_video) && $pt->get_video->is_movie) || $pt->page == 'movies') { ?>
					<img itemprop="logo" src="{{CONFIG theme_url}}/img/logo-light.png" alt="{{CONFIG title}}">
				<?php } else { ?>
					<img itemprop="logo" src="{{CONFIG theme_url}}/img/<?php echo ($pt->mode != 'night') ? 'logo' : 'logo-light';?>.png" alt="{{CONFIG title}}">
				<?php } ?>
			</a>
			
			<?php if ($pt->page != 'login') { ?>
			<ul class="nav navbar-nav sec_lay_hdr">
				<li class="pt_hide-from-mobile <?php echo ($pt->page == 'latest') ? 'active': '';?>" id="latest_menu_" tooltip="{{LANG latest_videos}}" flow="down">
					<a href="{{LINK videos/latest}}" data-load="?link1=videos&page=latest">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M3 6c-.55 0-1 .45-1 1v13c0 1.1.9 2 2 2h13c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1-.45-1-1V7c0-.55-.45-1-1-1zm17-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8 12.5v-9l5.47 4.1c.27.2.27.6 0 .8L12 14.5z"/></svg>
				    </a>
				</li>
				<li class="pt_hide-from-mobile <?php echo ($pt->page == 'top') ? 'active': '';?>" id="top_menu_" tooltip="{{LANG top_videos}}" flow="down">
					<a href="{{LINK videos/top}}" data-load="?link1=videos&page=top">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M6.4 9.2h.2c.77 0 1.4.63 1.4 1.4v7c0 .77-.63 1.4-1.4 1.4h-.2c-.77 0-1.4-.63-1.4-1.4v-7c0-.77.63-1.4 1.4-1.4zM12 5c.77 0 1.4.63 1.4 1.4v11.2c0 .77-.63 1.4-1.4 1.4-.77 0-1.4-.63-1.4-1.4V6.4c0-.77.63-1.4 1.4-1.4zm5.6 8c.77 0 1.4.63 1.4 1.4v3.2c0 .77-.63 1.4-1.4 1.4-.77 0-1.4-.63-1.4-1.4v-3.2c0-.77.63-1.4 1.4-1.4z"/></svg>
				    </a>
				</li>
				<li class="pt_hide-from-mobile <?php echo ($pt->page == 'trending') ? 'active': '';?>" id="trending_menu_" tooltip="{{LANG trending}}" flow="down">
					<a href="{{LINK videos/trending}}" data-load="?link1=videos&page=trending">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M16.85 6.85l1.44 1.44-4.88 4.88-3.29-3.29c-.39-.39-1.02-.39-1.41 0l-6 6.01c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L9.41 12l3.29 3.29c.39.39 1.02.39 1.41 0l5.59-5.58 1.44 1.44c.31.31.85.09.85-.35V6.5c.01-.28-.21-.5-.49-.5h-4.29c-.45 0-.67.54-.36.85z"/></svg>
				    </a>
				</li>
				<?php if ($pt->config->article_system == 'on'): ?>
				<li class="hide-from-mobile <?php echo ($pt->page == 'articles') ? 'active': '';?>" id="articles_menu_" tooltip="{{LANG articles}}" flow="down">
					<a href="{{LINK articles}}" data-load="?link1=articles">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20,11H4V8H20M20,15H13V13H20M20,19H13V17H20M11,19H4V13H11M20.33,4.67L18.67,3L17,4.67L15.33,3L13.67,4.67L12,3L10.33,4.67L8.67,3L7,4.67L5.33,3L3.67,4.67L2,3V19A2,2 0 0,0 4,21H20A2,2 0 0,0 22,19V3L20.33,4.67Z"/></svg>
				    </a>
				</li>
				<?php endif ?>
				<?php if ($pt->config->movies_videos == 'on') { ?>
				<li class="hide-from-mobile <?php echo ($pt->page == 'movies') ? 'active': '';?>" id="movies_menu_" tooltip="{{LANG movies}}" flow="down">
					<a href="{{LINK movies}}" data-load="?link1=movies">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M18 4v1h-2V4c0-.55-.45-1-1-1H9c-.55 0-1 .45-1 1v1H6V4c0-.55-.45-1-1-1s-1 .45-1 1v16c0 .55.45 1 1 1s1-.45 1-1v-1h2v1c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-1h2v1c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1s-1 .45-1 1zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z"/></svg>
				    </a>
				</li>
				<?php } ?>
				<?php if ( $pt->config->popular_channels == 'on') { ?>
				<li class="hide-from-mobile <?php echo ($pt->page == 'popular_channels') ? 'active': '';?>" id="popular_channels_menu_" tooltip="{{LANG popular_channels}}" flow="down">
					<a href="{{LINK popular_channels}}" data-load="?link1=popular_channels">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M8 19h8c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1H8c-.55 0-1 .45-1 1v13c0 .55.45 1 1 1zm-5-2h2c.55 0 1-.45 1-1V7c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1zM18 7v9c0 .55.45 1 1 1h2c.55 0 1-.45 1-1V7c0-.55-.45-1-1-1h-2c-.55 0-1 .45-1 1z"/></svg>
				    </a>
				</li>
				<?php } ?>
				<?php if ( $pt->config->stock_videos == 'on') { ?>
				<li class="hide-from-mobile <?php echo ($pt->page == 'stock') ? 'active': '';?>" id="stock_videos_menu_" tooltip="{{LANG stock_videos}}" flow="down">
					<a href="{{LINK videos/stock}}" data-load="?link1=videos&page=stock">
						<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z" /></svg>
				    </a>
				</li>
				<?php } ?>
				<?php if ( $pt->config->shorts_system == 'on') { ?>
				<li class="hide-from-mobile <?php echo ($pt->page == 'shorts') ? 'active': '';?>" id="stock_videos_menu_" tooltip="{{LANG shorts}}" flow="down">
					<a href="{{LINK shorts}}" data-load="?link1=shorts&id=">
						<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 168.071 168.071" xml:space="preserve"> <g> <g> <path opacity="0.5" style="fill: currentColor;" d="M154.932,91.819L42.473,27.483c-2.219-1.26-4.93-1.26-7.121-0.027 c-2.219,1.233-3.588,3.533-3.615,6.026L31.08,161.059c0,0,0,0,0,0.027c0,2.465,1.369,4.766,3.533,6.026 c1.123,0.63,2.355,0.959,3.615,0.959c1.205,0,2.438-0.301,3.533-0.931l113.116-63.214c2.219-1.26,3.588-3.533,3.588-6.053 c0,0,0,0,0-0.027C158.465,95.38,157.123,93.079,154.932,91.819z"></path> <g id="XMLID_15_"> <g> <path style="fill:currentColor;" d="M79.952,44.888L79.952,44.888c3.273-3.273,2.539-8.762-1.479-11.06l-7.288-4.171 c-2.75-1.572-6.212-1.109-8.452,1.128l0,0c-3.273,3.273-2.539,8.762,1.479,11.06l7.291,4.169 C74.25,47.589,77.712,47.126,79.952,44.888z"></path> <path style="fill:currentColor;" d="M133.459,65.285L99.103,45.631c-2.75-1.572-6.209-1.109-8.449,1.128l0,0 c-3.273,3.273-2.539,8.759,1.479,11.057l23.497,13.44L23.931,122.5l0.52-103.393l19.172,10.964 c2.722,1.558,6.152,1.098,8.367-1.12l0.104-0.104c3.24-3.24,2.514-8.674-1.463-10.95L21,0.948 c-2.219-1.26-4.93-1.26-7.121-0.027c-2.219,1.233-3.588,3.533-3.615,6.026L9.607,134.524c0,0,0,0,0,0.027 c0,2.465,1.369,4.766,3.533,6.026c1.123,0.63,2.355,0.959,3.615,0.959c1.205,0,2.438-0.301,3.533-0.931l113.116-63.214 c2.219-1.26,3.588-3.533,3.588-6.053c0,0,0,0,0-0.027C136.992,68.845,135.65,66.545,133.459,65.285z"></path> </g> </g> </g> </g></svg>
				    </a>
				</li>
				<?php } ?>
			</ul>
			<?php } ?>
			
			<form class="navbar-form navbar-left search-header" role="search" action="{{LINK search}}" method="GET">
                <div class="form-group">
                    <input type="text" class="form-control" id="search-bar" name="keyword" placeholder="{{LANG search_keyword}}" autocomplete="off" value="{{SEARCH_KEYWORD}}"> 
                    <?php
                    if (!empty($_GET['is_channel'])) {
                    ?>
                    <input type="hidden" name="is_channel" value="true">
                    <?php } ?>
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search" onclick="javascript:$('.search-header input').focus();"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>
                </div>
                <div class="search-dropdown hidden"></div>
            </form>
			<!--<ul class="nav navbar-nav">
				<li class="dropdown hide-from-mobile" id="category_menu_">
				   <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{LANG categories}} <span class="caret"></span></a>
				   <ul class="dropdown-menu categories-drop-down" role="menu">
				    <?php foreach($pt->categories as $key => $category) { 
					    if (1) { ?>
					    <li class="hide-from-mobile">
						   <a class="category" href="{{LINK videos/category/<?php echo $key?>}}" data-load="?link1=videos&page=category&id=<?php echo $key?>"><?php echo $category?></a>
						</li>
					<?php } }?>
				   </ul>
				</li>
			</ul>-->
		</div>
		<ul class="nav navbar-nav navbar-right">
			<?php if (IS_LOGGED) { ?>
				<?php if (($pt->config->who_upload == 'admin' && PT_IsAdmin()) || $pt->config->who_upload == 'all') { ?>
				<?php if ($pt->config->upload_system == 'on' && !$pt->user->suspend_upload) { ?> 
				    <li class="hide-from-mobile">
						<a href="{{LINK upload-video}}" class="btn upload-button" data-load="?link1=upload-video">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M14,13V17H10V13H7L12,8L17,13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" /></svg>
							<span class="hide-in-mobile">{{LANG upload}}</span>
						</a>
					</li>
				<?php } ?>
				<?php } ?>
				<?php if ($pt->config->import_system == 'on' && !$pt->user->suspend_import) { ?> 
				    <li class="hide-from-mobile">
						<a href="{{LINK import-video}}" class="btn import-button" data-load="?link1=import-video">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17,13L12,18L7,13H10V9H14V13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" /></svg>
							<span class="hide-in-mobile">{{LANG import}}</span>
						</a>
					</li>
				<?php } ?>
				<?php if ($pt->config->live_video == 1 && ($pt->config->who_use_live == 'all' || ($pt->config->who_use_live == 'admin' && PT_IsAdmin()) || ($pt->config->who_use_live == 'pro' && $pt->user->is_pro > 0))) { ?>
					<li class="hide-from-mobile">
						<a href="{{LINK live}}" class="btn live-button" data-load="?link1=live">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17,10.5L21,6.5V17.5L17,13.5V17A1,1 0 0,1 16,18H4A1,1 0 0,1 3,17V7A1,1 0 0,1 4,6H16A1,1 0 0,1 17,7V10.5M14,16V15C14,13.67 11.33,13 10,13C8.67,13 6,13.67 6,15V16H14M10,8A2,2 0 0,0 8,10A2,2 0 0,0 10,12A2,2 0 0,0 12,10A2,2 0 0,0 10,8Z"></path></svg>
							<span class="hide-in-mobile">{{LANG live}}</span>
						</a>
					</li>
				<?php } ?>
			<?php }else{ ?>
			<?php if ($pt->config->upload_system == 'on') { ?> 
			    <li class="hide-from-mobile">
					<a href="{{LINK upload-video}}" class="btn upload-button" data-load="?link1=upload-video">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M14,13V17H10V13H7L12,8L17,13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" /></svg>
						<span class="hide-in-mobile">{{LANG upload}}</span>
					</a>
				</li>
			<?php } ?>
			<?php if ($pt->config->import_system == 'on') { ?> 
			    <li class="hide-from-mobile">
					<a href="{{LINK import-video}}" class="btn import-button" data-load="?link1=import-video">
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17,13L12,18L7,13H10V9H14V13M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z" /></svg>
						<span class="hide-in-mobile">{{LANG import}}</span>
					</a>
				</li>
			<?php } ?>
		<?php } ?>
			<li class="show-in-mobile pull-left top-header">
				<a href="#" class="search-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z" /></svg> </a>
			</li>
			<?php if (IS_LOGGED): ?>
				<li class="hide-from-mobile pull-left top-header">
					 <a href="{{LINK messages}}"  data-load="?link1=messages">
				   		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M6,9H18V11H6M14,14H6V12H14M18,8H6V6H18" /></svg>
				   		<span id="new-messages"></span>
				    </a>
				</li>
				<li class="hide-from-mobile dropdown pull-left top-header">
				    <a href="javascript:void(0);"  id="get-notifications" class=" dropdown-toggle" data-toggle="dropdown">
				   		<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M14,21A2,2 0 0,1 12,23A2,2 0 0,1 10,21M19.75,3.19L18.33,4.61C20.04,6.3 21,8.6 21,11H23C23,8.07 21.84,5.25 19.75,3.19M1,11H3C3,8.6 3.96,6.3 5.67,4.61L4.25,3.19C2.16,5.25 1,8.07 1,11Z" /></svg>
				   		<span id="new-notifications"></span>
				    </a>
				    <ul class="dropdown-menu dropdown-menu-right notfi-dropdown" id="notifications">
					    <li>
					    	<h5>
					    		<b id="all-notifications"></b> {{LANG notifications}}
					    		<i class="fa fa-circle-o-notch spin hidden"></i>
					    	</h5>
					    </li>
					    <li>
					    	<ul id="notifications-list"></ul>
					    </li>
				    </ul>
				</li>
			<?php endif; ?>
			{{SIDE_HEADER}}
		</ul>
	</div>
</nav>

<nav class="navbar navbar-findcond navbar-fixed-top header-layout hidden search-bar">
	<div class="navbar-header">
		<form class="search-header-mobile" role="search" action="{{LINK search}}" method="GET">
			<div class="form-group">
				<input type="text" class="form-control" id="search-bar-mobile" name="keyword" placeholder="{{LANG search_keyword}}" autocomplete="off" value="{{SEARCH_KEYWORD}}"> 
			</div>
			<div class="search-dropdown hidden"></div>
		</form>
	</div>
</nav>

<?php if (IS_LOGGED): ?>
<script>
	jQuery(document).ready(function($) {
		pt_get_notifications({type:'new'});
		UpdateInfo();
		
		$("#get-notifications").click(function(event) {
			if ($('#notifications').css('display') == 'none') {
				var notfi_cont = $("ul.notfi-dropdown");
				
				if ($("span#new-notifications").html() != '') {
					$(this).find('span#new-notifications').empty();
				}

				pt_get_notifications({sa:1});
			}
		});

		setInterval(function(){
			pt_get_notifications({type:'new'});
		}, 6000);
	});
	function UpdateInfo() {
		$.post('{{LINK aj/user/update_info}}?hash=' + $('.main_session').val(), function(data, textStatus, xhr) {});
	}

	function pt_get_notifications(args){
		if (!args) {
			args = {};
		}
		var notfi_cont = $("ul.notfi-dropdown");
		var notfi_set  = $("ul#notifications");
		
		defparams = {
			type: false,
			sa:false
		}

		options = Object.assign(defparams,args);
		data    = {'hash':$('.main_session').val()};

		if (options['type']) {
			data['t'] = options['type'];
		}

		if (options['sa']) {
			data['sa'] = options['sa'];
			notfi_set.find('i.spin').removeClass('hidden');
		}

		$.ajax({
			url: '{{LINK aj/get_notifications}}',
			type: 'GET',
			dataType: 'json',
			data:data
		})
		.done(function(data) {
			if (data.status == 200) {
				if (data.new) {
					$("span#new-notifications").html($('<b>',{
						text:data.new
					}));
				}
				else{
					notfi_set.find('b').text(data.len);
					notfi_set.find('ul').html(data.html);
				}			
			}
			else if(data.status == 304 && options['sa']){
				notfi_set.find('ul').html($("<li>",{
					class:'no-notifications',
					text: "{{LANG no_notifications}}"
				}));
			}

			if (data.count_messages > 0) {
				$('#new-messages').html('<b>' + data.count_messages + '</b>');
			} else {
				$('#new-messages').html('');
			}

			if (options['sa']) {notfi_set.find('i.spin').addClass('hidden');}
			
		})
		.fail(function() {
			console.log("error");
		});
	}
</script>
<?php endif ?>

<script>
$('.search-icon').on('click', function(event) {
	event.preventDefault();
	$('.search-bar').toggleClass('hidden');
});

$('#open_slide').on('click', function(event) {
	event.preventDefault();
	$('body').toggleClass('side_open');
});

$('#search-bar').keyup(function(event) {
	var search_value = $(this).val();
	var search_dropdown = $('.search-dropdown');
	if (search_value == '') {
		search_dropdown.addClass('hidden');
		search_dropdown.empty();
		return false;
	} else {
		search_dropdown.removeClass('hidden');
	}
    $.post('{{LINK aj/search}}', {search_value: search_value}, function(data, textStatus, xhr) {
    	if (data.status == 200) {
    		search_dropdown.html(data.html);
    	} else {
	       search_dropdown.addClass('hidden');
		   search_dropdown.empty();
		   return false;
    	}
    });
});

jQuery(document).click(function(event){
    if (!(jQuery(event.target).closest(".search-dropdown").length)) {
        jQuery('.search-dropdown').addClass('hidden');
    }
});

jQuery(document).click(function(event){
    if (!(jQuery(event.target).closest("#open_slide, .yp_side_drawer").length)) {
        jQuery('body').removeClass('side_open');
    }
});
</script>