<!--


function DEF_OBJ_EKSPERTI_ATBILD() {
	
	
	this.getCommentsBlock = function(question_id) {
		
		var id = 'id_tools_block_' + question_id + '';
		var obj = fns_getElementById(id);
		
		if (obj) {
			
			if (obj.style.display !== '') {
				
				var link = HTTP_ROOT + 'v2008/act/eksperti_atbild/get_comments.ajax.php?question_id=' + question_id;
				OBJ_AH.doGet(link, id, 'OBJ_EKSPERTI_ATBILD.displayCommentsBlock(' + question_id + ', resp)');
				
			}else {
				obj.style.display = 'none';
			}
			
		}
		
		return false;
		
	}// END getCommentsBlock
	
	
	this.displayCommentsBlock = function(question_id, resp) {
		
		var id = 'id_tools_block_' + question_id + '';
		var obj = fns_getElementById(id);
		
		if (obj) {
			obj.style.display = '';
			obj.innerHTML = resp;
		}
		
	}// END displayCommentsBlock
	
	
	this.postComment = function(question_id) {
		
		var id = 'id_tools_block_' + question_id + '';
		var id_text = 'id_qa_comment_form_' + question_id + '_text';
		var obj = fns_getElementById(id);
		var obj_text = fns_getElementById(id_text);
		
		if (obj && obj_text) {
			
			var link = HTTP_ROOT + 'v2008/act/eksperti_atbild/get_comments.ajax.php';
			var vars = 'action=add_comment&question_id=' + question_id + '&text=' + encodeURIComponent(obj_text.value) + '';
				
			OBJ_AH.doPost(link, id, 'OBJ_EKSPERTI_ATBILD.displayCommentsBlock("' + question_id + '", resp)', vars);
			
		}else {
			alert('Kļūda! Nav ielādēti visi nepieciešamie lauki');
		}
		
		return false;
		
	}// END postComment
	
	
	this.closeToolsBlock = function(question_id) {
		
		var id = 'id_tools_block_' + question_id + '';
		var obj = fns_getElementById(id);
		
		if (obj) {
			obj.style.display = 'none';
		}
		
		return true;
		
	}// END closeToolsBlock
	
	
	this.checkNewQuestionForm = function() {
		
		var fns_res = false;
		
		var obj_question = fns_getElementById('id_question');
		
		if (obj_question) {
			
			if (obj_question.value.length > 0) {
				fns_res = true;
			}else {
				alert('Kļūda! Nav aizpildīti visi nepieciešamie lauki\nvai tie aizpildīti nepareizi!');
			}
			
		}else {
			alert('Kļūda! Nav ielādēti visi objekti');
		}
		
		return fns_res;
		
	}// END checkNewQuestionForm
	
	
}// END of CLASS DEF_OBJ_EKSPERTI_ATBILD


var OBJ_EKSPERTI_ATBILD = new DEF_OBJ_EKSPERTI_ATBILD();

// -->
