<div class="topbar" style='text-align:center; background-color:none;'>
	<div class="topbar" style='height:45px; z-index:99;'>
	<span style='float:left; line-height:45px;padding-left:10px;' class='appname desktop'>
		<a href="./<?php echo ($logedin ? "?mode=home" : ""); ?>" style="font-family: 'patua', serif; font-weight:bold; color:white; font-size:20px; text-decoration:none" ><?php echo $setting['appname']; ?></a>
	</span>

	<?php if ($logedin): ?>
	<span class='mid' style='margin:0 auto; height:100%;'>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=federated' title='Federated' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "federated" ? "tiselected" : "");?>'>&#xe83c;</a>
		</span>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=home' title='Home' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "home" ? "tiselected" : "");?>'>&#xe816;</a>
		</span>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=local' title='Local' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "local" ? "tiselected" : "");?>'>&#xf1e0;</a>
		</span>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=favourites' title='Favorited' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "favourites" ? "tiselected" : "");?>'>&#xe804;</a>
		</span>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=direct' title='Direct Messages' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "direct" ? "tiselected" : "");?>'>&#xf0e0;</a>
		</span>
		<span class="topbutton" style='position:relative;'>
			<a href='?mode=bookmarks' title='Bookmarks' class='fontello topicon tlicon ldr <?php echo ($tl['mode'] == "bookmarks" ? "tiselected" : "");?>'>&#xe81e;</a>
		</span>
	</span>
	<?php endif; ?>

	<span class="fw" style='margin-right:20px; height:100%;'>
		<?php if ($logedin): ?>

		<span class="topbutton mobile" style='position:relative;'>
			<a href="./<?php echo ($logedin ? "?mode=home" : ""); ?>"' class='fontello topicon ldr' style='text-decoration:none; display:inline; font-size:20px;'>&#xe816;</a>
		</span>	

		<span class="topbutton desktop" style='position:relative;'>
			<div style='position:absolute; left:-200px; display:none; height: 50%; background-color:white; border-radius:10px; padding: 2px; margin-top: 8px;' class="search"><form method='get' style="margin-top:-11px;"><input type='text' name='search' style='margin-left:3px; width:150px' placeholder='Type your search here'><input type='submit' value='&#xe800;' class='fontello'></form></div>
			<a href='?page=search' title='Search Form' class='searchform fontello topicon' onClick='return false'>&#xe800;</a>
		</span>
		
		
		<span class="topbutton mobile compose" style='position:relative;'>
			<a href='' onClick='return false;' class='fontello topicon' style='text-decoration:none; display:inline; font-size:20px;'>&#xe824;</a>
		</span>	
		
		<span class="topbutton ntbutton">
			<a href='?page=notifications' title='Notifications' onClick='return false;' class='badge fontello topicon' style='text-decoration:none; display:inline; font-size:20px;'>&#xf0f3; <span class='alert' style=''></span> </a>
			<div id='notifications'><div class='container'><?php echo $notif ?></div><span class='nloadmore'>Load More</span></div>
		</span>	
		
		<span class="topbutton desktop" id="accountmenu">
			<div class='topicon' style='margin-top: 5px; display:inline !important;'><div style='margin-top: 0px; margin-left: 10px; border-radius:15px; display:block; width:30px; height: 30px; background-size:cover; background-image:url("<?php echo $info['avatar']; ?>");'></div></div>
			<div class='menu' style="width:180px;">
				<ul>
					<?php 
						$c = 0;
						foreach ($cookie as $elem){
							if(!isset($elem['acct'])){
								continue;
							}
							echo "<a href='?switchaccount=$c'><li style='text-align:left !important;'>
								<div style='width:100%; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: normal; align-items: normal; align-content: normal; padding:5px;'>
									<div style='width:30px; height:30px; display: block; flex-grow: 0; flex-shrink: 1; flex-basis: auto; align-self: auto; order: 0; border-radius:15px; background-image:url(".$elem['avatar']."); background-size:cover;'></div>
									<div style='padding-left:5px; height:30px; display: block; flex-grow: 0; flex-shrink: 1; flex-basis: auto; align-self: auto; order: 0; line-height:1em; border:0px !important;'>
										<span style='display:block;'>".$elem['acct']."</span>
										<span style='display:block; font-size:12px'>".$elem['instance']."</span>
									</div>
								</div>
							</li></a>";
							$c++;
						}
					?>
					<li><a class='fontello link'  href='./login'>&#xe832; Add account</a></li>
					<li><a class='fontello ldr link'  href='?page=settings' onClick='return false'>&#xe82d; Settings</a></li>
					<li></li>
					<li><a class='fontello link'  href='./logout'>&#xe832; Log Out</a></li>
				</ul>
			</div>
		</span>
		
		<span class="topbutton mobile" id="usermenu">
			<span class='fontello topicon' style='display:inline; font-size:20px;'>&#xe80b;</span>
		</span>
		

		
		
		<?php else: ?>
		<span class="topbutton" style='position:relative;'>
			<a href='?page=about' class='fontello topicon ldr' style='text-decoration:none; display:inline; font-size:20px;'>&#xe814; </a>
		</span>		
		
		<span class="topbutton desktop" style='position:relative;'>
			<a href='?page=fediverse' class='fontello topicon ldr' style='text-decoration:none; display:inline; font-size:20px;'>&#xf1e0; </a>
		</span>		

		<span class="topbutton desktop" style='position:relative;'>
			<a href='?page=privacy' class='fontello topicon ldr' style='text-decoration:none; display:inline; font-size:20px;'>&#xe819; </a>
		</span>		
		
		<span class="topbutton" style='position:relative;'>
			<a href='?page=settings' class='fontello topicon ldr' style='text-decoration:none; display:inline; font-size:20px;'>&#xe82d; </a>
		</span>		

		<span class="topbutton" style='position:relative; width:auto; margin-left:10px;'>
			<a href='./login' style='display:inline:block; padding:3px; border: 1px solid white; font-weight:bold; border-radius:3px; color:white; text-decoration:none; display:inline; font-size:20px;'><span class='fontello' >&#xe832;</span> Login </a>
		</span>		
		<?php
endif; ?>
		<!--
		<a href='?page=notifications' onClick='return false;'><span class="badge disabled">&#128276;</span></a>
		<a href="./logout" style='color:lightgray; font-weight:bold; font-size:18px;'>Logout</a>
		-->
	</span>
	</div>
</div>