function oAddFriend(userid,text,container_id)
{
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'user_id'	: userid,
	         'message'	: text,
             'status'     : 'friend'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
	            //alert(errors); 
                if (result) {
			       document.getElementById(container_id).innerHTML = result['text'];
                   if (confirm(result['text'])) ReqOption.close(); 
                }
            },
            false  // do not disable caching
        );   
}
function oAddInstructor(userid,text,container_id)
{
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'user_id'	: userid,
             'message'	: text,
             'status'     : 'instructor'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
	            //alert(errors);
                if (result) {
			       document.getElementById(container_id).innerHTML = result['text'];
			       if (confirm(result['text'])) ReqOption.close();
                }
            },
            false  // do not disable caching
        );
}
function oAddStudent(userid,text,container_id)
{
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'user_id'	: userid,
	         'message'	: text,
             'status'     : 'student'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
	            //alert(errors);
                if (result) {
			       document.getElementById(container_id).innerHTML = result['text'];
			       if (confirm(result['text'])) ReqOption.close();
                }
            },
            false  // do not disable caching
        );
}
function Confirm(uid,container_id)
{
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'confirm'	: uid,
	         'status'     : 'confirm'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
	            //alert(errors);
                if (result) {
	               document.getElementById(container_id).innerHTML = result['text'];
	               if (confirm(result['text'])) ReqOption.close();
                }
            },
            false  // do not disable caching
        );
}
function Cancel(uid,st,container_id)
{
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
             'user_id'    : uid,
	         'confirm'	: st,
             'status'	    : 'cancel'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
                //alert(errors);
                if (result) {
		           document.getElementById(container_id).innerHTML = result['text'];
		           if (confirm(result['text'])) ReqOption.close();
                }
            },
            false  // do not disable caching
        );
}
function deleteRelation(userid,status)
{
         if (!confirm(l_confirm_quest)) return;
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'user_id'	: userid,
//Используем ка передачу информации кого удаляем Друга, Студента, или Инструктора
	         'confirm'	: status, 
		'status'    : 'delete'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
	            //alert(errors);
                if (result) {
			       confirm(result['text']);
                }
            },
            false  // do not disable caching
        );
}
function GetConfirmText(uid,container_id)
{
         
        JsHttpRequest.query(
            'ajax/backend/back_relations.php', // backend
            {
	         'confirm'	: uid,
             'status'	    : 'cnf_text'
            },
            // Function is called when an answer arrives. 
            function(result, errors) {
                // Write errors to the debug div.
                //document.write(errors); 
                // Write the answer.
                //alert(errors);
                if (result) {
		           document.getElementById(container_id).value = result['text'];
                }
            },
            false  // do not disable caching
        ); 
}
