﻿function keyfilter(filter, event) {
	if (!event) event=window.event;
	var c=getCharCode(event);
	if (c && !filter(c)) cancelEvent(event);
}

function getCharCode(event) {
	return typeof(event.charCode)=="undefined" ? (event.keyCode || event.which) : event.charCode;
}

function cancelEvent(event) {
	if (!event) event=window.event;
	if (event.preventDefault) event.preventDefault();
	else event.returnValue=false;
}

function keyfilter_Number(event) {
	keyfilter(function(c) {return (c >= 48 && c <= 57) || c==13},event);
}

function keyfilter_Date(event) {
	keyfilter(function(c) {return (c >= 48 && c <= 57) || c==13 || c==46 || c==45},event);
}

function ShowHirdetmeny(url)
{
    window.open(url, 'imageWindow', 'width=800,height=600,left=20,top=20,toolbar=1,status=0,menubar=1');
}

function GetCityList() {
    var idStr = '';
    var cbArr = document.getElementsByName('megye');
    for (i = 0; i < cbArr.length; i++)
        if (cbArr[i].checked)
        idStr += cbArr[i].value + ',';
    $.post('/Ajax/TelepulesList.aspx', { idList: idStr }, function(res) {
        $('#telepulesLista').html(res);
    });
}

function ClearSearchForm() {
    $('#Kereso1_IngatlanKeresoForm1_refSzam').val('');
    $('#Kereso1_IngatlanKeresoForm1_ingatlan_tipusa').val('0');
    $('#Kereso1_IngatlanKeresoForm1_arTol').val('0');
    $('#Kereso1_IngatlanKeresoForm1_arIg').val('0');
    $('#Kereso1_IngatlanKeresoForm1_m2Tol').val('');
    $('#Kereso1_IngatlanKeresoForm1_m2Ig').val('');
    $('#Kereso1_IngatlanKeresoForm1_szobaszam').val('0');
    $('#Kereso1_IngatlanKeresoForm1_emelet').val('0');
    $('.checkbox').attr('checked', '');
    GetCityList();
}
