aj = function(exeCode,args,settings) {
	if(!settings) settings = {};
    if(!args) args = {};
    
	var argsString = '';
	
	var aj_sett = {
	   type: "POST",
	   url: "/ajax.php",
	   dataType:'json',
	   cache: false,
		// async: false
		success: parseResponse
	 };
	
	if(settings.before) {
		aj_sett['beforeSend'] = settings.before;
	} else {
		if(!settings.nowait) document.body.style.cursor = 'wait';
	}
    
    if(/^(.*)->(.*);(.*)?$/.test(exeCode)) {
        var classCode = RegExp.$1;
        var methodCode = RegExp.$2;
        var sett = RegExp.$3.split(":");
    } else {
        return false;
    }
    
    for(var i=0, j=sett.length;i<j;i++) {
        settings[sett[i]] = true;
    }
	var fu = hrefGet('fu');
       
	if(typeof args == 'object') {
		args['c'] = classCode;
        args['m'] = methodCode;
		if(fu != '') args['fu'] = fu;
	} else {
		if(typeof args == 'string') {
            args += "&c="+classCode+"&m="+methodCode;
			if(fu != '') args += "&fu="+fu;
		}
	}
	
	
	aj_sett['data'] = args;
	 
	$.ajax(aj_sett);
	 
	 return false;

}
 parseResponse = function(objs) {
		var obj;
		document.body.style.cursor = '';
        for (var z=0; obj = objs[z]; z++) {
			
			
            switch(obj['act']) {
            case "inner":
                $(obj['id']).html(obj['data'] || ''); 
            break;
            case "data":
			   var pre = '';
                var exec = obj['exec'] || false;
                if(!exec) continue; 
                args = obj['args'] || '-NULL_UNICAL-';
                var args_comm = "";
                
                    parse = function(arg, pre, name) {
                        if(pre) args_comm += pre+', ';
                        var pre = arg;
                        if(/^\d+$/.test(arg) == false) {
                            var typeofres = typeof arg;
                            if(typeofres == 'object' || typeofres == 'boolean') {
                                return name;
                            }
                            return name;
                        } else {
                            return 'parseInt('+pre+')';
                        }
                    }
                 //alert(args['0']);
                for(var a = 0; b=args[a];a++) {
                    var pre = parse(args[a], pre||false, "args['"+a+"']");
                }
                
              //  alert(exec+'('+(args != '-NULL_UNICAL-'?(args_comm+pre):'')+')');
                //eval(exec+'('+(args != '-NULL_UNICAL-'?(args_comm+pre):'')+')');
				var scr = exec+'('+(args != '-NULL_UNICAL-'?(args_comm+pre):'')+')';
				if (window.execScript) {
		            window.execScript(scr);
		        } else {
		            eval.call(window, scr);
		        }
            break;
            case "redirect":
                if(typeof obj['loc'] == 'undefined') {document.location.reload();continue;}
                try {
                    document.location = obj['loc'];
                } catch(ee) {
                    document.location.reload();
                }
            break;
            }
        }
    }