function browseIt() {
	this.ver = navigator.appVersion.toLowerCase();
	this.agent = navigator.userAgent.toLowerCase();
	this.vendor = (navigator.vendor) ? navigator.vendor.toLowerCase() : '';
	this.dom = document.getElementById ? 1 : 0;
	this.opera = (this.agent.indexOf("opera")>-1 && document.getElementById) ? 1 : 0;
	this.opera7 = (this.opera && parseInt(navigator.appVersion) >= 7) ? 1 : 0;
	this.safari = (this.agent.indexOf("applewebkit")>-1 || this.vendor.indexOf("apple")>-1) ? 1 : 0;
	this.ie = (/*this.ver.indexOf("msie")>-1 && */this.dom &&  ('undefined' !== typeof window.onbeforeunload) && !this.safari && !this.opera) ? 1 : 0;
	this.macOS = (this.agent.indexOf("mac") > -1) ? 1 : 0;
	this.mac = (this.macOS && parseInt(this.ver) >= 7) ? 1 : 0;
	this.moz = (this.agent.indexOf("gecko")>-1 && !this.safari) ? 1 : 0;
	this.ns6 = (this.dom && this.agent.indexOf("netscape")>-1 && parseInt(this.ver) >= 5) ? 1 : 0;
	this.b = (this.ie || this.ns6 || this.opera7 || this.mac || this.moz || this.safari || this.dom);
	return this;
}
// ----------- Login Form Proceed ----------
function showFloatForm(event, formAct) {

	var floatForm = Get_DOM_Node('mainFloatForm'); if (!floatForm) return true;

	var X = f_scrollLeft() + Math.round(f_clientWidth()/2);
	var Y = f_scrollTop() + Math.round(f_clientHeight()/2);

	Fire_PopupDocLayer('mainFloatForm', event, 'click', X, Y, 2000, closeFloatForm, (stopALoginFormutoClose = true));

	var alphaBg = Get_DOM_Node('mainFloatFormAlphaBg');
	alphaBg.style.width = document.body.scrollWidth + 'px';
	alphaBg.style.height = document.body.scrollHeight + 'px';
	Change_LayerVisibility('mainFloatFormAlphaBg', true, false);

	if(document.forms['login']) {
		var float_form = document.forms['login'];
		if(float_form.login) {
			if(float_form.login.select) {
				setTimeout("document.forms['login'].login.select();", 50);
			}
			//setTimeout("document.forms['login'].login.focus();", 50);
		}
		if(float_form.url) {
			float_form.url.value = (formAct) ? formAct : '';
		}
	}

	Attach_EventListener(document, 'keyup', closeFloatFormEscape);

	return false;
}
function closeFloatForm(event) {
	Change_LayerVisibility('mainFloatForm', false, true);
	Change_LayerVisibility('mainFloatFormAlphaBg', false, true);
	return false;
}
function closeFloatFormEscape(event) {
	if (event.keyCode==27) {
		closeFloatForm(event);
		Detach_EventListener(document, 'keyup', closeFloatForm);
	}
	return false;
}
// ------------ End Login Form Proceeding --

function Change_SearchTarget(index) {
	var d = ["bsa", "fsp", "fsc"];
	var i = 0, j, e, a;
	var f = document.forms.sform;
	var sTargets =
		[
			{href:"http://search.bigmir.net/", text:"Украина", hidden:"", divs:[0]},
			{href:"http://search.bigmir.net/?t=w", text:"мир", hidden:"w", divs:[0]},
			{href:"http://search.bigmir.net/?t=f", text:"файлы", hidden:"f", divs:[0]/*divs:[1, 2]*/},
			{href:"http://shop.bigmir.net/search/", text:"товары", hidden:"", divs:[0]}
		];
	var container = document.getElementById("searchTabs");

	container.innerHTML = '<li class="gray" style="padding-top:6px;">Поиск</li>';
	for (var i = 0; i < sTargets.length; i++) {
		if (i == index) {
			f.action = sTargets[i].href;
			f.t.value = sTargets[i].hidden;
			container.innerHTML += "<li class=\"current\"><span><b>"+sTargets[i].text+"</b></span></li>";
			if (Trim_Str(f.q.value)) {
				f.submit();
			}
			a = [];
			for (j = 0; j < sTargets[i].divs.length; j++) {
				a[sTargets[i].divs[j]] = 1;
			}
			for (j = 0; j < d.length; j++) {
				e = document.getElementById(d[j]);
				if (e) {
					if (a[j]) {
						e.style.visibility = "visible", e.style.display = "block";
					} else {
						e.style.visibility = "hidden", e.style.display = "none";
					}
				}
			}
		} else {
			container.innerHTML += "<li><a href=\""+sTargets[i].href+"\" title=\""+sTargets[i].text+"\" onClick=\"javascript:return Change_SearchTarget("+i+")\">"+sTargets[i].text+"</a></li>";
		}
	}
	return false;
}
// ----------------------------
function showToolTip(event, action, inner_html, X, Y) {
	if (mouseJustOver == 2)
	{	
		return false;
	}
	var layer = Get_DOM_Node('TopCatTipTextId');
	if(layer) {
		layer.innerHTML = inner_html;
		Fire_PopupDocLayer('TopCatTipContId', event, action, X, Y);
		var pos = Get_DOM_Node('TopCatTipContId');
		newY = Y - pos.offsetHeight;
		pos.style.left = X + 10 + 'px';
		pos.style.top = newY + 'px';
		pos.style.left = X + 'px';
	}
}

// ---------- GLOBAL JavaScript Variables Declaration Section ----
var px = window.opera ? "" : "px";
var b = new browseIt();
var mouseJustOver = 0;