	
	// --- title_banner_class ---
	
	function title_banner(container) {
	    var self = this;
	
	    this.container = container;
	    this.close = null;
	    this.overlay = null;
		
		this._onresize = function() { self.position(); }
		this._onscroll = function() { self.position(); }
    }
    
    title_banner.prototype.construct = function() {
        var self = this;
        document.body.appendChild(this.container);
    
		this.overlay = document.createElement("DIV");
		this.overlay.className = "overlay";
		
		this.container.parentNode.appendChild(this.overlay);
		this.container.style.position = "absolute";
		this.container.style.zIndex = 20;
		
		this.close = document.createElement("SPAN");
		this.close.className = "close";
		this.close.onclick = function() {
		    if (self.o_ds == null) self.done();
        }
		
		this.container.appendChild(this.close);
		
		this.position();
		
		addEvent(window, "resize", this._onresize);
		addEvent(window, "scroll", this._onscroll);
	}
	
	title_banner.prototype.done = function() {
		removeEvent(window, "resize", this._onresize);
		removeEvent(window, "scroll", this._onscroll);
	    
		document.body.style.border = "none";
	
		context.structure_destroy(this.overlay);
		context.structure_destroy(this.container);
		context.object_destroy(this);
	}
	
	title_banner.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";
	}
	
	// --- roof_banner_class ---
	
	function roof_banner(container) {
        var self = this;
        
        this.container = container;
        this.target = 0;
        this.pos = 0.0;
        this.acc = 0.0;
        this.dec = 0.0;
        
        this._onresize = function() { self.evt_move(); }
        this._onscroll = function() { self.evt_move(); }
    }
    
    roof_banner.prototype.construct = function() {
        var self = this;
        this.target = context.get_scY();
        this.pos = this.target;
        this.container.style.top = (Math.round(this.pos) + 103) + "px";
        
        addEvent(window, "resize", this._onresize);
        addEvent(window, "scroll", this._onscroll);
    }
    
    roof_banner.prototype.evt_move = function() {
        this.target = context.get_scY();
        this.dec = 0.0;
        
        if (true) {
            this.pos = this.target;
            this.container.style.top = (Math.round(this.pos) + 103) + "px";
        }
    }
    
    roof_banner.prototype.do_motion = function() {
        if (this.pos != this.target || this.acc != 0) {
            if (document.all || true) {
                this.pos = this.target;
                this.container.style.top = (Math.round(this.pos) + 103) + "px";
                
            } else {
                /*
                var dist = Math.abs(this.pos - this.target);
                this.dec += 0.03;
                if (this.dec > 3.0) this.dec = 3.0;
                
                if (this.pos > this.target) {
                    this.acc += ((dist / 10.0) * -1.0);
                } else {
                    this.acc += ((dist / 10.0) * 1.0);
                }
                
                this.acc = this.acc / (1.0 + this.dec);
                */
                var dist = Math.abs(this.pos - this.target);
                var dr = 0;
                
                if (this.pos > this.target) {
                    //this.acc += ((dist / 10.0) * (dr = -1.0));
                    this.pos += (dist / 4.0) * (dr = -1.0);
                } else {
                    //this.acc += ((dist / 10.0) * (dr = 1.0));
                    this.pos += (dist / 4.0) * (dr = 1.0);
                }
                
                //this.pos += this.acc;
                
                if ((dr == 1.0 && this.pos >= this.target) || (dr == -1.0 && this.pos <= this.target)) {
                    this.pos = this.target;
                    //this.acc = 0.0;
                    //this.dec = 0.0;
                }
                
                this.container.style.top = (Math.round(this.pos) + 103) + "px";
            }
        }
    }

	// --- ---

    function img_swap_panel(cont, par) {
        this.cont = cont;
        this.par = par;
        this.img = null;

        this.loader = null;
        this.loading = false;

        this.arrow_left = null;
        this.arrow_right = null;

        this.items = new Array();
        this.index = -1;
    }

    img_swap_panel.prototype.construct = function() {
        var self = this;

        this.loader = document.createElement("IMG");

        this.arrow_left = document.createElement("IMG");
        this.arrow_left.className = "arrow_left";
        this.arrow_left.src = "/web/perfecto/gfx/arrow_left.gif";
        this.arrow_left.onmousedown = function() { this.className = "arrow_left arrow_left_over"; }
        this.arrow_left.onmouseup = function() { this.className = "arrow_left"; }
        this.arrow_left.onclick = function() { if (self.o_ds == null) self.evt_left(); }
        this.arrow_left.style.display = "none";

        this.arrow_right = document.createElement("IMG");
        this.arrow_right.className = "arrow_right";
        this.arrow_right.src = "/web/perfecto/gfx/arrow_right.gif";
        this.arrow_right.onmousedown = function() { this.className = "arrow_right arrow_right_over"; }
        this.arrow_right.onmouseup = function() { this.className = "arrow_right"; }
        this.arrow_right.onclick = function() { if (self.o_ds == null) self.evt_right(); }
        this.arrow_right.style.display = "none";

        this.cont.rel = "";
        this.cont.href = "javascript:void(0)";
        this.cont.onclick = function() {
            if (self.o_ds == null) {
                self.evt_click();
                return false;
            }
        }

        var parent = this.cont.parentNode;
        while (parent != null && parent.tagName.toUpperCase() != "DIV") parent = parent.parentNode;

        if (parent != null) {
            parent.appendChild(this.arrow_left);
            parent.appendChild(this.arrow_right);
        }
        
        var founded = false;
        var pos = 0;

        while (!founded && pos < this.cont.childNodes.length)
            if (this.cont.childNodes[pos].nodeType == 1 && this.cont.childNodes[pos].tagName.toUpperCase() == "IMG") founded = true;
            else pos++;

        if (founded) {
            this.img = this.cont.childNodes[pos];
        }

        this.push_item(0);
    }

    img_swap_panel.prototype.add_item = function(href, src, note) {
        this.items[this.items.length] = {
            "href" : href,
            "src" : src,
            "note" : note
        };
    }

    img_swap_panel.prototype.evt_left = function() {
        if (this.index > 0)
            this.push_item(this.index - 1);
    }

    img_swap_panel.prototype.evt_right = function() {
        if (this.index + 1 < this.items.length)
            this.push_item(this.index + 1);
    }

    img_swap_panel.prototype.evt_click = function() {
        if (g_iCol != null && this.index >= 0 && this.index < this.items.length) {
            g_iCol.open_gallery_dummy("gal", this.items[this.index]["href"]);
        }
    }

    img_swap_panel.prototype.push_item = function(index) {
        if (index != this.index && !this.loading) {
            var self = this;
            this.index = index;

            this.loading = true;
            this.loader.onload = function() { if (self.o_ds == null) self.evt_push_item(); }
            this.loader.src = this.items[this.index]["src"];
        }
    }
    
    img_swap_panel.prototype.evt_push_item = function() {
        if (this.loading) {
            this.loading = false;

            this.img.src = this.items[this.index]["src"];

            this.arrow_left.style.display = this.index > 0 ? "block" : "none";
            this.arrow_right.style.display = this.index + 1 < this.items.length ? "block" : "none";
            
            if (this.par != null) this.par.innerHTML = this.items[this.index]["note"];
        }
    }

	// --- scroll_watch_class ---
	
	function scroll_watch() {
		this.scroll_x = null;
		this.scroll_y = null;
		
		this.enabled = false;
		this.sloop = -1;
		this.sloop_top = 10;
	}
	
	scroll_watch.prototype.construct = function() {
		var self = this;
		addEvent(document.body, "scroll", function(trgEvent) {  
			var evt = trgEvent == null ? window.event : trgEvent;
			self.evt_scroll(evt);
		});
		addEvent(window, "scroll", function(trgEvent) {  
			var evt = trgEvent == null ? window.event : trgEvent;
			self.evt_scroll(evt);
		});
	}
	
	scroll_watch.prototype.evt_scroll = function(evt) {
		if (this.enabled && this.sloop != -2) {
			this.scroll_x = context.get_scX();
			this.scroll_y = context.get_scY();
			this.sloop = 0;
		}
	}
	
	scroll_watch.prototype.do_motion = function() {
		if (this.enabled && this.sloop >= 0) {
			this.sloop++;
			
			if (this.sloop > this.sloop_top) {
				this.sloop = -2;
				
				var self = this;
				var struct = new structure_class();
				
				struct.map("head/major", "pnc_browser_scroll");
				struct.map("head/scroll_x", this.scroll_x);
				struct.map("head/scroll_y", this.scroll_y);
				
				context.request("pnc_browser_scroll", null, function(data, request) {
					if (self != null) self.evt_save(data, request);
				}, struct);
			}
		}
	}
	
	scroll_watch.prototype.evt_save = function() {
		this.sloop = -1;
	}
	
	// --- 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.box_button = 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;
		else {
			var current, f, stack = new Array();
			stack[0] = this.container;
			
			while (stack.length > 0 && this.box_button == null) {
				current = stack.pop();
				
				if (current.tagName.toUpperCase() == "A" && current.className == "box_button") this.box_button = current;
				else {
					if (current.childNodes.length > 0)
						for (f = 0; f < current.childNodes.length; f++)
							if (current.childNodes[f].nodeType == 1) stack[stack.length] = current.childNodes[f];
				}
			}
		}
		
		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();
		}
		
		if (this.box_button != null) {
			this.input.value = this.box_button.innerHTML;
			this.ondone = function() {
				document.location.href = self.box_button.href;
			}
			
			this.box_button.parentNode.removeChild(this.box_button);
		}
		
		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";
	}
		
	// --- deflist_collector ---
	
	function deflist_node(parent, node, ident) {
		this.parent = parent;
		this.node = node;
		this.ident = ident;
		
		this.container = null;
		this.c_head = null;
		this.c_content = null;
		this.c_foot = null;
	}
	
	deflist_node.prototype.construct = function() {
		var self = this;
		this.node.onmouseover = function() { if (self.o_ds == null) self.evt_over(); }
		this.node.onmouseout = function() { if (self.o_ds == null) self.evt_out(); }
		
		var iHTML = this.node.innerHTML;
		this.node.innerHTML = "<em>" + iHTML + "</em>&nbsp;&nbsp;&nbsp;&nbsp;";
		this.node.className += " deflist_ico";
	}
	
	deflist_node.prototype.destroy = function() {
		context.object_destroy(this);
	}
	
	deflist_node.prototype.available = function() {
		return this.container != null && this.container.parentNode != null;
	}
	
	deflist_node.prototype.evt_over = function() {
		if (this.contianer == null) {
			var self = this;
			
			this.container = document.createElement("DIV");
			this.container.className = "deflist_box";
			this.container.style.left = (context.get_elementX(this.node) + context.get_elementWidth(this.node) - 10) + "px";
			this.container.style.top = (context.get_elementY(this.node) + context.get_elementHeight(this.node) + 16) + "px";
			
			this.c_head = document.createElement("SPAN");
			this.c_head.className = "c_head";
			
			this.c_content = document.createElement("P");
			this.c_content.innerHTML = "načítám ...";
			
			this.c_foot = document.createElement("SPAN");
			this.c_foot.className = "c_foot";
			
			this.container.appendChild(this.c_head);
			this.container.appendChild(this.c_content);
			this.container.appendChild(this.c_foot);
			
			context.document_ref.body.appendChild(this.container);
			
			var self = this;
			var struct = new structure_class();
			
			struct.map("head/major", "deflist_query");
			struct.map("head/deflist_node_ID", this.ident);
			struct.map("head/lang", this.parent.lang);
			
			context.request("shop_store_state", null, function(data, request) {
				if (self != null) self.evt_over_done(data, request);
			}, struct);
		}
	}
	
	deflist_node.prototype.evt_over_done = function(data, request) {
		var res, f;
		if ((res = request.get_response()) != null) {
			
			var head = res[0];
			var body = res[1];
			
			var els = body.getElementsByTagName("deflist_node");
			if (els.length > 0) {
				this.c_content.innerHTML = context.sub_element_value(els[0], "note");
			}
			
		}
	}
	
	deflist_node.prototype.evt_out = function() {
		if (this.container != null) {
			context.structure_destroy(this.container);
			this.container = null;
		}
	}
	
	function deflist_collector(container) {
		this.prefix = "deflist";
		this.items = new Array();
		this.lang = null;
	}
	
	deflist_collector.prototype.exist = function(ref) {
		var founded = false;
		var pos = 0;
		
		while (!founded && pos < this.items.length)
			if (this.items[pos] === ref) founded = true;
			else pos++;
			
		return founded;
	}
	
	deflist_collector.prototype.check_nodes = function() {
		var sf, f, rem = new Array();
		
		for (f = 0; f < this.items.length; f++)
			if (!this.items[f].available()) {
				rem[rem.length] = this.items[f];
				
				for (sf = f; sf < this.items.length - 1; sf++)
					this.items[sf] = this.items[sf + 1];
				this.items.pop();
				f--;
			}
		
		for (f = 0; f < rem.length; f++)
			rem[f].destroy();
	}
	
	deflist_collector.prototype.construct = function() {
		this.map_nodes();
	}
	
	deflist_collector.prototype.map_nodes = function(from) {
		var target = from == null ? document : from;
		var f, ref, els = target.getElementsByTagName("A");
		
		for (f = 0; f < els.length; f++) {
			if (els[f].className.length > this.prefix.length && els[f].className.substr(0, this.prefix.length) == this.prefix && !this.exist(els[f])) {
				var ident = parseInt(els[f].className.substr(this.prefix.length * 2 + 2));
				
				ref = new deflist_node(this, els[f], ident);
				this.items[this.items.length] = ref;
				ref.construct();
			}
		}
	}
		
	// --- product_box_class ---
	
	function product_box_class(container) {
		this.inheritFrom = shadow_block_class;
		this.inheritFrom();
		
		this.container = container;
		this.butt_close = null;
	}
	
	//clone_add(product_box_class.prototype, shadow_block_class.prototype); // inherit
	
	product_box_class.prototype.ref_stack = new Array();
	
	product_box_class.prototype.construct = function() {
		var self = this;
		this.ref_stack[this.ref_stack.length] = this;
		this.container.className += " product_box_long error_box_float";
		
		var sf, current, stack = new Array();
		stack[0] = this.container;
		
		while (stack.length > 0) {
			current = stack.pop();
			
			switch (current.tagName.toUpperCase()) {
				case "A" :
					if (current.className == "button_normal") this.butt_close = current;
					break;
			}
			
			if (current.childNodes.length > 0) {
				for (sf = 0; sf < current.childNodes.length; sf++)
					if (current.childNodes[sf].nodeType == 1) stack[stack.length] = current.childNodes[sf];
			}
		}
		
		if (this.butt_close != null) {
			this.butt_close.href = "javascript:blank()";
			this.butt_close.onclick = function() { self.close(); }
		} else {
			this.butt_close = document.createElement("SPAN");
			this.butt_close.className = "close_box";
			this.butt_close.onclick = function() { self.close(); }
			
			this.container.appendChild(this.butt_close);
		}
	}
	
	product_box_class.prototype.open = function(ref) {
		var f;
		for (f = 0; f < this.ref_stack.length; f++)
			if (this.ref_stack[f] != this) this.ref_stack[f].close();
		
		this.container.style.display = "block";
		if (ref != null) {
			document.body.appendChild(this.container);
			this.container.style.position = "absolute";
			this.container.style.left = context.get_elementX(ref) + "px";
			this.container.style.top = context.get_elementY(ref) + "px";
		}
		//this.shadows_build();
	}
	
	product_box_class.prototype.close = function() {
		this.container.style.display = "none";
		//this.shadows_destroy();
	}
	
	product_box_class.prototype.shadow_width = function() { return context.get_elementWidth(this.container) - 1; }
	product_box_class.prototype.shadow_height = function() { return context.get_elementHeight(this.container) - 1; }
	
	// --- filter_handle ---
	
	function filter_handle(container) {
		this.container = container;
		this.href_prefix = null;
		this.form = null;
		
		this.construct();
	}
	
	filter_handle.prototype.construct = function() {
		var self = this;
		
		var parent = this.container.parentNode;
		while (parent != null) {
			if (parent.tagName.toUpperCase() == "FORM") {
				this.form = parent;
				parent = null;
			} else parent = parent.parentNode;
		}
		
		var f, current, stack = new Array();
		stack[0] = this.container;
		
		while (stack.length > 0) {
			current = stack.pop();
			
			if (current.tagName.toUpperCase() == "SELECT") {
				current.onchange = function() {
					self.form.submit();
					//document.location.href = (self.href_prefix == null ? document.location.href : self.href_prefix) + "/(" + this.id + ":" + this.options[this.selectedIndex].value + ")filter";
				}
				new ic_select(current);
			}
			if (current.tagName.toUpperCase() == "INPUT" && current.type == "checkbox") {
				current.onclick = function() {
					self.form.submit();
					//document.location.href = (self.href_prefix == null ? document.location.href : self.href_prefix) + "/(" + this.id + ":" + (this.checked ? 1 : 0) + ")filter";
				}
			}
			if (current.tagName.toUpperCase() == "LI" && current.className == "filter_do") {
				current.style.display = "none";
			}
			if (current.childNodes.length > 0) {
				for (f = 0; f < current.childNodes.length; f++)
					if (current.childNodes[f].nodeType == 1) stack[stack.length] = current.childNodes[f];
			}
		}
	}
	
	// --- news_block_class ---
	
    function block_list_item(parent, index, input, func, data, alt) {
        this.parent = parent;
        this.index = index;

        this.func = func;
        this.input = input;
        this.data = data;
        this.alt = alt;

        this.href = null;
        this.block = null;
        this.block_title = null;
        this.block_corner = null;
    }

    block_list_item.prototype.construct = function() {
        var self = this;

        var idx, to_rem = "item_list_margintop";
        if ((idx = this.block.className.indexOf(to_rem)) >= 0) {
            this.block.className = this.block.className.substr(0, idx) + this.block.className.substr(idx + to_rem.length);
        }

        if (!this.is_selected()) this.block.style.display = "none";
        this.block_title.className = this.is_selected() ? "tab_active" : "tab_inactive";

        var sf, current, stack = new Array();
        stack[0] = this.block_title;

        while (stack.length > 0) {
            current = stack.pop();

            if (current.tagName.toUpperCase() == "A") {
                this.href = current;

                current.href = "javascript:blank()";
                current.onclick = function() { self.parent.do_select(self); }

            }

            if (current.childNodes.length > 0)
                for (sf = 0; sf < current.childNodes.length; sf++)
                    if (current.childNodes[sf].nodeType == 1) stack[stack.length] = current.childNodes[sf];
        }

        stack = new Array();
        stack[0] = this.block;

        while (stack.length > 0) {
            current = stack.pop();

            if (current.tagName.toUpperCase() == "SPAN" && current.className == "left_top") {
                var parent = current.parentNode;
                parent.removeChild(current);
            }

            if (current.childNodes.length > 0)
                for (sf = 0; sf < current.childNodes.length; sf++)
                    if (current.childNodes[sf].nodeType == 1) stack[stack.length] = current.childNodes[sf];
        }
    }
    
    block_list_item.prototype.destroy = function() {
        context.object_destroy(this);
    }

    block_list_item.prototype.is_selected = function() {
        return this.index == this.parent.selected;
    }

    block_list_item.prototype.toggle = function() {
        this.block_title.className = this.is_selected() ? "tab_active" : "tab_inactive";
        this.block.style.display = this.is_selected() ? "block" : "none";
    }

    block_list_item.prototype.evt_click = function() {
        if (this.func != null)
            this.func(this, this.data);
    }

    function block_list_class() {
        this.items = new Array();
        this.selected = -1;
    }

    block_list_class.prototype.construct = function() {
        if (this.items.length > 0) {
            var f, self = this;

            if (this.selected == -1) this.selected = this.items.length - 1;

            for (f = 0; f < this.items.length; f++)
                this.items[f].construct();
        }
    }
    
    block_list_class.prototype.destroy = function() {
        var f;
        for (f = 0; f < this.items.length; f++)
            this.items[f].destroy();
        
        context.object_destroy(this);
    }
    
    block_list_class.prototype.add = function(input, func, data, is_selected, alt) {
        var block = document.getElementById(input);
        var block_title = document.getElementById(input + "_title");
        var block_corner = document.getElementById(input + "_corner");

        if (block != null && block_title != null) {
            var ref = new block_list_item(this, this.items.length, input, func, data, alt);

            ref.block = block;
            ref.block_title = block_title;
            ref.block_corner = block_corner;

            if (is_selected) this.selected = this.items.length;
            this.items[this.items.length] = ref;
        }
    }

    block_list_class.prototype.add_ref = function(block, block_title, func, data, is_selected, alt) {
        if (block != null && block_title != null) {
            var ref = new block_list_item(this, this.items.length, null, func, data, alt);

            ref.block = block;
            ref.block_title = block_title;
            
            if (is_selected) this.selected = this.items.length;
            this.items[this.items.length] = ref;
        }
    }

    block_list_class.prototype.force_open = function(ident) {
        var founded;
        var pos = 0;

        while (!founded && pos < this.items.length)
            if (this.items[pos].block.id == ident) founded = true;
            else pos++;

        if (founded) this.do_select(this.items[pos]);
        else {
            pos = 0;

            while (!founded && pos < this.items.length)
                if (this.items[pos].alt == ident) founded = true;
                else pos++;

            if (founded) this.do_select(this.items[pos]);
        }
    }

    block_list_class.prototype.do_select = function(item) {
        if (item.index != this.selected) {
            var bef = this.selected;
            this.selected = item.index;

            if (bef != -1) this.items[bef].toggle();
            this.items[this.selected].toggle();
            this.items[this.selected].evt_click();
        }
    }

	// ---- infobox_handler ---
	
	function infobox_handler(button, container) {
		this.button = button;
		this.container = container;
		
		this.close_timeout = null;
		this.touch_timeout = null;
		this.mouse_opened = false;
	}

	infobox_handler.prototype.opened = null;
	
	infobox_handler.prototype.construct_infobox = function() {
		var self = this;
		
		document.body.appendChild(this.container);
		
		this.button.onmouseover = function(trgEvent) {
			self.evt_activate(trgEvent == null ? event : trgEvent);
		}
		this.container.onmouseover = function(trgEvent) {
			self.evt_over(trgEvent == null ? event : trgEvent);
		}
		this.container.onmouseout = function(trgEvent) {
			self.evt_out(trgEvent == null ? event : trgEvent);
		}
	}
	
	infobox_handler.prototype.close = function() {
		this.container.style.display = "none";
		this.mouse_opened = false;
		infobox_handler.prototype.opened = null;
	}
	
	infobox_handler.prototype.cancel_close = function() {
		var self = this;
		if (this.close_timeout != null) {
			if (context.ic_collector.timeout_stop(this.close_timeout))
				this.close_timeout = null;
		}
	}
	
	infobox_handler.prototype.touched = function() {
		var self = this;
	
		if (this.touch_timeout != null) context.ic_collector.timeout_stop(this.touch_timeout);
		this.touch_timeout = context.ic_collector.timeout(function() { self.evt_activate() }, 1000);
	}
	
	infobox_handler.prototype.open = function() {
	    if (infobox_handler.prototype.opened != null)
	        infobox_handler.prototype.opened.close();

		this.container.style.position = "absolute";
		this.container.style.left = context.get_elementX(this.button) + "px";
		this.container.style.top = context.get_elementY(this.button) + "px";
		this.container.style.display = "block";

		infobox_handler.prototype.opened = this;
	}
	
	infobox_handler.prototype.evt_activate = function() {
		this.mouse_opened = true;
		this.open();
	}
	
	infobox_handler.prototype.evt_over = function(trgEvent) {
		this.cancel_close();
	}
	
	infobox_handler.prototype.evt_out = function(trgEvent) {
		var self = this;
	
		var target = trgEvent.toElement == null ? trgEvent.relatedTarget : trgEvent.toElement;
		
		while (target != null && target !== this.container && target !== this.button) target = target.parentNode;

		if (target == null) {
			if (this.mouse_opened) this.close();
			else {
				var self = this;
				this.cancel_close();
				this.close_timeout = context.ic_collector.timeout(function() { self.close(); }, 2000);
			}
		}
	}
	
	// --- store_infobox ---
	
	function store_infobox(button, container, input) {
		this.inheritFrom = infobox_handler;
		this.inheritFrom(button, container);
	
		this.input = input;
		
		this.par = null;
		this.hidden = null;
		
		this.last_value = null;
		this.lang = null;
		
		this.construct();
	}
	
	clone_add(store_infobox.prototype, infobox_handler.prototype); // inherit
	
	store_infobox.prototype.construct = function() {
		var self = this;
		
		this.construct_infobox();

		var f, current, stack = new Array();
		stack[0] = this.container;
		
		while ((this.par == null || this.hidden == null) && stack.length > 0) {
			current = stack.pop();
            
			if (current.tagName.toUpperCase() == "P" && current.className == "") this.par = current;
			else if (current.tagName.toUpperCase() == "INPUT" && current.type == "hidden") this.hidden = current;
			else {
				if (current.childNodes.length > 0) {
					for (f = 0; f < current.childNodes.length; f++)
						if (current.childNodes[f].nodeType == 1) stack[stack.length] = current.childNodes[f];
				}
			}
		}
		
		this.last_value = this.input.value;
		this.input.onchange = function() {
			if (self.touch_timeout != null) {
				context.ic_collector.timeout_stop(self.touch_timeout);
				self.touch_timeout = null;
			}
			self.refresh();
		}
		this.input.onkeyup = function() {
			self.touched();
		}
	}
	
	store_infobox.prototype.refresh = function() {
		if (this.input.value != this.last_value) {
			var self = this;
			var struct = new structure_class();
			
			var n = parseInt(this.input.value);
			if (isNaN(n)) n = 1;
			
			struct.map("head/major", "shop_store_state");
			struct.map("head/productID", parseInt(this.hidden.value));
			struct.map("head/num", n);
			struct.map("head/lang", this.lang);
			
			context.request("shop_store_state", null, function(data, request) {
				if (self != null) self.evt_refresh(data, request);
			}, struct);
		}
	}
	
	store_infobox.prototype.evt_refresh = function(data, request) {
		var res, f;
		if ((res = request.get_response()) != null) {
			
			var head = res[0];
			var body = res[1];
			
			this.last_value = this.input.value;
			var dt, el = body.getElementsByTagName("output_data");
			if (el.length > 0) {
				dt = context.element_value(el[0]);
				this.par.innerHTML = dt;
			}
			
		}
	}
	
	store_infobox.prototype.touched = function() {
		if (this.input.value != this.last_value) {
			var self = this;
			
			if (this.touch_timeout != null) context.ic_collector.timeout_stop(this.touch_timeout);
			this.touch_timeout = context.ic_collector.timeout(function() { self.evt_activate() }, 1000);
		}
	}
	
	store_infobox.prototype.evt_activate = function() {
		this.open();
		this.refresh();
	}
	
	// --- gallery_handler ---
	
	/*
	gallery_parser_handle_item = function(parent, img, href) {
		this.img = img;
		this.href = href;
		this.image = null;
	}
	
	gallery_parser_handle_item.prototype.construct = function() {
		var self = this;
		
		this.image = this.href.href;
		this.href.href = "javascript:blank()";
		this.href.onclick = function() {
			
			var pos, spos, p = self.image;
			
			if (
				(pos = self.image.indexOf("http://")) != -1 && (spos = self.image.indexOf("/", pos + 1)) != -1
			) {
				p = self.image.substr(spos);
			}
			
			window.open('/preview.php?prev_path=' + p, 'gwnd', 'width=auto,height=auto,toolbar=0,statusbar=0,menubar=0');
		}
	}
	
	gallery_parser_handle = function(parent, container) {
		this.parent = parent;
		this.container = container;
		
		this.items = new Array();
	}
	
	gallery_parser_handle.prototype.construct = function() {
		var ref, current, f, stack = new Array();
		stack[0] = this.container;
		
		while (stack.length > 0) {
			current = stack.pop();
			
			if (current.tagName.toUpperCase() == "IMG" && current.parentNode.tagName.toUpperCase() == "A") {
				ref = new gallery_parser_handle_item(this, current, current.parentNode);
				ref.construct();
				
				this.items[this.items.length] = ref;
			}
			
			if (current.childNodes.length > 0)
				for (f = 0; f < current.childNodes.length; f++)
					if (current.childNodes[f].nodeType == 1) stack[stack.length] = current.childNodes[f];
		}
	}
	
	gallery_parser = function() {
		this.items = new Array();
	}
	
	gallery_parser.prototype.construct = function() {
		var f, ref, divs = document.getElementsByTagName("div"), tp = new Array();
		
		for (f = 0; f < divs.length; f++)
			if (divs[f].className == "img_list") {
				ref = new gallery_parser_handle(this, divs[f]);
				ref.construct();
				
				this.items[this.items.length] = ref;
			}
		
		divs = document.getElementsByTagName("table");
		for (f = 0; f < divs.length; f++)
			if (divs[f].className == "gallery_in_content") {
				ref = new gallery_parser_handle(this, divs[f]);
				ref.construct();
				
				this.items[this.items.length] = ref;
			}
	}
	*/

	// --- rest ---
	
	var context = null;
	var pageTracker = null;
	var g_fcl = null;
	var g_fh = null;
	var g_lh = new Array();
	var g_sfcl = null;
	var g_wt = null; // product watchdog
	var g_ms = null; // product mail send
	var g_sbox = null;
	var g_cp = null; // cart panel
	var g_isw = null; // image swap
	var g_roofb = null; // roof banner
	var g_gp = null; 
	var g_vlist = null;
	var g_scr = null; // scroll
	var g_news = null;
	var g_filter = null;
	var g_dcol = null;
	var g_tm = null; // title swap
	var g_iCol = null;
	var vimg = null;
	var pnc_edit_mode = false;
	
	function blank() { }
	
	function area_insert(ref, input) {
		if (ref != null) {
			if (document.selection) {
				ref.focus();
				var sel = document.selection.createRange();
				sel.text = input;
			} else if (ref.selectionStart || ref.selectionStart == 0) {
				var startPos = ref.selectionStart;
				var endPos = ref.selectionEnd;
				ref.value = ref.value.substring(0, startPos) + input + ref.value.substring(endPos, ref.value.length);
			} else {
				ref.value += input;
			}			
		}
	}
	
	function g_lh_add(ref) {
		g_lh[g_lh.length] = ref;
	}
	
	function g_lh_motion() {
		if (g_lh.length > 0) {
			var f;
			for (f = 0; f < g_lh.length; f++)
				g_lh[f].motion();
		}
	}
	
	function g_set_lang(lang) {
		if (g_sfcl != null) g_sfcl.lang = lang;
		if (g_sbox != null) g_sbox.lang = lang;
		if (g_cp != null) g_cp.lang = lang;
		if (g_vlist != null) g_vlist.lang = lang;
		if (g_news != null) g_news.lang = lang;
		if (g_filter != null) g_filter.lang = lang;
		if (g_dcol != null) g_dcol.lang = lang;
	}
	
	function do_print() {
		window.print();
	}
	
	function print_document(type, ident) {
		window.open("/shop_print.php?type=" + type + "&ident=" + ident, "shop_wnd", "toolbar=0,statusbar=0,menubar=1,resizable=1,width=850,height=600,scrollbars=1");
	}
	
	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);
		}
	}
	
	function open_login() {
		tmp = document.getElementById("user_login_do_block");
		inp = document.getElementById("user_login_do");
		
		if (tmp != null && inp != null) {
			inp.checked = true;
			tmp.style.display = "block";
		}
	}
	
	function motion() {
		g_lh_motion();
		if (g_fcl != null) g_fcl.do_motion();
		if (g_cp != null) g_cp.do_motion();
		if (g_isw != null) g_isw.do_motion();
		if (g_scr != null) g_scr.do_motion();
		if (g_news != null) g_news.do_motion();
		if (g_filter != null) g_filter.do_motion();
		if (g_tm != null) g_tm.loop();
        if (g_roofb != null) g_roofb.do_motion();
		setTimeout("motion()", 50);
	}
	
	function mount_box(form, dtext) {
		var box = null, sf, current, stack = new Array();
		stack[0] = form;
		
		while (stack.length > 0) {
			current = stack.pop();
			
			switch (current.tagName.toUpperCase()) {
				case "TEXTAREA" :
					box = current;
					break;
					
				case "INPUT" :
					if (current.type == "text") box = current;
					break;
			}
			
			if (current.childNodes.length > 0) {
				for (sf = 0; sf < current.childNodes.length; sf++)
					if (current.childNodes[sf].nodeType == 1) stack[stack.length] = current.childNodes[sf];
			}
		}
		
		if (box != null) {
			var fr = form;
			while (fr != null && fr.tagName.toUpperCase() != "FORM") fr = fr.parentNode;
			
			if (fr != null) addEvent(fr, "submit", function() {
				if (box.value == dtext) box.value = "";
			});
			
			box.onblur = function() {
				if (this.value == "") this.value = dtext;
			}
			box.onfocus = function() {
				if (this.value == dtext) this.value = "";
			}
			if (box.value == "") box.value = dtext;
		}
	}
	
	function make_bubble(inner, trigger, replace, className, stdPosition, noPar) {
		
		var nBlock = document.createElement("DIV");
		nBlock.className = className == null ? "deflist_box" : className;
		nBlock.style.display = "none";
		nBlock.style.zIndex = 10;
		nBlock.innerHTML = "<span class='c_head'></span>" + (noPar ? inner : ("<p>" + inner + "</p>")) + "<span class='c_foot'></span>";
		
		if (replace != null) {
			if (stdPosition) {
				var parent = replace.parentNode;
				if (parent != null) parent.removeChild(replace);
				document.body.appendChild(nBlock);
				
			} else {
				var parent = replace.parentNode;
				parent.insertBefore(nBlock, replace);
				parent.removeChild(replace);
			}
			
		} else {
			document.body.appendChild(nBlock);
		}
		
		trigger.onmouseover = function() {
			if (replace == null) {
				nBlock.style.left = (context.get_elementX(this) + context.get_elementWidth(this)) + "px";
				nBlock.style.top = (context.get_elementY(this) + context.get_elementHeight(this) + 15) + "px";
				nBlock.style.display = "block";
					
			} else {
				if (stdPosition) {
					nBlock.style.left = (context.get_elementX(trigger) + 16) + "px";
					nBlock.style.top = (context.get_elementY(trigger) + context.get_elementHeight(trigger) + 20) + "px";
					nBlock.style.display = "block";
				
				} else {
					var founded = this.parentNode;
					while (founded != null && founded.tagName.toUpperCase() != "DIV")
						founded = founded.parentNode;
					
					if (founded != null) {
						nBlock.style.left = (context.get_elementX(this) - context.get_elementX(founded) + 52) + "px";
						nBlock.style.top = (context.get_elementY(this) - context.get_elementY(founded) + context.get_elementHeight(this) + 16) + "px";
						nBlock.style.display = "block";
					}
				}
			}
		}
		trigger.onmouseout = function() {
			nBlock.style.display = "none";
		}
		
		return nBlock;
	}
	
	function evt_body_load_final() {
		
		context = new context_class();
		context.construct();
		
		g_scr = new scroll_watch();
		g_scr.construct();
		
		var f = document.getElementById("search_form");
		if (f != null) mount_box(f, context.trans("Vyhledat ..."));
		
		f = document.getElementById("mail_form");
		if (f != null) mount_box(f, context.trans("Váš email ..."));
		
		f = document.getElementById("user_login");
		if (f != null) mount_box(f, context.trans("Váš přihlašovací email ..."));
		
		f = document.getElementById("response_email");
		if (f != null) mount_box(f, context.trans("Váš email ..."));
		
		f = document.getElementById("response_message");
		if (f != null) mount_box(f, context.trans("Vaše zpráva ..."));
		
		f = document.getElementById("product_email");
		if (f != null) mount_box(f, context.trans("Zaslat na email ..."));
		
		f = document.getElementById("product_message");
		if (f != null) mount_box(f, context.trans("Vaše zpráva ..."));
		
		f = document.getElementById("newsgrab_form");
		if (f != null) mount_box(f, context.trans("Vyplňte Váš email ..."));
		
		f = document.getElementById("response_captcha");
		if (f != null) mount_box(f, context.trans("Zde přepište písmena z obrázku..."));
		
		f = document.getElementById("watchdog_captcha");
		if (f != null) mount_box(f, context.trans("Zde přepište písmena z obrázku..."));
		
		f = document.getElementById("product_captcha");
		if (f != null) mount_box(f, context.trans("Zde přepište písmena z obrázku..."));
		
		f = document.getElementById("user_captcha");
		if (f != null) mount_box(f, context.trans("Zde přepište písmena z obrázku..."));
		
		f = document.getElementById("comp_name");
		if (f != null) mount_box(f, context.trans("Vaše jméno ..."));
		
		f = document.getElementById("comp_email");
		if (f != null) mount_box(f, context.trans("Váš email ..."));
		
		f = document.getElementById("comp_rcp");
		if (f != null) mount_box(f, context.trans("Email příjemce ..."));
		
		f = document.getElementById("comp_message");
		if (f != null) mount_box(f, context.trans("Text zprávy ..."));
		
		f = document.getElementById("comp_captcha");
		if (f != null) mount_box(f, context.trans("Zde přepiště písmena z obrázku..."));
		
		f = document.getElementById("watchdog_email");
		if (f != null) mount_box(f, context.trans("Informovat na email ..."));

		if ((f = document.getElementById("fav_toggle")) != null) {
			f.onclick = function(trgEvent) {
				cancelEvent(trgEvent == null ? window.event : trgEvent, true);
				g_sfcl.toggle(parseInt(this.className.substr(13)));
				return false;
			}
		}
		if ((f = document.getElementById("watchdog")) != null) {
			g_wt = new product_box_class(f);
			g_wt.construct();
		}
		if ((f = document.getElementById("mail_send")) != null) {
			g_ms = new product_box_class(f);
			g_ms.construct();
		}
		
		var inp_forum_category = null;
		var inp_response_contact = null;
		var inp_users_de_country = null;
		var inp_users_in_country = null;
		var inp_users_country = null;
		
		if ((box = document.getElementById("forum_category")) != null) {
			inp_forum_category = new ic_select(box);
		}
		if ((box = document.getElementById("response_contact")) != null) {
			inp_response_contact = new ic_select(box);
		}
		if ((box = document.getElementById("users_de_country")) != null) {
			inp_users_de_country = new ic_select(box);
		}
		if ((box = document.getElementById("users_in_country")) != null) {
			inp_users_in_country = new ic_select(box);
		}
		if ((box = document.getElementById("users_country")) != null) {
			inp_users_country = new ic_select(box);
		}

		
		var btn, inp, inps, inpt, tmp = document.getElementById("area_users_de_create");
		
		if (tmp != null) {
			inp = document.getElementById("users_de_create");
			var dis_users_de_create = new ic_disable_class(tmp, false, true);
			dis_users_de_create.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_de_create.toggle_force(this.checked);
			}
		}
		
		tmp = document.getElementById("area_users_in_create");
		
		if (tmp != null) {
			inp = document.getElementById("users_in_create");
			var dis_users_in_create = new ic_disable_class(tmp, false, true);
			dis_users_in_create.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_in_create.toggle_force(this.checked);
			}
		}
		
		tmp = document.getElementById("users_set_area");
		
		if (tmp != null) {
			inp = document.getElementById("users_set");
			var dis_users_set = new ic_disable_class(tmp, false, true);
			dis_users_set.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_set.toggle_force(this.checked);
			}
		}
		
        tmp = document.getElementById("specific_set_area");
        
        if (tmp != null) {
            inp = document.getElementById("specific_set");
            var dis_users_set = new ic_disable_class(tmp, false, true);
            dis_users_set.toggle_force(inp.checked);
            inp.onclick = function() {
                dis_users_set.toggle_force(this.checked);
            }
        }
		
		tmp = document.getElementById("users_change_email_area");
		
		if (tmp != null) {
			inp = document.getElementById("users_change_email");
			var dis_users_change_email = new ic_disable_class(tmp, false, true);
			dis_users_change_email.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_change_email.toggle_force(this.checked);
			}
		}

		tmp = document.getElementById("users_change_passwd_area");
		
		if (tmp != null) {
			inp = document.getElementById("users_change_passwd");
			var dis_users_change_passwd = new ic_disable_class(tmp, false, true);
			dis_users_change_passwd.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_change_passwd.toggle_force(this.checked);
			}
		}
		
		tmp = document.getElementById("users_invoice_email_change_area");
		
		if (tmp != null) {
			inp = document.getElementById("users_invoice_email_change");
			var dis_users_invoice_email_change = new ic_disable_class(tmp, false, true);
			dis_users_invoice_email_change.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_invoice_email_change.toggle_force(this.checked);
			}
		}
		
		tmp = document.getElementById("users_news_agree_area");
		
		if (tmp != null) {
			inp = document.getElementById("news_agree");
			var dis_users_news_agree_area = new ic_disable_class(tmp, false, true);
			dis_users_news_agree_area.toggle_force(inp.checked);
			inp.onclick = function() {
				dis_users_news_agree_area.toggle_force(this.checked);
			}
		}
		
		tmp = document.getElementById("delivery_block");
		inp = inp_users_country;
		inps = inp_users_de_country;
		inpt = document.getElementById("users_set");
		
		if (tmp != null && inp != null && inps != null && inpt != null) {
            
		    function del_swap() {
		        this.delivery_block = null;
		        this.country_a = null;
		        this.country_b = null;
		        this.check = null;
		        this.delivery = null;
            }

            del_swap.prototype.construct = function() {
                var self = this;

                this.delivery = new param_swap_class(this.delivery_block);
                this.delivery.construct();

                this.country_a.onchange = function() { if (self.o_ds == null) self.evt_change(true); }
                this.country_b.onchange = function() { if (self.o_ds == null) self.evt_change(true); }
                addEvent(this.check, "click", function() { if (self.o_ds == null) self.evt_change(true); });
                
                self.evt_change(false);
            }

            del_swap.prototype.evt_change = function(reset) {
                var val = 0
                if (this.check.checked) val = parseInt(this.country_b.options[this.country_b.selectedIndex].value);
                else val = parseInt(this.country_a.options[this.country_a.selectedIndex].value);

                this.delivery.set_param(val);
                if (reset) this.delivery.reset_param();
            }

            var dsw = new del_swap();
            dsw.delivery_block = tmp;
            dsw.country_a = inp;
            dsw.country_b = inps;
            dsw.check = inpt;

            dsw.construct();
		}

		tmp = document.getElementById("payment_block");

		if (tmp != null) {
		    var payment = new param_swap_class(tmp);
		    payment.construct();
        }
		
		var tmpb = document.getElementById("user_login_do_block");
		inp = document.getElementById("user_login_do");
		
		if (tmpb != null && inp != null) {
			inp.onclick = function() { tmpb.style.display = this.checked ? "block" : "none"; }
			tmpb.style.display = inp.checked ? "block" : "none";
		}
		
		tmp = document.getElementById("shop_product_ico");
		tmp = document.getElementsByTagName("SPAN");
		
		for (f = 0; f < tmp.length; f++) {
		    var ico = tmp[f];
			switch (ico.className) {
				case "product_ico product_ico_action" :
					make_bubble(context.trans("Akční nabídka"), ico, null, "deflist_box deflist_box_small");
					break;
					
				case "product_ico product_ico_tip" :
					make_bubble(context.trans("Náš tip"), ico, null, "deflist_box deflist_box_small");
					break;
					
				case "product_ico product_ico_dop" :
					make_bubble(context.trans("Doporučujeme"), ico, null, "deflist_box deflist_box_small");
					break;
					
				case "product_ico product_ico_show" :
					make_bubble(context.trans("Tento produkt můžete vidět v showroomu v Praze."), ico, null, "deflist_box deflist_box_small");
					break;
			}
		}
		
		btn = document.getElementById("infobox_image");
		tmp = document.getElementById("infobox_container");
		inp = document.getElementById("cart_count_input");
		
		if (btn != null && tmp != null && inp != null) {
			g_sbox = new store_infobox(btn, tmp, inp);
		}
		
		btn = document.getElementById("platform_image");
		tmp = document.getElementById("platform_container");
		
		if (btn != null && tmp != null) {
			var plnf = new infobox_handler(btn, tmp);
			plnf.construct_infobox();
		}

		btn = document.getElementById("action_image");
		tmp = document.getElementById("action_container");
		
		if (btn != null && tmp != null) {
			var plnf = new infobox_handler(btn, tmp);
			plnf.construct_infobox();
		}
		
		btn = document.getElementById("collection_image");
		tmp = document.getElementById("collection_container");
		
		if (btn != null && tmp != null) {
			var plnf = new infobox_handler(btn, tmp);
			plnf.construct_infobox();
		}
		
		/*
		var news_a = document.getElementById("area_news_a");
		var news_b = document.getElementById("area_news_b");
		var news_c = document.getElementById("area_news_c");
		
		if (news_a != null && news_b != null && news_c != null) {
			inp = document.getElementById("news_agree");
			
			var dis_area_a = new ic_disable_class(news_a, true);
			var dis_area_b = new ic_disable_class(news_b, true);
			var dis_area_c = new ic_disable_class(news_c, true);
			
			dis_area_a.toggle_force(inp.checked);
			dis_area_b.toggle_force(inp.checked);
			dis_area_c.toggle_force(inp.checked);
			
			inp.onclick = function() {
				dis_area_a.toggle_force(this.checked);
				dis_area_b.toggle_force(this.checked);
				dis_area_c.toggle_force(this.checked);
			}
		}
		*/
		
		var f, img = null, box = null, box_b = null;
		
		if ((box = document.getElementById("filter_box")) != null) {
			g_fh = new filter_handle(box);
		}
		if ((box = document.getElementById("main_img_list")) != null && (box_b = document.getElementById("main_img_space")) != null) {
			img = new image_list_class(box, box_b);
			img.construct();
		}
		if ((box = document.getElementById("error_box_main")) != null) {
			var wnd = new error_wnd();
			wnd.construct(box, context.trans("Beru na vědomí"));
		}
		if ((box = document.getElementById("info_box_main")) != null) {
			var wnd = new error_wnd();
			wnd.construct(box, context.trans("Beru na vědomí"), null, "error_box_float_info");
		}
		if ((box = document.getElementById("variant_level1no")) != null) {
			
			g_vlist = new ic_variant_list();
			var point = 1, brk = false;
			do {
				g_vlist.add_box(box);
				point++;
				box = document.getElementById("variant_level" + point + "no");
				if (!brk && box == null) {
					box = document.getElementById("cart_code_self_input");
					brk = true;
				}
			} while (box != null);
			
			var layer_ID = null, before_layer_ID = null;
			
			g_vlist.set_layer_element("product_layer_ID", "product_before_layer_ID");
			g_vlist.construct(before_layer_ID);
			
		} else if ((box = document.getElementById("cart_code_self_input")) != null) {
			if (box.tagName.toUpperCase() == "SELECT") {
				g_vlist = new ic_variant_list();
				g_vlist.add_box(box);
				
				g_vlist.set_layer_element("product_layer_ID", "product_before_layer_ID");
				g_vlist.construct();
			}
		}
		if ((box = document.getElementById("cart_panel")) != null) {
			g_cp = new cart_panel_class();
			g_cp.construct(box,
				document.getElementById("cart_panel_content"),
				document.getElementById("cart_submit_input"),
				document.getElementById("cart_code_self_input"),
				document.getElementById("cart_count_input"),
				document.getElementById("cart_panel_title"),
				document.getElementById("cart_panel_info"),
				document.getElementById("cart_panel_info2"),
				document.getElementById("cart_panel_price"),
				document.getElementById("cart_panel_price2")
			);
		}
		if ((box = document.getElementById("image_line")) != null && (box_b = document.getElementById("image_right")) != null) {
			g_isw = new image_swap_class(box, box_b);
			g_isw.construct();
		}
		if ((box = document.getElementById("nlist")) != null && (box_b = document.getElementById("nmenu")) != null) {
			g_news = new news_list(box, box_b);
			g_news.construct();
		}
		
		if ((box = document.getElementById("filter_box_ext")) != null) {
			g_filter = new filter_class(box);
			g_filter.construct();
		}
		
		
		if (window.parent == null && (box = document.getElementById("adv_popup")) != null) {
		    var tbn = new title_banner(box);
		    tbn.construct();
        }
        /*
        if ((box = document.getElementById("roof_banner")) != null) {
            g_roofb = new roof_banner(box);
            g_roofb.construct();
        }
        */
		
		// openable
		var hf, op = document.getElementsByTagName("DIV");
		for (f = 0; f < op.length; f++) {
			if (op[f].className == "openable openable_opened") {
				hf = op[f].getElementsByTagName("A");
				
				hf[0].onclick = hf[1].onclick = function() {
					var sf, sop = document.getElementsByTagName("DIV");
					for (sf = 0; sf < sop.length; sf++) 
						if (sop[sf] !== this.parentNode && sop[sf].className == "openable openable_opened") sop[sf].className = "openable";
					
					if (this.parentNode.className == "openable openable_opened") this.parentNode.className = "openable";
					else this.parentNode.className = "openable openable_opened";
				}
				
				op[f].className = "openable";
			}
		}
		
		// deflist
		g_dcol = new deflist_collector();
		g_dcol.construct();
		
		// ochrana
		var boxes = new Array();
		boxes[0] = document.getElementById("ochrana-osobnich-dat");
		boxes[1] = document.getElementById("ochrana-osobnich-dat-2");
		
		for (f = 0; f < boxes.length; f++) {
			box = boxes[f];
			if (box != null) {
				box.onclick = function(trgEvent) {
					cancelEvent(trgEvent == null ? window.event : trgEvent, true);
					window.open(this.href, 'ochr', 'width=1000,height=550,toolbar=0,statusbar=0,menubar=0');
					return false;
				}
			}
		}
		
		// tlacitka zpet
		hf = document.getElementsByTagName("A");
		for (f = 0; f < hf.length; f++) {
			if (hf[f].className == "back_link") {
				hf[f].onclick = function(trgEvent) {
					cancelEvent(trgEvent == null ? window.event : trgEvent, true);
					history.go(-1);
					return false;
				}
			}
		}
		
		// titulka
		if ((box = document.getElementById("title_menu_el")) != null) {
			g_tm = new title_menu_handler(document.getElementById("title_menu_el"));
			g_tm.construct();
			
			// skryti kontejneru
			var sf, pos, els = document.getElementsByTagName('*'), tblocks = new Array();
			for (sf = 0; sf < els.length; sf++) {
				if ((pos = els[sf].className.indexOf("title_show_")) != -1) {
					var leaf = els[sf].className.substr(pos + 11);
					if ((tblocks[leaf] = document.getElementById("title_block_" + leaf)) != null) {
						
						tblocks[leaf] = make_bubble(tblocks[leaf].innerHTML, els[sf], tblocks[leaf]);
						
					}
				}
			}
		}
		
		// bubliny po strance
		var tmp = document.getElementsByTagName("div"), divs = new Array(), stack = new Array();
		for (f = 0; f < tmp.length; f++) {
			if (tmp[f].className == "editable_text_block") {
				divs[divs.length] = tmp[f];
				stack[stack.length] = tmp[f];
			}
		}
		
		var current = null, k_el = new Array(), sh_el = new Array();
		while (stack.length > 0) {
			current = stack.pop();
			
			if (current.className.indexOf("key_") != -1) k_el[k_el.length] = current;
			else if (current.className.indexOf("show_") != -1) sh_el[sh_el.length] = current;
			
			for (f = 0; f < current.childNodes.length; f++)
				if (current.childNodes[f].nodeType == 1) stack[stack.length] = current.childNodes[f];
		}
		
		for (f = 0; f < k_el.length; f++) {
			var sf, k_val = k_el[f].className.substr(k_el[f].className.indexOf("key_") + 4);
			for (sf = 0; sf < sh_el.length; sf++) {
				var sh_val = sh_el[sf].className.substr(sh_el[sf].className.indexOf("show_") + 5);
				
				if (sh_val == k_val) {
					make_bubble(sh_el[sf].innerHTML, k_el[f], sh_el[sf], null, true, true);
				}
			}
		}
		
		// image box
		g_iCol = new image_box_collector();
        g_iCol.construct();
		
		// rest
		for (f = 0; f < g_lh.length; f++) {
			g_lh[f].construct();
		}
		
		g_fcl = new fav_class();
		
		if ((box = document.getElementById("item_list_container")) != null) g_fcl.add_container(box);
		
		g_sfcl = new fav_simple_class();
		
		//g_gp = new gallery_parser();
		//g_gp.construct();
		
		motion();
		evt_page_load();
	}
	
	function evt_page_load() { }
	

