
	// --- fav_simple_class ---

	function fav_simple_class() {
		this.wnd = null;
		this.lang = null;
		this.lock = false;
		this.href = null;
	}
	
	fav_simple_class.prototype.toggle = function(ident, href) {
		if (!this.lock) {
			this.lock = true;
			this.href = href;
			
			// g-analytics
			if (pageTracker != null) pageTracker._trackPageview("/web_action/favourite"); 
			// ---------
			
			var self = this;
			var struct = new structure_class();
			struct.map("head/major", "shop_fav");
			struct.map("head/productID", ident);
			struct.map("head/lang", this.lang);
			
			context.request("shop_fav", null, function(data, request) {
				if (self != null) self.evt_toggle(data, request);
			}, struct);
		}
	}
	
	fav_simple_class.prototype.evt_toggle = function(data, request) {
		var res;
		if ((res = request.get_response()) != null) {
			
			var self = this;
			var head = res[0]
			var body = res[1];
			
			var productName = null;
			var code_self = null;
			var msg = null;
			var el = body.getElementsByTagName("shop_product");
			if (el != null && el.length > 0) {
				productName = context.sub_element_value(el[0], "productName");
				code_self = context.sub_element_value(el[0], "code_self");
			}
			
			switch (parseInt(context.sub_element_value(body, "fav_flag"))) {
				case 1 :
					msg = "<ul><li>položka `" + productName + "` (" + code_self + ") <strong>byla přidána</strong> k oblíbeným</li></ul>";
					break;
				
				case 0 :
					msg = "<ul><li>položka `" + productName + "` (" + code_self + ") <strong>byla odebrána</strong> z oblíbených</li></ul>";
					break;
			}
			
			this.wnd = new error_wnd();
			this.wnd.construct(document.createElement("DIV"), "beru na vědomí", msg, "error_box_float_info");
			this.wnd.ondone = function() { 
				self.wnd = null; 
				document.location.href = self.href == null ? document.location.href : self.href;
			}
			
			this.lock = false;
		}
	}