			var DivId;
			var status = true;
			var time = 0;
			var DepIDbefore = 0;
			var TabIDbefore = 1;
			var FirstGo = true;
			//var objektai = new Array();
			
			function XmlHttp( ){
                this.CreateXmlHttpObject = CreateXmlHttpObject;
                this.GetUrlContent              = GetUrlContent;
                this.GetResponseText          = GetResponseText;
                this.GetReadyState              = GetReadyState;           
                this.HttpMethod = 'GET'; // default
                this.objXmlHttp = this.CreateXmlHttpObject();
            }

            // Initialize XMLHttpObject
            function CreateXmlHttpObject(){
                var xmlhttp=false;
                try {
                    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (E) {
                    xmlhttp = false;
                }
            }
       

            if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest();
            }
                return xmlhttp;
            }
            var objXMLHttp =  new XmlHttp();
                   
            function GetReadyState( ){
				return this.objXmlHttp.readyState;
            }
 
            function GetResponseText( ){
                return this.objXmlHttp.responseText;
            }

			function GetResponse(){
				if (objXMLHttp!=null && objXMLHttp.GetReadyState()==4 && tmpDivId != null) {
				var objMyDiv = document.getElementById( tmpDivId );
                    // save response in inner html of result object                       
					//objMyDiv.innerHTML = '<a style="font-size:12px;padding-top:15px;">Please wait...'+DivId+'</a>';
					if (objXMLHttp.GetResponseText( )!=''){
                    objMyDiv.innerHTML = objXMLHttp.GetResponseText( );
					}
                }
            }			
 
            // Function performs Get request to absolute url(strUrl)
            // using XmlHttp object (asynchroni)
            // Response returned into objResult element using innerHTML.
            // When state of XmlHttp object is changed - objOnReadyStateChangeFunction called
            function GetUrlContent( strUrl, toSend ,objOnReadyStateChangeFunction ){
				this.objXmlHttp.open(this.HttpMethod, strUrl, true);
                this.objXmlHttp.setRequestHeader('Content-Type', 'text/xml; charset=UTF-8');
                if(objOnReadyStateChangeFunction){
					this.objXmlHttp.onreadystatechange=function(){
                        objOnReadyStateChangeFunction();
                    }
                }
                this.objXmlHttp.send(toSend);
				status = true;
            }
           
            //This function is called when we get the data back from the server.       
            
			var tmpDivId = null;
            function UpdateDiv( DivId, Page ){
			if (FirstGo==false && objXMLHttp.GetReadyState()!=4){
			UpdateDivByTimeOut(DivId, Page);
			}else{
			FirstGo = false;
			status = false;
                tmpDivId = DivId;
				if( Page !='' ){
					var objMyDiv = document.getElementById( DivId );
				
                    objMyDiv.innerHTML = '<a style="font-size:11px;">Please wait...</a>';
					
                    objXMLHttp.GetUrlContent( Page, null ,GetResponse);
					//objXMLHttp.GetUrlContent( Page, null);
					
                }
			}
			return true;
            }			
			
			function UpdateDivByTimeOut(a, b){
			if (FirstGo == true){
			UpdateDiv(a, b);
			} else {
				if(objXMLHttp.GetReadyState()!=4 && time<2001){
				//alert(time);
				time++;				
					if (time==2001){ alert("server is not answering, please try later");}
					setTimeout('UpdateDivByTimeOut("'+a+'", "'+b+'")', 100);
				}
				if(objXMLHttp.GetReadyState()==4 && time<2001){
					UpdateDiv(a, b);
				}
			}
			}