function JimetAjaxObj() {
    this.req = null;
    this.url = null;
    this.method = 'GET';
    this.async = true;
    this.status = null;
    this.statusText = '';
    this.postData = null;
    this.readyState = null;
    this.responseText = null;
    this.responseXML = null;
    this.handleResp = null;
    this.handleErr = null;
    this.responseFormat = 'text'; // 'text', 'xml', or 'object'
    this.mimeType = null;
    this.executeScript = null;
    this.numberOfRetries = 0;
    this.timeout		= 120000;//15000;
    this.intervalId		= 0;
    this.isSubmit		= false;
    this.debug = true;

    this.init = function(){
        try{
            this.req = new XMLHttpRequest();
        }
        catch(e){
            return false;
        }
        return this.req;
    };

    this.doReq = function(obj){
        ajaxOnWork = true;

        if (!obj.init()){
            alert('Could not create XMLHttpRequest object.');
            return;
        }
        obj.req.open(obj.method, obj.url, obj.async);

        obj.intervalId = setTimeout(function() {
            if(!obj.debug&&!obj.isSubmit&&obj.req!=null){
                obj.req.abort();
                //			alert("handle error");
                //obj.numberOfRetries = 5;
                obj.handleErr(obj.req);
            }
        // Handle timeout situation, e.g. Retry or inform user.
        }, obj.timeout);


        if (obj.mimeType) {
            try {
                req.overrideMimeType(obj.mimeType);
            }
            catch (e) {
            // couldn't override MIME type  --  IE6 or Opera?
            }
        }

        obj.req.onreadystatechange = function() {

            /*if(ajaxAbort){
 				obj.req.abort();
 			}*/

            clearTimeout(obj.intervalId);
            if (obj.req.readyState == 4){
                switch (obj.responseFormat) {
                    case 'text':
                        var resp = obj.req.responseText;
                        //alert(obj.req.responseText);
                        break;
                    case 'xml':
                        var resp=obj.req.responseXML;
                        //alert(resp);
                        break;
                    case 'object':
                        var resp = req;
                        break;
                }

                if (obj.req.status == 200) {
                    if(document.getElementById('ajaxResponsePrint'))
                        document.getElementById('ajaxResponsePrint').value = resp;
                    //alert(resp);

                    obj.handleResp(resp);
                //if(obj.responseFormat=='text')
                //obj.executeScript(resp);
                }
                else {
                    obj.handleErr(obj.req);
                }
            }
        };
        obj.req.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8");
        obj.req.setRequestHeader("Content-length", obj.postData.length);
        obj.req.setRequestHeader("Connection", "close");
        //alert (this.postData);
        obj.req.send(obj.postData);


    };

    this.setMimeType = function(mimeType) {
        this.mimeType = mimeType;
    };

    this.setTimeout = function(tmoutinmillis) {
        this.timeout = tmoutinmillis;
    };

    this.setPostData = function(postData) {
        this.postData = postData;
    };

    this.handleErr = function(obj) {
        this.numberOfRetries++
        if(this.numberOfRetries<3){

            this.doReq(this);
        }else{

            sttext = obj.status!=0?obj.statusText:'Zaman Aşımı';
            document.getElementById('ajaxErrorOuterDiv').style.display = 'block';
            document.getElementById('ajaxErrorDiv').innerHTML = 'Status Code: ' + obj.status + '\n<br>'
            + 'Status Description: ' + sttext + '\n<br>'
            + 'Response: ' + obj.responseText + '\n<br>';

            this.handleResp('ajaxError');

            alert('İşlem Sırasında Bir Hata Oluştu.\nHatanın içeriğiyle ilgili bilgi sayfanın altındadır.\nAynı hatayı almaya devam etmeniz durumunda bu bilgi ile birlikte teknik bilgi sahibi yetkililere başvurunuz!');
            if(document.getElementById('cover'))
            {
                document.getElementById('cover').style.display = 'none';
                document.getElementById('cover').innerHTML = '';
                if(document.getElementById('wrapper')) document.getElementById('wrapper').style.overflowY='auto';
            }
        }

    };

    this.setIsSubmit = function(submitb)
    {
        this.isSubmit = submitb;
    }

    this.doGet = function(url, hand, format) {
        this.url = url;
        this.handleResp = hand;
        this.responseFormat = format || 'text';
        this.doReq(this);
    };

    this.doPost = function(url, hand, format) {
        this.method = 'POST';
        this.url = url;
        this.handleResp = hand;
        this.responseFormat = format || 'text';
        this.doReq(this);
    };

    this.executeScript = function(content)
    {
        //		alert(resp);// <script src=source.js olanlanlar? ay?klayal?m
        var src = new RegExp('<script.*?src=".*?"');
        var repl = new RegExp('<script.*?src="');
        var matches = src.exec(content);

        /**ilerde jsin i?inden script ?al??t?rmak istersek kullan?l?r
	   if (matches != null)
	    {
	        for (i = 0; i < matches.length; i++)
	        {
	            // source dosyas?n?n ad?
	            var scriptSrc = matches[i].replace(repl, '');
	            scriptSrc = scriptSrc.substring(0, scriptSrc.length-1);

	        }
	    }
	*/
        repl = new RegExp('<script.*?src=".*?".*?</script>');
        content = content.replace(repl, '');

        // inline scriptler i?in

        // script commentlerini kald?r
        repl = new RegExp('//.*?$', 'gm');
        content = content.replace(repl, '\n');

        // enterlar? clean
        repl = new RegExp('[\n\r]', 'g');
        content = content.replace(repl, ' ');

        //<script> i?indeki her?eyi match et
        src = new RegExp('<script.*?</script>', 'g');
        matches = content.match(src);


        if (matches != null)
        {
            for (i = 0; i < matches.length; i++)
            {
                // ba?taki tag? kald?r
                var repl = new RegExp('<script.*?>', 'gm');
                var script = matches[i].replace(repl, '');

                // sondaki tag? kald?r
                repl = new RegExp('</script>', 'gm');
                script = script.replace(repl, '');

                // comutlar? ?al??t?r
                setTimeout(script, 250);
            }
        }
    }
}

function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;

    do {
        curDate = new Date();
    }
    while(curDate-date < millis);
} 
