var xmlhttp;

function referthisfriend(str) {

    xmlhttp = GetXmlHttpObject();
    if (xmlhttp == null) {
        alert("Browser does not support HTTP Request");
        return;
    }
    var url = window.location.href.replace(window.location.pathname, '/') + "refer_php.asp";
    if (str != null) {
        url = url + "?" + str;
    }
    xmlhttp.onreadystatechange = stateChanged;
    xmlhttp.open("GET", url, true);
    xmlhttp.send(null);
    document.getElementById("loading").style.visibility = 'visible';
}

function stateChanged() {
    if (xmlhttp.readyState == 4) {
        //document.getElementById("image").innerText="";
        //alert("OutPut==="+xmlhttp.responseText);
        if (xmlhttp.responseText == 1) {
            document.getElementById("okmessage_1").innerHTML = "<font color='red'><strong>Thank You!</strong></font>";
            document.getElementById("okmessage_1").style.visibility = 'visible';
            document.getElementById("loading").style.visibility = 'hidden';
        }
        else {
            document.getElementById("okmessage_1").innerHTML = "<font color='red'><strong>Sorry Not Added!</strong></font>";
            document.getElementById("okmessage_1").style.visibility = 'visible';
            document.getElementById("loading").style.visibility = 'hidden';
        }

    }
}

function GetXmlHttpObject() {
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        return new XMLHttpRequest();
    }
    if (window.ActiveXObject) {
        // code for IE6, IE5
        return new ActiveXObject("Microsoft.XMLHTTP");
    }
    return null;
}


