// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Ajax
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function Ajax() 
{
	var XmlHttp = null
	var pFnCallBack

	function CreateXmlHttp()
	{
		try
		{
			XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(oc)
			{
				XmlHttp = null;
			}
		}

		// Creating object of XMLHTTP in Mozilla and Safari 
		if (!XmlHttp && typeof XMLHttpRequest != "undefined")
		{
			XmlHttp = new XMLHttpRequest();
		}
	}		

	this.ExecuteAsync = function(url, CallBack)
	{
		pFnCallBack = CallBack;
		var ret = false;
		CreateXmlHttp();
		if (XmlHttp != null)
		{
			XmlHttp.onreadystatechange = ResponseHandler;
			url = url + "&nocache=" + Date();
			XmlHttp.open("GET", url, true);
			XmlHttp.send(null);
		}
		return ret;
	}
	
	function ResponseHandler() 
	{ 
		try { 
			if (XmlHttp.readyState == 4) 
			{
				if (XmlHttp.status == 200) 
				{ 
					pFnCallBack(XmlHttp.responseText)
				} 
			} 
		} 
		catch(e) {
		} 
	} 
	
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Get Value
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function GetValue(result, tagName)
{
	var tn = new String();
	tn = tagName;
	var idx1 = result.indexOf("<" + tagName + ">") ;
	var idx2 = result.indexOf("</" + tagName + ">");
	if (idx1 != idx2)
		return result.substring(idx1 + tn.length + 2, idx2);
	else
		return "";
}
