

//Global variable
var http = createRequestObject();

//Return request object
function createRequestObject() {
    var xmlhttp;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
        try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
        catch (f) { xmlhttp = null; }
    }
    if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
        xmlhttp = new XMLHttpRequest();
    }
    return xmlhttp;
}

//***********************************************************************************************/
//Begin check username availability
//***********************************************************************************************/
function sendRequestTextUsernamePost() {
    var loginname = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;
    try {
        http.open('Get', 'AJAX/AjaxRequest.aspx?mode=checkusername&uname=' + loginname);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = handleResponseUsernameText;
        http.send(null);
    }
    catch (e) {

    }
    finally {
    }
}

//***********************************************************************************************/
//Begin check username availability for User Profile >> Account Information page
//***********************************************************************************************/
function sendRequestTextAccountInfoUsernamePost() {
    var loginname = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;
    try {
        http.open('Get', 'AJAX/AjaxRequest.aspx?mode=CheckAcctInfoUserName&uname=' + loginname);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = handleResponseUsernameText;
        http.send(null);
    }
    catch (e) {

    }
    finally {
    }
}

//Get the username response text
function handleResponseUsernameText() {
    $("#spanChecking").text('Loading...');
    if ((http.readyState == 4) && (http.status == 200)) {
        var response = http.responseText;
        $("#spanChecking").fadeTo(1500, 0.1, function() { $(this).html(response).fadeTo(900, 1); });
    }
}
//End ************************************************************************************************/

function sendRequestShoppingUsernamePost() {
    var loginname = document.getElementById("ctl00_ContentPlaceHolder1_txtUserName").value;
    try {
        http.open('Get', 'AJAX/AjaxRequest.aspx?mode=checkshoppingusername&uname=' + loginname);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = handleResponseShoppingUsernameText;
        http.send(null);
    }
    catch (e) {

    }
    finally {
    }
}

function handleResponseShoppingUsernameText() {
    $("#spanChecking").text('Loading...');
    if ((http.readyState == 4) && (http.status == 200)) {
        var response = http.responseText;
        $("#spanChecking").fadeTo(1500, 0.1, function() { $(this).html(response).fadeTo(900, 1); });
    }
}

//****************************************************************************************************//
// Get Image for item image
//****************************************************************************************************//
function sendRequestTextItemImagePost(ImageName) {
    try {
        http.open('Get', 'AJAX/AjaxRequest.aspx?mode=Image&ImageName=' + ImageName);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = handleResponseItemImageText;
        http.send(null);
    }
    catch (e) {

    }
    finally {
    }
}

//Get the image as response text
function handleResponseItemImageText() {
    if ((http.readyState == 4) && (http.status == 200)) {
        var response = http.responseText;
        $("#BigImage").attr("src", "" + response + "&Square=yes&Size=448");
        $("#SmallImage").attr("src", "" + response + "&Square=yes&Size=115");
        $("#aZoomImage").attr("href", "" + response + "&Square=yes&Size=1024");
    }
}


//***********************************************************************************************/
//Begin check username availability for send message
//***********************************************************************************************/
function sendRequestTextUsernamePost_message() {
    var loginname = document.getElementById("ctl00_ContentPlaceHolder1_txtTo").value;
    try {
        http.open('Get', 'AJAX/AjaxRequest.aspx?mode=checkusername_message&uname=' + loginname);
        http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        http.onreadystatechange = handleResponseUsernameText;
        http.send(null);
    }
    catch (e) {

    }
    finally {
    }
}




//******************************************************************************************************//



