// Ajax Kreipimosi i Narsykle Dalis
// *************** START HTTP REQUEST *********************
//alert('haha');
function createRequestObject() {

        var req;

        if(window.XMLHttpRequest){
            // Firefox, Safari, Opera...
            req = new XMLHttpRequest();
        } else if(window.ActiveXObject) {
            // Internet Explorer 5+
            req = new ActiveXObject("Microsoft.XMLHTTP");
        } else {
            // There is an error creating the object,
            // just as an old browser is being used.
            alert('There was a problem creating the XMLHttpRequest object');
        }

        return req;

    }

    // Make the XMLHttpRequest object
    var http = createRequestObject();
// ***************** END HTTP REQUEST *********************

// ***************** START GET METODAS ********************
    function sendRequest(act,sesion) 
	{
		http.abort();
		//alert(vier_is+act);
        // Open PHP script for requests
		//alert(act);
        http.open('get', 'http://'+window.location.hostname+'/admin/modules/nturtas/nta_isvedimas/kiekis_insert.php?id='+act+"&sesion="+sesion);
		
		
		//alert('http://'+window.location.hostname+'admin/modules/nturtas/nta_isvedimas/kiekis_insert.php?id='+act);
		//alert(http.responseText);
        http.onreadystatechange = handleResponse;
        http.send(null);
		//return http.responseText;
    }

function handleResponse() {

        if(http.readyState == 4 && http.status == 200){

            // Text returned FROM PHP script
            var response = http.responseText;
			
			if(response) 
			{
                // UPDATE ajaxTest content
              //alert(response+'  HAHA');
                
            }
			else  
			{
				alert('Negauta jokiu duomenu is check.php failo');
			}
            
        }
    }
	// ***************** END GET METODAS *************************/
