<?php include("header.php");
//echo'<pre>';print_r($_POST);exit;
if(isset($_POST['find']))
{
	$cityid=$_POST['cityid'];
        
        /*if($cityid=="")
	{
		 $cityid="all";
	}*/
	
	$ads=str_replace(" ","-",$_POST['ads']);
	
	$ads=str_replace("&","and",$ads);
	
	
        $city=str_replace(" ","_",$_POST['city']);
	
	if(isset($_POST['mcid']) && $_POST['mcid']==!"")
	{
		$mcatid=$_POST['mcid'];
	}
	else
	{
		$mcatid="all";
	}
	
	
	
	
	?><script>
    window.location="<?php echo $actual_link;?>products/<?php echo $city."/".$cityid."/".$mcatid."/".$ads;?>";
    </script><?php
}


?>
 
<div class="intro">
<div class="dtable hw100">
<div class="dtable-cell hw100">
<div class="container text-center">

<div class="row search-row animated fadeInUp">
<form method="post" autocomplete="off">
<div class="col-lg-4 col-sm-4 search-col relative locationicon">


<input type="text" name="ads" id="search_ads" class="form-control has-icon" placeholder="I'm looking for a ..." value="" required>
<input type="hidden" name="mcid" id="Mcid" value="">
<input type="hidden" name="cityid" id="cityid" value="">
</div>
<div style="    position: absolute;
    max-height: 300px;
    z-index: 9999;
    top: 346px;
    left: 312.5px;
    width: 24%; display:none;" id="citysearch" class="autocomplete-suggestions"  data-dismiss="modal">
</div>

<div class="col-lg-4 col-sm-4 search-col relative"> 
<input type="text" name="ads" id="search_ads" class="form-control has-icon" placeholder="I'm looking for a ..." value="" required>
<input type="hidden" name="mcid" id="Mcid" value="">
</div>
<div style="position: absolute; max-height: 300px; z-index: 9999; top: 329px; left: 544.5px; width: 258px; border-radius:none; display:none;" id="productsearch" class="autocomplete-suggestions">
</div>
<div class="col-lg-4 col-sm-4 search-col">
<button class="btn btn-primary btn-search btn-block" name="find"><i class="icon-search"></i><strong>Find</strong></button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
 
<div class="main-container">
<div class="container">
<div class="col-lg-12 content-box ">
<div class="row row-featured row-featured-category">
<div class="col-lg-12  box-title no-border">
<div class="inner"><h2><span>Browse by</span>
Category <a href="<?php echo $actual_link?>products" class="sell-your-item"> View more <i class="  icon-th-list"></i> </a></h2>
</div>
</div>
<form action="<?php echo $actual_link?>products" id="fromSec" method="post">
<input type="hidden" name="maincategory[]" id="mct">
<input type="hidden" name="submits">
</form>
<?php $sqlmaincatss=mysql_query("select * from tbl_maincategory where status='Enable' order by name asc");
	  while($resmaincatss=mysql_fetch_assoc($sqlmaincatss))
	  {
?>


<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a class="MainCatClick" value="<?php echo $resmaincatss['mcid'];?>"><img src="<?php echo $actual_link."admin/maincatimage/".$resmaincatss['maincategory_file'];?>" class="img-responsive" alt="img"> <h6> <?php echo $resmaincatss['name'];?> </h6> </a>
</div>

<?php } ?>


<!--<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/laptop-2.jpg" class="img-responsive" alt="img"> <h6> Laptops </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/mobile.jpg" class="img-responsive" alt="img"> <h6> Mobiles </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/tv.jpg" class="img-responsive" alt="img"> <h6> Electronics </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/hdd.jpg" class="img-responsive" alt="img"> <h6> Computer Accessories </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/house.jpg" class="img-responsive" alt="img"> <h6> Real Estate </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/Home-Electronics-Appliances-2.jpg" class="img-responsive" alt="img"> <h6> Home Appliances </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/camera.jpg" class="img-responsive" alt="img"> <h6> Cameras </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/fashion.jpg" class="img-responsive" alt="img"> <h6> Fashion & Beauty </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/toy.jpg" class="img-responsive" alt="img"> <h6> Kids & Baby Products </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/jobs.jpg" class="img-responsive" alt="img"> <h6> Jobs </h6> </a>
</div>
<div class="col-lg-2 col-md-3 col-sm-3 col-xs-4 f-category">
<a href="category.html"><img src="images/category/catalog.jpg" class="img-responsive" alt="img"> <h6> Home & Furniture </h6> </a>
</div>-->
</div>
</div>
<div style="clear: both"></div>
<div class="col-lg-12 content-box ">
<div class="row row-featured">
<div class="col-lg-12  box-title ">
<div class="inner"><h2><span>Featured </span> Products 
<a href="<?php echo $actual_link?>products" class="sell-your-item"> View more <i class="  icon-th-list"></i> </a></h2>
</div>
</div>
<div style="clear: both"></div>
<div class=" relative  content featured-list-row clearfix">
<nav class="slider-nav has-white-bg nav-narrow-svg">
<a class="prev">
<span class="nav-icon-wrap"></span>
</a>
<a class="next">
<span class="nav-icon-wrap"></span>
</a>
</nav>
<div class="no-margin featured-list-slider ">

<?php 
$sqlpac=mysql_query("select * from tbl_package where amount<1 and status='Enable'");
$respac=mysql_fetch_assoc($sqlpac);

$sqlads1=mysql_query("select * from tbl_ads where  package!='".$respac['pid']."' and admin_status!='Archived' order by rand() limit 0,10");
  if(mysql_num_rows($sqlads1)>0)
  {
	while($resads1=mysql_fetch_assoc($sqlads1))
	{
	
	
	?>
		<div class="item"> 
			<a href="<?php echo $actual_link;?>ads_details/<?php echo $resads1['ads_id'];?>">
				<span class="item-carousel-thumb">
					<img class="img-responsive" src="<?php echo $actual_link."postedfile/".$resads1['file1']; ?>" alt="img">
				</span>
				<span class="item-name"> <?php echo ucfirst($resads1['title']);?> </span>
				<span class="price"> <i class="fa fa-inr"></i> <?php echo $resads1['price'];?> </span>
			</a>
		</div>
	<?php
	}
	
  }
		  
		  
	
?>

</div>
</div>
</div>
</div>


</div>
</div>
 
<div class="page-info" style="background: url(images/bg.jpg); background-size:cover">
<div class="container text-center section-promo">
<div class="row">
<div class="col-sm-3 col-xs-6 col-xxs-12">
<div class="iconbox-wrap">
<div class="iconbox">
<div class="iconbox-wrap-icon">
<i class="icon  icon-group"></i>
</div>
<div class="iconbox-wrap-content">
<h5><span>2200</span> </h5>
<div class="iconbox-wrap-text">Trusted Seller</div>
</div>
</div>
 
</div> 
</div>
<div class="col-sm-3 col-xs-6 col-xxs-12">
<div class="iconbox-wrap">
<div class="iconbox">
<div class="iconbox-wrap-icon">
<i class="icon  icon-th-large-1"></i>
</div>
<div class="iconbox-wrap-content">
<h5><span>100</span> </h5>
<div class="iconbox-wrap-text">Categories</div>
</div>
</div>
 
</div> 
</div>
<div class="col-sm-3 col-xs-6  col-xxs-12">
<div class="iconbox-wrap">
<div class="iconbox">
<div class="iconbox-wrap-icon">
<i class="icon  icon-map"></i>
</div>
<div class="iconbox-wrap-content">
<h5><span>700</span> </h5>
<div class="iconbox-wrap-text">Location</div>
</div>
</div>
 
</div> 
</div>
<div class="col-sm-3 col-xs-6 col-xxs-12">
<div class="iconbox-wrap">
<div class="iconbox">
<div class="iconbox-wrap-icon">
<i class="icon icon-facebook"></i>
</div>
<div class="iconbox-wrap-content">
<h5><span>50,000</span> </h5>
<div class="iconbox-wrap-text"> Facebook Fans</div>
</div>
</div>
 
</div> 
</div>
</div>
</div>
</div>
 
<div class="page-bottom-info">
<div class="page-bottom-info-inner">
<div class="page-bottom-info-content text-center">
<h1>If you have any questions, comments or concerns, please call the Classified Advertising department at (000) 555-5555</h1>
<a class="btn  btn-lg btn-primary-dark" href="tel:+000000000">
<i class="icon-mobile"></i> <span class="hide-xs color50">Call Now:</span> (000) 555-5555 </a>
</div>
</div>
</div>

<div class="modal fade" id="selectRegion" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" style="
    margin-top: 18%;
    margin-right: 16%;
    width:65%;
">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" style="
    
    color: #149078;
">&times;</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-12">
<div style="padding: 11px;
    background-color: rgb(20,144,120);
    width: 46%;
    border-radius: 6px;
"><input type="text" name="city" id="autocomplete-ajax" autocomplete="off" class="form-control locinput input-rel searchtag-input has-icon citys" placeholder="Type region or city" value=""  data-toggle="modal" data-nodel="close" style="width:100%; height: 42px;">
</div>

<div style="clear:both"></div>
<div class="col-sm-6 no-padding">

</div>
<div style="clear:both"></div>
<hr class="hr-thin">
</div>




<div class="col-md-12" style="height:200px; overflow-y:scroll;">
<?php $sqlct=mysql_query("select * from tbl_cities where status='Enable' order by cityname asc");
      while($resct=mysql_fetch_assoc($sqlct))
	  {
		  ?>
          <div class="col-md-4">
<ul class="list-link list-unstyled">	  	
<li> 

<a  id="<?php echo $resct['city_id'];?>" class="Choosecity" title="<?php echo $resct['cityname'];?>"><?php echo $resct['cityname'];?></a> </li> 
</ul>
</div>
		  <?php
	  }
?>
</div>


<!--<div class="col-md-4">
<ul class="list-link list-unstyled">
<li> <a href="#" title="Elmont">Elmont</a> </li>
<li> <a href="#" title="Elmsford">Elmsford</a> </li>
<li> <a href="#" title="Farmingville">Farmingville</a> </li>
<li> <a href="#" title="Floral Park">Floral Park</a> </li>
<li> <a href="#" title="Flushing">Flushing</a> </li>
<li> <a href="#" title="Fonda">Fonda</a> </li>
<li> <a href="#" title="Freeport">Freeport</a> </li>
<li> <a href="#" title="Fresh Meadows">Fresh Meadows</a> </li>
<li> <a href="#" title="Fultonville">Fultonville</a> </li>
<li> <a href="#" title="Gansevoort">Gansevoort</a> </li>
<li> <a href="#" title="Garden City">Garden City</a> </li>
</ul>
</div>
<div class="col-md-4">
<ul class="list-link list-unstyled">
<li> <a href="#" title="Oceanside">Oceanside</a> </li>
<li> <a href="#" title="Orangeburg">Orangeburg</a> </li>
<li> <a href="#" title="Orient">Orient</a> </li>
<li> <a href="#" title="Ozone Park">Ozone Park</a> </li>
<li> <a href="#" title="Palatine Bridge">Palatine Bridge</a> </li>
<li> <a href="#" title="Patterson">Patterson</a> </li>
<li> <a href="#" title="Pearl River">Pearl River</a> </li>
<li> <a href="#" title="Peekskill">Peekskill</a> </li>
<li> <a href="#" title="Pelham">Pelham</a> </li>
<li> <a href="#" title="Penn Yan">Penn Yan</a> </li>
<li> <a href="#" title="Peru">Peru</a> </li>
</ul>
</div>-->
</div>
</div>
</div>
</div>
</div>

<?php include("footer.php");?>

<script>
$(".MainCatClick").click(function()
{
	
	$("#mct").val($(this).attr('value'));
	$("form#fromSec").submit();
});


$(document).click(function() {
//alert('sdgdg');
$(".autocomplete-suggestions").css('display','none');
});

$("#autocomplete-ajax").keyup(function(){
	
	//$(".autocomplete-suggestions").show();
	$("#citysearch").show();
	
	$(this).val();
	$.post("<?php echo $actual_link?>ajax/slocation.php",{sname:$(this).val()},function(data){
	
	$("#citysearch").html(data);
	});
	

});


$(".Choosecity").click(function(){
	
	$("#cityid").val($(this).attr('id'));
	$(".citys").val($(this).attr('title'));
	$(".fade").removeClass('in');
	$(".fade").css('display','none');
});

$("#citysearch").on('click',".cityChoose",function(){
	
	//alert('faf');
	$("#cityid").val($(this).attr('id'));
	$(".citys").val($(this).attr('value'));
	$(".fade").removeClass('in');
	$(".fade").css('display','none');
});



</script>
