	var rechdets_preview_xmlHttp;

	var actual_rechdet_preview_id = false;
	var actual_rechdet_preview_kind = false;
	var actual_rechdet_preview_loaded = false;

	function reload_rechdets_preview(_id, _be_id, _kind, _high){

		if(_id!= actual_rechdet_preview_id
			|| _kind != actual_rechdet_preview_kind){
			var url="props_";
			url = url + "arid-"+ar_id;
			url = url + "-kind-"+_kind;
			if(_id!=-1) url = url + "-id-"+_id;
			if(_be_id!="" && _be_id!=-1) url = url + "-beid-"+_be_id;
			url = url + "-source-"+"preview";
			url = url + "-high-"+_high;
			url = url + ".html";

			actual_rechdet_preview_id = _id;
			actual_rechdet_preview_kind = _kind;

			rechdets_preview_xmlHttp = new net.ContentLoader(url,rechdets_preview_stateChanged);
		}
	}


	function rechdets_preview_stateChanged(){
	
		write2js_log("ajax_rechdets_preview - rechdets_preview_stateChanged", "", "rechdet_preview");
	
		var new_inner = this.req.responseText;

		var has_content = new_inner.substr(0,new_inner.indexOf('*'));

		new_inner = new_inner.substr(new_inner.indexOf('*')+1);

		var kind = new_inner.substr(0,new_inner.indexOf('*'));

		new_inner = new_inner.substr(new_inner.indexOf('*')+1);
		
		var id = new_inner.substr(0,new_inner.indexOf('*'));
	
		new_inner = new_inner.substr(new_inner.indexOf('*')+1);

		if(id== actual_rechdet_preview_id
			&& kind ==actual_rechdet_preview_kind){

			document.getElementById('rechdets_content').innerHTML = new_inner;
			
			actual_rechdet_preview_loaded = true;
			
			rechdets_preview_path_left = false;

			rechdets_preview_set_visible();
		}
		else{
			write2js_log("ajax_rechdets_preview - rechdets_preview_stateChanged", "id== actual_rechdet_preview_id&& kind ==actual_rechdet_preview_kind", "rechdet_preview");
		
			write2js_log("ajax_rechdets_preview - rechdets_preview_stateChanged", id+"=="+actual_rechdet_preview_id+"&&"+kind+"=="+actual_rechdet_preview_kind, "rechdet_preview");
		}
	}
	
	function rechdets_preview_set_visible(){
	
		write2js_log("ajax_rechdets_preview - rechdets_preview_set_visible", "(start)", "rechdet_preview");

		if(rechdet_preview_visible){
		write2js_log("ajax_rechdets_preview - rechdets_preview_set_visible", rechdet_preview_visible, "rechdet_preview");
			if(actual_rechdet_preview_path_loaded
				&& actual_rechdet_preview_loaded){
		
				actual_rechdet_preview_path_loaded = false;
				actual_rechdet_preview_loaded = false;
				
				document.getElementById('rechdets').style.visibility = 'visible';
				
				write2js_log("ajax_rechdets_preview - rechdets_preview_set_visible", "(done)", "rechdet_preview");
			}		
			else{
				write2js_log("ajax_rechdets_preview - rechdets_preview_set_visible", "actual_rechdet_preview_path_loaded&&actual_rechdet_preview_loaded", "rechdet_preview");
				write2js_log("ajax_rechdets_preview - rechdets_preview_set_visible", actual_rechdet_preview_path_loaded+"&&"+actual_rechdet_preview_loaded, "rechdet_preview");
			}			
		}
		
		set_lock_mouse_pointer(false);
	}
