<?php $this->load->view('site/templates/header');
$this->load->model('user_model');

/*$url=str_replace('?','#',$_SERVER['REQUEST_URI']); 
$url=parse_url($url);
$filtervals=$url["fragment"];*/ ?>
<!-- purchases and Review -->
<div class="main">
  <div class="content-wrap">
    <div id="header_menu" class="content-wrap-inner clear ">
      <div id="logo_inner" class="col col4">
        <?php $segmentvalues=$this->uri->segment_array(); 
				?>
        <?php for($i=1;$i<=count($segmentvalues);$i++) {
			$lnk=''; $lnk1='';
					for($j=1;$j<=$i;$j++){
						$lnk.=$segmentvalues[$j].'/';
						if($j==1)
						$lnk1.=$segmentvalues[$j].'/';
						else if($i!=$j)
						$lnk1.=$segmentvalues[$j].'/';	
					}  
		?>
        <?php if($i+1 != count($segmentvalues)){ ?>
        <a href="<?php echo $lnk.$segmentvalues[$j]; ?>">
        <?php if($i!=1 && $segmentvalues[$j] != ''){ echo '/'; } ?>
        <span class="submenustyl">
        <?php $catid=@explode('-',$segmentvalues[$j]); 	
		echo $this->product_model->get_all_details(CATEGORY,array('id' => $catid[0]))->row()->cat_name;  ?>
        </span></a>
        <?php } ?>
        <?php  $curr_cat=$segmentvalues[$i+1];} ?>
        <h1 id="bigCat" class="jewely-text"><?php echo $currentsubCategory->cat_name;?></h1>
        <input type="hidden" id="bigCatid" value="<?php echo $currentsubCategory->id.'-'.$currentsubCategory->seourl;?>" />
        <input type="hidden" name="current_url_prod_list" id="current_url_prod_list" value="<?php echo $this->uri->segment(count($segmentvalues));?>" />
      </div>
      <ul id="inner-page-ul" class="col col8 col-last">
        <?php  $segmentvalues=$this->uri->segment_array();
				//echo $lnk; echo '<pre>'; echo $lnk1; die;
				foreach($subCats->result() as $catList) {
				if ($catList->cat_name != ''){ $commentData = $this->category_model->get_all_counts($catList->id,''); if($commentData[0]['disp']>0){
				
				$activeCatid=@explode('-',$this->uri->segment(count($segmentvalues)));
				
				?>
        <li class="col col2 <?php if($activeCatid[0] == $catList->id) { echo 'active-list';}?>"> <a href="<?php if($activeCatid[0] == $catList->id) { echo 'javascript: void(0);'; } else  if($super_sub_catStatus=='No') {
				   if($super_sub_catStatus=='No' && $super_sub_catID == $catList->id){ echo $lnk;} else { echo $lnk1.$catList->id.'-'.$catList->seourl; } } else { echo $lnk.$catList->id.'-'.$catList->seourl;}
				   ?>" name="<?php echo $catList->cat_name;?>" <?php if($activeCatid[0] == $catList->id) { echo 'style="cursor:default"';}?>  id="<?php echo $catList->id.'-'.$catList->seourl;?>"><?php echo $catList->cat_name;?></a> </li>
        <?php } } }?>
      </ul>
    </div>
  </div>
</div>

<div  class="purchase_review">
  <div class="list-page-top"> </div>
  <div style="margin-top: 0px;" class="main">
  
  
    <div class="top_list" style="display: block; width:980px;">
      <div class="itemslist">
        <ul class="listtypename">
          <li id="filter_by_all_products" class="<?php if($this->input->get('marketplace') != ''){ echo '';} else { echo 'first_list first_list_seleted'; }?>"> 
          <a class="top_first_line " id="m_place1" href="<?php echo base_url().$lnk;  if($this->input->get('gift_cards') == '1'){ echo '?gift_cards=1'; }?>"> <?php if($this->lang->line('shop_allitems') != '') { echo stripslashes($this->lang->line('shop_allitems')); } else echo 'All Items'; ?> </a> </li>
          <li  id="handmade" class="<?php if($this->input->get('marketplace') == 'handmade'){ echo 'first_list first_list_seleted';} else { echo 'first_list2'; }?>"> 
          <a class="top_first_line" id="m_place2"  href="javascript:void(0);"> <?php if($this->lang->line('shop_handmad') != '') { echo stripslashes($this->lang->line('shop_handmad')); } else echo 'Handmade'; ?> </a> </li>
          <li id="vintage" class="<?php if($this->input->get('marketplace') == 'vintage'){ echo 'first_list first_list_seleted';} else { echo 'first_list3'; }?>">
           <a class="top_first_line" id="m_place3"  href="javascript:void(0);"> <?php if($this->lang->line('shop_vint') != '') { echo stripslashes($this->lang->line('shop_vint')); } else echo 'Vintage'; ?> </a> </li>
        </ul>
      </div>
      
      
      
      <div class="accept_notification">
        <input  type="checkbox" id="giftcard" name="giftcard" <?php if($this->input->get('gift_cards') == '1'){ echo 'checked="checked"';}?> >
        <label > <?php if($this->lang->line('prod_accepts') != '') { echo stripslashes($this->lang->line('prod_accepts')); } else echo 'Accepts'; ?> <?php echo $this->config->item('email_title'); ?> <?php if($this->lang->line('giftcard_cards') != '') { echo stripslashes($this->lang->line('giftcard_cards')); } else echo 'Gift Cards'; ?> </label>
      </div>
      <div class="shorting">
        <?php if($this->input->get('min_price') != '' || $this->input->get('max_price') != '') {?>
        <ul id="price_clicked" style="display:block">
          <div class="clicked_inputs-groups" id="restore_price" style="display: inline-block;">
            <div class="clicked_inputs">
              <label for="price-clicked"><?php if($this->lang->line('list_range') != '') { echo stripslashes($this->lang->line('list_range')); } else echo 'Price range'; ?> </label>
              <select name="price_filter_index" id="filter_byprice">
               <option value=""><?php if($this->lang->line('list_any') != '') { echo stripslashes($this->lang->line('list_any')); } else echo 'Any price'; ?></option>
                <option value="1" data-max="25" data-min="" <?php if($this->input->get('min_price') == 0){ echo 'selected="selected"';} ?> ><?php if($this->lang->line('list_under') != '') { echo stripslashes($this->lang->line('list_under')); } else echo 'Under'; ?> <?php echo $currencySymbol.'  '; echo '25'.$currencyType;?></option>
                <option value="2" data-max="50" data-min="25" <?php if($this->input->get('min_price') == 25){ echo 'selected="selected"';} ?>><?php echo $currencySymbol; echo '25 – '; echo $currencySymbol; echo '50 '.$currencyType;?></option>
                <option value="3" data-max="100" data-min="50" <?php if($this->input->get('min_price') == 50){ echo 'selected="selected"';} ?>><?php echo $currencySymbol; echo '50 – '; echo $currencySymbol; echo '100 '.$currencyType;?></option>
                <option value="4" data-max="250" data-min="100" <?php if($this->input->get('min_price') == 100){ echo 'selected="selected"';} ?>><?php echo $currencySymbol; echo '100 – '; echo $currencySymbol; echo '250 '.$currencyType;?></option>
                <option value="5" data-max="500" data-min="250" <?php if($this->input->get('min_price') == 250){ echo 'selected="selected"';} ?>><?php echo $currencySymbol; echo '250 – '; echo $currencySymbol; echo '500 '.$currencyType;?></option>
                <option value="6" data-max="" data-min="500" <?php if($this->input->get('min_price') == 500){ echo 'selected="selected"';} ?>>Over <?php echo $currencySymbol.' '; echo '500'.$currencyType;?></option>
              </select>
            </div>
            <input class="clicked-submit" type="button" id="remove_price" onclick="return remove_priceFilter1();" value="x">
          </div>
        </ul>
        <ul id="filter_list_price" style="display:none">
          <li><?php if($this->lang->line('giftcard_price') != '') { echo stripslashes($this->lang->line('giftcard_price')); } else echo 'Price'; ?></li>
        </ul>
        <?php } else {?>
        <ul id="filter_list_price" style="display:block">
          <li><?php if($this->lang->line('giftcard_price') != '') { echo stripslashes($this->lang->line('giftcard_price')); } else echo 'Price'; ?></li>
        </ul>
        <?php }?>
        <?php if($this->input->get('location') != '') {?>
        <ul id="filter_bylocation" style="display:block">
          <div class="clicked_inputs-groups" id="restore_from" style="display: inline-block;">
            <div class="clicked_inputs">
              <label for="filter_byshipFrom"><?php if($this->lang->line('list_itemsfrom') != '') { echo stripslashes($this->lang->line('list_itemsfrom')); } else echo 'Items from'; ?> </label>
              <input type="hidden" value="<?php echo $this->input->get('location');?>" name="filter_byshipFrom" id="filter_byshipFrom"/>
              <?php echo $this->input->get('location');?>
            </div>
            <input class="clicked-submit" type="button" id="remove_from" onclick="return remove_fromFilter();" value="x">
          </div>
        </ul>
       
        <?php } else {?>
        <ul id="filter_bylocation">
          <li><?php if($this->lang->line('list_location') != '') { echo stripslashes($this->lang->line('list_location')); } else echo 'Shop Location'; ?></li>
        </ul>
        <?php }?>
        
        
        <?php if($this->input->get('shipto') != '') {?>
        <div class="clicked_inputs-groups" id="restore_to" style="display: inline-block;"><div class="clicked_inputs"><label for="price-clicked"><?php if($this->lang->line('list_delivers') != '') { echo stripslashes($this->lang->line('list_delivers')); } else echo 'Delivers to'; ?></label><select name="filterByship_to" id="filterByship_to"><option value=""><?php if($this->lang->line('list_choose') != '') { echo stripslashes($this->lang->line('list_choose')); } else echo 'choose country'; ?>..</option><?php foreach($countryList as $c_list) {?>
        <option value="<?php echo $c_list->id;?>" <?php if($c_list->id == $this->input->get('shipto')) { echo 'selected="selected"';} ?>><?php echo $c_list->name;?></option>
		<?php }?></select>
        </div><input class="clicked-submit" type="button" id="remove_to" onclick="return remove_toFilter();" value="x"></div>
        
          <ul  id="filter_byshipTo" style="display:none">
            <li><?php if($this->lang->line('list_shipsto') != '') { echo stripslashes($this->lang->line('list_shipsto')); } else echo 'Ships To'; ?></li>
          </ul>
          <?php } else {?>
           <ul  id="filter_byshipTo">
             <li><?php if($this->lang->line('list_shipsto') != '') { echo stripslashes($this->lang->line('list_shipsto')); } else echo 'Ships To'; ?></li>
           </ul>
        <?php }?>
       
      </div>
    </div>
    <div id="main" style="margin-bottom:20px;">
    
    <ul style="  background: none repeat scroll 0 0 #FFFFFF;box-shadow: 0 3px 0 0 #E1E1E1;float: left;padding: 20px;width: 95%; display:none" id="loader">
    <li style="text-align: center;" ><img src="images/spinner.gif" /></li>
    </ul>
    
    <?php if($product_list->num_rows() > 0){ ?>
      <ul class="product-list" id="tiles">
        <!-- These are our grid blocks -->
        <?php 
        
		 //$Imgheight=array(220,147,333,232,299,159,242,167,298,153,129);
		 $i=0; $hover=0; foreach($product_list->result_array() as $products) {
			 $hover++;
			$Images=explode(',',$products['image']);
			?>
        <li class="style-type1"> <!--width="215" height="<?php echo $Imgheight[$i];?>"--> 
          <a href="products/<?php echo $products['seourl'];?>"> <img src="images/product/org-image/<?php echo $Images[0]?>" width="215" title="<?php echo stripslashes($products['product_name']);?>" /> </a>
          <div class="product_hide"> <a href="#"> </a>
            <div class="product_fav">
              <?php if($loginCheck !=''){
			$favArr = $this->product_model->getUserFavoriteProductDetails(stripslashes($products['id']));
			#print_r($favArr); die;
			if(empty($favArr)){ ?>
              <a href="javascript:void(0);" onclick="return changeProductToFavourite('<?php echo stripslashes($products['id']); ?>','Fresh');">
              <input type="submit" value="" class="hoverfav_icon" />
              </a>
              <?php  } else { ?>
              <a href="javascript:void(0);" onclick="return changeProductToFavourite('<?php echo stripslashes($products['id']); ?>','Old');">
              <input type="submit" value="" class="hoverfav_icon1" />
              </a>
              <?php }} else { ?>
              <a href="javascript:void(0);" onclick="return changeProductToFavourite('<?php echo stripslashes($products['id']); ?>','Fresh');">
              <input type="submit" value="" class="hoverfav_icon" />
              </a>
              <?php  } ?>
              <!--<a href="#">
              <input class="hoverfav_icon" type="submit" value="">
           </a>--> 
            </div>
            <div class="hoverdrop_icon"> <a href="javascript:hoverView('<?php echo $hover; ?>');"></a>
              <div class="hover_lists" id="hoverlist<?php echo $hover; ?>">
                <h2><?php if($this->lang->line('user_your_lists') != '') { echo stripslashes($this->lang->line('user_your_lists')); } else echo 'Your Lists'; ?></h2>
                <div class="lists_check">
                  <?php foreach($userLists as $Lists){ 
                    $haveListIn = $this->user_model->check_list_products(stripslashes($products['id']),$Lists['id'])->num_rows();
                    #echo $haveListIn;
                    if($haveListIn>0){$chk='checked="checked"';}else{ $chk='';}
                    ?>
                  <input type="checkbox" class="check_box" onclick="return addproducttoList('<?php echo $Lists['id']; ?>','<?php echo stripslashes($products['id']); ?>');" <?php echo $chk; ?> />
                  <label><?php echo $Lists['name']; ?></label>
                  <?php } ?>
                  <?php if(!empty($userRegistry)){ 
					$haveRegisryIn = $this->user_model->check_registry_products($products['id'],$userRegistry->user_id)->num_rows();
					if($haveRegisryIn>0){$chk='checked="checked"';}else{ $chk='';}
				?>
				<input type="checkbox" class="check_box" onclick="return manageRegisrtyProduct('<?php echo $userRegistry->user_id; ?>','<?php echo $products['id']; ?>');" <?php echo $chk; ?> />
				<label><span class="registry_icon"></span><?php if($this->lang->line('prod_wedding') != '') { echo stripslashes($this->lang->line('prod_wedding')); } else echo 'Wedding Registry'; ?></label>
				<?php }  ?>
                </div>
                <div class="new_list">
                  <form method="post" action="site/user/add_list">
                    <input type="hidden" value="1" name="ddl" />
                    <input type="hidden" value="<?php echo $products['id']; ?>" name="productId" />
                    <input type="text" placeholder="<?php if($this->lang->line('user_new_list') != '') { echo stripslashes($this->lang->line('user_new_list')); } else echo 'New list'; ?>" class="list_scroll" name="list" id="creat_list_<?php echo $i; ?>" />
                    <input type="submit" value="<?php if($this->lang->line('user_add') != '') { echo stripslashes($this->lang->line('user_add')); } else echo 'Add'; ?>" class="primary-button" onclick="return validate_create_list('<?php echo $i; ?>');" />
                  </form>
                </div>
              </div>
            </div>
          </div>
          <span class="image-detail-text"><a href="products/<?php echo $products['seourl'];?>"><?php echo $products['product_name'];?></a></span>
          <label>
          <a class="bottom-text" href="shop-section/<?php echo $products['shop_seourl'];?>"><?php echo $products['shop_name'];?></a>
          <p class="dollar-sign"><?php echo $currencySymbol; if($products['price'] != 0.00) { echo number_format($currencyValue*$products['price'],2); } else { echo number_format($currencyValue*$products['pricing'],2); echo '+'; }?>&nbsp;<span class="currency_code"><?php echo $currencyType;?></span></p>
          </label>
        </li>
        <?php  $i++;  if($i == 10) { $i=0;} }?>
        </ul>
        
         <?php } else { ?>
        <section>
          <div class="main">
            <div style="margin:20px 0" class="search-error">
              <h3 class="crumbs"> <?php if($this->lang->line('list_selections') != '') { echo stripslashes($this->lang->line('list_selections')); } else echo 'Darn. No items match your selections'; ?>. </h3>
              <p class="newline"> <?php if($this->lang->line('list_try') != '') { echo stripslashes($this->lang->line('list_try')); } else echo 'Try'; ?> <a href="<?php echo $_SERVER['HTTP_REFERER']; ?>"><?php if($this->lang->line('list_showing') != '') { echo stripslashes($this->lang->line('list_showing')); } else echo 'showing all items'; ?> .</a>  </p>
            </div>
          </div>
        </section>
        <?php }?>
      
    </div>
				    <div id="infscr-loading" style="text-align: center; display: none;">
							<span><img src="images/spinner.gif" alt="Loading..." /></span>
				</div>
				<div class="landing_pagination" id="landing_page_id" style="display: none;">
				<?php echo $paginationDisplay;?>
				</div>
  </div>	
</div>
<div class="main">
  <div id="footer-divider">
    <ul class="footer-menus">
         <li class="blocker"> <?php if($this->lang->line('user_follow') != '') { echo stripslashes($this->lang->line('user_follow')); } else echo 'Follow'; ?> <?php echo $this->config->item('email_title'); ?> </li>
         <li><a class="icons1" href="<?php echo $this->config->item('facebook_link'); ?>" target="_blank"><?php if($this->lang->line('user_facebook') != '') { echo stripslashes($this->lang->line('user_facebook')); } else echo 'Facebook'; ?></a></li>
         <li><a class="icons3" href="<?php echo $this->config->item('twitter_link'); ?>" target="_blank"><?php if($this->lang->line('comm_twitter') != '') { echo stripslashes($this->lang->line('comm_twitter')); } else echo 'Twitter'; ?></a></li>
         <li><a class="icons4" href="<?php echo $this->config->item('pinterest'); ?>" target="_blank"><?php if($this->lang->line('comm_pininterest') != '') { echo stripslashes($this->lang->line('comm_pininterest')); } else echo 'Pintrest'; ?></a></li>
    </ul>
    <ul class="footer-menus1 col col8 col-last">
      
      <!--<span>Spring Celebrations</span>-->
      
      <?php  foreach ($this->data['mainCategories']->result() as $row){
							if ($row->cat_name != ''){ $commentData = $this->category_model->get_all_counts($row->id,''); if($commentData[0]['disp']>0){
							$cur_catid=explode('-',$this->uri->segment(2));	
							if($cur_catid[0] == $row->id) {
                      	?>
      <span> <a href="category-list/<?php echo $row->id;?>-<?php echo $row->seourl;?>"><?php echo $row->cat_name;?></a> </span>
      <?php 
                      	}}   }  }
						
                $segmentvalues=$this->uri->segment_array();
				foreach($footerSubcatList->result() as $catList) 
				{   if ($catList->cat_name != ''){ $commentData = $this->category_model->get_all_counts($catList->id,''); if($commentData[0]['disp']>0){
				    ?>
      <li class="col col2"> <a href="browse/<?php  echo $this->uri->segment(2).'/'.$catList->id.'-'.$catList->seourl;?>" name="<?php echo $catList->cat_name;?>"  id="<?php echo $catList->id.'-'.$catList->seourl;?>"><?php echo $catList->cat_name;?></a> </li>
      <?php } }}?>
    </ul>
    <ul class="footer-menus2">
      <?php  foreach ($this->data['mainCategories']->result() as $row){
							if ($row->cat_name != ''){ $commentData = $this->category_model->get_all_counts($row->id,''); if($commentData[0]['disp']>0){
							$cur_catid=explode('-',$this->uri->segment(2));	
							if($cur_catid[0] != $row->id) {
                      	?>
      <li class="blocker2"> <a href="category-list/<?php echo $row->id;?>-<?php echo $row->seourl;?>"><?php echo $row->cat_name;?></a> </li>
      <?php }} } }?>
    </ul>
  </div>
</div>
<input type="hidden" name="madebyFilter" id="madebyFilter" value="<?php if($this->input->get('marketplace') != ''){ echo $this->input->get('marketplace');}?>"/>
<input type="hidden" name="pricebyFilter" id="pricebyFilter" value="<?php if($this->input->get('min_price') != ''){ echo '&min_price='.$this->input->get('min_price');} if($this->input->get('max_price') != ''){ echo '&max_price='.$this->input->get('max_price');}?>"/>
<input type="hidden" name="shipfromFilter" id="shipfromFilter" value="<?php if($this->input->get('location') != ''){ echo $this->input->get('location');}?>"/>
<input type="hidden" name="shiptoFilter" id="shiptoFilter" value="<?php if($this->input->get('shipto') != ''){ echo $this->input->get('shipto');}?>"/>
<input type="hidden" name="fullurl" id="fullurl" value="<?php echo $lnk;?>"/>
 <input type="hidden" value="<?php if($filtervals != ''){ echo 'Yes';} else { echo 'No';}?>" id="backstatus">
<!-- section_end -->

<script type="text/javascript">
var loading=false;
var $win     = $(window),
$stream  = $('ul.product-list');
$(window).scroll(function() { //detect page scroll
	if($(window).scrollTop() + $(window).height() == $(document).height())  //user scrolled to bottom of the page?
	{
		var $url = $('.landing-btn-more').attr('href');
		if(!$url) $url='';
		if($url != '' && loading==false) //there's more data to load
		{
			loading = true; //prevent further ajax loading
			$('#infscr-loading').show(); //show loading image
			//var vmode = $('.figure.classic').css('display');
			//load data from the server using a HTTP POST request
			
			$.ajax({
					type:'post',
					url:$url,
					success:function(html){
//						alert(data);	
				
				
						var $html = $($.trim(html)),
					    $more = $('.landing_pagination > a'),
					    $new_more = $html.find('.landing_pagination > a');

					if($html.find('ul.product-list').text() == ''){
						//$stream.append('<ul class="product_main_thumb"><li style="width: 100%;"><p class="noproducts">No more products available</p></li></ul>');
					}else {
						$stream.append( $html.find('ul.product-list').html());
					}

					if($new_more.length) $('.landing_pagination').append($new_more);
					$more.remove();
					
				
				
				//hide loading image
				$('#infscr-loading').hide(); //hide loading image once data is received
				
				loading = false; 
				 var options = {
			        autoResize: true, // This will auto-update the layout when the browser window is resized.
			        container: $('#main'), // Optional, used for some extra CSS styling
			        offset: 8, // Optional, the distance between grid items
			        itemWidth: 230 // Optional, the width of a grid item
			      };
			 	var handler = $('#tiles li');
			 	handler.wookmark(options);
			 
				},
				fail:function(xhr, ajaxOptions, thrownError) { //any errors?
					
					alert(thrownError); //alert with HTTP error
					$('#infscr-loading').hide(); //hide loading image
					loading = false;
				
				}
			});
			
		}
	}
});
</script>
<!-- include jQuery --> 
<script src="js/site/jquery-1.9.1.min.js"></script> 
<script src="js/site/jquery.wookmark.js"></script> 

<script type="text/javascript">
    $(document).ready(new function() {
      // Prepare layout options.
      var options = {
        autoResize: true, // This will auto-update the layout when the browser window is resized.
        container: $('#main'), // Optional, used for some extra CSS styling
        offset: 8, // Optional, the distance between grid items
        itemWidth: 230 // Optional, the width of a grid item
      };

      // Get a reference to your grid items.
      var handler = $('#tiles li');

      // Call the layout function.
      handler.wookmark(options);

      // Capture clicks on grid items.
     
    });
  </script>

 <script type="text/javascript">
	$(document).ready(function() {
	  window.setTimeout(function(){ $("html, body").animate({ scrollTop: 50 }, 100); },100);
    });
 

</script>
<script>
$("#filter_byprice").trigger('click'); 
$(document).ready(function(){ 
 if (window.history && window.history.pushState) { 
		$(window).on('popstate', function() {
			if($("#backstatus").val() == 'Yes'){
			var fullUrl=$('#fullurl').val();
			var consta=confirm('You want to completely leave this page? you will loss your filters.');
				if(consta){
					window.location.href=baseURL+'category-list/<?php echo $this->uri->segment(2);?>';
				}
		    } 
		});
 }


  $("#filter_list_price").click(function(){ 
    $("#filter_list_price").html('<div class="clicked_inputs-groups" id="restore_price" style="display: inline-block;"><div class="clicked_inputs"><label for="price-clicked">Price range </label><select name="price_filter_index" id="filter_byprice"><option value="">Any price</option><option value="1" data-max="25" data-min="">Under <?php echo $currencySymbol.'  '; echo '25'.$currencyType;?></option><option value="2" data-max="50" data-min="25"><?php echo $currencySymbol; echo '25 – '; echo $currencySymbol; echo '50 '.$currencyType;?></option><option value="3" data-max="100" data-min="50"><?php echo $currencySymbol; echo '50 – '; echo $currencySymbol; echo '100 '.$currencyType;?></option><option value="4" data-max="250" data-min="100"><?php echo $currencySymbol; echo '100 – '; echo $currencySymbol; echo '250 '.$currencyType;?></option><option value="5" data-max="500" data-min="250"><?php echo $currencySymbol; echo '250 – '; echo $currencySymbol; echo '500 '.$currencyType;?></option><option value="6" data-max="" data-min="500">Over <?php echo $currencySymbol.' '; echo '500'.$currencyType;?></option></select></div><input class="clicked-submit" type="button" id="remove_price" onclick="return remove_priceFilter();" value="Go"></div>');
	$('#filter_list_price').attr('id', 'price_clicked'); //filter_list_price
	  });
});


$(document).ready(function(){
  $("#filter_bylocation").click(function(){ 
    $("#filter_bylocation").html('<div class="clicked_inputs-groups" id="restore_from" style="display: inline-block;"><div class="clicked_inputs"><label for="price-clicked">Items from </label><input type="text" name="filter_byshipFrom" id="filter_byshipFrom"/></div><input class="clicked-submit" type="button" id="remove_from" onclick="return ship_fromFilter();" value="Go"></div>');
	$('#filter_bylocation').attr('id', 'fromloc_clicked');
	  });
});



$(document).ready(function(){
  $("#filter_byshipTo").click(function(){ 
    $("#filter_byshipTo").html('<div class="clicked_inputs-groups" id="restore_to" style="display: inline-block;"><div class="clicked_inputs"><label for="price-clicked">Delivers to</label><select name="filterByship_to" id="filterByship_to"><option value="">choose country..</option><?php foreach($countryList as $c_list) {?><option value="<?php echo $c_list->id;?>"><?php echo $c_list->name;?></option><?php }?></select></div><input class="clicked-submit" type="button" id="remove_to" onclick="return remove_toFilter();" value="Go"></div>');
	$('#filter_byshipTo').attr('id', 'toloc_clicked');
	  });
	  
});


$(document).ready(function(){
  $("#handmade").click(function(){    
       
	  $("#backstatus").val('Yes'); 
	  $('#loader').css('display','block');
	  $('#tiles').css('display','none');	  
         
	  $('#filter_by_all_products').removeClass('first_list_seleted first_list');
	  $('#vintage').removeClass('first_list_seleted first_list');
	  $('#handmade').addClass('first_list first_list_seleted');
	  $('#madebyFilter').val('handmade');
		  var shipfrom='';
		  if($('#shipfromFilter').val() != '')
		  {
			  var shipfrom='&location='+$('#shipfromFilter').val();
		  }
		  var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
		  var pricefilter='';
		  if($('#pricebyFilter').val() != '')
		  {
			  var pricefilter=$('#pricebyFilter').val();
		  }
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  }
	  var fullUrl=$('#fullurl').val(); //fullurl
	  var filterid=document.getElementById('bigCatid').value;  
	  if (history.pushState) {
	     window.history.pushState("object or string", "Title",fullUrl+"?marketplace="+this.id+shipfrom+shipto+pricefilter+giftcard);
	  }
	  $.get('site/product/Load_ajax_products_list?cat_id='+filterid+'&marketplace='+this.id+shipfrom+shipto+pricefilter+giftcard, function(data) {
	  
	  $('#loader').css('display','none');
	  $('#tiles').css('display','block');		
	  $("#tiles").html(data);
			
			//closeActionAfter();
	});
    
  });
});

$(document).ready(function(){
  $("#vintage").click(function(){
	  $("#backstatus").val('Yes'); 
	  $('#loader').css('display','block');
	  $('#tiles').css('display','none');	
	  
	  $('#filter_by_all_products').removeClass('first_list_seleted first_list');
	  $('#handmade').removeClass('first_list_seleted first_list');
	  $('#vintage').addClass('first_list first_list_seleted');
	  $('#madebyFilter').val('vintage');
		  var shipfrom='';
		  if($('#shipfromFilter').val() != '')
		  {
			  var shipfrom='&location='+$('#shipfromFilter').val();
		  }
		  var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
		  var pricefilter='';
		  if($('#pricebyFilter').val() != '')
		  {
			  var pricefilter=$('#pricebyFilter').val();
		  }
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  }
	  var fullUrl=$('#fullurl').val();
	  var filterid=document.getElementById('bigCatid').value; 
	  if (history.pushState) {
        window.history.pushState("object or string", "Title",fullUrl+"?marketplace="+this.id+shipfrom+shipto+pricefilter+giftcard);
	  }
	  $.get('site/product/Load_ajax_products_list?cat_id='+filterid+'&marketplace='+this.id+shipfrom+pricefilter+shipto+giftcard, function(data) {
	 
	  
	  $('#loader').css('display','none');
	  $('#tiles').css('display','block');
	  $("#tiles").html(data);
			//closeActionAfter();
	});
    
  });
});



$(document).change(function(){
  $("#filter_byprice").click(function(){ //remove_price
      $("#backstatus").val('Yes'); 
      $('#loader').css('display','block');
	  $('#tiles').css('display','none');	
  
      $("#remove_price").val('x');
	  var filterPrice=document.getElementById('filter_byprice').value;
	  if(filterPrice==1)
	  {
		  var minPrice=0;
		  var maxPrice=25;
	  }
	 if(filterPrice==2)
	  {
		  var minPrice=25;
		  var maxPrice=50;
	  }
	  if(filterPrice==3)
	  {
		  var minPrice=50;
		  var maxPrice=100;
	  }
	  if(filterPrice==4)
	  {
		  var minPrice=100;
		  var maxPrice=250;
	  }
	  if(filterPrice==5)
	  {
		  var minPrice=250;
		  var maxPrice=500;
	  }
	   if(filterPrice==6) 
	  {
		  var minPrice=500;
		  var maxPrice='';
	  }
	      var madeby='';
		  if($('#madebyFilter').val() != '')
		  {
			  var madeby='&marketplace='+$('#madebyFilter').val();
		  }
	      var shipfrom='';
		  if($('#shipfromFilter').val() != '')
		  {
			  var shipfrom='&location='+$('#shipfromFilter').val();
		  }
		  var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  }
	  if(minPrice != '' || maxPrice != '')
	  {
		  var minp='&min_price='+minPrice;
		  if(maxPrice != '')
		  {
			var maxp= '&max_price='+maxPrice;
		  } else 
		  {
			var maxp='';  
		  }
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var fullUrl=$('#fullurl').val();
		  if(filterPrice!=''){
			  $('#pricebyFilter').val(minp+maxp);
			  if (history.pushState) {
			    window.history.pushState("object or string", "Title",fullUrl+'?'+minp+maxp+shipto+giftcard+madeby+shipfrom);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+minp+maxp+giftcard+madeby+shipto+shipfrom, function(data) {
			  
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
		  	  }); 
		  } else {
		      if (history.pushState) {
		      window.history.pushState("object or string", "Title",fullUrl+'?'+giftcard+madeby+shipto+shipfrom);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'?'+giftcard+madeby+shipto+shipfrom, function(data) {
			 
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
		  	  }); 
			  $('#pricebyFilter').val('');
		  }
	  } 
  });
});
//
$(document).click(function(){ 
  $("#filterByship_to").change(function(){ 
           $("#backstatus").val('Yes'); 
		  $('#loader').css('display','block');
		  $('#tiles').css('display','none');	
	  
	      var filtercountry=document.getElementById('filterByship_to').value;
		  $("#remove_to").val('x');
		  var madeby='';
		  if($('#madebyFilter').val() != '')
		  {
			  var madeby='&marketplace='+$('#madebyFilter').val();
		  }
		  var shipfrom='';
		  if($('#shipfromFilter').val() != '')
		  {
			  var shipfrom='&location='+$('#shipfromFilter').val();
		  }
		  var pricefilter='';
		  if($('#pricebyFilter').val() != '')
		  {
			  var pricefilter=$('#pricebyFilter').val();
		  }
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  } 
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var fullUrl=$('#fullurl').val();
		  if(filtercountry != ''){  
			  $('#shiptoFilter').val(filtercountry);
			  if (history.pushState) {
			   window.history.pushState("object or string", "Title",fullUrl+'?shipto='+filtercountry+giftcard+madeby+shipfrom+pricefilter);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'&shipto='+filtercountry+madeby+giftcard+shipfrom+pricefilter, function(data) {
			  
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
			  }); 
		  } else {
		       if (history.pushState) { 
		       window.history.pushState("object or string", "Title",fullUrl+'?'+giftcard+madeby+shipfrom+pricefilter);
			   }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'?'+madeby+giftcard+shipfrom+pricefilter, function(data) {
			  
		      $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
			  }); 
			  $('#shiptoFilter').val('');
		  }
  });
});

function ship_fromFilter(){
	
	      $("#backstatus").val('Yes'); 
	      $('#loader').css('display','block');
		  $('#tiles').css('display','none');
	
	      var filtercountry=document.getElementById('filter_byshipFrom').value; 
		
		$('#fromloc_clicked').html('<div class="clicked_inputs-groups" id="restore_from" style="display: inline-block;"><div class="clicked_inputs"><label for="filter_byshipFrom">Items from </label><input type="hidden" value="'+filtercountry+'" name="filter_byshipFrom" id="filter_byshipFrom"/>'+filtercountry+'</div><input class="clicked-submit" type="button" id="remove_from" onclick="return remove_fromFilter();" value="x"></div>');
		  //$("#remove_from").val('x'); 
		 // alert(filtercountry);
		  //$('#fromloc_clicked').attr('id', 'filter_bylocation');
	//alert($('#filter_byshipFrom').val());
	      var madeby='';
		  if($('#madebyFilter').val() != '')
		  {
			  var madeby='&marketplace='+$('#madebyFilter').val();
		  }
		  var pricefilter='';
		  if($('#pricebyFilter').val() != '')
		  {
			  var pricefilter=$('#pricebyFilter').val();
		  }
		  var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
	      var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		  var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  } 
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var fullUrl=$('#fullurl').val();
		  if(filtercountry != ''){
			  $('#shipfromFilter').val(filtercountry);
			  if (history.pushState) {
			   window.history.pushState("object or string", "Title",fullUrl+'?location='+filtercountry+shipto+giftcard+madeby+pricefilter);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'&location='+filtercountry+giftcard+shipto+madeby+pricefilter, function(data) {
			  
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
		      }); 
		  } else {
		      if (history.pushState) {
		        window.history.pushState("object or string", "Title",fullUrl+'?'+filtercountry+giftcard+shipto+madeby+pricefilter);
			  }
		      $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'?'+giftcard+madeby+shipto+pricefilter, function(data) {
		      
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
			   }); 
			  $('#shipfromFilter').val('');
		  }
	//}
}

$(document).ready(function(){ 
  $("#giftcard").change(function(){
	      $("#backstatus").val('Yes'); 
	      $('#loader').css('display','block');
		  $('#tiles').css('display','none');
	  
		   var shipfrom='';
		   if($('#shipfromFilter').val() != '')
		   {
			   var shipfrom='&location='+$('#shipfromFilter').val();
		   }
	       var madeby='';
		  if($('#madebyFilter').val() != '')
		  {
			  var madeby='&marketplace='+$('#madebyFilter').val();
		  }
		  var pricefilter='';
		  if($('#pricebyFilter').val() != '')
		  {
			  var pricefilter=$('#pricebyFilter').val();
		  }
	      var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  }
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var fullUrl=$('#fullurl').val();
		  if (history.pushState) {
		    window.history.pushState("object or string", "Title",fullUrl+'?'+giftcard+shipto+shipfrom+madeby+pricefilter);
		  }
		  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+giftcard+shipfrom+madeby+shipto+pricefilter, function(data) {
		  
		  $('#loader').css('display','none');
	      $('#tiles').css('display','block');
		  $("#tiles").html(data); 
		 }); 
		
  });
  
 
  
});

function remove_priceFilter(){
$('#filter_byprice').val('');  //
var selectedPrice=$('#filter_byprice').val();
$('#pricebyFilter').val('');
$("#filter_byprice").click(); 
if($('#remove_price').val() == 'x'){   
$('#filter_list_price').html('<li>Price</li>');
}
$('#price_clicked').attr('id', 'filter_list_price'); 
}



function remove_priceFilter1(){
$('#filter_byprice').val('');  //
var selectedPrice=$('#filter_byprice').val();
$('#pricebyFilter').val('');

$("#backstatus").val('Yes'); 
$('#loader').css('display','block');
$('#tiles').css('display','none');

var filterPrice=document.getElementById('filter_byprice').value;
	  if(filterPrice==1)
	  {
		  var minPrice=0;
		  var maxPrice=25;
	  }
	 if(filterPrice==2)
	  {
		  var minPrice=25;
		  var maxPrice=50;
	  }
	  if(filterPrice==3)
	  {
		  var minPrice=50;
		  var maxPrice=100;
	  }
	  if(filterPrice==4)
	  {
		  var minPrice=100;
		  var maxPrice=250;
	  }
	  if(filterPrice==5)
	  {
		  var minPrice=250;
		  var maxPrice=500;
	  }
	   if(filterPrice==6) 
	  {
		  var minPrice=500;
		  var maxPrice='';
	  }
	      var madeby='';
		  if($('#madebyFilter').val() != '')
		  {
			  var madeby='&marketplace='+$('#madebyFilter').val();
		  }
	      var shipfrom='';
		  if($('#shipfromFilter').val() != '')
		  {
			  var shipfrom='&location='+$('#shipfromFilter').val();
		  }
		  var shipto='';
		  if($('#shiptoFilter').val() != '')
		  {
			  var shipto='&shipto='+$('#shiptoFilter').val();
		  }
		  var filtergiftcard=document.getElementById('giftcard').checked;
		  if(filtergiftcard){
		   var giftcard='&gift_cards='+1;
		  } else {
		   var giftcard='';
		  }
	  if(minPrice != '' || maxPrice != '')
	  {
		  var minp='&min_price='+minPrice;
		  if(maxPrice != '')
		  {
			var maxp= '&max_price='+maxPrice;
		  } else 
		  {
			var maxp='';  
		  }
		  var Catid=document.getElementById('current_url_prod_list').value;
		  var fullUrl=$('#fullurl').val();
		  if(filterPrice!=''){
			  $('#pricebyFilter').val(minp+maxp);
			  if (history.pushState) {
			  window.history.pushState("object or string", "Title",fullUrl+'?'+minp+maxp+shipto+giftcard+madeby+shipfrom);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+minp+maxp+giftcard+shipto+madeby+shipfrom, function(data) {
			  
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
		  	  }); 
		  } else {
		      if (history.pushState) {
		      window.history.pushState("object or string", "Title",fullUrl+'?'+giftcard+shipto+madeby+shipfrom);
			  }
			  $.get('site/product/Load_ajax_products_list?cat_id='+Catid+'?'+giftcard+shipto+madeby+shipfrom, function(data) {
			 
			 
			  $('#loader').css('display','none');
	          $('#tiles').css('display','block');
			  $("#tiles").html(data); 
		  	  }); 
			  $('#pricebyFilter').val('');
		  }
	  } 

if($('#remove_price').val() == 'x'){   
$('#filter_list_price').html('<li>Price</li>');
}
$('#remove_price').val('Go');
$('#price_clicked').attr('id', 'filter_list_price'); 
}



function remove_fromFilter(){
	if($('#remove_from').val() == 'x'){
	$('#filter_byshipFrom').val('');  
	 ship_fromFilter();   
	$('#shipfromFilter').val(''); 
	$('#restore_from').html('<div class="clicked_inputs-groups" id="restore_from" style="display: inline-block;"><div class="clicked_inputs"><label for="filter_byshipFrom">Items from </label><input type="text" name="filter_byshipFrom" id="filter_byshipFrom"/></div><input class="clicked-submit" type="button" id="remove_from" onclick="return ship_fromFilter();" value="Go"></div>'); 
	$('#filter_bylocation').attr('id', 'fromloc_clicked'); 
	//$('#fromloc_clicked').attr('id', 'filter_bylocation'); 
	} else {
	ship_fromFilter();
	}

}

function remove_toFilter(){
	if($("#remove_to").val() == 'x') {
$('#filterByship_to').val(''); 
$("#filterByship_to").trigger('click');
$("#filterByship_to").change();
$('#shiptoFilter').val('');

//alert($('#shiptoFilter').val());
$('#restore_to').html('<div class="clicked_inputs-groups" id="restore_to" style="display: inline-block;"><div class="clicked_inputs"><label for="price-clicked">Delivers to</label><select name="filterByship_to" id="filterByship_to"><option value="">choose country..</option><?php foreach($countryList as $c_list) {?><option value="<?php echo $c_list->id;?>"><?php echo $c_list->name;?></option><?php }?></select></div><input class="clicked-submit" type="button" id="remove_to" onclick="return remove_toFilter();" value="Go"></div>');
$('#toloc_clicked').attr('id', 'filter_byshipTo'); 
	} 
}



function load_producs(val)
{
	
	var Catid=val.id; //alert(Catid); changedsubCatstatus
	var Catname=val.name; 
	$("#bigCatid").val(Catid);
	$("#bigCat").html(Catname);
	//$('#changedsubCatstatus').css('display','block');
	$("#current_url_prod_list").val(Catid); 
	$("#filter_by_all_products").attr("href", "browse/"+Catid)
	//window.location.hash = '/'+Catid;
	
   window.history.pushState("object or string", "Title","browse/"+Catid);

	//$('#tiles').before('<div><img src="images/loading.gif" alt="Loading products List" /></div>');
	$.get('site/product/Load_ajax_products_list?cat_id='+Catid, function(data) {
			//$("#tiles").html(data);
	});
	
   

}


</script> 




<?php $this->load->view('site/templates/footer'); ?>