function TrimString(sInString) {
  sInString = sInString.replace( /^\s+/g, "" );// strip leading
  return sInString.replace( /\s+$/g, "" );// strip trailing
}

function getHTTPObject()
{
	var xmlhttp;
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

var http;

function loadXMLDoc(url,params,meth,endfunc)
{
	 http = getHTTPObject();

	 http.onreadystatechange = httpreturned;
	 if(meth=="POST")
	 {
		 http.open(meth,url,true);
		 http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=ISO-8859-1");
		 http.send(params); //UTF-8
	 }
	 else
	 {
		 http.open("GET", url+"?"+params, true);
		 http.send(null);
	 }

	 function httpreturned()
{

 if (http.readyState==4) // ready state getting some value
  {
	  if (http.status==200) // html page desire recieve then true
		{
				str=http.responseText;
				//alert(str);
				//if(str=="logged off") window.location.replace("process.php?process=logout&st=logoff");
				if(str!="")
				{
					if(str.indexOf(":::")>-1)
						str=str.split(":::");
					else
						str=new Array(str);
					
					for(i=0;i<str.length;i++)
					{
						str1=str[i].substring(0,str[i].indexOf(";:"));
						
						//alert(str1);
						str2=str[i].substring(str[i].indexOf(";:")+2);
						
						if(str1.indexOf(" ")>-1)
						{
							str1_arr = str1.split(" ");
							var tstr = "";
							for(q=0;q<str1_arr.length;q++)
							{
								if(str1_arr[q]!="")
								{
									str1 = str1_arr[q];
									break;
								}
							}
							
						}
						
						/*if(str1.indexOf("div_lang_speak_data")>-1)
						{
							str1='div_lang_speak_data';
						}*/
						//alert(str1+"\n"+str2);
						
						ele=eval("document.getElementById('"+TrimString(str1)+"')");

						if(ele)
						{
							if(str2!="" & str2!="1")
							{
								if(str1!="div_success_status")
								{
									ele.style.display = "block";
									
								}
								ele.innerHTML=str2;
								//
							}
							else
							{
								ele.innerHTML = "";
								ele.style.display = "none";
							}
						}
						
					}
					
				}
				if( endfunc != "" )
				eval( endfunc );
		}
	  else
	  {
		return false;
		//alert("Problem retrieving XML data");
	  }
  }
  
  
}

}






