/* -------------------------- */
/*   XMLHTTPRequest Enable    */
/* -------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
} else {
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

/* -------------------------- */
/*        SEARCH              */
/* -------------------------- */

function loginenter() {
login = encodeURI(document.getElementById('gaylogin').value);
pass = encodeURI(document.getElementById('gaypass').value);
document.getElementById('buttomlogin').src='images/progress_barb.gif';

// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'ajax_login.php?login='+login+'&pass='+pass+'&nocache = '+nocache);
http.onreadystatechange =  searchNameqReply;
http.send(null);
}

function searchNameqReply() {
if(http.readyState == 4){
var response = http.responseText;
if (response=='ok') {document.location.reload();} else {document.getElementById('buttomlogin').src='images/login-1.png';document.getElementById('loginmess').innerHTML = response;}
}
}
function RegNik() {
nik = encodeURI(document.getElementById('newnik').value);
// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'userreg_ajax.php?nik='+nik+'&nocache = '+nocache);
http.onreadystatechange =  searchnik;
http.send(null);
}
function searchnik() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('messnik').innerHTML = response;
}
}
function RegEmail() {
email = encodeURI(document.getElementById('newemail').value);
// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'userreg_ajax.php?email='+email+'&nocache = '+nocache);
http.onreadystatechange =  searchemail;
http.send(null);
}
function searchemail() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('messemail').innerHTML = response;
}
}
function RegPass() {
pass = encodeURI(document.getElementById('newpass').value);
pass1 = encodeURI(document.getElementById('newpass1').value);

// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'userreg_ajax.php?pass='+pass+'&pass1='+pass1+'&nocache = '+nocache);
http.onreadystatechange =  searchpass;
http.send(null);
}
function searchpass() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('messpass').innerHTML = response;
}
}
function RegPhone() {
phone = encodeURI(document.getElementById('newphone').value);

// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'userreg_ajax.php?phone='+phone+'&nocache = '+nocache);
http.onreadystatechange =  searchphone;
http.send(null);
}
function searchphone() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('messphone').innerHTML = response;
}
}

function viewAstro() {
period = encodeURI(document.getElementById('period').value);
znak = encodeURI(document.getElementById('znak').value);

// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'astro1.php?period='+period+'&znak='+znak+'&nocache = '+nocache);
http.onreadystatechange =  viewAstroEnd;
http.send(null);
}
function viewAstroEnd() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('astro-result').innerHTML = response;
}
}

