function msh_common_create_request (){
/* Создание нового объекта XMLHttpRequest для общения с Web-сервером */
var lc_xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  lc_xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    lc_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    lc_xmlHttp = false;
  } }
@end @*/
if (!lc_xmlHttp && typeof XMLHttpRequest != 'undefined') {
  lc_xmlHttp = new XMLHttpRequest();
}
return lc_xmlHttp;
};//function create_request (){

function GEBI(id){
	var element = false;
	element = document.getElementById(id)
	return element;
};//function GEBI (id){

function msh_common_rem_amp(str){
	var return_str = "";
	var last_pos = 0;
	var pos  = str.indexOf("&");
	while (pos!=-1) {
		return_str = return_str + str.substring(last_pos, pos)+"%26";
		last_pos = pos + 1;
		pos  = str.indexOf("&",last_pos);
	};//while (pos!=-1) {
		if (last_pos < str.length) return_str = return_str + str.substring(last_pos, str.length);
	return return_str;
};//function remove_amp (str){

//----------------Находим, следующий за указанным, дочерний элемент--------------------
function msh_common_get_next_include(elem, tagName) {
	if (!elem.childNodes) return false;
	var i=0;
	var next_child = '';
	if (!tagName){
		do {
			next_child = elem.childNodes[i];
			i++;
       	} while (next_child && next_child.nodeType != 1);
	}//if (!tagName){
	else
	{
		do {
			next_child = elem.childNodes[i];
			i++;
       	} while (next_child && (next_child.nodeType!=1 || next_child.tagName!=tagName));
	}//else
	if (next_child)	return next_child
	else return false;
}//get_next_include (elem, tagName) {

//----------------Находит, следующий за указанным, не дочерний элемент--------------------
function msh_common_get_next (elem, tagName) {
	var next = elem;
	if (!tagName){
		do {
			next = next.nextSibling;
       	} while (next && next.nodeType != 1);
	}//if (!tagName){
	else
	{
		do {
			next = next.nextSibling;
       	} while (next && (next.nodeType!=1 || next.tagName!=tagName));
	}//else
	if (next) return next
	else  return false;
}//get_next (elem, tagName) {
	
function send_handler(){
	
	var request = create_request ();
	var url = "send_handler.php";
	var params = "text="+rem_amp(GEBI("text_1").value);
	request.open("POST", url, true);
	
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	request.setRequestHeader("Content-length", params.length);
	request.setRequestHeader("Connection", "close");
	
		alert(params.length);
	
	request.onreadystatechange = function() {//Call a function when the state changes.
	if(request.readyState == 4 && request.status == 200) {
		GEBI("right_cont").innerHTML = request.responseText;
	}
}
request.send(params);
};//function send_handler(){


function msh_common_check_fill(form_name){
	var val = null;
	var is_OK = true;
	var req = null;
	var to_check = document.forms[form_name].length-1;
	for (i=0; i<to_check; i++){
		val = document.forms[form_name][i].value;
		req = document.forms[form_name][i].getAttribute("required");
		if (req!=null)
			if (val==''||val=='0') {
				GEBI("label_input_"+(i+1)).style.color='red';
				is_OK=false;
			}//if ((val=='')||(val=='0')) {
	}//for (i=0, i<to_check, i++){
	return is_OK;
}//msh_common.check_fill = function (){

function msh_common_send_form_and_file (){
	var XHR = msh_common_create_request ();
	var url = 'http://test.ua/XHR/acceptor.php';
	XHR.open("POST", url, false);
	XHR.setRequestHeader("Content-type", "multipart/form-data");
	XHR.setRequestHeader("Content-Length", file.fileSize);


	
}//function msh_common_send_form_and_file (){

