// Browser detect
var agt = navigator.userAgent.toLowerCase();
var is_ie = (agt.indexOf("msie") != -1);
var is_ie5 = (agt.indexOf("msie 5") != -1);
var is_opera = (agt.indexOf("opera") != -1);
var is_mac = (agt.indexOf("mac") != -1);
var is_gecko = (agt.indexOf("gecko") != -1);
var is_safari = (agt.indexOf("safari") != -1);

function CreateXmlHttpReqUTF8(handler)
{
	var xmlhttpUTF8 = null;

	if (is_ie)
	{// Guaranteed to be ie5 or ie6
		var control = (is_ie5) ? "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP";

		try
		{
			xmlhttpUTF8 = new ActiveXObject(control);
			xmlhttpUTF8.onreadystatechange = handler;
		} catch (ex) {
		// TODO: better help message
		alert("Aktif betikleri ve '\activeX'\ controllerini aktif hale getirmelisiniz.");
	}

	}
	else
	{// Mozilla
		xmlhttpUTF8 = new XMLHttpRequest();
		xmlhttpUTF8.onload = handler;
		xmlhttpUTF8.onerror = handler;
	}

	return xmlhttpUTF8;
}

function XmlHttpPOSTUTF8(xmlhttpUTF8, url, data)
{
	try {
		xmlhttpUTF8.open("POST", url, true);
		xmlhttpUTF8.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
		xmlhttpUTF8.send(data);
	} catch (ex) {
		alert("Deneme : "+ex.description);
		// do nothing
	}
}

// XMLHttp send GEt request
function XmlHttpGETUTF8(xmlhttpUTF8, url)
{
	try {
		xmlhttpUTF8.open("GET", url, true);
		xmlhttpUTF8.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
		xmlhttpUTF8.send(null);
	} catch (e) {
		alert("Deneme : "+e.description);
		// do nothing
	}
}