	// --- error_wnd_class ---

	function error_wnd() {
		var self = this;
	
		this.container = null;
		this.div = null;
		this.input = null;
		this.overlay = null;
		this.ondone = null;
		
		this.right_top = null;
		this.right_bottom = null;
		this.left_top = null;
		this.left_bottom = null;
		
		this._onresize = function() { self.position(); }
		this._onscroll = function() { self.position(); }
	}

	error_wnd.prototype.construct = function(container, caption, inner, add_class) {
		var self = this;
		document.body.appendChild(container);
		
		this.container = container;
		this.container.className = "error_box error_box_float" + (add_class != null ? (" " + add_class) : "");
		if (inner != null) this.container.innerHTML = inner;
		
		this.div = document.createElement("DIV");
		this.div.className = "button";
		
		this.input = document.createElement("INPUT");
		this.input.type = "button";
		this.input.value = caption;
		this.input.onclick = function() {
			self.done();
		}
		
		this.right_top = document.createElement("SPAN");
		this.right_top.className = "right_top";
		
		this.right_bottom = document.createElement("SPAN");
		this.right_bottom.className = "right_bottom";
		
		this.left_top = document.createElement("SPAN");
		this.left_top.className = "left_top";
		
		this.left_bottom = document.createElement("SPAN");
		this.left_bottom.className = "left_bottom";
		
		this.container.appendChild(this.right_top);
		this.container.appendChild(this.right_bottom);
		this.container.appendChild(this.left_top);
		this.container.appendChild(this.left_bottom);
		
		this.overlay = document.createElement("DIV");
		this.overlay.className = "overlay";
		
		this.div.appendChild(this.input);
		this.container.appendChild(this.div);
		this.container.parentNode.appendChild(this.overlay);
		
		this.position();
		
		addEvent(window, "resize", this._onresize);
		addEvent(window, "scroll", this._onscroll);
	}
	
	error_wnd.prototype.done = function() {
		removeEvent(window, "resize", this._onresize);
		removeEvent(window, "scroll", this._onscroll);
	
		if (this.ondone != null) this.ondone();
	
		document.body.style.border = "none";
	
		context.structure_destroy(this.overlay);
		context.structure_destroy(this.container);
		context.object_destroy(this);
	}
	
	error_wnd.prototype.position = function() {
		this.overlay.style.width = document.body.offsetWidth + "px";
		this.overlay.style.height = document.body.offsetHeight + "px";
		
		this.container.style.left = Math.round((context.wnd_x() - context.get_elementWidth(this.container)) / 2) + "px";
		this.container.style.top = (Math.round((context.wnd_y() - context.get_elementHeight(this.container)) / 2) + context.get_scY()) + "px";
	}
		
	
	// --- rest ---
	
	var context = null;
	
	function blank() { }
	
	function do_print() {
		window.print();
	}
	
	function open_window(href, wid) {
		window.open(href, wid, "toolbar=0,statusbar=0,menubar=0,resizable=1,width=1000,height=830");
	}
	
	function new_captcha_make(ref, skip_new) {
		var link = "/captcha.php?";
		if (skip_new == null) link += "new=1&";
		link += "r="
		var univ = "qwertyuiopasdfghjklzxcvbnm0123456789";
		var f, letter, len = Math.round(Math.random() * 20) + 15;
		
		for (f = 0; f < len; f++) link += univ.substr(Math.round(Math.random() * (univ.length - 1)), 1);
		
		ref.src = link;
	}
	
	function new_captcha() {
		var ref = document.getElementById("captcha");
		if (ref != null) {
			new_captcha_make(ref);
			
		} else {
			ref = null;
			var index = 1;
			
			do {
				if ((ref = document.getElementById("captcha_" + index)) != null)
					new_captcha_make(ref, index == 1 ? null : true);
				index++;
			} while (ref != null);
		}
	}
	
	var g_cfrm = null;
	var g_ilist = null;
	
	function g_set_lang(lang) {
		g_cfrm.lang = lang;
	}
	
	function motion() {
		if (g_cfrm != null) g_cfrm.motion();
		setTimeout("motion()", 50);
	}
	
	function evt_body_load_final() {
		context = new context_class();
		context.construct();
		
		g_cfrm = new car_form_class();
		g_cfrm.construct();
		
		var i_a = document.getElementById("image_list");
		var i_b = document.getElementById("image_main");
		
		if (i_a != null && i_b != null) {
			g_ilist = new image_list_class(i_a, i_b);
			g_ilist.construct();
		}
		
		motion();
	}
	
