<div style="padding: 20px;">
	<div class="text" style="padding-top: 10px; padding-left:10px;">
		<form id="targeting">
			<div style="margin: 0;">
                <input type="checkbox" id="all" name="show" value="1" onclick="enableall();" {if $checklist.show}checked{/if}><label for="all">{$lang.builder.show_users}</label>:
    			<div style="padding: 5px 0px !important;">
    				<!--hr style="border: 0; height: 1px; color: #e0e0b3; background-color:#e0e0b3;"/-->
    			</div>
    			<div style="float: left; width: 100px; padding-left: 5px ! important;">{$lang.builder.location}:</div> 
                <div>
                    <input type="checkbox" id="country" name="country" onclick="checkloc(1);" value="1" {if $checklist.country}checked{/if}><label for="country">{$lang.builder.country}</label>&nbsp;&nbsp;
        			<input type="checkbox" id="region" name="region" onclick="checkloc(2);" value="1" {if $checklist.region}checked{/if}><label for="region" >{$lang.builder.region}</label>&nbsp;&nbsp;
        			<input type="checkbox" id="city" name="city" onclick="checkloc(3);" value="1" {if $checklist.city}checked{/if}><label for="city">{$lang.builder.city}</label>
                </div>
    			<div style="padding: 5px 0px !important;">
    				<!--hr style="border: 0; height: 1px; color: #e0e0b3; background-color:#e0e0b3;"/-->
    			</div>
    			<div style="margin-left: 105px;">
                    <input type="checkbox" id="looking_for" name="looking_for" value="1" {if $checklist.looking_for}checked{/if}><label for="looking_for">{$lang.builder.looking_for}</label><br>
        			<input type="checkbox" id="age" name="age" value="1"  {if $checklist.age}checked{/if}><label for="age">{$lang.builder.age}</label><br>
        			<input type="checkbox" id="online" name="online" value="1" {if $checklist.online}checked{/if}><label for="online">{$lang.builder.online}</label><br>
                </div>
            </div>
            <div style="padding: 5px 0px !important;">
				<hr style="border: 0; height: 1px; color: #e0e0b3; background-color:#e0e0b3;"/>
			</div>
            
            
            <table>
				<tr>
					<td><label for="min_age_limit">{$lang.settings.min_age_limit}&nbsp;</label></td>
					<td><input type="text" name="min_age_limit" id="min_age_limit" value="{$data.min_age_limit}" style="text-align: center;" size=2/></td>
				</tr>
				<tr>
					<td><label for="max_age_limit">{$lang.settings.max_age_limit}&nbsp;</label></td>
					<td><input type="text" name="max_age_limit" value="{$data.max_age_limit}"  style="margin-top: 5px; text-align: center;" size=2/></td>
				</tr>
				<tr>
					<td><label for="index_us_type_i">{$lang.admin.design_management.users_type_I_am}</label></td>
					<td>
						<select name="index_us_type_i" id="index_us_type_i" style="margin-top: 5px;">
							{foreach name=user_type item=item from=$user_types_i}
							<option value="{$item.id}" {if $item.id eq $i_am_user_type}selected="selected"{/if}>{$item.name}</option>
							{/foreach}
						</select>
					</td>
				</tr>
				<tr>
					<td><label for="index_us_type_for">{$lang.admin.design_management.users_type_looking}</label></td>
					<td>
						<select name="index_us_type_for" id="index_us_type_for" style="margin-top: 5px;">
							{foreach name=user_type item=item from=$user_types_for}
							<option value="{$item.id}" {if $item.id eq $look_for_user_type}selected="selected"{/if}>{$item.name}</option>
							{/foreach}
						</select>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
{literal}
<script language="JavaScript" type="text/javascript">
	function checkloc(num){
		if(num == 1){
			if($('#country:checked').attr('id') == undefined){
				$('#region, #city').attr('checked', false);
			}
		}
		if(num == 2){
			if($('#region:checked').attr('id') == undefined){
				$('#city').attr('checked', false);
			}
			else{
				$('#country').attr('checked', true);
			}
		}
		if(num == 3){
			if($('#city:checked').attr('id') != undefined){
				$('#country').attr('checked', true);
				$('#region').attr('checked', true);
			}
		}
	}

	function enableall(){
		if($('#all:checked').attr('id') == undefined){
			$('input[id!=all][type!=button]').attr('disabled', true).attr('checked', false);
		}
		else{
			$('input[id!=all]').removeAttr('disabled');
		}
	}
	enableall();

	function save(){
		$.ajax({
			url: 'admin_builder.php?sel=save_targeting',
			type: 'POST',
			data: $("#targeting").serialize(),
			success: function (data) {
				$('#TargetingPopup').hide();
				$('#mask').hide();
			}
		});
	}
</script>
{/literal}

