// JavaScript Document

var numPop = 0;
var move_obj_id = '';
var del_obj_x = 0;
var del_obj_y = 0;
var max_z_index = 0;
var user_state = '';
var pred_pat = 0;

function UserState(xmlObj)
	{
	if(user_state != ''){return true;}
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			user_state = textXML;
			if(user_state == '')user_state = 0;
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_user_state.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('');
	}

function CheckUserState(need_state)
	{
	
	}

function GetRequest()
	{
	document.body.focus();
	var obj_request = false;
	if(window.XMLHttpRequest)
		{
		obj_request = new XMLHttpRequest();
		UserState(obj_request);
		obj_request = new XMLHttpRequest();
		}
	else if(window.ActiveXObject)
		{
		obj_request = new ActiveXObject("Microsoft.XMLHTTP");
		UserState(obj_request);
		obj_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
	return obj_request;
	}

function GetGUID()
	{
	d = new Date();
	tt = d.getTime();
	return tt;
	}

function a_SaveRangPatternRazdel(id_pattern, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				a_ShowSavePattern(id_pattern, curNumPop);
				}
			}
		}
	obj_list = document.getElementById('list_razdel_' + id_pattern);
	if(!obj_list)return false;
	arr_list = obj_list.value.split(",");
	txt_list = '';
	for(k in arr_list)
		{
		obj_rang = document.getElementById('rang_r_' + arr_list[k] + '_' + id_pattern);
		if(!obj_rang)continue;
		txt_list += ', ' + arr_list[k] + ' => ' + obj_rang.value;
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_pattern.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('list_rang_razdel=' + txt_list +
	'&id_pattern=' + id_pattern);
	}

function a_SaveTabRangPatternRazdel(id_pattern, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				a_ShowSaveTabPattern(id_pattern, 'tab_pattern');
				}
			}
		}
	obj_list = document.getElementById('list_razdel_' + id_pattern);
	if(!obj_list)return false;
	arr_list = obj_list.value.split(",");
	txt_list = '';
	for(k in arr_list)
		{
		obj_rang = document.getElementById('rang_r_' + arr_list[k] + '_' + id_pattern);
		if(!obj_rang)continue;
		txt_list += ', ' + arr_list[k] + ' => ' + obj_rang.value;
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_pattern.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('list_rang_razdel=' + txt_list +
	'&id_pattern=' + id_pattern);
	}

function a_SavePatternRazdel(id_form, id_pattern)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	obj_form = document['razdel_form_' + id_form];
	if(!obj_form)return false;
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				a_ShowSavePattern(id_pattern, obj_form.id_pop.value);
				}
			}
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_pattern.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('name_razdel=' + obj_form.name_razdel.value + 
	'&id_parent=' + obj_form.id_parent.item(obj_form.id_parent.selectedIndex).value +
	'&rang_razdel=' + obj_form.rang_razdel.value +
	'&id_razdel=' + obj_form.id_razdel.value +
	'&id_pattern=' + obj_form.id_pattern.value);
	}

function a_SaveTabPatternRazdel(id_form, id_pattern)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	obj_form = document['razdel_form_' + id_form];
	if(!obj_form)return false;
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				a_ShowSaveTabPattern(id_pattern, 'tab_pattern');
				}
			}
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_pattern.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('name_razdel=' + obj_form.name_razdel.value + 
	'&id_parent=' + obj_form.id_parent.item(obj_form.id_parent.selectedIndex).value +
	'&rang_razdel=' + obj_form.rang_razdel.value +
	'&id_razdel=' + obj_form.id_razdel.value +
	'&id_pattern=' + obj_form.id_pattern.value);
	}

function a_DropPatternRazdel(id_razdel, id_pattern, id_form)
	{
	if(!window.confirm('Вы действительно хотите удалить раздел?'))return false;
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	obj_form = document['pattern_form_' + id_form];
	if(!obj_form)return false;
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			a_ShowSavePattern(id_pattern, obj_form.id_pop.value);
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_pattern.php?del_razdel=" + id_razdel, true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('');
	}

function a_DropTabPatternRazdel(id_razdel, id_pattern, id_form)
	{
	if(!window.confirm('Вы действительно хотите удалить раздел?'))return false;
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			a_ShowSaveTabPattern(id_pattern, 'tab_pattern');
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_pattern.php?del_razdel=" + id_razdel, true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('');
	}

function a_EditPatternRazdel(id_razdel, id_pattern, curNumPop)
	{
	if(!id_pattern)return false;
	var xmlObj = GetRequest();
	var curNumPop;
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_pattern.php?id_razdel=" + id_razdel + "&id_pattern=" + id_pattern + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_EditTabPatternRazdel(id_razdel, id_pattern, curNumPop)
	{
	if(!id_pattern)return false;
	var xmlObj = GetRequest();
	var curNumPop;
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_pattern.php?id_razdel=" + id_razdel + "&type_form=1&id_pattern=" + id_pattern + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_ShowTest(id_razdel, id_kurs, type, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_test.php?id_razdel=" + id_razdel + "&id_kurs=" + id_kurs + "&type=" + type + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_SaveRazdelTest(id_form, id_razdel)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	form_test = document['razdel_form_' + id_form];
	if(!form_test){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				if(document.getElementById('tab_pattern') && form_test.type.value == 1)a_ShowSaveTabPattern(0, 'tab_pattern');
				else
					{
					a_ShowTest(id_razdel, form_test.id_kurs.value, 1, form_test.id_pop.value);
					alert("Список сохранен");
					}
				}
			}
		}
	
	if(form_test.type.value == 1)
		{
		list_test = new String(form_test.list_using_test.value);
		arr_using_test = list_test.split(",");
		list_num_les = '';
		for(k in arr_using_test)
			{
			objNumLes = form_test['num_urok_' + id_form + '_' + arr_using_test[k]];
			if(!objNumLes)continue;
			list_num_les += "|||" + arr_using_test[k] + " => '" + objNumLes.value + "'";
			}
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_test.php", true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		if(list_num_les == '')list_num_les = "|||";
		xmlObj.send('list_test_num_les=' + list_num_les + 
		'&id_razdel=' + form_test.id_razdel.value);
		}
	else if(form_test.type.value == 2)
		{
		objSel = document['razdel_form_' + id_form]['left_select' + id_form];
		if(!objSel)return false;
		arr_sel = new Array;
		for(i = 0; i < objSel.length; i++)
			{
			arr_sel[i] = objSel.item(i).value;
			}
		txt_sel = arr_sel.join("|||");
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_test.php", true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		if(txt_sel == '')txt_sel = 0;
		xmlObj.send('list_test_razdel=' + txt_sel + 
		'&id_razdel=' + form_test.id_razdel.value);
		}
	}

function a_ShowTask(id_razdel, id_kurs, type, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_task.php?id_razdel=" + id_razdel + "&id_kurs=" + id_kurs + "&type=" + type + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_SaveRazdelTask(id_form, id_razdel)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	form_task = document['razdel_form_' + id_form];
	if(!form_task){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(textXML != 'true')alert(textXML);
			else
				{
				if(document.getElementById('tab_pattern') && form_task.type.value == 1)a_ShowSaveTabPattern(0, 'tab_pattern');
				else
					{
					a_ShowTask(id_razdel, form_task.id_kurs.value, 1, form_task.id_pop.value);
					alert("Список сохранен");
					}
				}
			}
		}
	
	if(form_task.type.value == 1)
		{
		list_task = new String(form_task.list_using_task.value);
		arr_using_task = list_task.split(",");
		list_num_les = '';
		for(k in arr_using_task)
			{
			objNumLes = form_task['num_urok_' + id_form + '_' + arr_using_task[k]];
			if(!objNumLes)continue;
			list_num_les += "|||'" + arr_using_task[k] + "' => '" + objNumLes.value + "'";
			}
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_task.php", true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		if(list_num_les == '')list_num_les = "0";
		xmlObj.send('list_task_num_les=' + list_num_les + 
		'&id_razdel=' + form_task.id_razdel.value);
		}
	else if(form_task.type.value == 2)
		{
		objSel = document['razdel_form_' + id_form]['left_select' + id_form];
		if(!objSel)return false;
		arr_sel = new Array;
		for(i = 0; i < objSel.length; i++)
			{
			arr_sel[i] = objSel.item(i).value;
			}
		txt_sel = arr_sel.join("|||");
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_razdel_task.php", true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		if(txt_sel == '')txt_sel = 0;
		xmlObj.send('list_task_razdel=' + txt_sel + 
		'&id_razdel=' + form_task.id_razdel.value);
		}
	}

function a_ShowPattern(tab, id_kurs)
	{
	objTab = document.getElementById(tab);
	if(!objTab)return false;
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objTab = document.getElementById(tab);
			if(!objTab)return false;
			objTab.innerHTML = textXml;
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_section_pattern.php?&id_kurs=" + id_kurs + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_ShowSavePattern(id_pattern, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		a_HideLastPopWindow();
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_section_pattern.php?id_pattern=" + id_pattern + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_ShowSaveTabPattern(id_pattern, tab)
	{
	if(id_pattern == 0)
		{
		id_pattern = pred_pat;
		}
	if(id_pattern == 0)
		{
		return false;
		}
	pred_pat = id_pattern;
	a_HideAllPopWindow();
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById(tab);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			a_ShowCalendar(id_pattern, 0);
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_section_pattern.php?id_pattern=" + id_pattern + "&type_form=1&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}


function a_SavePattern(id_form)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	form_patt = document['pattern_form_' + id_form];
	if(!form_patt){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXML = xmlObj.responseText;
			if(isNaN(textXML))alert(textXML);
			else a_ShowSavePattern(textXML, form_patt.id_pop.value);
			a_ShowPattern('tab_pattern', 0);
			}
		}
	list_t = new String(form_patt.list_t.value);
	arr_t = list_t.split(",");
	list_ac_t = '|||';
	for(k in arr_t)
		{
		objCh = document.getElementById('ch_t_' + id_form + '_' + arr_t[k]);
		if(!objCh)continue;
		if(objCh.checked)list_ac_t += arr_t[k] + '|||';
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_section_pattern.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('id_pattern=' + form_patt.id_pattern.value +
	'&name_pattern=' + form_patt.name_pattern.value +
	'&id_kurs_group=' + form_patt.id_kurs_group.value +
	'&list_t=' + list_ac_t);
	}

function a_LoadPattern(id_kurs_group)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window');
			objPopContent.innerHTML = textXml;
			objPopHeader = document.getElementById('header_pop_window');
			objPopHeader.innerHTML = "Загрузка шаблона";
			}
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_section_pattern.php?load_pattern=" + id_kurs_group + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	a_HidePopWindow();
	a_ShowPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
	}

function a_ShowCalendar(id_pattern, id_group, id_save)
	{
	a_HideAllPopWindow();
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('tab_calendar');
			objPopContent.innerHTML = textXml;
			}
		}
	if(id_save == 0)
		{
		xmlObj.open('GET', root_a + "ajax_scripts/ajax_pattern_calendar.php?id_pattern=" + id_pattern + "&id_group=" + id_group + "&save_calendar=" + id_save + "&guid=" + GetGUID(), true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		xmlObj.send();
		}
	else
		{
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_pattern_calendar.php" + "?guid=" + GetGUID(), true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		txt_days = '';
		for(i = 1; i <= id_save; i++)
			{
			in_day = document.getElementById('date_les_' + i);
			if(!in_day)continue;
			txt_days += "&date_les_" + i + "=" + in_day.value;
			}
		xmlObj.send("id_pattern=" + id_pattern + "&id_group=" + id_group + txt_days + "&save_calendar=" + id_save);
		alert('Календарь был сохранен');
		}
	}


function a_ShowCalendarRazdel(id_pattern, id_group, id_save)
	{
	a_HideAllPopWindow();
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('tab_calendar');
			objPopContent.innerHTML = textXml;
			}
		}
	if(id_save == 0)
		{
		xmlObj.open('GET', root_a + "ajax_scripts/ajax_razdel_calendar.php?id_pattern=" + id_pattern + "&id_group=" + id_group + "&save_calendar=" + id_save + "&guid=" + GetGUID(), true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		xmlObj.send();
		}
	else
		{
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_pattern_calendar.php" + "?guid=" + GetGUID(), true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		txt_days = '';
		for(i = 1; i <= id_save; i++)
			{
			in_day = document.getElementById('date_les_' + i);
			if(!in_day)continue;
			txt_days += "&date_les_" + i + "=" + in_day.value;
			}
		xmlObj.send("id_pattern=" + id_pattern + "&id_group=" + id_group + txt_days + "&save_calendar=" + id_save);
		alert('Календарь был сохранен');
		}
	}


function a_ShowTaskExeption(id_pattern, id_group, num_les, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_pattern_task.php?id_pattern=" + id_pattern + "&id_group=" + id_group + "&num_les=" + num_les + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_SaveTaskExeption(id_pattern, id_group, num_les, curNumPop, id_form)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			a_ShowTaskExeption(id_pattern, id_group, num_les, curNumPop);
			}
		}
	count_line = document.getElementById('count_line_' + id_form).value;
	count_col = document.getElementById('count_col_' + id_form).value;
	txt_send_task = '|||';
	for(i=2; i < count_line; i++)
		{
		for(j=0; j < count_col; j++)
			{
			obj_task = document.getElementById('task_' + id_form + '_' + i + '_' + j);
			obj_tnum = document.getElementById('task_num_' + id_form + '_' + i + '_' + j);
			obj_user = document.getElementById('task_user_' + id_form + '_' + i + '_' + j);
			obj_text = document.getElementById('task_text_' + id_form + '_' + i + '_' + j);
			if(obj_text.value == '')obj_text.value = 0;
			obj_text.value = Number(obj_text.value);
			txt_send_task += obj_task.value + "###" + obj_tnum.value + "###" + obj_user.value + "###" + obj_text.value + "|||";
			}
		}
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_pattern_task.php" + "?guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send("id_pattern=" + id_pattern + "&id_group=" + id_group + "&num_les=" + num_les + "&txt_send_task=" + txt_send_task);
	}

function a_AddComposCurs(id_kurs, id_group, curNumPop)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			objPopContent = document.getElementById('content_pop_window_' + curNumPop);
			if(!objPopContent)return false;
			objPopContent.innerHTML = textXml;
			}
		}
	if(curNumPop == 0)
		{
		curNumPop = a_NewPopWindow('<img src="' + root_a + 'img/wait.gif" width="40">');
		}
	else
		{
		objPopContent = document.getElementById('content_pop_window_' + curNumPop);
		if(!objPopContent)return false;
		objPopContent.innerHTML = '<img src="' + root_a + 'img/wait.gif" width="40">';
		}
	xmlObj.open('GET', root_a + "ajax_scripts/ajax_kurs_compos.php?id_kurs=" + id_kurs + "&id_group=" + id_group + "&id_pop=" + curNumPop + "&guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send();
	}

function a_ShowCommentText(tab, title)
	{
	text_content = '2VDevIDtext_comment';
	txt = '<br><div align="center"><b>Новый комментарий:</b><form action="<?= CHEMIN;?>send_comment.php" onSubmit="javascript:a_SendCommentCode(text_content, \'com_code\', \'' + title + '\'); return false;" name="comment_page"><textarea name="text_comment" id="text_comment" cols="20" rows="10"></textarea><br>Код защиты:&nbsp;&nbsp;(<a href="#" onClick="javascript:a_UpdateCode(\'code_image\', \'./code_image.php\', false); return false;">обновить</a>)<br><img id="code_image" src="./code_image.php?id=' + Math.round(Math.random() * 10000) + '"><br><input class="texte" type="text" name="com_code" id="com_code" size="15"><br><input type="button" onClick="javascript:a_SendCommentCode(text_content, \'com_code\', \'' + title + '\')" class="bouton" value="Отправить"></form></div>';
	updateInObj(tab, txt);
	VISUAL=-1;
	SECURE=0;
	RETURNNL=1;
	FULLCTRL=0;
	DFFACE='Times New Roman, Times, serif';
	DFSIZE='14px';
	LANGUAGE='ru-lang.js';
	LANG='ru';
	IPATH = 'http://alfakom.uz/';
	changetoIframeEditor(document.comment_page.text_comment);
	a_UpdateCode('code_image', './code_image.php', false);
	}

function a_SendCommentCode(text_content, com_code, title)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			if(textXml == 'true')a_SendCommentText(text_content, title);
			else
				{
				document.getElementById(com_code).value = '';
				alert('Не правильно указан код защиты.');
				a_UpdateCode('code_image', './code_image.php', false);
				}
			}
		}
	xmlObj.open('POST', root_a + "ajax_scripts/send_comment.php" + "?guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('com_code=' + document.getElementById(com_code).value);
	}

function a_SendCommentText(text_content, title)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			if(textXml == 'true')alert('Ваше сообщение было успешно отправлено! Через некоторое время оно отобразиться в комментариях.');
			else alert('К сожалению Ваше сообщение не отправлено. Попробуййте позже.');
			a_ShowComment('comment_tab');
			a_ShowCommentText('comment_text', title);
			}
		}
	var el = document.getElementById(text_content);
	if(el.contentDocument != undefined)
		{
		txt_inner = el.contentDocument.body.innerHTML;
		}
	else
		{
		el.focus();
		txt_inner = el.contentWindow.document.body.innerHTML;
		}
	xmlObj.open('POST', root_a + "ajax_scripts/send_comment.php" + "?guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('link=' + escape(document.location.href) + '&content=' + (txt_inner) + '&title=' + (title));
	}

function a_ShowComment(tab)
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	xmlObj.onreadystatechange = function()
		{
		var txt = '';
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			arr_com = eval(textXml);
			txt = 'Всего комментариев - ' + arr_com.length + '<br>';
			for(k in arr_com)
				{
				txt += '<br><b>' + arr_com[k][2] + ' - ' + arr_com[k][0] + '</b><div align="center"><div class="block_faq">' + arr_com[k][1] + '</div></div>';
				}
			obj_tab = document.getElementById(tab);
			if(!obj_tab)return false;
			obj_tab.innerHTML = txt;
			}
		}
	xmlObj.open('POST', root_a + "ajax_scripts/get_comment.php" + "?guid=" + GetGUID(), true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('link=' + document.location.href.replace(/\&/, '%26'));
	}

function a_SearchUser(tab, type_form, id_group)
	{
	obj_tab = document.getElementById(tab);
	if(!obj_tab)return false;
	if(type_form == 0)
		{
		txt = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><tr><td>Строка поиска</td><td><input name=\"search_text" + tab + "\" type=\"text\" id=\"search_text" + tab + "\" size=\"78\"></td></tr><tr><td colspan=\"2\">Искать по:&nbsp;&nbsp;&nbsp;<input name=\"search_fio" + tab + "\" type=\"checkbox\" id=\"search_fio" + tab + "\" value=\"\" checked><label for=\"search_fio" + tab + "\" title=\"По ФИО\">&nbsp;ФИО</label>&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"search_login" + tab + "\" type=\"checkbox\" id=\"search_login" + tab + "\" value=\"\" checked><label for=\"search_login" + tab + "\" title=\"По логину\">&nbsp;логину</label>&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"search_email" + tab + "\" type=\"checkbox\" id=\"search_email" + tab + "\" value=\"\" checked><label for=\"search_email" + tab + "\" title=\"По e-mail\">&nbsp;e-mail</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"search_student" + tab + "\" type=\"checkbox\" id=\"search_student" + tab + "\" value=\"\" checked><label for=\"search_student" + tab + "\" title=\"только слушатели\">&nbsp;только&nbsp;слушатели</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"\" type=\"button\" class=\"bouton\" onClick=\"javascript:a_SearchUser('" + tab + "', 1, '" + id_group + "');\" value=\"Искать\"></td></tr></table>";
		obj_tab.innerHTML = txt;
		}
	else if(type_form == 1)
		{
		var xmlObj = GetRequest();
		if(xmlObj === false){return false;}
		obj_search = document.getElementById('search_text' + tab);
		obj_s_fio = document.getElementById('search_fio' + tab);
		obj_s_log = document.getElementById('search_login' + tab);
		obj_s_eml = document.getElementById('search_email' + tab);
		obj_s_stu = document.getElementById('search_student' + tab);
		if(!obj_search || !obj_s_fio || !obj_s_log || !obj_s_eml || !obj_s_stu){return false;}
		if(obj_search.value == "")
			{
			alert("Строка поиска пуста!");
			return false;
			}
		if(!obj_s_fio.checked && !obj_s_log.checked && !obj_s_eml.checked)
			{
			alert("Укажите параметры поиска!");
			return false;
			}
		if(obj_s_fio.checked)ch_f = 1;
		else ch_f = 0;
		if(obj_s_log.checked)ch_l = 1;
		else ch_l = 0;
		if(obj_s_eml.checked)ch_e = 1;
		else ch_e = 0;
		if(obj_s_stu.checked)ch_s = 1;
		else ch_s = 0;
		xmlObj.onreadystatechange = function()
			{
			if(xmlObj.readyState == 4)
				{
				textXml = xmlObj.responseText;
				obj_tab.innerHTML = textXml;
				}
			}
		xmlObj.open('POST', root_a + "ajax_scripts/ajax_user_search.php", true);
		xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
		xmlObj.setRequestHeader("Content-length", 1);
		xmlObj.setRequestHeader("Connection", "close");
		xmlObj.send('search_text=' + obj_search.value + '&id_group=' + id_group + '&ch_f=' + ch_f + '&ch_l=' + ch_l + '&ch_e=' + ch_e + '&ch_s=' + ch_s + '&tab=' + tab + "&guid=" + GetGUID());
		}
	}

function OpenComposKurs(id_kurs)
	{
	for(i=1;i<=1000;i++)
		{
		tr_kurs = document.getElementById('kurs_compos_'+id_kurs+'_'+i);
		if(!tr_kurs)break;
		tr_kurs.className = 'tr_vis';
		}
	document.getElementById('kurs_compos_img_'+id_kurs).outerHTML = "<img src=\"img/small_minus.png\" onClick=\"javascript:CloseComposKurs(" + id_kurs + ")\" style=\"cursor:hand;\" id=\"kurs_compos_img_" + id_kurs + "\">";
	}

function CloseComposKurs(id_kurs)
	{
	for(i=1;i<=1000;i++)
		{
		tr_kurs = document.getElementById('kurs_compos_'+id_kurs+'_'+i);
		if(!tr_kurs)break;
		tr_kurs.className = 'tr_unvis';
		}
	document.getElementById('kurs_compos_img_'+id_kurs).outerHTML = "<img src=\"img/small_plus.png\" onClick=\"javascript:OpenComposKurs(" + id_kurs + ")\" style=\"cursor:hand;\" id=\"kurs_compos_img_" + id_kurs + "\">";
	}

function a_ShowPopWindow(txt)
	{
	objPop = document.getElementById('pop_window');
	objPopContent = document.getElementById('content_pop_window');
	if(!objPop || !objPopContent)return false;
	objPop.style.display = "block";
	objPop.style.left = mouseX() + 10;
	objPop.style.top = mouseY() + 10;
	objPopContent.innerHTML = txt;
	}

function a_NewPopWindow(txt)
	{
	objPop = document.getElementById('pop_window');
	objPopContent = document.getElementById('content_pop_window');
	if(!objPop || !objPopContent)return false;
	numPop++;
	newIdPop = 'pop_window_' + numPop;
	var txtPop = new String(objPop.outerHTML);
	txtPop = txtPop.replace(/=pop_window/, "=\"" + newIdPop + "\"");
	txtPop = txtPop.replace(/\"header_pop_window\"/, "\"header_" + newIdPop + "\"");
	txtPop = txtPop.replace(/\"pop_window\"/, "\"" + newIdPop + "\"");
	txtPop = txtPop.replace(/\'pop_window\'/, "'" + newIdPop + "'");
	txtPop = txtPop.replace(/\'pop_window\'/, "'" + newIdPop + "'");
	txtPop = txtPop.replace(/content_pop_window/, 'content_' + newIdPop);
	document.body.innerHTML += txtPop;
	objPop = document.getElementById(newIdPop);
	objPopContent = document.getElementById('content_' + newIdPop);
	if(!objPop || !objPopContent)return false;
	objPop.style.display = "block";
	objPop.style.left = mouseX() + 10;
	objPop.style.top = mouseY() + 10;
	max_z_index++;
	objPop.style.zIndex = max_z_index;
	objPopContent.innerHTML = txt;
	return numPop;
	}

function a_HidePopWindow()
	{
	objPop = document.getElementById('pop_window');
	objPopContent = document.getElementById('content_pop_window');
	if(!objPop || !objPopContent)return false;
	objPop.style.display = "none";
	objPop.style.left = 0;
	objPop.style.top = 0;
	objPopContent.innerHTML = '';
	}

function a_HideLastPopWindow()
	{
	if(numPop == 0)idPop = 'pop_window';
	else idPop = 'pop_window_' + numPop;
	objPop = document.getElementById(idPop);
	objPopContent = document.getElementById('content_' + idPop);
	if(!objPop || !objPopContent)return false;
	objPop.style.display = "none";
	objPop.style.left = 0;
	objPop.style.top = 0;
	objPopContent.innerHTML = '';
	}

function a_SetTextLastPop(txt)
	{
	if(numPop == 0)idPop = 'pop_window';
	else idPop = 'pop_window_' + numPop;
	objPopContent = document.getElementById('content_' + idPop);
	if(!objPopContent)return false;
	objPopContent.innerHTML = txt;
	}

function a_HideAllPopWindow()
	{
	for(i = numPop; i > 0; i--)
		{
		idPop = 'pop_window_' + numPop;
		objPop = document.getElementById(idPop);
		if(!objPop)continue;
		objPop.outerHTML = '';
		numPop--;
		}
	}

function a_UpdateCode(id_img, src, amp)
	{
	img = document.getElementById(id_img);
	if(!img)return false;
	if(!amp)img.src = src + '?id=' + GetGUID();
	else img.src = src + '&id=' + GetGUID();
	}

function a_StartMove(idPop)
	{
	if(move_obj_id != '')
		{
		a_EndMove();
		return false;
		}
	move_obj_id = idPop;
	objPop = document.getElementById(idPop);
	if(!objPop)return false;
	max_z_index++;
	objPop.style.zIndex = max_z_index;
	var left_obj = new String(objPop.style.left);
	var top_obj = new String(objPop.style.top);
	if(left_obj.substr(left_obj.length - 2, 2) == "px")
		{
		left_num = new Number(left_obj.substr(0, left_obj.length - 2));
		del_obj_x = left_num  - mouseX();
		}
	else
		{
		del_obj_x = left_obj - mouseX();
		}
	if(top_obj.substr(left_obj.length - 2, 2) == "px")
		{
		top_num = new Number(top_obj.substr(0, top_obj.length - 2));
		del_obj_y = top_num  - mouseY();
		}
	else if(top_obj.substr(left_obj.length - 1, 2) == "px")
		{
		top_num = new Number(top_obj.substr(0, top_obj.length - 2));
		del_obj_y = top_num  - mouseY();
		}
	else
		{
		del_obj_y = top_obj - mouseY();
		}
	}

function a_Move()
	{
	if(move_obj_id == '')return false;
	objPop = document.getElementById(move_obj_id);
	if(!objPop)return false;
	objPop.style.left = mouseX() + del_obj_x;
	objPop.style.top = mouseY() + del_obj_y;
	}

function a_EndMove()
	{
	move_obj_id = '';
	del_obj_x = 0;
	del_obj_y = 0;
	}

function a_KeyPress()
	{
	if(window.event.keyCode == 27) a_HideLastPopWindow();
	}

function mouseX()
	{
	if(event.pageX) return event.pageX;
	else if(event.clientX) return event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	else return null;
	}

function mouseY()
	{
	if(event.pageY) return event.pageY;
	else if (event.clientY) return event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	else return null;
	}

function a_MoveLeftList(pref)
	{
	obj_l = document.getElementById('left_select' + pref);
	obj_r = document.getElementById('right_select' + pref);
	if(!obj_l || !obj_r)return false;
	if(obj_r.selectedIndex < 0)return false;
	obj_l.appendChild(obj_r.item(obj_r.selectedIndex));
	}

function a_MoveAllLeftList(pref)
	{
	obj_l = document.getElementById('left_select' + pref);
	obj_r = document.getElementById('right_select' + pref);
	if(!obj_l || !obj_r)return false;
	while(obj_r.item(0))
		{
		obj_l.appendChild(obj_r.item(0));
		}
	}

function a_MoveRightList(pref)
	{
	obj_l = document.getElementById('left_select' + pref);
	obj_r = document.getElementById('right_select' + pref);
	if(!obj_l || !obj_r)return false;
	if(obj_l.selectedIndex < 0)return false;
	obj_r.appendChild(obj_l.item(obj_l.selectedIndex));
	}

function a_MoveAllRightList(pref)
	{
	obj_l = document.getElementById('left_select' + pref);
	obj_r = document.getElementById('right_select' + pref);
	if(!obj_l || !obj_r)return false;
	while(obj_l.item(0))
		{
		obj_r.appendChild(obj_l.item(0));
		}
	}

function a_UpList(list_name)
	{
	obj_l = document.getElementById(list_name);
	if(!obj_l)return false;
	if(obj_l.selectedIndex <= 0)return false;
	obj_l.insertBefore(obj_l.item(obj_l.selectedIndex), obj_l.item(obj_l.selectedIndex - 1));
	}

function a_DownList(list_name)
	{
	obj_l = document.getElementById(list_name);
	if(!obj_l)return false;
	if(obj_l.selectedIndex <= 0)return false;
	obj_l.insertBefore(obj_l.item(obj_l.selectedIndex), obj_l.item(obj_l.selectedIndex + 2));
	}

function ChatSend()
	{
	var xmlObj = GetRequest();
	if(xmlObj === false){return false;}
	obj_text = document.getElementById('chat_text');
	if(!obj_text){return false;}
	obj_input = document.getElementById('chat_input');
	if(!obj_input){return false;}
	xmlObj.onreadystatechange = function()
		{
		if(xmlObj.readyState == 4)
			{
			textXml = xmlObj.responseText;
			obj_text.value = textXml;
			}
		}
	text_from_input = obj_input.value;
	obj_input.value = "";
	
	xmlObj.open('POST', root_a + "ajax_scripts/ajax_chat.php", true);
	xmlObj.setRequestHeader("Content-type", "application/x-www-form-URLencoded");
	xmlObj.setRequestHeader("Content-length", 1);
	xmlObj.setRequestHeader("Connection", "close");
	xmlObj.send('text_from_input=' + text_from_input);
	}
