if( typeof gCLoadAjaxContent == 'undefined' ){
  var gCLoadAjaxContent = 'defined';
  var CLoadAjaxContent = Class.create();
  CLoadAjaxContent.prototype = Object.extend(new AJSMapBaseClass(), {
    localurl : gJSMapImagePath+"CLoadAjaxContent/",
    initialize: function(params){
      this.res=null;
      this.params=params;
      this.params.requesturl=this.checkParameter(this.params.requesturl);
      this.params.onload=this.checkParameter(this.params.onload);
      this.params.debug=this.checkParameter(this.params.debug,false);
      this.doAjaxRequest();
    },
    doAjaxRequest:function(){
      this.request = new Ajax.Request(
        this.params.requesturl,
        {
          method: 'get',
          onComplete: this.handleAjaxResult.bind(this)
        }
      );
    },
    getResult:function(){
      return this.res;
    },
    handleAjaxResult:function(json){
      if(this.params.debug&&typeof console!='undefined')console.log("CLoadAjaxContent: Json loaded");
      if(typeof json.responseText!='undefined'&&json.responseText!=null&&json.responseText!=""){
        if(this.params.debug&&typeof console!='undefined')console.log("CLoadAjaxContent: Json is defined, try to eval");
        if(this.params.debug&&typeof console!='undefined')console.log("CLoadAjaxContent: Json :",json);
        this.res=eval('('+json.responseText+')');
        if(this.params.debug&&typeof console!='undefined')console.log("CLoadAjaxContent: Json successfully evaluated, call Callback function");
        this.params.onload(this);
      }else{
        alert('fehlerAJAX');
      }
    }
  });
}

