// JavaScript Document
COTOCI.prototype.gt = function(e,d){
	if(!d) d = document;
	return d.getElementsByTagName(e);
};//1.0 - 1

COTOCI.prototype.ge = function(e){
	return document.getElementById(e);
};//1.0 - 2
//custom element operations end/////////////////

//xmlhttprequest object starts//////////////////
COTOCI.prototype.s = function(url, method, callback, data, urlencoded){
	var req;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}else if (window.ActiveXObject){
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}

	req.onreadystatechange = function() {
		if (req.readyState == 4) {
			if (req.status < 400) {
				(method=="POST") ? callback(req) : callback(req,data);
			} else {
				alert("Veriler yüklenirken bir hata meydana geldi:\n" + req.status+ "/" + req.statusText+"\n"+url);
				
				cotoci.ge("kat").options[0] = new Option("Bir hata meydana geldi.");
			}
		}
	};

	if (method=="POST") {
		req.open("POST", url, true);
		if (urlencoded) {
			req.setRequestHeader('Content-Type','application/x-www-form-urlencoded;UTF-8');
		}
		req.send(data);
	} else {
		req.open("GET", url, true);
		req.send(null);
	};
	
	return req;
};//1.0 - 3

COTOCI.prototype.sp = function(url, data, callback){
	cotoci.s(url, "POST", callback, data, true);
};//1.0 - 4

COTOCI.prototype.sg = function(url, callback, args){
	cotoci.s(url, "GET", callback, args);
};//1.0 - 5
//xmlhttprequest object end/////////////////////
