function fill_block_with_content(destination,content){
	if(document.getElementById(destination)){
		document.getElementById(destination).innerHTML = content;
	}
}

function loading_process(destination){
	if(document.getElementById(destination)){
		document.getElementById(destination).innerHTML = "<img src='http://prf.icecat.biz/imgs/ajax_loader.gif'>";
	}
}

function post_ajax_request(url,destination,response){
   
	 	
	 	url = url + '&;'+Math.round((Math.random()*9)+1);
//		alert(url+"\nTo\n"+destination);
    if(!this.http){
      this.http = get_http();
      this.working = false;
    }
//		if(this.working && this.http){
//			this.http.about();//send(null);
//			this.working = false;
//			setTimeout('',1000);
//		}
    if (!this.working && this.http) {
      var http = this.http;
      //url  = 'http://kundeserver278.webglobe.dk/category_products_ajax.php?'+request;
      this.http.open("GET", url, true);
      loading_process(destination);
      this.http.onreadystatechange = function() {
                                                  if (http.readyState == 4) {
                                                    fill_block_with_content(destination,http.responseText);
                                                    this.working = false;
                                                  }else{
                                                    loading_process(destination);
                                                  }
                                                }
      loading_process(destination);
      this.http.send(null);
    }
    if(!this.http){
      alert('error  XMLHTTP request !')
    }
}


function post_ajax_stack_request(url,destination,response){
    
    if(!this.http){
      this.http = get_http();
      this.working = false;
    }
//		if(this.working && this.http){
//			this.http.about();//send(null);
//			this.working = false;
//			setTimeout('',1000);
//		}
    if (!this.working && this.http) {
      var http = this.http;
      //url  = 'http://kundeserver278.webglobe.dk/category_products_ajax.php?'+request;
      this.http.open("GET", url, true);
      loading_process();
      this.http.onreadystatechange = function() {
                                                  if (http.readyState == 4) {
                                                    fill_block_with_content(destination,http.responseText);
                                                    this.working = false;
                                                  }else{
                                                    loading_process(destination);
                                                  }
                                                }
      loading_process();
      this.http.send(null);
    }
    if(!this.http){
      alert('error  XMLHTTP request !')
    }
}

////////////////////////////////////////////////////////////////////////////////////////////////

function pause (mSec) {
  clock = new Date();
  justMinute = clock.getTime();
  while (true) {
    just = new Date();
    if (just.getTime() - justMinute > mSec) break;
  }
}


function get_http(){
    var xmlhttp;
    /*@cc_on
      @if (@_jscript_version >= 5)
        try {
             xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                      try {
                            xmlhttp = new
                            ActiveXObject("Microsoft.XMLHTTP");
                          } catch (E) {
                                       xmlhttp = false;
                          }
        }
      @else
      xmlhttp = false;
   @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}



