function AjaxKit(){
	this.Language = "English";
	this.XmlHttp = this.CreateXmlHttp();
}

AjaxKit.prototype.CreateXmlHttp = function(){
// xmlhttp nesnesini farklý browserlar için alalým.
        xmlhttp = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            xmlhttp = new XMLHttpRequest();
            if (xmlhttp.overrideMimeType) {
                xmlhttp.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!xmlhttp) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

		return xmlhttp
}

AjaxKit.prototype.LoadPage = function(address,postdata){	
	this.XmlHttp.open("POST",address,true);
	this.XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	this.XmlHttp.send(postdata);
	return this.XmlHttp.responseText;
}

AjaxKit.prototype.LoadPageInto = function(address,postdata,container){	
	this.XmlHttp.open("POST",address,false);
	this.XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=iso-8859-9");
	//this.XmlHttp.setRequestHeader("Content-Type","text/html; charset=ISO-8859-9");
	this.XmlHttp.send(this.TR2URL(postdata));
	output = this.URL2TR(this.XmlHttp.responseText);
	if(container.innerHTML != output)
		container.innerHTML = output;
}

AjaxKit.prototype.GetChat = function(container){
	postdata = "func=GetChat";
	
	xmlhttp = this.XmlHttp;
	xmlhttp.onreadystatechange=function() {
  		if(xmlhttp.readyState==4) {
			output = xmlhttp.responseText;
			msgs = output.split("|");
			output="";
			for(i=0;i<msgs.length;i++){
				output += msgs[i] + "<br>";
			}
			if(container.innerHTML != output)
	  			container.innerHTML = output;
		}
	}
	this.XmlHttp = xmlhttp;
		
	this.XmlHttp.open("POST","chat.php",true);
	this.XmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	this.XmlHttp.send(postdata);
	}

AjaxKit.prototype.URL2TR = function(str){
	str=str.replace(/%E7/g,"ç");
	str=str.replace(/%C7/g,"Ç");
	str=str.replace(/%F0/g,"ð");
	str=str.replace(/%D0/g,"Ð");
	str=str.replace(/%FD/g,"ý");
	str=str.replace(/%DD/g,"Ý");
	str=str.replace(/%F6/g,"ö");
	str=str.replace(/%D6/g,"Ö");
	str=str.replace(/%FE/g,"þ");
	str=str.replace(/%DE/g,"Þ");
	str=str.replace(/%FC/g,"ü");
	str=str.replace(/%DC/g,"Ü");
	return unescape(str);
}


AjaxKit.prototype.TR2URL = function(str){
	str=str.replace(/ç/g,escape("ç"));
	str=str.replace(/Ç/g,escape("Ç"));
	str=str.replace(/ð/g,escape("ð"));
	str=str.replace(/Ð/g,escape("Ð"));
	str=str.replace(/ý/g,escape("ý"));
	str=str.replace(/Ý/g,escape("Ý"));
	str=str.replace(/ö/g,escape("ö"));
	str=str.replace(/Ö/g,escape("Ö"));
	str=str.replace(/þ/g,escape("þ"));
	str=str.replace(/Þ/g,escape("Þ"));
	str=str.replace(/ü/g,escape("ü"));
	str=str.replace(/Ü/g,escape("Ü"));
	return str;
}
