var openerflag = 0;
function initAutoScalingNav(a) {
	function c(i) {
		for (var j = 0, h = 0; h < i.length; h++) j += i[h].width;
		return j
	}
	if (!a.menuId) a.menuId = "main-nav";
	if (!a.tag) a.tag = "a";
	if (!a.spacing) a.spacing = 0;
	if (!a.constant) a.constant = 0;
	if (!a.minPaddings) a.minPaddings = 0;
	if (!a.liHovering) a.liHovering = false;
	if (!a.sideClasses) a.sideClasses = false;
	var e = document.getElementById(a.menuId);
	if (e) {
		for (var b = e.getElementsByTagName("li"), f = [], g = [], d = 0, l = 0; d < b.length; d++) {
			if (b[d].parentNode == e) {
				var k = b[d].getElementsByTagName(a.tag).item(0);
				f.push(k);
				f[l++].width = k.offsetWidth;
				g.push(b[d])
			}
			if (a.liHovering) {
				b[d].onmouseover = function () {
					this.className += " hover"
				};
				b[d].onmouseout = function () {
					this.className = this.className.replace("hover", "")
				}
			}
		}
		e = e.clientWidth - f.length * a.spacing - a.constant;
		if (c(f) < e) {
			for (d = 0; c(f) < e; d++) {
				f[d].width++;
				if (d >= f.length - 1) d = -1
			}
			for (d = 0; d < f.length; d++) f[d].style.width = f[d].width + "px"
		} else if (a.minPaddings > 0) for (d = 0; d < f.length; d++) f[d].style.width = f[d].width + a.minPaddings * 2 + "px"
	}
	if (a.sideClasses) {
		g[0].className += " first-child";
		g[g.length - 1].className += " last-child"
	}
}
function initMenu() {
	var a = document.getElementById("nav");
	if (a) {
		var c = a.getElementsByTagName("a"),
		e = a.getElementsByTagName("li");
		function b() {
			for (var f = 0; f < e.length; f++) e[f].className = e[f].className.replace("hover", "")
		}
		for (a = 0; a < c.length; a++) {
			c[a].onmouseover = function () {
				b();
				if (this.parentNode.parentNode.className.indexOf("hover") == -1) this.parentNode.parentNode.className += " hover"
			};
			c[a].onmouseout = function () {
				b()
			}
		}
	}
}
function hideFormText() {
	var a = document.getElementsByTagName("input"),
	c = document.getElementsByTagName("textarea"),
	e = [],
	b;
	if (a) for (b = 0; b < a.length; b++) if ((a[b].type == "text" || a[b].type == "password") && (a[b].value == "\u041d\u0430\u0439\u0442\u0438..." || a[b].value == "\u0418\u0441\u043a\u0430\u0442\u044c..." || a[b].value == "E-mail")) {
		a[b].index = b;
		e[b] = a[b].value;
		a[b].onfocus = function () {
			if (this.value == e[this.index]) this.value = ""
		};
		a[b].onblur = function () {
			if (this.value == "") this.value = e[this.index]
		}
	}
	if (c) for (b = 0; b < c.length; b++) {
		c[b].index = b;
		e["txt" + b] = c[b].value;
		c[b].onfocus = function () {
			if (this.value == "\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435") this.value = ""
		};
		c[b].onblur = function () {
			if (this.value == "") this.value = e["txt" + this.index]
		}
	}
}
function initPopup(a, c) {
//alert(1);
	function e() {
		$("#errors").slideUp(0);
		if (openerflag == 1) {
			$.browser.msie ? $(a).css({
				display: "none"
			}) : $(a).css({
				display: "none"
			}).animate({
				opacity: 0
			});
			$(b).animate({
				opacity: 0
			},
			400, function () {
				$(b).css({
					display: "none"
				});
				openerflag = 0;
				$.browser.version < 7 && $("#wrapper select").css("visibility", "visible")
			})
		}
	}
	var b = $(".overlayer");
	$(b).css({
		opacity: 0
	});
	$.browser.msie ? $(a).css({
		display: "none"
	}) : $(a).css({
		display: "none"
	}).css({
		opacity: 0
	});
	$(c).click(function () {
		var f = $("#" + this.rel),
		g = 0;
		g = document.documentElement.scrollTop > document.body.scrollTop ? document.documentElement.scrollTop: document.body.scrollTop;
		$.browser.msie && $.browser.version < 7 && $("#wrapper select").css("visibility", "hidden");
		$(b).css({
			display: "block",
			height: document.documentElement.scrollHeight + 100
		}).animate({
			opacity: 0.5
		},
		400, function () {
			$.browser.msie ? $(f).css({
				display: "block",
				top: 60 + g,
				"margin-left": -$(f).width() / 2
			}) : $(f).css({
				display: "block",
				top: 60 + g,
				"margin-left": -$(f).width() / 2
			}).animate({
				opacity: 1
			},
			400);
			openerflag = 1
		});
		var d = $(a).find("a.close");
		$(d).click(function () {
			//alert(1);
			e();
			return false
		});
		$(b).click(function () {
			e();
			return false
		});
		$("a.auction-choose").click(function () {
			e();
			return false
		});
		$("div.captcha-pic").html() || $("input[type=button].refresh").click();
		return false
	})
}
function initTabs() {
	$("ul.tabset > li > a").each(function () {
		$(this).hasClass("active") ? $($(this).attr("href")).removeClass("hidden") : $($(this).attr("href")).addClass("hidden");
		$(this).click(function () {
			var a = $(this);
			a.parents("ul.tabset").find("li a").each(function () {
				$(this).removeClass("active");
				$($(this).attr("href")).addClass("hidden")
			});
			a.addClass("active");
			$(a.attr("href")).removeClass("hidden");
			return false
		})
	})
}
var transparentImage = "images/none.gif";
function fixTrans() {
	if (typeof document.body.style.maxHeight == "undefined") {
		var a = document.getElementsByTagName("img"),
		c;
		for (c = 0; c < a.length; c++) {
			if (a[c].src.indexOf(transparentImage) != -1) return;
			if (a[c].src.indexOf(".png") != -1) {
				var e = a[c].src;
				a[c].src = transparentImage;
				a[c].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + e + "',sizingMethod='scale')";
				a[c].style.display = "block"
			}
		}
	}
}
document.all && !window.opera && attachEvent("onload", fixTrans);
function initLinks() {
	var a = $(".overlayer");
	$(".quick-links-popup").css({
		"margin-left": -$(".quick-links-popup").width() / 2
	});
	$(".btn-quick-links").click(function () {
		if ($.browser.msie && $.browser.version < 7) {
			$(".quick-links-popup").css({
				display: "block"
			});
			$("#wrapper select").css("visibility", "hidden")
		} else $(".quick-links-popup").slideDown(200);
		$(a).css({
			display: "block",
			height: document.documentElement.scrollHeight
		});
		$(a).click(function () {
			if ($.browser.msie && $.browser.version < 7) {
				$(".quick-links-popup").css({
					display: "none"
				});
				$("#wrapper select").css("visibility", "visible")
			} else $(".quick-links-popup").slideUp(200);
			$(a).css({
				display: "none"
			})
		});
		return false
	})
};
