﻿AjaxClass = function(url_,onBegin,onEnd){
    this.url = url_;
    this.onBeginReq = onBegin;
    this.onEndReq = onEnd;
}
AjaxClass.prototype = {
    CreateXmlReq: function(){
        var objXmlReq;
	    try{
		    objXmlReq = new ActiveXObject("Msxml2.XMLHTTP");
	    }catch(e){
		    try{
			    objXmlReq = new ActiveXObject("Microsoft.XMLHTTP");
		    }catch(oc){
			    objXmlReq = null;
		    }
	    }
	    if(!objXmlReq && typeof XMLHttpRequest != "undefined"){
		    objXmlReq = new XMLHttpRequest();
	    }	    
	    return objXmlReq;
    },
    sendReq: function(data,callback,url_){
        var req_ = this.CreateXmlReq();
        if(req_){
            if(url_)this.url = url_;
            var th = this;
            req_.onreadystatechange = function(){
                if(req_.readyState == 4)
	            {	
	                th.onEndReq();
		        }
                callback(req_);
            };
            req_.open("POST",this.url + "?rnd=" + Math.random());
            req_.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            th.onBeginReq();
            req_.send(data);
        }else{
            alert("No Ajax Support");
        }
    }
}
function GetLoadingHtml()
{
    var root = (typeof(pathExt)=="string") ? pathExt : "";
    var Str = "";
    Str += "<table width='100%' style='height:150px;'>";
    Str += "<tr><td align='center' valign='middle'><img src='"+ root +"images/loading.gif' alt='' /><br/>Loading..</td></tr>";
    Str += "</table>";
    return Str;
}