{include file="$gentemplates/$header_tpl"}
<div class="profile_general_table">
	<div class="search_form_table">
		<h2>{$lang.section.searches}</h2>
		{strip}
		<!-- main tabs -->	
		<div class="main_tabs">
			<div class="tab_block first {if $type_search eq 0}active{/if}">
				<a href="?type_search=0" onclick="">{$lang.section.q_search}</a>
			</div>
			<div class="tab_block {if $type_search eq 2}active{/if}">
				<a href="?type_search=2" onclick="">{$lang.search.search_2_name}</a>
			</div>
			<div class="tab_block {if $type_search eq 4}active{/if}">
				<a href="?type_search=4" onclick="">{$lang.search.search_4_name}</a>
			</div>
			{if $use_tags}
			<div class="tab_block {if $type_search eq 5}active{/if}">
				<a href="?type_search=5" onclick="">{$lang.search.search_5_name}</a>
			</div>
			{/if}
		</div>
		<!-- end main tabs -->		
		{/strip}
		
		<!-- default -->
		{if $type_search eq 0}
        <form action="{$form.search_action}" method="post" name="search_form" id="search_form" style="margin-top:-5px;">
            {$form.search_hiddens_1}	
			<input type="hidden" name="from_search" value="1" />
			<div class="quick_search_form">
			<!--quick search form-->
				<div class="qs_form">
					<div style="overflow: hidden;">
						<div class="float_left" style="width:55%;">
							<dl class="name_for_lang">
								<dt>{$lang.home_page.view_result_in}: </dt>
								<dd>
									<input type="radio" id="view_list" name="view" value="list" checked="checked"><label style="padding-{$default_left}: 8px;" for="view_list">{$lang.home_page.view_result_in_list}</label></dd>
								<dd>
									<input type="radio" id="view_gallery" name="view" value="gallery" ><label style="padding-{$default_left}: 8px;" for="view_gallery">{$lang.home_page.view_result_in_gallery}</label>
								</dd>
							</dl>
							
							{*if $user_types_val}
							<dl>
								<dt>&nbsp;</dt>
								<dd style="padding-top: 10px; padding-{$default_left}: 5px;" colspan="{$smarty.foreach.user_type.total*2}">
									<div id="user_subtype_div" style="position: relative; top: 0px">
										<select name="id_user_subtype" style="width:150px">
											<option value="0">{$lang.home_page.select_default}</option>
											{foreach item=item from=$user_types_val}<option value="{$item.id}" {if $item.sel eq 1}selected="selected"{/if}>{$item.name}</option>{/foreach}
										</select>
									</div>
								</dd>
							</dl>
							{/if*}
							<dl>
								<dt>{$lang.profile.looking_for}&nbsp;</dt>
								{if $looking_user_types_val}
									{foreach item=item name=looking_user_types_val from=$looking_user_types_val}
										{if !$item.id}
											<dd>
												<input type="checkbox" name="id_looking_user_type[]" value="{$item.id_spr}" {if ($id_looking_user_type && $id_looking_user_type eq $item.id_spr) || ($item.sel eq 1)} checked="checked" {/if} id="looking_user_type_{$item.id_spr}" >
												<label for= "id_looking_user_types[{$item.id_spr}]" >{$item.name}</label>
											</dd>
										{else}
											<dd>
												<input type="checkbox" name="id_looking_user_subtypes[{$item.id}]" id = "id_looking_user_types[{$item.id}]" value="{$item.id}" {if $item.sel eq 1}checked="checked"{/if}>
												<label for= "id_looking_user_types[{$item.id}]" >{$item.name}</label>
											</dd>
										{/if}
									{/foreach}
								{/if}
							</dl>
							<dl>
								<dt style="height: 100px;">{$lang.home_page.looking_for}</dt>
								{section name=s loop=$relation}
									<input type="checkbox" name="relation[]" value="{$relation[s].id}" {if ($relation[s].sel eq 1)} checked="checked" {/if}>&nbsp;{$relation[s].name}<br />
								{/section}
								
							</dl>
							{if $user_id != 2}
								<dl>
									<dt style="width: 250px;">
										<input type="checkbox" name="who_look_me" value="1">
										<span>{$lang.home_page.who_look_me}</span>
									</dt>
								</dl>
							{/if}
							<dl class="line3">
								<dd>
									<input type="checkbox" checked="checked" name="foto_only" value="1">
									<span>{$lang.home_page.foto}</span>
								</dd>
								<dd>
									<input type="checkbox"  name="online_only" value="1">
									<span >{$lang.home_page.online_now}</span>
								</dd>
							</dl>
						</div>
						
						<div class="float_left" style="width:43%;">
							<dl>
								<dt>
									{$lang.home_page.between_the_ages_of}
								</dt>
								<dd style="width: 120px;">
									<select style="width:42px;" name="age_min" class="index_select">
										{section name=a loop=$age_min}
										<option value="{$age_min[a]}" {if $form.age_min eq $age_min[a]}selected="selected"{/if}>{$age_min[a]}</option>
										{/section}
									</select>						
									<span >{$lang.home_page.and}</span>
									<select style="width:43px;" name="age_max" class="index_select">
										{section name=a loop=$age_max}
										<option value="{$age_max[a]}" {if $form.age_max eq $age_max[a]}selected="selected"{/if}>{$age_max[a]}</option>
										{/section}
									</select>
								</dd>
							</dl>						
							<dl class="search_form">
								{assign var="count" value=0}
								{foreach item=item from=$elements name=elements}
									{if $item.position_text == 'inline'}
										<dt>
											{$item.elem_html}&nbsp;
										</dt>
										<dd>
											{if $lang.profile[$item.name_for_lang] ne ''}
												{$lang.profile[$item.name_for_lang]}
											{else}
												{if $item.name_for_lang eq 'id_within'}
													{$lang.profile[$item.name_for_lang]}
												{else}
													{$item.name_for_lang}
												{/if}
											{/if}
										</dd>
									{else}
										{if $item.name_for_lang eq 'id_within'}
											{if $useDistanceSearch}
												<dl>
													<dd style="width:100px;margin-top:0px; line-height:1;">
														<input style="margin-top:0px;" type="checkbox" id="within" name="within" value="1" {if $form.search_type eq 2}disabled{/if} onclick="javascript: if (document.getElementById('distance').disabled) document.getElementById('distance').disabled = false; else document.getElementById('distance').disabled = true;">
														{if $lang.profile[$item.name_for_lang] ne ''}
															{$lang.profile[$item.name_for_lang]}
														{else}
															{$lang.home_page.within}
														{/if}
													</dd>
													<dd>
														<select id="distance" name="distance" disabled class="index_select">
															{section name=d loop=$distances}
																<option value="{$distances[d].id}">{$distances[d].name} {$distances[d].type}</option>
															{/section}
														</select>
													</dd>
												</dl>
											{/if}
										{else}
											{include file="$site_path/$template_root/registration_edit_element.tpl"}
										{/if}
									{/if}
								{/foreach}		
							</dl>
						</div>
					</div>	
		            <div style="padding-top:15px;">
						<input type="button" value="{$lang.button.search}" class="big_button" onclick="document.search_form.submit();">
					</div>
				</div>
            </div>
        </form>
		{/if}
		<!-- /default -->
		
		<!-- login -->
		{if $type_search eq 2}
			<div class="search_content" style="width:709px;">
				<form action="{$form.search_action}" method="post" name="search_form_2" style="margin:0px">
					{$form.search_hiddens_2}
					<div class="text">
						{$header_s.name_text}
					</div>
					<div>
						<dl>
							<input type=text name="nick"  style="width: 150px" maxlength="50">
						</dl>
						<dl>
							<input type="button" class="index_btn" onclick="javascript: document.search_form_2.submit();" value="{$lang.button.search}">
						</dl>
					</div>
				</form>
			</div>
		{/if}
		<!-- /login -->
		
		<!-- keyword -->
		{if $type_search eq 4}
			<div class="search_content" style="width:709px;">
				<form action="{$form.search_action}" method='post' id="search_form_4" name="search_form_4">
				{$form.search_hiddens_4}
					<div>
						<div class="text">
							{$header_s.keyword_text}
						</div>
						<div>						
							<dl>
								<input type=text name="word"  style="width: 150px">
							</dl>
							<dl>
								<input type="button" class="index_btn" onclick="javascript: document.search_form_4.submit();" value="{$lang.button.search}">
							</dl>
						</div>
					</div>
				</form>
			</div>
		{/if}
		<!-- /keyword -->
		
		<!-- tag -->
		{if $type_search eq 5}
			{if $tags && $use_tags}
				<!-- tags quick search -->
				<div class="search_content" style="width:709px;">
					<div>
						{section name=s loop=$tags}
							<a href="{$tags[s].searchlink}" style="vertical-align: baseline; font-size: {$tags[s].size}px;" title="{$tags[s].count}">
								{$tags[s].tag}
							</a>&nbsp;&nbsp;
						{/section}
					</div>
				</div>
			  <!-- /tags quick search -->
			{/if}
		{/if}
		<!-- /tag -->
        
	<!-- targeting section -->
	{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}" style="position:relative;">
									<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 class="text-overflow" 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}
	{strip}
		<div class="overflowhidden">
        <form action="{$form.search_action}" method="post" name="search_form_3" style="margin:0px;">
			<div class="content content_adult_2">
				<h3 class="p-b5">{$lang.search.search_3_name}</h3>
				<div class="direct_quick_search">
					<p><a href="{$site_root}/{$seo.top_users}">{$header_s.top_users}</a></p>
					<p><a href="{$site_root}/{$seo.photo_gallery}">{$header_s.photo_gallery_latest}</a></p>
					<p><a href="{$site_root}/{$seo.video_gallery_latest}">{$header_s.video_gallery_latest}</a></p>
				</div>
				<div class="direct_quick_search">
					<p><a href="{$form.search_3_birthday}">{$header_s.search_3_birthday}</a></p>
					<p><a href="{$form.search_3_online}">{$header_s.search_3_online}</a></p>
					<p><a href="{$form.search_3_hotlist}">{$header_s.search_3_hotlist}</a></p>
				</div>
          </div>
        </form>
        </div>	  
    {/strip}
	<!-- /direct quick search -->
	
  </div>
  
<script language="JavaScript" type="text/javascript">
{literal}
	/* <![CDATA[ */	
	$(document).ready(function() {
		$('#small_mycarousel').jcarousel();
		setInterval(function(){$('#small_mycarousel').find('.couple_icon').fadeToggle();}, 3000);
	}); 
	/* ]]> */	
$('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('within').checked = false;
    document.getElementById('search_type').value = 2;
    document.getElementById('within').disabled = true;
  }
  return;
}


$('.search_form').find('input[type=radio]').each(function(){
    if($(this).attr('name') != 'looking_for[]'){
        name = $(this).attr('name');
        value = $(this).val();
        var html = '<input type="checkbox" checked="checked" name="'+name+'[]" value="'+value+'" >';
        $(this).after(html).remove();
    }
});
$('.search_form').find('input[type=checkbox]').each(function(){
    if(($(this).attr('name') != 'foto_only') && ($(this).attr('name') != 'online_only') && ($(this).attr('name') != 'within')){
		$(this).attr('checked', true);
    }
});

$('select[name=id_language_2]').remove();
$('select[name=id_language_3]').remove();
{/literal}
var resize=0;
</script>
{include file="$site_path$index_theme_path/like.tpl"}
{include file="$gentemplates/$footer_tpl"}