var ajax=0;
var ajaxBusy=false; 
var ajax= new Array ();

function openAjax(){
try{
    ajax = new XMLHttpRequest();
} catch (e){
    try{
        ajax = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try{
            ajax = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (e){
            alert("Your browser broke!");
            return false;
        }
       }
    }
}                                 
                  
function ajaxSend (dataArray){
	var firstElement =  true;
	var a='';
	
	openAjax ();                      // izvuci action npr. getproducts i slicno...

	for (key in dataArray){
	   if ( firstElement ) {
	      a+=  key + '=' +dataArray[key];
	      firstElement = false;
	   } else {
	     a+= '&' + key + '=' +dataArray[key];
	   }
	}
	   
	ajaxBusy=true;
	ajax.onreadystatechange = updateDNS
	ajax.open("POST", "ajax_dnsList.php", true);
	
	//Send the proper header information along with the request
	ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	ajax.setRequestHeader("Content-length", a.length);
	ajax.setRequestHeader("Connection", "close");
	ajax.send(a);
	       
 }
 
 function updateDNS() {
 	if ( ajax.readyState == 4  ) {
		document.getElementById("dnsField").innerHTML = ajax.responseText;
	}
 }
 
 function legalTypeToogle(type) {
     if ( type == "pravno" ) {
         document.getElementById("rowFizicko").style.display="none";
         document.getElementById("rowPravno").style.display="block";
     } else if ( type == "fizičko" ) {
         document.getElementById("rowFizicko").style.display="block";
         document.getElementById("rowPravno").style.display="none";
     }
 }
 

 

