//اللهم لا علم لنا الا ما علمتنا
//  Advanced  Javascript
//		PHP0@hotmail.com And Almhajer@hotmail.com
//   Class  BK  Javascript
//
//


BK.Ajax = new function() {

    var Msg_Loading = 'Loading ......';

    return {
        bar: "Public variable bar",

        Msg_Loading:function(Msgs) {
            Msg_Loading = Msgs;
        },
        Updates: function(Urls, ID_Elements) {
            if (window.XMLHttpRequest) { // Mozilla, Safari, ...
                var httpRequest = new XMLHttpRequest();
                if (httpRequest.overrideMimeType) {
                    httpRequest.overrideMimeType('text/xml');
                }
            }
            else if (window.ActiveXObject) { // IE
                try {
                    httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch (e) {
                    try {
                        httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e) {
                    }
                }
            }

            if (!httpRequest) {
                alert('Giving up :( Cannot create an XMLHTTP instance');
                return false;
            }
            httpRequest.onreadystatechange = function() {

                if (httpRequest.readyState == 1) {
                    document.getElementById(ID_Elements).innerHTML = Msg_Loading;
                }

                if (httpRequest.readyState == 4) {
                    if (httpRequest.status == 200) {
                        document.getElementById(ID_Elements).innerHTML = httpRequest.responseText;
                    } else {
                        alert('There was a problem with the request.');
                    }
                }
            };

            httpRequest.open('GET', Urls, true);
            httpRequest.send(null);
        }
    };
};



