 <form action="{$form.search_action}" method="post" name="search_form" id="search_form">
	{$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 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" {if $form.view eq "list"}checked="checked"{/if}/><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" {if $form.view eq "gallery"}checked="checked"{/if}/><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 && in_array($item.id_spr, $id_looking_user_type))  || ($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" {if $form.who_look_me eq 1}checked{/if} />
							<span>{$lang.home_page.who_look_me}</span>
						</dt>
					</dl>
				{/if}
				<dl class="line3">
					<dd>
						<input type="checkbox" {if $form.foto eq 1}checked="checked"{/if} name="foto_only" value="1"/>
						<span>{$lang.home_page.foto}</span>
					</dd>
					<dd>
						<input type="checkbox"  name="online_only" {if $form.online eq 1}checked="checked"{/if} 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: 140px;">
						<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.search.within}
									{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 style="padding-top:15px;">
				<input type="button" value="{$lang.button.search}" class="big_button" onclick="document.search_form.submit();">
			</div>
		</div>
	</div>
</form>

<script type="text/javascript">
{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);
			}
		);
	}
}));

$('.search_form').find('select[name=id_language_1]').attr('name', 'id_language_1[]');
$('.search_form').find('select').each(function(){
    if(!$(this).hasClass('index_select')){
        if(!$(this).find('option:first').val() || $(this).find('option:first').val() == 0){
            $(this).find('option:first').val('0');
            $(this).find('option:first').text('{/literal}{$lang.button.all}{literal}');
            if($(this).height() > 150)
                $(this).height(150);
          
        }
        else{
            if($(this).attr('name') != 'looking_for[]'){
                $(this).prepend('<option value=0>{/literal}{$lang.button.all}{literal}<\/option>');
                $(this).attr('multiple', true);
            }
        }
    }
});

$('.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();
var resize=0;
{/literal}
</script>
{include file="$site_path$index_theme_path/like.tpl"}