// JavaScript Document
	var httpObject = null;
    var link = "";
	var ap_path  = ""; 
	var objDiv = "";
		
	function getHTTPObject(){
         if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
         else if (window.XMLHttpRequest) return new XMLHttpRequest();
         else {
            alert("Tarayıcınız AJAX desteklemiyor.");
            return null;
         }
	} 
	  
	function setOutput(){
         if(httpObject.readyState == 4){
	        var response = httpObject.responseText;
            objDiv.innerHTML = response;
         }
         else {
			objDiv.innerHTML = "<div id='loading'><img src='/images/loading.gif' /></div>";
		}	
	}
	
	function set(){
         if(httpObject.readyState == 4){
	        var response = httpObject.responseText;
            objDiv.innerHTML = response;
         }
	}
	
	function set_input(){
         if(httpObject.readyState == 4){
	        var response = httpObject.responseText;
            objDiv.value = response;
         }
	}
	
	function get_set(){
         if(httpObject.readyState == 4){
	        return httpObject.responseText;
         }
	}
	
	function update_material_count(material_id,source_value,source_id,target_id) {
		ap_path = "http://10.0.0.28/web/acquisition";
		objDiv = document.getElementById(target_id);
         httpObject = getHTTPObject();
         if (httpObject != null) {
            link = ap_path + "/ajax_updates.php?update_type=1&material_id=" + material_id + "&source_value=" + source_value;
            httpObject.open("GET", link , true);
            httpObject.onreadystatechange = set_input;
            httpObject.send(null);
         }
	}
	
	function update_material_unit_price(material_id,source_value,source_id,target_id) {
		ap_path = "http://10.0.0.28/web/acquisition";
		objDiv = document.getElementById(target_id);
         httpObject = getHTTPObject();
         if (httpObject != null) {
            link = ap_path + "/ajax_updates.php?update_type=2&material_id=" + material_id + "&source_value=" + source_value;
            httpObject.open("GET", link , true);
            httpObject.onreadystatechange = set_input;
            httpObject.send(null);
         }
	}
	
	function update_item_count(database_id,target_id,increment_amount) {
		ap_path = "http://10.0.0.28/web/acquisition";
		objDiv = document.getElementById(target_id);
        httpObject = getHTTPObject();
         if (httpObject != null) {
            link = ap_path + "/ajax_updates.php?update_type=4&database_id=" + database_id + "&increment_amount=" + increment_amount;
			
            httpObject.open("GET", link , true);
            httpObject.onreadystatechange = set;
            httpObject.send(null);
         }
	}
	
	
	//not completed yet
	function update_order_detail_table() {
		var total_price_box = document.getElementById("total_price");
		
		
	}
	
