/**
 * @author lonelysuch
 */

function getSecondTree(id) {
	var url = "ajax.php?action=get_second_tree&page_id="+id;
	new Ajax(url, {
		method: 'get',
		update: $('second_category_'+id)
	}).request();
}

function aSecondTree(id) {
	if($('second_category_'+id).style.display == 'none') {
		$('second_category_'+id).style.display = 'block';
	} else {
		$('second_category_'+id).style.display = 'none';
	}
	if($('first_category_'+id).className == 'first_close') {
		$('first_category_'+id).className = 'first_open';
	} else {
		$('first_category_'+id).className = 'first_close';
	}
	getSecondTree(id);
}

function getRecord(id) {
	var url = "ajax.php?action=get_record&id="+id;
	new Ajax(url, {
		method: 'get',
		update: $('record_'+id)
	}).request();
}

function aRecord(id) {
	if($('record_'+id).style.display == 'none') {
		$('record_'+id).style.display = 'block';
	} else {
		$('record_'+id).style.display = 'none';
	}
	if($('second_category1_'+id).className == 'second_close') {
		$('second_category1_'+id).className = 'second_open';
	} else {
		$('second_category1_'+id).className = 'second_close';
	}
	getRecord(id);
}

function addQuestion() {
	if($('questionForm').style.display == 'none') {
		$('questionForm').style.display = 'block';
	} else {
		$('questionForm').style.display = 'none';
	}
}
