﻿function lsubmit_press()
{
	document.getElementById('loadImage').style.display='';
	document.getElementById('loadSubmit').style.display='none';
	
	var weight = document.getElementById('weight').value;
	var to = document.getElementById('value_to').value;
	var cnt = document.getElementById('cnt').value;

	this.http = get_http();
	this.working = false;

	if (!this.working && this.http)
	{
		var http = this.http;

		url = "/asd.php?weight="+weight+"&to="+to+"&cnt="+cnt;
		this.http.open("GET", url, true);

		this.http.onreadystatechange = function()
		{
			if (http.readyState == 4)
			{
				document.getElementById('loadImage').style.display='none';
				document.getElementById('loadSubmit').style.display='';
				document.getElementById('result').innerHTML = http.responseText;
				this.working = false;
			}
			else
			{

			}
		}

		this.working = true;
		this.http.send(null);
	}
	
	if(!this.http)
	{
		  alert('Ошибка при создании XMLHTTP объекта!')
	}
}

function get_http(){
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlhttp = new 
                ActiveXObject("Microsoft.XMLHTTP");
            } catch (E) {
                xmlhttp = false;
            }
        }
    @else
        xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}
