var doInviteActionOnSucess;


function doInviteWindow(actionOnSuccess){
    window.overLibY=cursor.y;
    window.overLibX=cursor.x;

    if (actionOnSuccess) {
        doInviteActionOnSucess=actionOnSuccess;
    } else {
        doInviteActionOnSucess=function(){
            loadScript("/include/user.js.php");
            if (window.translations["XOOPS__MD_SW_LOGIN_OK"]) {
                showOverlib(window.translations["XOOPS__MD_SW_LOGIN_OK"],'');
            } else {
                cClick();
            }
            setTimeout("cClick()", 1000);
            refresh_block(220);
                
        };
    }
    window.invite_path="/ajax/membership_invite.html";
    doAJAXGetCall(window.invite_path, drawInviteForm);
}




function drawInviteForm(){
    if (xmlHttp.readyState == 4) {  
        result=xmlHttp.responseText;
        result=parse_and_replace_constants(result);
        showOverlib(result, 'Invite');
    }
}





function checkInviteStatus(){
    if (xmlHttp.readyState == 4) {  
        result=xmlHttp.responseText;
        if (result=="INVITE_FAILED") {
            alert(window.translations["XOOPS__US_INCORRECTLOGIN"]);
        }
        if (result=="INVITE_OK") {
            showOverlib("OK", "");
            setTimeout("cClick()", 1000);
        }
    }
}



function doInvite(f){
    email=f.email.value;
    message=f.msg.value;
    if (window.user_id>0) {
        if (email && message) {
            url="/modules/membership/invite_embedded.php?email="+email+"&uid="+window.user_id+"&msg="+escape(message);
            loadOverlibContent(url, checkInviteStatus);
        }
    }
    

    return false;
}


