////////////LOAD FIELD UPDATE
function loadFieldUpdate(sname,svalue,stag_data,not_found_message)
{

	stag_array = stag_data.split(",");
//	alert("working ajax");

	for(xvalueKey in stag_array){

stag = stag_array[xvalueKey];
//	alert(stag);
	
	if(svalue != ""){
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();

	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

	  }
	  

	  
	  
	xmlhttp.onreadystatechange=function(){
		  	 	  	
		 if (xmlhttp.readyState==1)
	  {
	// document.getElementById("myDiv").innerHTML="Loading.....";
	 // alert(7777);

	  } 
	  

	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
	  deli = 4+5;  
		response_text_array = xmlhttp.responseText.split("<xx--xx--xx>" + deli);
	//	alert(response_text_array.length);
		if(response_text_array[1] == undefined){
		document.getElementById(stag).innerHTML = not_found_message;	
		}
		else
		{
		document.getElementById(stag).innerHTML=response_text_array[1];
		}
		
		
		document.getElementById('seeresult').value=response_text_array[1];
		
		//	sleep(1000);
//	alert(stag);
		}
	  }
url = window.location.href;
	//change this url to same script
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8");

	req = "update_submit_button=" + sname + "&update_ajax_request=" + sname + "&update_current_field=" + stag + "&" + sname + "=" + svalue;

//alert(stag);
	xmlhttp.setRequestHeader("Content-length", req.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(req);

	}

}
}



//////////AUTO COMPLETE FIELD
function autoCompleteField(sname,svalue,stag,not_found_message)
{
//	stag_array = stag_data.split(",");
//	alert("working ajax");
//	for(xvalueKey in stag_array){
	
//stag = stag_array[xvalueKey];
//	alert(stag);
	
	if((svalue != undefined) || (svalue != null)){
	var xmlhttp;
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	  

	  
	  
	xmlhttp.onreadystatechange=function()
	  {
		 if (xmlhttp.readyState==1)
	  {
	 document.getElementById(stag).innerHTML="Loading...";
	 // alert(7777);
	  } 
	  
	  
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
	  deli = 4+2; 
//<auto_complete-response>6	  
		response_text_array = xmlhttp.responseText.split("<auto_complete-response>" + deli);
	//	alert(response_text_array.length);
		if(response_text_array[1] == undefined){
		document.getElementById(stag).innerHTML = not_found_message;	
		}
		else
		{
		document.getElementById(stag).innerHTML=response_text_array[1];
		}
		
		document.getElementById('seeresult').value=response_text_array[1];
		
		//	sleep(1000);
//	alert(stag);
		}
	  }

	url = window.location.href;
	//change this url to same script
	xmlhttp.open("POST",url,true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8");
	req = "auto_complete_button=" + sname + "&auto_complete_request=" + sname + "&auto_complete_value=" + svalue;

//alert(stag);
	xmlhttp.setRequestHeader("Content-length", req.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.send(req);

	}

//}
}
