<?php
$actual_links = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$ex_url =explode("/",$actual_links);
$url = $ex_url[4];
$location = $ex_url[3];
$location_name = ucwords(str_ireplace("-", " ", $location));

$web_det_query = "Select * from admin_details where slno = '1'";
$res_web = $dbconn->query($web_det_query);
$web_details = $res_web->fetch_assoc();

$sel_about_query = "select pageDesc,pageDesc1 from static_pages where pageID ='2'";
$res_about = $dbconn->query($sel_about_query);
$about_details = $res_about->fetch_assoc();
?>
<a id="scroll-up" title="Go to Top"><svg xmlns="http://www.w3.org/2000/svg" width="16"
        height="16" fill="currentColor" viewBox="0 0 16 16">
        <path fill-rule="evenodd"
            d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z" />
    </svg></a>
<header class="header">
    <div class="topbar">
        <div class="top-header">
            <div class="container">
                <div class="row align-items-center">
                    <div class="col-xxl-3 col-xl-3 col-lg-3 col-md-3 col-sm-12 col-12">
                        <div class="logo">
                            <a href="<?= site_url; ?>" title="<?= $web_details['companyName']; ?>">
                            <img src="<?= site_url; ?>/designer/images/logo.png"
                                    alt="<?= $web_details['companyName']; ?>" title="<?= $web_details['companyName']; ?>"  width="190" height="50"></a>
                        </div>
                    </div>

                    <div class="col-xxl-5 col-xl-5 col-lg-5 col-md-5 col-sm-12 col-12">

                        <div class="search-top">
                            <form method="get" action="<?= site_url; ?>/search.htm">
                                <div id="sw_search" class="search input-group">
                                    <div class="content-search">
                                        <select class="no_border" name="categories">
                                            <option value="">Select Category</option>
                                            <?php
                                            $res_cate = $dbconn->query("Select displayName,catName,parentID,catID from category_tbl  where parentID = '0' and status ='Y' order By catOrder asc");
                                            if($res_cate->num_rows >0){
                                                while($cates = $res_cate->fetch_assoc()){
                                            ?>
                                            <option value="<?= $cates['catID']; ?>"><?= $cates['displayName']; ?></option>
                                            <?php } } ?>
                                        </select>
                                        <input class="autosearch-input" type="text" value="" size="50"
                                            placeholder="Search" name="keyword" required>
                                        <span class="input-group-btn">
                                            <button type="submit"
                                                class="fa fa-search button-search-pro form-button" title="menubar"></button>
                                        </span>
                                    </div>
                                </div>
                            </form>
                        </div>

                    </div>

                    <div class="col-xxl-4 col-xl-4 col-lg-4 col-md-4 col-sm-12 col-12">
                        <ul class="top_right">
                        <li><a href="tel:<?= $web_details['phone']; ?>" title="Call Us"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                            <path d="M3.654 1.328a.678.678 0 0 0-1.015-.063L1.605 2.3c-.483.484-.661 1.169-.45 1.77a17.568 17.568 0 0 0 4.168 6.608 17.569 17.569 0 0 0 6.608 4.168c.601.211 1.286.033 1.77-.45l1.034-1.034a.678.678 0 0 0-.063-1.015l-2.307-1.794a.678.678 0 0 0-.58-.122l-2.19.547a1.745 1.745 0 0 1-1.657-.459L5.482 8.062a1.745 1.745 0 0 1-.46-1.657l.548-2.19a.678.678 0 0 0-.122-.58L3.654 1.328zM1.884.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.678.678 0 0 0 .178.643l2.457 2.457a.678.678 0 0 0 .644.178l2.189-.547a1.745 1.745 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.634 18.634 0 0 1-7.01-4.42 18.634 18.634 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877L1.885.511z"></path>
                        </svg> <?= $web_details['phone']; ?></a></li>

                            <!-- <li><a href="javascript:void(0);" title="Help Center"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
  <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>
</svg> Help Center</a></li> -->
                        </ul>
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class=navigation_bar>
        <div class="container">
            <div class="menu_width">
                <div class="row">
                    <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                        <div class="navigation">
                            <div class="navbar">
                                <button id="menubar" title="menubar">
                                    <span></span>
                                    <span></span>
                                    <span></span>
                                    <span></span>
                                </button>
                            </div>
                            <div class="menu">
                                <ul class="nav">
                                    <li class="<?= ($url == '')? 'active':''; ?>"><a href="<?= site_url; ?>" title="Home">Home</a></li>
                                    <li class="<?= ($url == 'about.htm')? 'active':''; ?>"><a href="<?= site_url; ?>/about.htm" title="Contact Us">About</a></li>
                                    <?php
                                        $category_query = "Select displayName,catName,parentID,catID from category_tbl  where parentID = '0' and status ='Y' order By catOrder asc";
                                        $res_cate = $dbconn->query($category_query);
                                        if($res_cate->num_rows >0){
                                            while($categories = $res_cate->fetch_assoc()){
                                                $cat_href = str_ireplace(" ", "-", $categories['catName']);
                                                $sub_cat_query = "Select displayName,catName,parentID,catID from category_tbl where parentID = '".$categories['catID']."' and status ='Y' order by catOrder asc";
                                                $res_sub_cate = $dbconn->query($sub_cat_query);

                                    ?>
                                    <li class="<?= ($res_sub_cate->num_rows > 0) ? 'cs-submenu':''; ?> <?= ($url == strtolower($cat_href).'.htm')? 'active':''; ?>"><a href="<?= site_url.'/'.$location.'/'.strtolower($cat_href).'.htm'; ?>" title="<?= $categories['displayName']; ?> in <?= $location_name; ?>"><?= $categories['displayName']; ?></a>
                                    <?php
                                        if($res_sub_cate->num_rows > 0){
                                    ?>
                                        <ul class="cs-dropdown">
                                        <?php while($sub_categories = $res_sub_cate->fetch_assoc()){
                                            $sub_cat_href = str_ireplace(" ", "-", $sub_categories['catName']);
                                            $sub_sub_cat_query = "Select displayName,catName,parentID,catID from category_tbl where parentID = '".$sub_categories['catID']."' and status ='Y' order by catOrder asc";
                                            $res_sub_sub_cate = $dbconn->query($sub_sub_cat_query);
                                        ?>
                                            <li><a href="<?= site_url.'/'.$location.'/'.strtolower($sub_cat_href).'.htm'; ?>" title="<?= $sub_categories['displayName']; ?> in <?= $location_name; ?>"><?= $sub_categories['displayName']; ?></a></li>
                                        <?php } ?>
                                        </ul>
                                        <?php } ?>
                                    </li>
                                    <?php } } ?>
                                    <li class="<?= ($url == 'gallery.htm')? 'active':''; ?>"><a href="<?= site_url; ?>/gallery.htm" title="Gallery">Gallery</a></li>
                                    <li class="<?= ($url == 'contact.htm')? 'active':''; ?>"><a href="<?= site_url; ?>/contact.htm" title="Contact Us">Contact</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</header>