<?php
$titlelogo = explode(" ", BASE_NAME);
$titleword1 = $titlelogo[0];
$titleword2 = $titlelogo[1];
// Solve problem for H1 Tags count character for SEO 20-70, so i choise only for minimal
if(strlen(BASE_NAME) < 20){$addchar = str_repeat("&nbsp;", 22 - strlen(BASE_NAME));}
// Good work for H1 tags

echo '<div class="" style="margin-top:0px;margin-bottom:6px;padding:4px;height:146px">';
echo '<div class="w3-col l3 m12 s12 w3-center">';

if (file_exists(THEM.$set['theme'].'/img/'.$set['logo'])){
    
echo '<a rel="dofollow" class="w3-center" style="margin-top:10px;" href="'.BASE_URL.'">';
echo '<img src="'.THEM.$set['theme'].'/img/'.$set['logo'].'" alt="'.BASE_NAME.'" title="'.BASE_NAME.'" style="width:300px;height:106px;margin-top:20px;margin-bottom:20px;padding:8px;" loading="lazy"/></a>';

echo '<h1 class="w3-hide" style="margin:0;padding:0;">';
echo $titleword1.' <span class="dotcom">'.$titleword2.'</span>'.$addchar;
echo '</h1>';
  
   }else{
    
echo '<a rel="dofollow" class="w3-container logo" href="'.BASE_URL.'">';
echo '<h1 style="margin:0;margin-top:50px;padding:0;">';
echo $titleword1.'<span class="dotcom">'.$titleword2.'</span>'.$addchar;
echo '</h1></a>';
  
  }
echo '</div>';

echo '<div class="w3-col l9 m12 s12 w3-center w3-wide w3-hide-small w3-hide-medium w3-display-container" style="height:146px;">';
echo '<div class="w3-display-middle">
<a class="gofollow" data-track="NiwyLDEsNjA=" href="https://pmar.ro/anunturi/">
<img src="https://pmar.ro/wp-content/uploads/2019/10/banner-anunturi.jpg" style="width:620px;">
</a>
</div>';
echo '</div></div>';

echo '<div id="navbar" class="w3-margin-bottom" style="z-index:1005;">';
echo '<div class="w3-content" style="max-width:1431px;">';
echo '<div class="w3-bar w3-bluepm w3-card w3-large" style="text-transform:uppercase;height:42px;" id="myNavbar">';

// Left Menu
echo '<a href="'.$urlto['home'].'" class="w3-bar-item w3-button w3-hover-seagreen w3-hide w3-wide" title="';if($lng['top_menu_home']){echo $lng['top_menu_home'];}else{echo 'Home';} echo '" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;">'.BASE_NAME.'</a>';

echo '<a href="'.$urlto['home'].'" class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:17px;padding-right:17px;" title="';if($lng['top_menu_home']){echo $lng['top_menu_home'];}else{echo 'Prima pagină';} echo '">';

if($lng['top_menu_home']){echo $lng['top_menu_home'];}else{echo 'Prima pagină';} echo '</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:22px;padding-right:22px; border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['columbofili'].'" title="Columbofili"> ';
echo 'Columbofili</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:28px;padding-right:28px;border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['competitii'].'" title="Competiții"> ';
echo 'Competiții</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:22px;padding-right:22px;border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['licitatii'].'" title="Licitații"> ';
echo 'Licitații</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:21px;padding-right:21px;border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['anunturi'].'" title="Anunțuri"> ';
echo 'Anunțuri</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:21px;padding-right:21px;border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['links'].'" title="Links"> ';
echo 'Links</a>';

echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;padding-left:21px;padding-right:21px;border-left: 1px solid rgba(255, 255, 255, 0.1);" href="'.$urlto['contact'].'" title=""> ';
echo 'Contact</a>';
     
// END Left Menu
// Right Menu
/*if(!empty($set['trs_g'])){
// Google Translate
echo '<div id="google_translate_element" class="w3-bar-item w3-button w3-hover-seagreen w3-right w3-hide-small" style="margin:0px;margin-top:-3px;width:200px;overflow:hidden;font-weight: 700;line-height: 1.188em;font-size: 14px;padding:0px;padding-left:6px;text-transform:uppercase;"></div>';
// END Google Translate
 }else{

echo '<div class="w3-dropdown-hover w3-hide-small w3-right" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:0px;">';

echo '<button class="w3-button w3-bluepm w3-hover-seagreen" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;text-transform:uppercase;" title="'.$lng['language'].'">';

echo '<img src="'.PATH.'libs/img/flags/'.$lang.'.png" alt="'.$lng['top_menu_lang_active'].'" title="'.$lng['top_menu_lang_active'].'" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> <i class="fa fa-fw fa-caret-down"></i></button>';

echo '<div class="w3-dropdown-content w3-bar-block w3-card w3-bluepm" style="margin-top:-4px;margin-left:-87px;">';
     
echo '<form action="" method="post">';
echo '<button class="w3-bar-item w3-button w3-hover-seagreen">';
echo '<img src="'.PATH.'libs/img/flags/en.png" alt="English" title="English" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> English</button>';
echo '<input type="hidden" name="langID" value="1"/>';
echo '<input type="hidden" name="changelang" value="true"/>';
echo '</form>';
      
echo '<form action="" method="post">';
echo '<button class="w3-bar-item w3-button w3-hover-seagreen">';
echo '<img src="'.PATH.'libs/img/flags/ro.png" alt="Română" title="Română" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> Română</button>';
echo '<input type="hidden" name="langID" value="2"/>';
echo '<input type="hidden" name="changelang" value="true"/>';
echo '</form>';
echo '</div>';
echo '</div>';
  }*/

if(isset($_SESSION['uid'])){

echo '<div class="w3-dropdown-hover w3-bluepm w3-hover-seagreen w3-hide-small w3-hide-medium w3-right">';

echo '<button class="w3-button w3-bluepm w3-hover-seagreen" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;text-transform:uppercase;"><i class="fa fa-fw fa-user-o"></i> ';

if(!empty($_SESSION['first_name'])){echo $_SESSION['first_name'];}else{$gun = explode("-", $_SESSION['user_name']);echo $gun[0];} 

echo ' <i class="fa fa-fw fa-caret-down"></i></button>';

echo '<div class="w3-dropdown-content w3-bar-block w3-card w3-bluepm" style="margin-left:-50px;text-transform:none;">';
     
echo '<a href="'.PATH.'myaccount.html" class="w3-bar-item w3-button w3-hover-seagreen">';

echo '<i class="fa fa-fw fa-user-o"></i> '.$lng['top_smenu_my_account'].'</a>';

echo '<a href="'.PATH.'change_password.html" class="w3-bar-item w3-button w3-hover-seagreen">';

echo '<i class="fa fa-fw fa-key"></i> '.$lng['top_smenu_change_password'].'</a>';

echo '<form action="" method="post">';
echo '<button class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-right" type="submit">';
echo '<i class="fa fa-fw fa-power-off"></i> '.$lng['top_smenu_logout'].'</button>';
echo '<input type="hidden" name="userlogout" value="true"/>';
echo '</form>';
      
echo '</div>';
echo '</div>';

if($_SESSION['lid'] == 1){
     
echo '<a href="'.PATH.'admin-dashboard.html" class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium w3-right" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;">';
echo '<i class="fa fa-user-secret"></i> '.$lng['top_smenu_admin'].'</a>';

    }
 }else{
//echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-hide-small w3-hide-medium w3-right" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="'.PATH.'login.html">';
//echo '<i class="fa fa-fw fa-lock"></i> '.$lng['top_smenu_sign_in'].'Sign In</a>';

//if(!empty($set['reg'])){
//echo '<a class="w3-bar-item w3-button w3-hover-seagreen w3-right" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="'.PATH.'register.html">';
//echo '<i class="fa fa-user-plus"></i> '.$lng['top_smenu_signup'].'</a>';
     }
//  }
// Right Menu

// Hide right-floated links on small screens and replace them with a menu icon

echo '<a href="javascript:void(0)" class="w3-bar-item w3-button w3-right w3-green w3-hover-blue w3-hide-large" onclick="w3_open()"><i class="fa fa-th-large"></i></a>';

echo '<a onclick="document.getElementById(\'searchmobile\').style.display=\'block\'" class="w3-bar-item w3-button w3-right w3-hover-teal w3-hide" style="margin-top:6px;"><i class="fa fa-search"></i></a>';

echo '<a class="w3-bar-item w3-button w3-right w3-hover-teal w3-hide w3-round-large" style="margin-top:6px;"><i class="fa fa-plus"></i></a>';

// END Hide

echo '</div></div></div>';

// Sidebar on small screens when clicking the menu icon
echo '<nav class="w3-sidebar w3-white w3-card-4 w3-animate-left w3-hide-large w3-top" style="display:none;z-index:3;width:100%;margin-top:-20;" id="mySidebar">';

if(isset($_SESSION['uid'])){

echo '<div class="w3-row w3-center">';

echo '<div class="w3-col w3-card" style="width:27.33%;margin:2%;">';

echo '<a href="'.PATH.'myaccount.html" onclick="w3_close()" class="w3-bar-item w3-button w3-text-green">';

echo '<i class="fa fa-user-o w3-xxxlarge"></i><br/>';
echo '<span class="w3-small">'.$lng['top_smenu_my_account'].'</span></a>';
echo '</div>';

echo '<div class="w3-col w3-card" style="width:33.33%;margin:2%;">';

echo '<a href="<'.PATH.'change_password.html" onclick="w3_close()" class="w3-bar-item w3-button w3-white w3-hover-white w3-text-brown w3-hover-text-brown"><i class="fa fa-key w3-xxxlarge"></i><br/>';
echo '<span class="w3-tiny" style="word-break: break-all;">'.$lng['top_smenu_change_password'].'</span></a>';

echo '</div>';

echo '<div class="w3-col w3-card" style="width:27.33%;margin:2%;">';

echo '<form action="" method="post">';

echo '<button class="w3-bar-item w3-button w3-white w3-hover-white w3-text-brown w3-hover-text-brown" type="submit"><i class="fa fa-power-off w3-xxxlarge"></i><br/>';

echo '<span class="w3-small">'.$lng['top_smenu_logout'].'</span></button>';

echo '<input type="hidden" name="userlogout" value="true"/>';

echo '</form>';

echo '</div></div>';
    
  }else{

echo '<div class="w3-row w3-center">'; ?>

<div class="w3-row-padding w3-bar w3-bar-block w3-large" style="text-transform:uppercase;" id="myNavbar">

<div class="w3-col s12 w3-margin-top w3-margin-bottom">
<a class="w3-bar-item w3-button w3-red w3-hover-seagreen w3-hide-large w3-center" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" title="Închide meniul" onclick="w3_close()">
<i class="fa fa-fw fa-close"></i> Închide meniul</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a href="<?=$urlto['home']?>" class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" title="Prima pagină">Prima pagină</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-card w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['columbofili']?>" title="Columbofili">Columbofili</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['competitii']?>" title="Competiții">Competiții</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['licitatii']?>" title="Licitații">Licitații</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['anunturi']?>" title="Anunțuri">Anunțuri</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['links']?>" title="Links">Links</a>
</div>

<div class="w3-col s6 w3-margin-bottom">
<a class="w3-bar-item w3-button w3-bluepm w3-hover-seagreen w3-hide-large" style="font-weight: 700;line-height: 1.188em;font-size: 14px;padding:13px;" href="<?=$urlto['contact']?>" title="">
Contact</a>
</div>


</div>

<div class="w3-col l2 m4 s12 w3-hide-large">

<div id="accordion" style="font-size:14px;">
<?php
$loc = str_replace('/', '', PATH);
include(BASE);
$getcatext = $dbc->query("SELECT * FROM `categlinks` WHERE `catext_loc`='{$loc}' ORDER BY `sort` ASC") or die($dbc->error);

if($getcatext->num_rows > 0){
while($rwcatex = $getcatext->fetch_assoc()){ 
?>

<div class="card">
<a class="collapsed w3-button w3-bluepm w3-hover-seagreen" data-toggle="collapse" href="#<?=$rwcatex['catext_seo']?>">
<?=$rwcatex['catext_name']?>
</a>

<div id="<?=$rwcatex['catext_seo']?>" class="collapse<?php if($rwcatex['sort'] === '1'){echo ' show';}?>" data-parent="#accordion">
<div class="w3-bar w3-bar-block">
<?php   
$getlinkext = $dbc->query("SELECT * FROM `extlinks` WHERE `catext_id`='".$rwcatex['catext_id']."' ORDER BY `sort` ASC") or die($dbc->error);
if($getlinkext->num_rows > 0){
    while($rwlnk = $getlinkext->fetch_assoc()){
        echo '<a href="'.$rwlnk['extl_url'].'" class="w3-bar-item w3-button" target="'.$rwlnk['extl_target'].'" onclick="w3_close()">'.$rwlnk['extl_name'].'</a>';
    }
}
?>
</div>
</div>

</div>
<?php  } } $dbc->close(); ?>
</div>

</div>


<?php /*
echo '<div class="w3-col w3-card" style="width:46%;margin:2%;">';
echo '<a href="'.PATH.'#register.html" onclick="w3_close()" class="w3-bar-item w3-button w3-text-blue">';
echo '<i class="fa fa-user-plus w3-xxxlarge"></i><br/>';
echo $lng['top_smenu_signup'];
echo '</a>';
echo '</div>';

echo '<div class="w3-col w3-card" style="width:46%;margin:2%;">';
echo '<a href="'.PATH.'login.html" onclick="w3_close()" class="w3-bar-item w3-button w3-white w3-hover-white w3-text-blue w3-hover-text-green"><i class="fa fa-lock w3-xxxlarge"></i><br/>';
echo $lng['top_smenu_sign_in'];
echo '</a>';
echo '</div>';
echo '</div>';*/
 } 

/*echo '<div class="w3-row w3-center">';
echo '<div class="w3-col w3-card" style="width:32%;margin:2%;">';
echo '<a onclick="document.getElementById(\'countries\').style.display=\'block\'" class="w3-bar-item w3-button w3-text-blue">';
echo '<i class="fa fa-globe w3-xxxlarge"></i><br/>';
echo $lng['top_menu_country'];
echo '</a>';
echo '</div>';

echo '<div class="w3-col w3-card" style="width:24%;margin:2%;">';
echo '<a href="<?=PATH?>book.html" onclick="w3_close()" class="w3-bar-item w3-button w3-text-blue">';
echo '<i class="fa fa-address-book w3-xxxlarge"></i><br/>'.$lng['top_menu_book'].'</a>';
echo '</div>';

echo '<div class="w3-col w3-card" style="width:32%;margin:2%;">';
echo '<a onclick="document.getElementById(\'language\').style.display=\'block\'" class="w3-bar-item w3-button w3-text-blue">';
echo '<i class="fa fa-flag w3-xxxlarge"></i><br/>';
echo $lng['language'];
echo '</a>';

echo '</div></div>';*/

echo '</nav>';

// Modal Section 

// Countries for mobile

echo '<div id="countries" class="w3-modal" style="z-index:1007;margin-top:-50px;">';
echo '<div class="w3-modal-content w3-animate-top" style="width:100%;max-width:100%;margin:auto;">';
echo '<div class="w3-container_">';
echo '<span onclick="document.getElementById(\'countries\').style.display=\'none\'" class="w3-button w3-display-topright w3-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>';

echo '<div class="w3-row w3-hide-large">';
echo '<div class="w3-container w3-text-white w3-card" style="background-color:#117594;">';
echo '<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-fw fa-flag"></i> '.$lng['top_menu_country'].'</h3>';
echo '</div>';
echo '<div class="w3-bar-block w3-white">';
/*
include(BASE);

$rcountry = $dbc->query("SELECT * FROM `countries` WHERE 1=1 ORDER BY country_name ASC");
 if($rcountry->num_rows > 0){
     while($rowcnt = $rcountry->fetch_assoc()){
               
echo '<a href="<'.PATH.'country-';
$link = strtolower(str_replace(' ', '-', $rowcnt['country_name']));
echo $link.'.html" class="w3-bar-item w3-button w3-hover-blue w3-card" style="margin-bottom:4px;text-decoration:none;"><img src="'.PATH.'libs/img/flags/'.$rowcnt['country_code'].'.png" alt="'.$rowcnt['country_name'].'" title="'.$rowcnt['country_name'].'" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> '.$rowcnt['country_name'].'</a>';
     } 
   }else{
      echo '<div class="w3-padding w3-center">Not country found.</div>';
   }
$dbc->close();*/

echo '</div></div></div>';
echo '<div class="w3-hide">&nbsp;</div>';
echo '</div></div>';
// END Countries for mobile

// Languages for mobile
echo '<div id="language" class="w3-modal" style="z-index:1007;margin-top:-50px;">';
echo '<div class="w3-modal-content w3-animate-top" style="width:100%;max-width:100%;margin:auto;">';
echo '<div class="w3-container_">';
echo '<span onclick="document.getElementById(\'language\').style.display=\'none\'" class="w3-button w3-display-topright w3-red" style="margin-top:5px;"><i class="fa fa-close w3-xlarge"></i></span>';

echo '<div class="w3-row w3-hide-large">';
echo '<div class="w3-container w3-text-white w3-card" style="background-color:#117594;">';
echo '<h3 style="margin-top:8px;font-size:22px;"><i class="fa fa-fw fa-language"></i> '.$lng['language'].'</h3>';
echo '</div>';
echo '<div class="w3-bar-block w3-white">';

echo '<form action="" method="post">';
echo '<button class="w3-bar-item w3-button w3-hover-blue w3-card" style="margin-bottom:4px;">';
echo '<img src="'.PATH.'libs/img/flags/uk.png" alt="English" title="English" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> English</button>';
echo '<input type="hidden" name="langID" value="1"/>';
echo '<input type="hidden" name="changelang" value="true"/>';
echo '</form>';
      
echo '<form action="" method="post">';
echo '<button class="w3-bar-item w3-button w3-hover-blue w3-card" style="margin-bottom:4px;">';
echo '<img src="'.PATH.'libs/img/flags/ro.png" alt="Română" title="Română" style="width:24px;height:24px;margin:0;margin-top:-4px;" loading="lazy"/> Română</button>';
echo '<input type="hidden" name="langID" value="2"/>';
echo '<input type="hidden" name="changelang" value="true"/>';
echo '</form>';

echo '</div></div></div><div class="w3-hide">&nbsp;</div></div></div>';
// END Languages for mobile

// Overlay effect when opening sidebar on small screens
echo '<div class="w3-overlay w3-hide-large w3-animate-opacity" onclick="w3_close()" style="cursor:pointer" title="close side menu" id="myOverlay"></div>';

echo '<script>';
echo 'function dropDownMenu() {';
echo 'var x = document.getElementById("countries");';
echo 'if (x.className.indexOf("w3-show") == -1) {';
echo 'x.className += " w3-show";';
echo '} else { ';
echo 'x.className = x.className.replace(" w3-show", "");';
echo '}';
echo '}';
echo '</script>';
?>