// ----------------
// ---------------- XMLHttpRequest [-ActiveXObject("Microsoft.XMLHTTP")-]
// ---------------- <div id='result'>
// ----------------
var req;
var doesNotSupport = true;

function send(url,from)
{
if (document.getElementById('Email').value && document.getElementById('Text').value){


var meno = document.getElementById('Meno').value;
var priez = document.getElementById('Priezvisko').value;
var spol = document.getElementById('Spolocnost').value;
var odkaz = document.getElementById('Text').value;
var email = document.getElementById('Email').value;
var tel = document.getElementById('Telefon').value;





    if (url == "" || !doesNotSupport)
        return;
        document.getElementById('alert').innerHTML = "Odosiela sa ...";
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest;
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (req) {
	params = "from="+encodeURIComponent(from) +
		
		"&meno="+encodeURIComponent(meno)+
		"&priez="+encodeURIComponent(priez)+
		"&spol="+encodeURIComponent(spol)+
		"&odkaz="+encodeURIComponent(odkaz)+
		"&email="+encodeURIComponent(email)+
		"&tel="+encodeURIComponent(tel);
		
       req.open("POST", url ,true);
	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
       req.onreadystatechange = processReqChange;
       req.send(params);
      
    } else {
       alert("Your browser does not support XMLHttpRequest technology!");
       doesNotSupport = false;
    }
}else{
document.getElementById('alert').innerHTML='<h4 style="color:#00369a;">Please fill in the requested information below.</h4>';
document.getElementById('Email').style.border='1px solid #00369a';
document.getElementById('Text').style.border='1px solid #00369a';
}

}
function processReqChange() {
    // only if req shows "loaded"
    if (req.readyState == 4) {
        // only if "OK"
        if (req.status == 200) {
         
         var text = req.responseText;
            document.getElementById('result').innerHTML=text;
        } else {
            alert("There was a problem retrieving the data:\n" + req.statusText);
        }
    }
}

