//اللهم لا علم لنا الا ما علمتنا



//  Advanced  Javascript



//		PHP0@hotmail.com And Almhajer@hotmail.com



//   Class  BK  Javascript



//



//









BK.Ajax = new function() {











    var Loading_Images = new Image();



    Loading_Images.src = "http://www.dawahwin.com/Icons/loading.gif";







    var Msg_Loading = '<img src="' + Loading_Images.src + '" border="0"/>  جاري التحميل ...';



















    return {











        On_Loading : function() {



        },



        On_Loaded : function() {



        },



        On_Interactive : function() {



        },



        On_Completion : function() {



        },



        On_Error : function() {



        },



        On_Fail : function() {



        },































        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) {



                    if (typeof BK.Ajax.onLoading == 'function') {



                        BK.Ajax.onLoading();



                    }











                }











                if (httpRequest.readyState == 2) {



                    if (typeof BK.Ajax.onLoaded == 'function') {



                        BK.Ajax.onLoaded();



                    }







                }







                if (httpRequest.readyState == 3) {



                    if (typeof BK.Ajax.onInteractive == 'function') {







                        BK.Ajax.onInteractive();



                    }



                }











                if (httpRequest.readyState == 4) {











                    if (httpRequest.status == 200) {



                        document.getElementById(ID_Elements).innerHTML = httpRequest.responseText;







                        if (typeof BK.Ajax.On_Completion == 'function') {



                            BK.Ajax.On_Completion();



                        }











                    } else {







                        if (typeof BK.Ajax.On_Error == 'function') {



                            BK.Ajax.On_Error();



                        }











                    }











                }











            };











            httpRequest.open('GET', Urls, true);











            httpRequest.send(null);











        }















    };











};































































