var xmlHttp; function GetXmlHttpObject() { var xmlHttp=null; try{ xmlHttp=new XMLHttpRequest(); }catch (e){ try{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }catch (e){ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
function setClass(str){ document.frmPaidRegister.txtPaidClass.value = str; }
function stateChangedUserName(){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById("txtResult").innerHTML=xmlHttp.responseText; } }
function disable_enable(formName,formField){ if (document.all || document.getElementByid){ document.formName.formField.disabled=!document.formName.formField.disabled; } }
function disable_enable_register(){ if(document.all || document.getElementById){ document.frmUserRegistration.submitRegistration.disabled=!document.frmUserRegistration.submitRegistration.disabled; } }
function disable_enable_suicide(){ if(document.all || document.getElementById){ document.frmUserCancel.subUserSuicide.disabled=!document.frmUserCancel.subUserSuicide.disabled; } }
function check_if_empty(){ if (document.frmUserRegister.txtEmail.value=='' || document.frmUserRegister.txtUserName.value=='' || document.frmUserRegister.passPw1.value=='' || document.frmUserRegister.passPw2.value=='' || document.frmUserRegister.txtFirst.value=='' || document.frmUserRegister.txtLast.value=='' || document.frmUserRegister.selSex.value=='' || document.frmUserRegister.txtAddress.value=='' || document.frmUserRegister.txtCity.value=='' || document.frmUserRegister.selUserState.value=='' || document.frmUserRegister.txtZip.value=='' || document.frmUserRegister.chkAgree.value==''){ document.frmUserRegister.submitUserRegister.disabled=true; }else{ document.frmUserRegister.submitUserRegister.disabled=false; } }
function showImage(){ var srcimage; srcimage=document.frmUserAvatar.selAvatar.value;
    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; }
    var myrand=parseInt(Math.random()*999999999999999); var url="http://www.queryvegas.com/includes/user_showavatar.php";
    url=url+"?a="+srcimage+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("spanPreview").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function saveImage(){ var srcimage; srcimage=document.frmUserAvatar.selAvatar.value;
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; }
    var myrand=parseInt(Math.random()*999999999999999); var url="http://www.queryvegas.com/includes/user_saveavatar.php";
    url=url+"?a="+srcimage+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("spanPreview").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function addUserRating(rating){ var srcuser; srcuser=document.frmUserRatings.hidID.value;
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){ alert ("Browser does not support HTTP Request"); return; }
    var myrand=parseInt(Math.random()*999999999999999); var url="http://www.queryvegas.com/includes/user_adduserrating.php";
    url=url+"?r="+srcuser+"&rating="+rating+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("userRatings").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true); xmlHttp.send(null); }
function addUserFriend(action){
    var myret;
    myret=window.confirm('Are you sure?');
    if(myret==true){
        var srcuser;
        srcuser=document.frmUserRatings.hidID.value;
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_adduserfriend.php";
        url=url+"?r="+srcuser+"&action="+action+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById("userFriends").innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
    //redoFriendsList(srcuser);
}

function editUserFriend(friendID,trID){
    //var myret;
    //myret=window.confirm('Are you sure?');
    //if(myret==true){
        var srcuser=document.frmEdit.hidID.value;
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_showedituserfriend.php";
        url=url+"?r="+srcuser+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById(trID).innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    //}
}

function redoFriendsList(userid){
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_friendslist.php";
    url=url+"?u="+userid+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("userFriendsList").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function addUserFav(action){
    var srcuser;
    srcuser=document.frmUserFav.hidID.value;
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_adduserfav.php";
    url=url+"?r="+srcuser+"&action="+action+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("fav_list").innerHTML=xmlHttp.responseText;
            reworkFavList(srcuser);
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function reworkFavList(srcuser){
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_favlist.php";
    url=url+"?r="+srcuser+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("userFavList").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function addUserReviewRate(action,reviewid){
    var srcuser;
    srcuser=document.frmUserFav.hidID.value;
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_adduserrevrate.php";
    url=url+"?r="+reviewid+"&action="+action+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById("thumbs_span").innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function acceptUser(userid,divname){
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_acceptuser.php";
    url=url+"?u="+userid+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById(divname).innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function denyUser(userid,divname){
    xmlHttp=GetXmlHttpObject();
    if(xmlHttp==null){
        alert("Browser does not support HTTP Request");
        return;
    }
    var myrand=parseInt(Math.random()*999999999999999);
    var url="http://www.queryvegas.com/includes/user_denyuser.php";
    url=url+"?u="+userid+"&myrand="+myrand;
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
            document.getElementById(divname).innerHTML=xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function showCheckSCR(){
    var uname;
    uname=document.frmUserRegistration.txtUserName.value;
    if(uname!=""){
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_showcheck.php";
        url=url+"?u="+uname+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById("unameWarn").innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
}

function checkSN(){
    var uname;
    uname=document.frmUserRegistration.txtUserName.value;
    if(uname!=""){
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_checksn.php";
        url=url+"?u="+uname+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById("unameWarn").innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
}

function checkPASS(){
    var upass1;
    var upass2;
    upass1=document.frmUserRegistration.passPw1.value;
    upass2=document.frmUserRegistration.passPw2.value;
    if(upass1!="" && upass2!="" && upass1 == upass2){
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_checkpass.php";
        url=url+"?p="+upass2+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById("upassWarn").innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }else{
        document.getElementById("upassWarn").innerHTML="Passwords not the same.";
    }
}

function checkEmail(){
    var uemail;
    uemail=document.frmUserRegistration.txtEmail.value;
    if(uemail!=""){
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null){
            alert("Browser does not support HTTP Request");
            return;
        }
        var myrand=parseInt(Math.random()*999999999999999);
        var url="http://www.queryvegas.com/includes/user_checkemail.php";
        url=url+"?e="+uemail+"&myrand="+myrand;
        xmlHttp.onreadystatechange=function(){
            if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
                document.getElementById("uemailWarn").innerHTML=xmlHttp.responseText;
            }
        }
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }else{
        document.getElementById("uemailWarn").innerHTML="Email must not be blank.";
    }
}
