var xmlHttp;
var xmlHttp2;


function obceload(id_obce)
{ 
xmlHttp2=GetXmlHttpObject2();

if (xmlHttp2==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var IDokres = document.formular.IDokres.value;
if (IDokres>=1000) document.getElementById('obce_tr').style.display = 'none'; 
else {
  var url="http://www.topreality.sk/ajaxobce.php";
  url=url+"?IDokres=" + IDokres;
  if (id_obce>0) url=url+"&id_obce=" + id_obce;
  url=url+"&sid="+Math.random();
  xmlHttp2.onreadystatechange=stateChanged2;
  xmlHttp2.open("GET",url,true);
  xmlHttp2.send(null);
}
}



function ajaxFunction()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="http://www.topreality.sk/ajax.php";


var q = document.searchform.q.value;
url=url+"?q=" + q;

var cat = document.searchform.cat.value;
url=url+"&cat=" + cat;

var form = document.searchform.form.value;
url=url+"&form=" + form;

var type = document.searchform.type.value;
url=url+"&type=" + type;

var region = document.searchform.region.value;
url=url+"&region=" + region;

var obec = document.searchform.obec.value;
url=url+"&obec=" + obec;

var cena_od = document.searchform.cena_od.value;
url=url+"&cena_od=" + cena_od;

var cena_do = document.searchform.cena_do.value;
url=url+"&cena_do=" + cena_do;

var vymera_od = document.searchform.vymera_od.value;
url=url+"&vymera_od=" + vymera_od;

var vymera_do = document.searchform.vymera_do.value;
url=url+"&vymera_do=" + vymera_do;

if (document.searchform.novostavba.checked) url=url+"&novostavba=1";

url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


function GetXmlHttpObject2()
{
var xmlHttp2=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp2=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp2;
}

function stateChanged() 
{ 
  if (xmlHttp.readyState==4)
  { 
    document.getElementById("foundresults").innerHTML=xmlHttp.responseText;
  }
}

function stateChanged2() 
{ 
  if (xmlHttp2.readyState==4)
  { 
    document.getElementById('obce_tr').style.display = '';
    document.getElementById("obce").innerHTML=xmlHttp2.responseText;
  }
}







<!--

  function ChangeMenu(id) {
      object = document.getElementById(id);
      img = document.getElementById(id+'_img');
//      lnk = document.getElementById(id+'a');
        if (object.style.display=='block'){
//          lnk.className='';
          img.src='./images/plus.gif';
          object.style.display='none';
        }
        else {
//          lnk.className='open';
          img.src='./images/minus.gif';
          object.style.display='block';
        }
  }

  function ChangeMenu2(id) {
      object = document.getElementById(id);
//      img = document.getElementById(id+'_img');
      lnk = document.getElementById(id+'a');
        if (object.style.display=='block'){
          lnk.className='';
//          img.src='./images/plus.gif';
          object.style.display='none';
        }
        else {
          lnk.className='open';
//          img.src='./images/minus.gif';
          object.style.display='block';
        }
  }
  
  function help(path) {
        window.open(path,'Pomoc','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,top=50,left=50,height=300,width=450');
     
  }

  function RegistryForm(id,category) {
      eval('id = document.all.' + id);
      if (category == 'public') {
              if (id.meno.value == "") { 
                  alert("Vyplňte Vaše meno a priezvisko!");
                  id.meno.focus();
                  return false; 
              }
              if (id.tel.value == "" && id.email.value == "") { 
                  alert("Vyplňte Váš emailový, alebo telefonický kontakt!");
                  id.tel.focus();
                  return false; 
              }
              if (id.nickname.value == "") { 
                  alert("Vyplňte prihlasovacie meno!");
                id.nickname.focus();
                return false; 
              }
              if (id.password.value == "") { 
                  alert("Vyplňte prihlasovacie heslo!");
                  id.password.focus();
                  return false; 
              }
              if (id.password2.value == "") { 
                  alert("Vyplňte overovacie heslo!");
                  id.password2.focus();
                  return false; 
              }
              if (id.password.value != id.password2.value) { 
                  alert("Overovacie heslo nie je totožné s prihlasovacím!");
                  id.password.focus();
                  return false; 
              }
      }
      if (category == 'agency') {
              if (id.nazov.value == "") { 
                  alert("Vyplňte názov spoločnosti!");
                id.nazov.focus();
                return false; 
              }
              if ((id.adresa.value == "") || (id.mesto.value == "")) { 
                  alert("Uveďte adresu sídla spoločnosti!");
                if(id.adresa.value == "") id.adresa.focus();
                else id.mesto.focus();
                return false; 
              }
              if (id.ico.value == "") { 
                  alert("Vyplňte IČO spoločnosti!");
                id.ico.focus();
                return false; 
              }
              if (id.meno.value == "") { 
                  alert("Vyplňte meno kontaktnej osoby!");
                id.meno.focus();
                return false; 
              }
              if (id.tel.value == "" && id.tel2.value == "" && id.email.value == "") { 
                  alert("Uveďte telefonický, alebo emailový kontakt!");
                  if(id.tel.value == "") id.tel.focus();
                  else id.email.focus();
                  return false; 
              }
              if (id.nick.value == "") { 
                  alert("Vyplňte prihlasovacie meno!");
                id.nick.focus();
                return false; 
              }
              if (id.password.value == "") { 
                  alert("Vyplňte prihlasovacie heslo!");
                  id.password.focus();
                  return false; 
              }
              if (id.password2.value == "") { 
                  alert("Vyplňte overovacie heslo!");
                  id.password2.focus();
                  return false; 
              }
              if (id.password.value != id.password2.value) { 
                  alert("Overovacie heslo nie je totožné s prihlasovacím!");
                  id.password.focus();
                  return false; 
              }
       }
  }
  function MailForm(id) {
      eval('id = document.all.' + id);
        if (id.meno.value == "") { 
            alert("Vyplňte Vaše meno a priezvisko!");
            id.meno.focus();
            return false; 
        }
        if (id.tel.value == "" && id.email.value == "") { 
            alert("Vyplňte Váš emailový, alebo telefonický kontakt!");
            id.email.focus();
            return false; 
        }
        if (id.text.value == "") { 
          alert("Nie je možné odoslať prázdnu správu!");
          id.text.focus();
          return false; 
        }
  }
  function LoginForm(id) {
      eval('id = document.all.' + id);
      if (id.nick.value == "") { 
          alert("Vyplňte Vaše prihlasovacie meno!");
          id.nick.focus();
          return false; 
      }
      if (id.password.value == "") { 
          alert("Vyplňte Vaše prihlasovacie heslo!");
          id.password.focus();
          return false; 
      }
  }
  function rowOver(id) {
      eval('id = document.all.' + id);
      id.style.backgroundColor = "#F5F5F5";
  }
  function rowOut(id) {
      eval('id = document.all.' + id);
      id.style.backgroundColor = "#FFFFFF";
  }
  function PreviewFoto1(path) {
        var NewWin = window.open('','FotoGalery','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,top=50,left=50');
        with (NewWin.document) {
          write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
          write('<html xmlns="http://www.w3.org/1999/xhtml" lang="sk" xml:lang="en">');
          write('<head>');
          write('<title>Fotogaléria</title>');
          write('<meta http-equiv="content-type" content="text/html; charset=utf-8" />');
          write('<link rel="stylesheet" type="text/css" href="./style/preview.css" />');
          write('</head>');
          write('<body onload="javascript: window.resizeTo(document.photo.width+40, document.photo.height+85);">');
          write('<a href="javascript:window.close();" title="Kliknutím okno zavriete">');
          write('<img name="photo" src="'+path+'" alt="Kliknutím okno zavriete" />');
          write('</a>');
          write('</body>');
          write('</html>');
          close();
        }      
  }
  function PreviewFoto2(category,id) {
	window.open('./other/preview.php?category='+category+'&ID='+id,'FotoGalery','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,top=50,left=50,width=350,height=350');
  }
  function PreviewEstate(id,photo,kind) {
	window.open('./other/preview_estate.php?ID='+id+'&IDphoto='+photo+'&kind='+kind,'FotoGalery','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,top=50,left=50,width=700,height=600');
  }
  function windowPrint(href) {
	window.open(href,'Print','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,top=50,left=50,width=640,height=480');
  }
  function windowMail(href) {
	window.open(href,'Mail','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,top=50,left=50,width=380,height=200');
  }
  function windowReport(href) {
	window.open(href,'Report','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,top=50,left=50,width=550,height=500');
  }
  function windowSave(href) {
	window.open(href,'Save','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,copyhistory=0,top=50,left=50,width=640,height=480');
  }
  
 
      function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;
 
         return true;
      }
      
 
      function isNumber(obj)
      {
		 out = "";
		 for (i=0;i<=(obj.value.length)-1;i++) {
		 	char = obj.value.substr(i,1);
 		    charCode = char.charCodeAt(0);
		    if (!(charCode > 31 && (charCode < 48 || charCode > 57))) {
			   out = out + char;
		    }
		 }
		 obj.value = out;
         return true;
      } 
 
-->  
