<?php include_once($_SERVER['DOCUMENT_ROOT'] . "/admin/inc/sessionStartGeneral.php") ?>
<?php
  if(isset($_GET['error'])){
    if($_GET['error'] == "noAccess"){
?>
  <div id="noEditError">
        <div class="alert alert-error">
              <a class="close" data-dismiss="alert" href="#">x</a>You do not have sufficient privileges to access the administration area of this website. Please contact the web administrator if you need further assistance.
        </div>
  </div>
<?php
    }else if($_GET['error'] == "noPage"){
?>
  <div id="noPageError">
      <div class="alert alert-error">
            <a class="close" data-dismiss="alert" href="#">x</a><br>The requested page does not exist in our site. If you believe it does exist, please find it using the navigation or links at the bottom of the page.<br>
      </div>
    </div>
<?php
    }
  }
  
  if(isset($_GET['loc'])){
    //echo $_GET['loc'];
    switch($_GET['loc']){
      case "powell":
        $theScreen = "powell";
		$pageTitle = "Powell";
        $storeID = "70";
		$storePic = "/Kickstrap/img/storeFrontPowell.jpg";
        $theMapHTML = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=331+West+Coulter+Ave.++Powell,+Wy.+82435&amp;aq=&amp;sll=39.499761,-111.547028&amp;sspn=9.627188,9.151611&amp;ie=UTF8&amp;hq=&amp;hnear=331+W+Coulter+Ave,+Powell,+Wyoming+82435&amp;t=m&amp;z=10&amp;iwloc=A&amp;output=embed&iwloc=near"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=331+West+Coulter+Ave.++Powell,+Wy.+82435&amp;aq=&amp;sll=39.499761,-111.547028&amp;sspn=9.627188,9.151611&amp;ie=UTF8&amp;hq=&amp;hnear=331+W+Coulter+Ave,+Powell,+Wyoming+82435&amp;t=m&amp;z=10&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>';
        break;
      case "worland":
        $theScreen = "worland";
		$pageTitle = "Worland";
        $storeID = "71";
		$storePic = "/Kickstrap/img/storeFrontWorland.jpg";
        $theMapHTML = '<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=1801+Big+Horn+Ave.++Worland,+Wy.+82401&amp;aq=&amp;sll=44.642277,-108.800354&amp;sspn=1.109993,1.143951&amp;ie=UTF8&amp;hq=&amp;hnear=1801+Big+Horn+Ave,+Worland,+Wyoming+82401&amp;t=m&amp;ll=44.016521,-107.94342&amp;spn=0.691311,1.167297&amp;z=9&amp;iwloc=A&amp;output=embed&iwloc=near"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=1801+Big+Horn+Ave.++Worland,+Wy.+82401&amp;aq=&amp;sll=44.642277,-108.800354&amp;sspn=1.109993,1.143951&amp;ie=UTF8&amp;hq=&amp;hnear=1801+Big+Horn+Ave,+Worland,+Wyoming+82401&amp;t=m&amp;ll=44.016521,-107.94342&amp;spn=0.691311,1.167297&amp;z=9&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>';
        break;
	  case "greybull":
        $theScreen = "greybull";
		$pageTitle = "Greybull";
        $storeID = "74";
		$storePic = "/Kickstrap/img/storeFrontGreybull.jpg";
        $theMapHTML = '<iframe width="228" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=909+North+6th+Street,+Greybull,+WY&amp;aq=0&amp;oq=909+North+6th+Street,+Grey&amp;sll=39.499761,-111.547028&amp;sspn=9.982835,8.250732&amp;ie=UTF8&amp;hq=&amp;hnear=909+N+6th+St,+Greybull,+Wyoming+82426&amp;t=m&amp;ll=44.498954,-108.055&amp;spn=0.042854,0.039139&amp;z=13&amp;iwloc=A&amp;output=embed&amp;iwloc=near"></iframe><br /><small><a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=909+North+6th+Street,+Greybull,+WY&amp;aq=0&amp;oq=909+North+6th+Street,+Grey&amp;sll=39.499761,-111.547028&amp;sspn=9.982835,8.250732&amp;ie=UTF8&amp;hq=&amp;hnear=909+N+6th+St,+Greybull,+Wyoming+82426&amp;t=m&amp;ll=44.498954,-108.055&amp;spn=0.042854,0.039139&amp;z=13&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>';
        break;
      case "all":
        $theScreen = "all";
		$pageTitle = "All Locations";
        $storeID = "0";
        break;
      default:
        $theMissingFile = $_SERVER['QUERY_STRING'];
    include($_SERVER['DOCUMENT_ROOT'] . "/admin/inc/missingFiles.php");
    header("Location: https://" . $_SERVER['SERVER_NAME'] . "?error=noPage");
		$theScreen = "main";
        $pageTitle = "Home";
		break;
    }
  }else{
    $theScreen = "main";
	$pageTitle = "Home";
  }
?>
<?php
  $pageDescription = "At Blair's Market we have everything you need, and expect, from your local grocery store.";
  $pageKeywords = "Blair's, Montana, Powell, Worland, grocery, store, market, fresh foods";
?>
<?php include_once($_SERVER['DOCUMENT_ROOT'] . "/common/header.php") ?>
<?php include_once($_SERVER['DOCUMENT_ROOT'] . "/common/mainNav.php")?>
    
    
    <section class="container">
      <div id="blankBuffer" class="carousel-buffer"></div>
      
      <section class="container" id="mainContent">
        <article class="row">
          <?php
            if($theScreen == "main"){
          ?>
           
           <script src="/js/jquery.cookie.js"></script>

          <div class="span12" style="margin-left: 15px;">
			<div id="carouselContain">
			  <?php include("includes/carousel.php"); ?>
			</div>
		  </div>
		</article>
		
		<article class="row" style="width:98%;">
		  <?php include("includes/hotDealHome.php"); ?>
		  <div class="span4 goHalf">
            <div class="paddingHelpLeft">
              <?php include("includes/featuredRecipe.php"); ?>
			  <?php include("includes/facebookWall.php"); ?>
			  <?php include("includes/storeItems.php"); ?>
            </div>
          </div><!--end left side div-->
            
          <div class="span4 goHalf">
            <div class="paddingHelpRight">
              <?php include_once("includes/storeInformationFront.php"); ?>
            </div>
          </div><!-- end right side div -->
		  <div class="span4 goHalf">
            <div class="paddingHelpRight">
			  <?php include("includes/adItemsFront.php"); ?>
			  <?php include("includes/departments.php"); ?>
            </div>
          </div><!-- end right side div -->
		  
		  <div class="span12" style="margin-left: 15px;width:95%;">
			<?php include("includes/wp-posts.php"); ?>
		  </div>

      <style>
        #standardSSOmodal,
        #standardSSOmodal .modal-footer {
          background: none;
          border: none;
          box-shadow: none;
        }
        
        #standardSSOmodal .modal-footer {
          width: auto;
          display: block;
          text-align: center;
        }

        #standardSSOmodal .modal-footer .btn + .btn {
          margin-left: 0;
        }
      </style>
      <div id="standardSSOmodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        
        <div class="modal-body">
          <img class="modal-content" id="img01" src="/Kickstrap/img/BlairsPopup2018_800x800.jpg" style="max-height: 400px;width: auto;margin: 0 auto;display: block;">
        </div>
        <div class="modal-footer btn-group">
          <a href="/register" id="shoppingRedirect" class="btn btn-large btn-primary">Register</a>
          <button id="ssoModalClose" class="btn btn-large" data-dismiss="modal" aria-hidden="true">Close</button>
        </div>
      </div>
      <script>
        $(document).ready(function() {
        // JavaScript placed here will run only once Kickstrap has loaded successfully.
        
        if ($.cookie('show_sso_modal') == null || $.cookie('show_sso_modal') == "yes") {
          $.cookie('show_sso_modal', 'yes', { expires: 7, path: '/' });
          $("#standardSSOmodal").modal("show");
        }
        
        $("#ssoModalClose").on("click touch", function(){
          $.cookie('show_sso_modal', 'no', { expires: 7, path: '/' });
        });
        });
      </script>

          <?php
            }//end if($theScreen == "main")
            else if($theScreen == "all"){
          ?>
            <div id="allStoreContain"></div>
            <script>
              var theStoreID = <?php echo $storeID; ?>;
              //console.log(theStoreID);
              getStoreInfoAllStores();
            </script>
          <?php
            }//end else if($theScreen == "all")
            else{ //if it is a specific location
          ?>
            <script>
              var theStoreID = <?php echo $storeID; ?>;
              var theMapHTML = '<?php echo $theMapHTML; ?>';
            </script>
            
            
            
            <div class="span8 leftSide">
              <div class="paddingHelpLeft">
                <img src="<?php echo $storePic; ?>" width="100%" alt="Store picture">
				<?php include($_SERVER['DOCUMENT_ROOT'] . "/includes/storeInformationSingle.php"); ?>
                <br>
                <p><a href="/contactUs" class="btn">Contact Us</a></p>
              </div>
            </div><!--end left side div-->
              
            <div class="span4 rightSide">
              <div class="paddingHelpRight">
                <br><a class="btn btn-primary btn-large" href="/weeklyAd">View our Ad</a><br><br>
                <?php
                  /*
				  if($theScreen == "la_verkin"){
                    include($_SERVER['DOCUMENT_ROOT'] . "/includes/facebookWallLaverkin.php"); 
                  }
                  */
                ?>
              </div>
            </div><!-- end right side div -->
            
          <?php
            }
          ?>
        </article>
        
      </section>
    </section>
      
    
    
    
    <?php include_once($_SERVER['DOCUMENT_ROOT'] . "/common/footer.php"); ?>
  <script>
    var theScreen = "<?php echo $pageTitle; ?>";
	
	
    
    $("#rightSidebarCollapse h4").bind("click", function(){
      $this = $(this).children("i");
      $siblings = $(this).parents(".accordion-group").siblings();
      $("h4", $siblings).children("i").removeClass("icon-minus-sign").addClass("icon-plus-sign");
      if($this.hasClass("icon-plus-sign")){
        $this.removeClass("icon-plus-sign").addClass("icon-minus-sign");
      }else{
        $this.removeClass("icon-minus-sign").addClass("icon-plus-sign");
      }
    });
   
   $(".weeklySpecial:last-child").css("margin-right", "0");
   
  </script>
  
</body>
</html>