{include file="$gentemplates/$header_tpl"}
<div class="profile_general_table">
<div class="quick_search_table">
	<h2>
		{if $form.par eq 'search_top'}
			{$lang.subsection.search_top}
		{elseif $form.par eq 'search_all'}
			{$lang.subsection.search_all}
		{else}
			{strip}
			{$lang.subsection.search_result}
			{if $form.sub_par}
				: {$form.sub_par}
			{/if}
			{/strip}
		{/if}
	</h2>
	{strip}
	<!-- main tabs -->	
	<div class="main_tabs">
		<div class="tab_block first {if $form.filter eq 'all'} active{/if}">
			<a href="{$form.view_all_link}">
				{$lang.search.view_all} ({math equation='x+y' x=$form.online_count y=$form.offline_count})
			</a>
		</div>
		<div class="tab_block {if $form.filter eq 'online'} active{/if}">
			<a href="{$form.view_online_link}">
				{$lang.search.view_online} ({$form.online_count})
			</a>
		</div>
		<div class="tab_block {if $form.filter eq 'photo'} active{/if}">
			<a href="{$form.view_photo_link}">
				{$lang.search.view_photo} ({$form.with_count})
			</a>
		</div>
		
		<div class="view" style="height:23px;padding: 13px 0px 0px 4px;">
			{if $form.view eq 'gallery'}
				<a style="padding-top:12px;" title="{$lang.search.view_list}" href="{$form.view_list_link}" class="view-list-icon">&nbsp;</a>
			{else}
				<a style="padding-top:12px;" title="{$lang.search.view_gallery}" href="{$form.view_gallery_link}" class="view-gal-icon">&nbsp;</a>
			{/if}					
		</div>
	</div>
	<!-- end main tabs -->		
	{/strip} 
	
			
		{*<font class="text_head">{$section.search_result}:&nbsp;{$form.pages_count}&nbsp;{$lang.pages}</font>*}
	<div id="search_form_hide_show" class="search_form_hide_show">		
		<div class="float_left" style="padding:11px;cursor:pointer;width:675px;" onclick="ShowSearchForm();return false;">
			<div style="display: block;" id="hide_link" >
				{$lang.users.hide_search_form}
			</div>
			<div style="display: none;" id="show_link" >
				{$lang.users.show_search_form}
			</div>
		</div>
		<div class="float_right" style="padding-top:8px;height:30px;">
			<div style="display: block;padding:5px 0px 0px 4px;" id="hide_image" >
				<a id="icon_click" style="padding-top:12px;" href="#" onclick="ShowSearchForm(); return false;" class="hide_search_form">&nbsp;</a>
			</div>
			<div style="display: none;padding:7px 1px 0px 4px;" id="show_image">
				<a id="icon_click" style="padding-top:12px;" href="#" onclick="ShowSearchForm(); return false;" class="show_search_form">&nbsp;</a>
			</div>
		</div>
		{strip}
			<div style="margin-top:40px;"  id="quick_search_form" style="display:none;">
				{include file="$gentemplates/quick_search_small_form.tpl"}
		   </div>
	   {/strip}
   </div>
   
   {*if $form.err}
		<div class="error"><font class="error_msg">*&nbsp;{$form.err}</font><br>&nbsp;</div>
   {/if*}
   
	{if $empty eq 1}
		<div>&nbsp;</div>
		<div class="error"><font class="error_msg">*&nbsp;{$header_s.empty_result}</font><br>&nbsp;</div>
		<div>{*include file="$gentemplates/quick_search_small_form.tpl"*}</div>
        {strip}
    	{if $targeting}
    		<div class="our_suggestions">
    			<h3 class="p-b5">{$targeting_header}</h3>
    			<link href="{$site_root}{$template_root}{$template_css_root}/jquery/carousel.css" rel="stylesheet" type="text/css" media="all">
    			<div class="carousel_hor search">
    				
    				<ul id="small_mycarousel" class="jcarousel-skin-dating" style="width:100%;">
    					{foreach key=key item=item from=$targeting name=visited}
							{if !$item.couple}
								{assign var=id_couple value=$item.id_user_pair}
								<li style="height:155px;">
									<a class="imgcanvas_container" href="{$item.link}">
										<img alt="" class="icon imgcanvas" src="{$item.icon_path}" width="{$icon_width}" height="{$icon_height}"/>
									</a>
									{if $id_couple}
										<a class="imgcanvas_container" href="{$targeting[$id_couple].link}" class="couple_icon" style="position:absolute; left: 5px; top: 0; display:none;">
											<img alt="" class="icon imgcanvas" src="{$targeting[$id_couple].icon_path}" width="{$icon_width}" height="{$icon_height}"/>
										</a>
									{/if}
									<div class="text-overflow" style="padding-top:5px;">
										<a href="{$item.link}">{$item.name}</a>{if $id_couple} + <a href="{$targeting[$id_couple].link}">{$targeting[$id_couple].name}</a>{/if}
									</div>
									<div style="padding-top:1px;">
										{$item.age}{if $id_couple}&nbsp;+&nbsp;{$targeting[$id_couple].age}{/if} {$lang.home_page.ans}
									</div>
								</li>
							{/if}
    					{/foreach}
    				</ul>
    			</div>
    		</div>
    	{/if}
        {/strip}
	{/if}	
	
   {if $search_res}
	{strip}
	{if $links_top}
		<div class="pagination_top">
			{include file="$gentemplates/pagination_top.tpl"}
		</div>
	{/if}
	{/strip}
   
	<!-- begin results list -->
	{strip}
	<div class="search_result_list" id="search_result_list">
		{counter start=0 assign=iterations}
		{foreach key=key item=item from=$search_res name=s}
			{if !$item.couple}
				{counter}
				{if $item.couple_id}
					{assign var=item2 value=$search_res[$item.couple_id]}
				{/if}
				
				{if $form.view eq 'gallery'}
					{if ($iterations-1)%6 == 0}<div class="overflowhidden">{/if}
					<div class="search_result_gallery_high" {if $iterations is div by 6}style="margin-{$default_right}:0px"{/if}>
						<div class="">
						<a class="imgcanvas_container" href="{$item.profile_link}" style="position: relative;">
							<img src="{$item.icon_path}" class="icon imgcanvas" alt="" onmouseover="javascript: CreateBigImage(this, event{if $iterations is div by 6 && $default_left eq 'left'}, true{else}, false{/if}, false);">
							{if $item.couple_id}
								<img src="{$item2.icon_path}" class="icon imgcanvas icon_couple" alt="" onmouseover="javascript: CreateBigImage(this, event{if $iterations is div by 6}, true{else}, false{/if}, false);" />
							{/if}
						</a>
							{if $item.hotlisted}
								<div style="position:relative;"><a class="small_heart_white" style="top:-38px; {$default_left}:5px; position:absolute;">&nbsp;</a></div>
							{elseif $item.blacklisted}
								<div style="position:relative;"><a class="small_block_white" style="top:-38px; {$default_left}:5px; position:absolute;">&nbsp;</a></div>
							{/if}
						<p>
							<a href="{$item.profile_link}">{$item.name|truncate:18:"...":true}</a>
							{assign var=status value=$item.status}
							{if $item.couple_id}
								{if $item2.status eq $lang.status.on}{assign var=status value=$lang.status.on}{/if}
								<span>&nbsp;+&nbsp;</span><a href="{$item2.profile_link}"><span>{$item2.name|truncate:18:"...":true}</span></a>
							{/if}
							<br />
							{if $item.couple_id && ($item.location || $item2.location) && $item.location != $item2.location}
								{$item.location|truncate:17:"...":true}{if $item2.location}<br/>+{$item2.location|truncate:16:"...":true}{/if}<br />
							{else}
								{if $item.location}{$item.location|truncate:17:"...":true}<br />{/if}
							{/if}
							{$item.age}{if $item.couple_id}&nbsp;+&nbsp{$item2.age}{/if} {$lang.home_page.ans}<br />
							<span class="text_hidden">{$item.photo_count} {$lang.users.upload_1}</span>
						</p>
						</div>
					</div>
					{if $iterations % 6 == 0}</div>{/if}
				{else}
			<!-- usersinfo -->
					<div class="table_result_list {if $item.is_me eq 1} home_menu {/if}" {if $iterations eq 1 && $smarty.foreach.s.last eq 1}style="height: 200px;"{/if}>					
						<div>
							<div class="image_col" style="padding:0px; position: relative;">	
								<a class="imgcanvas_container" href="{if $item.is_me ne 1}{$item.profile_link}{else}#{/if}">
									<img src="{$item.icon_path}" class="icon imgcanvas" alt="" onmouseover="javascript: CreateBigImage(this, event, false{if $smarty.foreach.s.last eq 1}, true{else}, false{/if});">	
									{if $item.couple_id}
										<img src="{$item2.icon_path}" class="icon imgcanvas icon_couple" alt="" onmouseover="javascript: CreateBigImage(this, event{if $iterations is div by 6}, true{else}, false{/if}, false);" />
									{/if}
									{if $item.hotlisted}
										<a class="small_heart_white" style="bottom:5px; {$default_left}:5px; position:absolute;" >&nbsp;</a>
									{elseif $item.blacklisted}
										<a class="small_block_white" style="bottom:5px; {$default_left}:5px; position:absolute;" >&nbsp;</a>
									{/if}
								</a>
							</div>
							<div class="info_col">
								<p style="overflow:hidden;">
								{if $item.is_me ne 1}
									<a class="float_left" href="{$item.profile_link}">
								{/if}
									<span class="float_left">{$item.name|truncate:20:"...":true}</span>
								{if $item.is_me ne 1}</a>{/if}
								{assign var=status value=$item.status}
								{if $item.couple_id}
									{if $item2.status eq $lang.status.on}{assign var=status value=$lang.status.on}{/if}
									<span class="float_left">&nbsp;+&nbsp;</span><a href="{$item2.profile_link}"><span class="float_left">{$item2.name|truncate:20:"...":true}</span></a>
								{/if}
								<span class="float_left">&nbsp;&nbsp;</span>
								<span class="float_left status{if $item.status eq $lang.status.on}_link{else}_text{/if}">{$item.status}</span></p>
								<p style="overflow:hidden;">
									{if $item.last_login}<span class="text_hidden float_left">{$lang.profile.last_connect}:&nbsp;</span> <span class="float_left">{$item.last_login}</span>{/if}
								</p>
								{if $item.couple_id && ($item.location || $item2.location) && $item.location != $item2.location}
									<span class="float_left">
										{if $item.location && $item2.location}
											{$item.location|truncate:23:"...":true}{if $item2.location}&nbsp;+&nbsp{$item2.location|truncate:23:"...":true}{/if}
										{else}
											{if $item.location}
												{$item.location|truncate:46:"...":true}
											{elseif $item2.location}
												{$item2.location|truncate:46:"...":true}
											{/if}
										{/if}
									</span><br />
								{else}
									{if $item.location}<span class="float_left">{$item.location|truncate:45:"...":true}</span><br />{/if}
								{/if}
								{$item.age}{if $item.couple_id}&nbsp;+&nbsp{$item2.age}{/if}&nbsp;{$lang.home_page.ans}<br />
								{if $item.group}<span class="text_hidden float_left">{$lang.profile.group}:&nbsp;</span> <span class="float_left">{$item.group}</span><br />{/if}
															
								{if $form.show_users_group_s eq '1'}					
									<p>{$item.group}</p>				
								{/if}							
								<p class="text_hidden" style="overflow:hidden;">
									<span class="float_left">{$lang.users.gender_search}&nbsp;</span>
									<span class="float_left">{if $item.user_subtypes}{$item.user_subtypes}&nbsp;({$item.user_type})
									{else}{$item.user_type}
									{/if} 
									&nbsp;</span><span class="float_left">{$lang.users.from} {$item.age_min} {$lang.users.to} {$item.age_max}</span>
								</p>							
							</div>
						</div>
						<div class="annonce text_hidden">
							{if $form.show_users_comments eq '1'}
								{$item.annonce}
							{/if}
						</div>
					</div>
				{/if}
			{/if}
			{if $smarty.foreach.s.last && $form.view eq 'gallery' && $iterations % 6 != 0}</div>{/if}
		{/foreach}
		<div style="clear:both"></div>
	<!-- end of usersinfo -->
	</div>
	<div>&nbsp;</div>
	{/strip}
	
	{include file="$gentemplates/pagination_bottom.tpl"}
	<!-- links -->
	
		<!-- end results list -->
			
	{/if}  
</div>

{literal}
<script language="JavaScript" type="text/javascript">
	$(document).ready(function() {	
		fadeimg = setInterval(function(){$('#search_result_list').find('.icon_couple').fadeToggle()}, 3000);
		$('#small_mycarousel').jcarousel();
		{/literal}{if ($search_res)}{literal}        
		   ShowSearchForm();
		{/literal}{/if}{literal} 
	});
	
	$('select').live("change",(function(){
		val = $(this).val();
		name = $(this).attr('name');
		if (name == "id_country") {
			$.post(SEO_SITE_ROOT+"/location.php",{sec:'rp',sel:'region', id_country:val},
				function(data){
					$("div #region_div").html(data);
					$("div #city_div select").val(0);
					$("div #city_div select").text('');
				}
			);
		} else if(name == "id_region") {
			$.post(SEO_SITE_ROOT+"/location.php",{sec:'rp',sel:'city', id_region:val},
				function(data){
					$("div#city_div").html(data);
				}
			);
		}
	}));

	function ZipCodeCheck(zip_value) {
		if (zip_value == '') {
			document.getElementById('within').disabled = false;
			document.getElementById('search_type').value = 1;
		} else {
			document.getElementById('search_type').value = 2;
			document.getElementById('within').disabled = true;
		}
		return;
	}

	function ShowSearchForm() {
		$('#hide_image, #hide_link, #quick_search_form, #show_image, #show_link').toggle();
	}
</script>
{/literal}

{include file="$gentemplates/$footer_tpl"}