
	var isIE = (navigator.appName == "Microsoft Internet Explorer");
	var isFF = (!isIE && !(navigator.appVersion.indexOf("MSIE") > -1));
	var isOPR = (navigator.userAgent.indexOf("Opera") != -1);
	var isIE6 = navigator.userAgent.indexOf("MSIE 6.0") >= 0;
	var isIE7 = navigator.userAgent.indexOf("MSIE 7.0") >= 0;
	var isIE8 = navigator.userAgent.indexOf("MSIE 8.0") >= 0;
	if (isOPR) {
		isIE = false;
	}

	var today = new Date();
	var lastId = today.getTime();
	function getNewId() {
		lastId++;
		return "window_id_" + lastId;
	}

	function checkTagForm() {
		if (document.getElementById('ac_update').style.display == 'block')
			return false;
		else
			return true;
	}

	function autoCompleteInit(rubric) {
		try {
			new Ajax.Autocompleter('tag', 'ac_update', '/api/lenta/_autocomplete_result.html?rubric_id=' + rubric, {afterUpdateElement : function() {
				return false
			}});
		}
		catch (e) {
		}
	}

	function sliderInit() {
		try {
			new Control.Slider('handle_track', 'ruller_track', {sliderValue:1,onSlide:function(v) {
				moveLine(v)
			}});
		}
		catch (e) {
		}
	}

	function vacancyTab(obj) {
		id = obj.id.replace(/z(1|2|3|4|5)([0-9]*)$/, '$2');
		z = obj.id.replace(/z(1|2|3|4|5)([0-9]*)$/, '$1');

		try {
			document.getElementById('z1' + id).className = 'zakladka_sr';
		} catch (e) {
		}
		try {
			document.getElementById('z2' + id).className = 'zakladka_sr';
		} catch (e) {
		}
		try {
			document.getElementById('z3' + id).className = 'zakladka_sr';
		} catch (e) {
		}
		try {
			document.getElementById('z4' + id).className = 'zakladka_sr';
		} catch (e) {
		}
		try {
			document.getElementById('z5' + id).className = 'zakladka_sr';
		} catch (e) {
		}

		xz = Math.round(z) + 1;
		while (xz <= 5) {
			try {
				document.getElementById('z' + xz + id).className = 'zakladka_sl';
			} catch (e) {
			}
			xz++
		}


		try {
			document.getElementById('zt1' + id).style.display = 'none';
		} catch (e) {
		}
		try {
			document.getElementById('zt2' + id).style.display = 'none';
		} catch (e) {
		}
		try {
			document.getElementById('zt3' + id).style.display = 'none';
		} catch (e) {
		}
		try {
			document.getElementById('zt4' + id).style.display = 'none';
		} catch (e) {
		}
		try {
			document.getElementById('zt5' + id).style.display = 'none';
		} catch (e) {
		}

		try {
			document.getElementById('z' + z + id).className = 'zakladka_a';
		} catch (e) {
		}
		try {
			document.getElementById('zt' + z + id).style.display = 'block';
		} catch (e) {
		}
	}


	function moveLine(v) {
		//       alert(document.getElementById('dates').offsetWidth);
		var newMargin = -1 * (document.getElementById('num_dates').value * 26 - document.getElementById('dates').offsetWidth) * (1 - v);
		newMargin = newMargin.toString() + 'px';
		document.getElementById('scroll_dates').style.marginRight = newMargin;
	}


	function fotoFull(file, w, h) {
		var infoWin = new Dialog.info({url: '/win/foto.html?file=' + file, options: {method: 'get'}},
				{windowParameters: {className: "nashi", width:w, height:h, draggable:false, resizable: false}}
		);
	}
	function fotoFree(file, title, w, h) {
		return false;
		try {
			var infoWin = new Dialog.info({url: '/win/freefoto.html?filename=' + file + '&title=' + encodeURIComponent(title), options: {method: 'get'}},
					{windowParameters: {className: "nashi", width:w, height:h, draggable:false, resizable: false}}
			);
		} catch (e) {
		}
	}

	function advertFull(id) {
		var infoWin = new Dialog.info({url: '/win/adv.html?id=' + id, options: {method: 'get'}},
				{windowParameters: {className: "nashi", width:400, height:300, draggable:false, resizable: false}}
		);
	}

	function videoFull(fileId, w, h) {
		tmpWin = getNewId();
		win = new Window(tmpWin, {url:'/win/video.html?id=' + fileId, classname:'nashi', width:w, height:h, scrolling:'no', minimizable:false, maximizable:false, resizable:false});
		win.setDestroyOnClose();
		win.setZIndex(10);
		win.toFront();
		win.showCenter('modal');
	}


	function getWay(cl) {
		switch (cl) {
			case 'f1':
				return 60;
			case 'f2':
				return 40;
			case 'f3':
				return 50;
			case 'f4':
				return 35;
		}
	}
	function getZIndex(cl) {
		switch (cl) {
			case 'f1':
				return 4;
			case 'f2':
				return 3;
			case 'f3':
				return 2;
			case 'f4':
				return 1;
		}
	}

	function f_show(obj) {
		if (isOPR) {
			obj.style.zIndex = 10;
			return false;
		}
		if (!obj.effectMove && obj.style.zIndex != 10) obj.effectMove = Effect.MoveBy(obj, 0, getWay(obj.className), {afterFinish: function() {
			obj.style.zIndex = 10;
			f_left(obj)
		}, duration: 0.3});
	}

	function f_hide(obj) {
		if (isOPR) {
			obj.style.zIndex = getZIndex(obj.className);
			return false
		}
		if (!obj.effectMove) obj.effectMove = Effect.MoveBy(obj, 0, getWay(obj.className), {afterFinish: function() {
			obj.style.zIndex = getZIndex(obj.className);
			f_left(obj)
		}, duration: 0.3});
	}

	function f_left(obj) {
		new Effect.MoveBy(obj, 0, -getWay(obj.className), {afterFinish: function() {
			obj.effectMove = '';
		}, duration: 0.3});
	}


	var a = 0;
	var b = -550;
	var t;
	var tf;
	function line() {
		document.getElementById('f').style.bottom = '-550px'
		document.getElementById('bl').style.display = 'block'
		a += 5;
		document.getElementById('bl').style.width = a + 'px'
		if (a < 270) {
			t = setTimeout('line()', 1)
		} else {
			clearTimeout(t);
			form();
			a = 0;
		}
	}
	function form() {
		document.getElementById('f').style.bottom = b + 'px'
		b += 5
		if (b < 0) {
			tf = setTimeout('form()', 1)
		} else {
			clearTimeout(tf);
			b = -550
		}
	}


	var xPos = 0;
	var yPos = 0;
	var showProgress = true;


	if (isFF) {
		document.onmousedown = function(e) {
			xPos = e.pageX;
			yPos = e.pageY;
		}
	}
	else {
		document.onmousedown = function() {
			xPos = event.clientX + document.body.scrollLeft;
			yPos = event.clientY + document.body.scrollTop;
		}
	}


	function startProgress() {
		document.getElementById('cursorProgress').style.left = xPos + 15;
		document.getElementById('cursorProgress').style.top = yPos + 0;
		document.onmousemove = moveProgressImage;
		document.getElementById('cursorProgress').style.display = "block";
	}


	function moveProgressImage() {
		if (isFF) {
			document.onmousemove = function(e) {
				document.getElementById('cursorProgress').style.left = e.pageX + 15;
				document.getElementById('cursorProgress').style.top = e.pageY + 0;
			}
		}
		else {
			document.getElementById('cursorProgress').style.posLeft = event.clientX + document.body.scrollLeft + 15;
			document.getElementById('cursorProgress').style.posTop = event.clientY + document.body.scrollTop + 0;
		}
		return false;
	}

	function stopProgress() {
		document.getElementById('cursorProgress').style.display = "none";
		document.onmousemove = null;
	}


	if (isOPR) {
		isIE = false;
	}

	var firstStarted = false;
	var secondStarted = false;
	var toSub = false;
	var popOpened = false;
	var popupCount = 0;

	var firstTop = 0;
	var secondTop = 0;
	var thirdTop = 0;

	function clearSelected() {
		firstStarted = false;
		secondStarted = false;
		firstTop = 0;
		secondTop = 0;
		thirdTop = 0;
	}


	function getAbsolutePos(el) {
		var r = { x: el.offsetLeft, y: el.offsetTop };
		if (el.offsetParent) {
			var tmp = getAbsolutePos(el.offsetParent);
			r.x += tmp.x;
			r.y += tmp.y;
		}
		return r;
	}


	function askQuestion(name, contact, text, page) {
		if (!/[А-яA-z]/.exec(name.value)) {
			alert('Укажите своё имя!')
			name.focus();
			return false;
		}
		if (!/[А-яA-z]/.exec(contact.value)) {
			alert('Укажите свои координаты!')
			contact.focus();
			return false;
		}
		if (!/[А-яA-z]/.exec(text.value)) {
			alert('Напишите ваш вопрос!')
			text.focus();
			return false;
		}
		document.getElementById('ask_form').style.display = 'none';
		lookup({url:'/feedback.api.php', postFunction:'window.setTimeout("smartCloseMessageSender();", 1500);', values:'name=' + encodeURIComponent(name.value) + '&contact=' + encodeURIComponent(contact.value) + '&text=' + encodeURIComponent(text.value) + '&page=' + encodeURIComponent(page.value), dest:'ans_form'});

		name.value = '';
		contact.value = '';
		text.value = '';
	}

	function sendToEmail(email) {
		if (!/^[A-z][A-z0-9._-]{1,30}[A-z0-9]?@[A-z][A-z0-9._-]{0,16}[A-z0-9]\.[A-z]{2,4}$/.exec(email))
			alert('Введённый вами адрес неправильный!');
		else
			lookup({url:'/feedback.api.php', values:'email=' + email, dest:'emailCont'});
	}


	function sendAnketa2() {
		if (!document.getElementById('a_title').value) {
			alert('Введите ваше имя!');
			document.getElementById('a_title').focus();
			return false;
		}
		if (!document.getElementById('a_org').value) {
			alert('Введите название организации!');
			document.getElementById('a_org').focus();
			return false;
		}
		if (!document.getElementById('a_email').value) {
			alert('Введите ваш email!');
			document.getElementById('a_email').focus();
			return false;
		}
		var working_time = new Object();
		working_time.address = document.getElementsByName('working_time[address][]');
		working_time.phone = document.getElementsByName('working_time[phone][]');
		working_time.time = document.getElementsByName('working_time[time][]');
		working_time.data = new Array();
		for (var i = 0; i < working_time.address.length; i++) {
			if (working_time.address[i].value && working_time.phone[i].value) {
				working_time.data[working_time.data.length] = 'working_time[address][]=' + working_time.address[i].value;
				working_time.data[working_time.data.length] = 'working_time[phone][]=' + working_time.phone[i].value;
				working_time.data[working_time.data.length] = 'working_time[time][]=' + working_time.time[i].value;
			}
		}
		if (working_time.data.length) {
			working_time.data = '&' + working_time.data.join('&');
		} else {
			alert('Вам необходимо указать координаты хотя бы одного офиса!');
			return false;
		}
		document.getElementById('job_form').action = '/work/feedback.anketas.html';
		document.getElementById('job_form').submit();
		//lookup({url:'/feedback.api.php',values:'anketas=1&title='+document.getElementById('a_title').value+'&org='+document.getElementById('a_org').value+'&description='+document.getElementById('a_description').value+'&email='+document.getElementById('a_email').value+'&site='+document.getElementById('a_site').value+'&card='+(document.getElementById('a_card').checked?'Y':'N')+working_time.data});
	}

	function sendAnketa() {
		if (!document.getElementById('a_title').value) {
			alert('Введите ваше имя!');
			document.getElementById('a_title').focus();
			return false;
		}
		if (!document.getElementById('a_org').value) {
			alert('Введите название организации!');
			document.getElementById('a_org').focus();
			return false;
		}
		if (!document.getElementById('a_description').value) {
			alert('Введите описание деятельности!');
			document.getElementById('a_description').focus();
			return false;
		}
		if (!document.getElementById('a_address').value) {
			alert('Введите фактический адрес!');
			document.getElementById('a_address').focus();
			return false;
		}
		if (!document.getElementById('a_phone').value) {
			alert('Введите ваш телефон!');
			document.getElementById('a_phone').focus();
			return false;
		}
		if (!document.getElementById('a_email').value) {
			alert('Введите ваш email!');
			document.getElementById('a_email').focus();
			return false;
		}

		lookup({url:'/feedback.api.php', values:'anketas=1&title=' + document.getElementById('a_title').value + '&org=' + document.getElementById('a_org').value + '&description=' + document.getElementById('a_description').value + '&address=' + document.getElementById('a_address').value + '&phone=' + document.getElementById('a_phone').value + '&email=' + document.getElementById('a_email').value + '&site=' + document.getElementById('a_site').value + '&card=' + (document.getElementById('a_card').checked ? 'Y' : 'N'), dest:'rr'});

		alert('Ваша заявка отправлена, спасибо!');

		document.getElementById('a_title').value = '';
		document.getElementById('a_org').value = '';
		document.getElementById('a_description').value = '';
		document.getElementById('a_address').value = '';
		document.getElementById('a_phone').value = '';
		document.getElementById('a_email').value = '';
		document.getElementById('a_site').value = '';
		document.getElementById('a_card').checked = false;

		document.getElementById('ank_im').alt = '+';
		document.getElementById('ank_im').src = '/images/plus.gif';
		document.getElementById('bl').style.display = 'none';
		document.getElementById('h2').style.display = 'none';

	}

	function sendToPhone(code1, code2, code3, code4) {
		phone = code1.toString() + code2.toString() + code3.toString() + code4.toString();
		if (
				!/^[0-9]{3,5}$/.exec(code1) ||
						!/^[0-9]{1,3}$/.exec(code2) ||
						!/^[0-9]{1,2}$/.exec(code3) ||
						!/^[0-9]{1,2}$/.exec(code4)
				)
			alert('Введённый вами телефон неправильный!');
		else
			lookup({url:'/feedback.api.php', values:'phone=' + phone, dest:'phoneCont'});
	}

	function smartCloseMessageSender() {
		if (document.getElementById('ans_form').style.display == 'block') {
			document.getElementById('f_q').style.display = 'none';
			document.getElementById('deal').style.display = 'block';
			document.getElementById('ans_form').style.display = 'none';
			document.getElementById('ask_form').style.display = 'block';
		}
	}

	function closeMessageSender() {
		document.getElementById('f_q').style.display = 'none';
		document.getElementById('deal').style.display = 'block';

		document.getElementById('ans_form').style.display = 'none';
		document.getElementById('ask_form').style.display = 'block';
	}

	function openMessageSender() {
		document.getElementById('f_q').style.display = 'block';
		document.getElementById('deal').style.display = 'none';

		document.getElementById('ans_form').style.display = 'none';
		document.getElementById('ask_form').style.display = 'block';
	}

	function secDivAdjust(res) {
		if (res) {
			try {
				document.getElementById('second').id = 'second2';
			}
			catch (e) {
			}
			try {
				document.getElementById('sec_br').style.display = 'none';
			}
			catch (e) {
			}
		}
	}

	function activateFirst(obj, id, sw) {
		document.getElementById('first_name').innerHTML = '<span>1</span>категория';

		if (!sw) {
			try {
				document.getElementById('sec_br').style.display = 'block';
			}
			catch (e) {
			}
		}
		try {
			document.getElementById('fraze').innerHTML = '';
			document.getElementById('fraze').style.position = 'absolute';
			document.getElementById('fraze').style.pixelLeft = '0px';
			document.getElementById('fraze').style.pixelTop = '0px';
		}
		catch (e) {
		}

		closeMessageSender();

		try {
			if (!sw) document.getElementById('second2').id = 'second';
		}
		catch (e) {
		}

		if (firstStarted == true) document.getElementById('first_' + selFirstObj.id).innerHTML = selFirstObj.innerHTML;

		if (!obj)
			obj = document.getElementById('category_' + id);
		selFirstObj = {innerHTML:obj.parentNode.innerHTML, id:id};

		firstSel = obj.parentNode;
		pos = getAbsolutePos(firstSel);
		firstTop = pos.y;


		var firstTabsNodesList = firstSel.parentNode.childNodes;
		for (i = 0; i < firstTabsNodesList.length; i++) {
			if (firstTabsNodesList[i].nodeName == 'DIV') {
				firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_unbord', 'right_bord');
				//firstTabsNodesList[i].style.paddingBottom = false;
				// firstTabsNodesList[i].style.paddingTop = false;
				firstTabsNodesList[i].style.paddingBottom = '12px';
			}
		}
		obj.parentNode.style.paddingBottom = '0px';
		obj.parentNode.style.paddingTop = '0px';
		obj.parentNode.innerHTML = '<table cellpadding="0" cellspacing="0" border="0" id="selected_f"><tr><td class="cell_arrow"><img alt=">" src="/images/arrow.gif" /></td><td class="cell_link">' + obj.innerHTML + '</td></tr></table>';
		firstStarted = true;
		document.getElementById('third').innerHTML = '';
		if (sw) return false;

		document.getElementById('third').innerHTML = '';
		topfunc = function() {
			lookup({url:'/tops.api.php', postFunction:'secDivAdjust(http.responseText); analizeThird(' + id + ')', values:'category_id=' + id, dest:'third'})
		};

		document.getElementById('second').innerHTML = '';
		if (toSub) {
			lookup({url:'/subcategories.api.php', postFunction:function(transport) {
				document.getElementById('second').innerHTML = transport.responseText + '<div id="second_banner"></div>';
				getSecondBanners(25, id);
				document.getElementById('subcategory_' + toSub).onclick();
			}, values:'id=' + id});
			toSub = false;
		}
		else {
	//              getSecondBanners(25, id);
			lookup({url:'/subcategories.api.php', values:'id=' + id, postFunction:function(transport) {
				document.getElementById('second').innerHTML = transport.responseText + '<div id="second_banner"></div>';
				getSecondBanners(25, id);
				topfunc()
			}});
		}
		secondStarted = false;

		try {
			document.getElementById('second').innerHTML = '<h3 class="col_name"><span>2</span>ещё</h3><div class="t_cats"><img alt="Часы" src="/images/wait.gif" class="wait"><span class="loading">идёт загрузка</span></div>';
		}
		catch (e) {
			document.getElementById('second2').innerHTML = '<h3 class="col_name"><span>2</span>ещё</h3><div class="t_cats"><img alt="Часы" src="/images/wait.gif" class="wait"><span class="loading">идёт загрузка</span></div>';
		}
	}

	var bannerCont = '';
	function bContent() {
		if (jQuery('#bs_content') && !bannerCont) {
			bannerCont = jQuery('#bs_content').html();
		}
	}

	var thirdBanner;
	function analizeThird(category_id) {
		category_id = typeof category_id == 'undefined' ? 0 : category_id;

		jQuery('#third .bs').remove();

		getThirdBanners(new Array(19, 12, 21, 22, 24), category_id);
	}

	var thirdBanner;

	function getThirdBanners(zones, category_id) {
		if (!zones.length) {
			return false;
		}
		zoneId = zones.shift();

		thirdBanner = null;

		var m3_u = (location.protocol == 'https:' ? 'https://adv.k-r-w.ru/www/delivery/ajs.php' : 'http://adv.k-r-w.ru/www/delivery/ajs.php');
		var m3_r = Math.floor(Math.random() * 99999999999);
		if (!document.MAX_used) {
			document.MAX_used = ',';
		}
		var url = '';
		url += m3_u;
		url += '?zoneid=' + zoneId;
		url += '[and]category_id=' + category_id;
		url += '[and]cb=' + m3_r;
		if (document.MAX_used != ',') {
			url += '[and]exclude=' + document.MAX_used;
		}
		url += document.charset ? '[and]charset=' + document.charset : (document.characterSet ? '[and]charset=' + document.characterSet : '');
		url += '[and]loc=' + escape(window.location);
		if (document.referrer) {
			url += '[and]referer=' + escape(document.referrer);
		}
		if (document.context) {
			url += '[and]context=' + escape(document.context);
		}
		if (document.mmm_fo) {
			url += '[and]mmm_fo=1';
		}
		// go!

		jQuery.ajax({
			type:"POST",
			url:"/api/cards.banners.api.php",
			data:"url=" + url,
			success:function(html) {
				if (html.length) {
					if (html.match(/^<iframe/i)) {
						if (jQuery("#third").html().length) {
							a = '<div class="bs" id="bs_content" style="text-align:center; margin-left:20px; position:relative; margin-bottom: 10px;"><div class="brd_banner" style="width: auto; display: inline-block; zoom: 0">' + html + '</div></div>';
						} else {
							a = '<div class="bs" id="bs_content" style="text-align:center; margin-left:20px; margin-top:50px; position:relative; margin-bottom: 10px;"><div class="brd_banner" style="width: auto; display: inline-block; zoom: 0">' + html + '</div></div>';
						}
						jQuery("#third").append(a);
						jQuery('#adv-iframe').height(jQuery('#second').height());
					} else {
						var a = html.substring(4, 15);
						eval(html);
						if (jQuery("#third").html().length) {
							a = '<div class="bs" id="bs_content" style="text-align:center; margin-left:20px; position:relative; margin-bottom: 10px;"><div class="brd_banner" style="width: auto; display: inline-block; zoom: 0">' + eval(a) + '</div></div>';
						} else {
							a = '<div class="bs" id="bs_content" style="text-align:center; margin-left:20px; margin-top:50px; position:relative; margin-bottom: 10px;"><div class="brd_banner" style="width: auto; display: inline-block; zoom: 0">' + eval(a) + '</div></div>';
						}
						jQuery("#third").append(a);
					}
				} else {
					bContent();
					if (!bannerCont) bannerCont = '';
				}
				if (zones.length) {
					getThirdBanners(zones, category_id);
				}
			}
		});

	}

	var secondBanner;
	function getSecondBanners(zoneId, category_id) {

		if (!zoneId) zoneId = 0;
		// prepare

		var m3_u = (location.protocol == 'https:' ? 'https://adv.k-r-w.ru/www/delivery/ajs.php' : 'http://adv.k-r-w.ru/www/delivery/ajs.php');
		var m3_r = Math.floor(Math.random() * 99999999999);
		if (!document.MAX_used) {
			document.MAX_used = ',';
		}
		var url = '';
		url += m3_u;
		url += '?zoneid=' + zoneId;
		url += '[and]cat_id=' + category_id;
		url += '[and]cb=' + m3_r;
		if (document.MAX_used != ',') {
			url += '[and]exclude=' + document.MAX_used;
		}
		url += document.charset ? '[and]charset=' + document.charset : (document.characterSet ? '[and]charset=' + document.characterSet : '');
		url += '[and]loc=' + escape(window.location);
		if (document.referrer) {
			url += '[and]referer=' + escape(document.referrer);
		}
		if (document.context) {
			url += '[and]context=' + escape(document.context);
		}
		if (document.mmm_fo) {
			url += '[and]mmm_fo=1';
		}
		// go!

		jQuery.ajax({
			type:"POST",
			url:"/api/cards.banners.api.php",
			data:"url=" + url,
			success:function(html) {
				var a;

				if (!html) return;

				if (html.match(/^<iframe/i)) {
					a = '<div class="bs" id="bs_content" style="margin-left:10px; position:relative; margin-bottom: 10px;"><div style="width: 300px;" class="brd_banner">' + html + '</div></div>';
				} else {
					var sa = html.substring(4, 15);

					eval(html);

					a = '<div class="bs" id="bs_content" style="margin-left:10px; position:relative; margin-bottom: 10px;"><div style="width: 300px;" class="brd_banner">' + eval(sa) + '</div></div>';
				}

				jQuery("#second_banner").append(a);
			}
		});

	}

	function activateSecond(obj, id, sw) {
		if (!sw) {
			try {
				document.getElementById('sec_br').style.display = 'none';
			}
			catch (e) {
			}
		}
		try {
			document.getElementById('fraze').innerHTML = '';
			document.getElementById('fraze').style.position = 'absolute';
			document.getElementById('fraze').style.pixelLeft = '0px';
			document.getElementById('fraze').style.pixelTop = '0px';
		}
		catch (e) {
		}

		closeMessageSender();
		jQuery("#second_banner").remove();

		try {
			if (!sw) document.getElementById('second').id = 'second2';
		}
		catch (e) {
		}

		if (secondStarted == true) document.getElementById('second_' + selSecondObj.id).innerHTML = selSecondObj.innerHTML;
		if (!obj)
			obj = document.getElementById('subcategory_' + id);
		selSecondObj = {innerHTML:obj.parentNode.innerHTML, id:id};

		if (document.documentElement.scrollTop > 285) self.scrollTo(0, 225);

		var firstTabsNodesList = firstSel.parentNode.childNodes;
		for (i = 0; i < firstTabsNodesList.length; i++) {
			if (firstTabsNodesList[i].nodeName == 'DIV') {
				firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_bord', 'right_unbord');
			}
		}
		var secondTabsNodesList = obj.parentNode.parentNode.childNodes;
		for (i = 0; i < secondTabsNodesList.length; i++) {
			if (secondTabsNodesList[i].nodeName == 'DIV') {
				secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('left_bord', 'left_unbord');
				secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('right_unbord', 'right_bord');
			}
		}

		obj.parentNode.innerHTML = '<div class="cell_link">' + obj.innerHTML + '</div>';
		secondSel = document.getElementById('second_' + selSecondObj.id);
		pos = getAbsolutePos(secondSel);
		secondTop = pos.y;
		firstOffset = secondTop - firstTop;


		pos = getAbsolutePos(firstSel);
		lastFirstOffset = pos.y;

		for (i = secondTabsNodesList.length - 1; i >= 0; i--) {
			if (secondTabsNodesList[i].nodeName == 'DIV') {
				pos = getAbsolutePos(secondTabsNodesList[i]);
				lastSecondOffset = pos.y;
				break;
			}
		}

		//   alert(lastFirstOffset+' '+lastSecondOffset);

		if (lastFirstOffset < lastSecondOffset)
			document.getElementById('last_sec').style.display = 'none';
		else
			document.getElementById('last_sec').style.display = 'block';

		if (firstOffset >= 0) /* -_ */
		{
			for (i = 0; i < secondTabsNodesList.length; i++) /* --> */
			{
				if (secondTabsNodesList[i].nodeName == 'DIV') {
					pos = getAbsolutePos(secondTabsNodesList[i]);
					tmpOffset = pos.y;
					if (tmpOffset <= secondTop && tmpOffset >= firstTop) {
						secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('left_unbord', 'left_bord');
					}
					else {
						secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('left_bord', 'left_unbord');
					}
				}
			}
			for (i = 0; i < firstTabsNodesList.length; i++) /* <-- */
			{
				if (firstTabsNodesList[i].nodeName == 'DIV') {
					pos = getAbsolutePos(firstTabsNodesList[i]);
					tmpOffset = pos.y;
					if (tmpOffset + firstTabsNodesList[i].offsetHeight <= secondTop + secondSel.offsetHeight && tmpOffset >= firstTop) {
						firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_unbord', 'right_bord');
					}
					else {
						firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_bord', 'right_unbord');
					}
				}
			}
			firstSel.className = firstSel.className.replace('right_unbord', 'right_bord');
			secondSel.className = secondSel.className.replace('left_unbord', 'left_bord');
		}
		else  /* _- */
		{
			for (i = 0; i < secondTabsNodesList.length; i++) /* --> */
			{
				if (secondTabsNodesList[i].nodeName == 'DIV') {
					pos = getAbsolutePos(secondTabsNodesList[i]);
					tmpOffset = pos.y;
					if (tmpOffset + secondTabsNodesList[i].offsetHeight <= firstTop && tmpOffset >= secondTop) {
						secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('left_unbord', 'left_bord');
					}
					else {
						secondTabsNodesList[i].className = secondTabsNodesList[i].className.replace('left_bord', 'left_unbord');
					}
				}
			}
			for (i = 0; i < firstTabsNodesList.length; i++) /* <-- */
			{
				if (firstTabsNodesList[i].nodeName == 'DIV') {
					pos = getAbsolutePos(firstTabsNodesList[i]);
					tmpOffset = pos.y;
					if (tmpOffset <= firstTop && tmpOffset >= secondTop) {
						firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_unbord', 'right_bord');
					}
					else {
						firstTabsNodesList[i].className = firstTabsNodesList[i].className.replace('right_bord', 'right_unbord');
					}
				}
			}
			firstSel.className = firstSel.className.replace('right_unbord', 'right_bord');
			secondSel.className = secondSel.className.replace('left_unbord', 'left_bord');
		}


		secondStarted = true;

		if (sw) return false;

		document.getElementById('third').innerHTML = '<h3 class="col_name"><span>3</span>организация</h3><div class="t_cats"><img alt="Часы" src="/images/wait.gif" class="wait"><span class="loading">идёт загрузка</span></div>';
		lookup({url:'/organizations.api.php', values:'id=' + id, dest:'third'});
	}

	function activateThird(obj, id) {
//		document.getElementById('sec_br').style.display = 'block';

		closeMessageSender();
	}

	function activateOnReturn(category_id, subcategory_id) {
		activateFirst(document.getElementById("category_" + category_id), category_id);
		window.setTimeout(function() {
			activateSecond(document.getElementById("subcategory_" + subcategory_id), subcategory_id);
		}, 1234)
	}


	var closePop = true;
	var popClose;
	var popOpened = false;
	function popup_close(a) {
		try {
			document.getElementById('popup_' + a).style.display = 'none';
		}
		catch (e) {
			popOpened = false;
			return false;
		}
		popOpened = false;
		return true;
	}

	function popup_open(a) {
		if (popOpened) popup_close(popOpened);
		document.getElementById('popup_' + a).style.display = 'block';
		popOpened = a;
		popupCount = 1;
	}


	document.onclick = function() {
		//if (!popClose) { popClose = true; return false; }
		if (popOpened && popupCount == 0) {
			popup_close(popOpened);
		}
		else popupCount = 0;

	}


	var oncl = new Array();

	function menuSwitch2(obj, classname) {
		var menuNodesList = obj.parentNode.childNodes;
		for (i = 0; i < menuNodesList.length; i++) {
			if (menuNodesList[i].nodeName == 'A') {
				menuNodesList[i].className = '';
				try {
					menuNodesList[i].onclick = oncl[menuNodesList[i].id].onclick;
					menuNodesList[i].href = oncl[menuNodesList[i].id].href;
				}
				catch (e) {
					// sdf
				}
			}
		}
		oncl[obj.id] = {onclick:obj.onclick, href:obj.href};
		obj.onclick = function() {
			return false;
		}
		obj.href = null;
		obj.className = classname;
	}

	function menuSwitch(params) {
		if (!params.silent) params.silent = false;
		if (params.silent == false) {
			if (!/(.+)\.(.+)/.exec(document.title))
				document.title = params.obj.innerHTML + '. ' + document.title;
			else
				document.title = document.title.replace(/(.+)\.(.+)/, params.obj.innerHTML + '.$2');
		}
		var menuNodesList = params.obj.parentNode.childNodes;
		for (i = 0; i < menuNodesList.length; i++) {
			if (menuNodesList[i].nodeName == 'A') {
				menuNodesList[i].className = params.classname;
			}
		}
		params.obj.className = params.classname + 'Active';
	}


	function startProgress() {
		document.getElementById('cursorProgress').style.left = xPos + 15;
		document.getElementById('cursorProgress').style.top = yPos + 0;
		document.onmousemove = moveProgressImage;
		moveProgressImage();
		document.getElementById('cursorProgress').style.display = "block";
	}


	function moveProgressImage() {
		if (isFF) {
			document.onmousemove = function(e) {
				document.getElementById('cursorProgress').style.left = e.pageX + 15;
				document.getElementById('cursorProgress').style.top = e.pageY + 0;
			}
		}
		else {
			document.getElementById('cursorProgress').style.posLeft = event.clientX + document.body.scrollLeft + 15;
			document.getElementById('cursorProgress').style.posTop = event.clientY + document.body.scrollTop + 0;
		}
		return false;
	}

	function stopProgress() {
		document.getElementById('cursorProgress').style.display = "none";
		document.onmousemove = null;
	}


	function getHTTP() {
		var xmlhttp;
		/*@cc_on
		 @if (@_jscript_version >= 5)
		 try
		 {
		 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 }
		 catch (e)
		 {
		 try
		 {
		 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		 }
		 catch (E)
		 {
		 xmlhttp = false;
		 }
		 }
		 @else
		 xmlhttp = false;
		 @end @*/
		if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			}
			catch (e) {
				xmlhttp = false;
			}
		}
		return xmlhttp;
	}


	function lookupProcess(lookupSettings) {
		if (!lookupSettings) lookupSettings = new Object();

		if (!lookupSettings.values)		 lookupSettings.values = '';
		if (!lookupSettings.postFunction)   lookupSettings.postFunction = '';
		if (!lookupSettings.dest)		   lookupSettings.dest = false;
		/*
		 try {
		 destHeight = document.getElementById(lookupSettings.dest).offsetHeight;
		 document.getElementById(lookupSettings.dest).innerHTML = "<div>&nbsp;</div>";
		 document.getElementById(lookupSettings.dest).style.height = destHeight;
		 }
		 catch (e) { destObj = false; }
		 */
		if (lookupSettings.url) {
			this.working = false;
			if (!this.working && (this.http = getHTTP())) {
				if (showProgress) startProgress();
				var http = this.http;
				this.http.open("POST", lookupSettings.url, true);
				this.http.onreadystatechange = function() {
					if (http.readyState == 4) {
						if (showProgress) stopProgress();
						showProgress = true;
						re = /^Location: ([a-zA-Z0-9._-]+)/;
						ReLocation = re.exec(http.responseText);
						try {
							destObj = document.getElementById(lookupSettings.dest);
						}
						catch (e) {
							destObj = false;
						}
						if (!ReLocation && destObj) {
							destObj.style.display = "block";
							destObj.style.height = '';
							destObj.innerHTML = http.responseText;
							if (lookupSettings.postFunction) eval(lookupSettings.postFunction);
						}
						else {
							if (ReLocation) {
								document.location.href = ReLocation[1];
							}
							else {
								return http.responseText;
							}
						}
						this.working = false;
						this.http = false;
					}
				}
				this.working = true;
				this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				this.http.send(lookupSettings.values);
			}
			if (!this.http) {
				alert('Ошибка при создании XMLHTTP объекта. Ваш браузер не поддерживается системой!')
			}
		}
	}

	function lookup(lookupSettings) {
		if (!lookupSettings) lookupSettings = new Object();

		if (!lookupSettings.values)		 lookupSettings.values = '';
		if (!lookupSettings.postFunction)   lookupSettings.postFunction = '';
		if (!lookupSettings.dest)		   lookupSettings.dest = false;

		if (lookupSettings.url) {
			this.working = false;
			if (!this.working && (this.http = getHTTP())) {
	//                if (showProgress) startProgress();
				var http = this.http;
				this.http.open("POST", lookupSettings.url, true);
				this.http.onreadystatechange = function() {
					if (http.readyState == 4) {
	//                          if (showProgress) stopProgress();
	//                          showProgress = true;
						re = /^Location: ([a-zA-Z0-9._-]+)/;
						ReLocation = re.exec(http.responseText);
						try {
							destObj = document.getElementById(lookupSettings.dest);
						}
						catch (e) {
							destObj = false;
						}
						if (!ReLocation && destObj) {
							destObj.style.display = "block";
							destObj.innerHTML = http.responseText;
							if (lookupSettings.postFunction) {
								if (typeof lookupSettings.postFunction == 'string')
									eval(lookupSettings.postFunction);
								else
									lookupSettings.postFunction(http);
							}
						}
						else {
							if (ReLocation) {
								document.location.href = ReLocation[1];
							}
							else {

								if (typeof lookupSettings.postFunction == 'string')
									eval(lookupSettings.postFunction);
								else
									lookupSettings.postFunction(http);

								return http.responseText;
							}
						}

						this.working = false;
						this.http = false;
					}
				}
				this.working = true;
				this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				this.http.send(lookupSettings.values);
			}
			if (!this.http) {
				alert('Ошибка при создании XMLHTTP объекта. Ваш браузер не поддерживается системой!')
			}
		}
	}


	function lookup2(lookupSettings) {
		if (!lookupSettings) lookupSettings = new Object();

		if (!lookupSettings.values)		 lookupSettings.values = '';
		if (!lookupSettings.postFunction)   lookupSettings.postFunction = '';
		if (!lookupSettings.dest)		   lookupSettings.dest = false;

		if (lookupSettings.url) {
			this.working = false;
			if (!this.working && (this.http = getHTTP())) {
	//                if (showProgress) startProgress();
				var http = this.http;
				this.http.open("POST", lookupSettings.url, true);
				this.http.onreadystatechange = function() {
					if (http.readyState == 4) {
	//                          if (showProgress) stopProgress();
	//                          showProgress = true;
						re = /^Location: ([a-zA-Z0-9._-]+)/;
						ReLocation = re.exec(http.responseText);
						alert(http.responseText);
						try {
							destObj = document.getElementById(lookupSettings.dest);
						}
						catch (e) {
							destObj = false;
						}
						if (!ReLocation && destObj) {
							destObj.style.display = "block";
							destObj.innerHTML = http.responseText;
							//                   if (lookupSettings.postFunction) postFunction;
						}
						else {
							if (ReLocation) {
								document.location.href = ReLocation[1];
							}
							else {
								return http.responseText;
							}
						}
						this.working = false;
						this.http = false;
					}
				}
				this.working = true;
				this.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				this.http.send(lookupSettings.values);
			}
			if (!this.http) {
				alert('Ошибка при создании XMLHTTP объекта. Ваш браузер не поддерживается системой!')
			}
		}
	}


	function urlEncodeById(text_id) {
		textValue = document.getElementById('value' + text_id).value;
		textValue = encodeURIComponent(textValue);
		return textValue;
	}

	function advertsSubRubrics(el) {
		var value = el;
		document.getElementById('select_rubric_id').value = '';
		document.getElementById('div-rubrics-select').innerHTML = '';
		document.getElementById('div-rubrics-select-sec').innerHTML = '';
		document.getElementById('auto_add').style.display = 'none';
		document.getElementById('ad_price').style.display = 'none';
		document.getElementById('ad_mark').style.display = 'none';
		document.getElementById('ad_text').style.height = '78px';
		document.getElementById('adverts_text').style.height = '82px';
		document.getElementById('adverts_text_p').style.height = '82px';
		if (value.indexOf('-subrubrics') > 0) {
			value = value.replace('-subrubrics', '');
			lookup({url:'/api/adverts.rubrics.api.php',values:'id=' + value,dest:'div-rubrics-select'});
		} else {
			document.getElementById('select_rubric_id').value = value;
		}
	}
	var test;
	function advertsSubRubricsSelected(obj, el) {
		if ($(obj).parent().attr('id') != 'div-rubrics-select-sec') {
			document.getElementById('auto_add').style.display = 'none';
			document.getElementById('ad_price').style.display = 'none';
			document.getElementById('ad_mark').style.display = 'none';
			var value = el;
			if (value.indexOf('-price') > 0) {
				value = value.replace('-price', '');
				document.getElementById('auto_add').style.display = 'block';
				document.getElementById('ad_price').style.display = 'inline';
				document.getElementById('ad_price').style.width = '216px';
			}
			if (value.indexOf('-mark') > 0) {
				value = value.replace('-mark', '');
				document.getElementById('auto_add').style.display = 'block';
				document.getElementById('ad_mark').style.display = 'inline';
				document.getElementById('ad_price').style.width = '100px';
			}
			lookup({url:'/api/adverts.rubrics.api.php',values:'id=' + value,postFunction:function(http){
				if (http.responseText) {
					document.getElementById('div-rubrics-select-sec').innerHTML = http.responseText;
					document.getElementById('select_rubric_id').value = '';
				} else {
					document.getElementById('div-rubrics-select-sec').innerHTML = '';
					document.getElementById('select_rubric_id').value = value;
				}
			}});
		} else {
			document.getElementById('select_rubric_id').value = el.replace('-mark', '').replace('-price', '');
		}
	}

	function advertsAddToFavorite(id, del) {
		del = typeof del == 'undefined' ? false : del;
		var destObj = document.getElementById('favorite-span-' + id);
		var http = getHTTP();
		http.open('POST', '/api/adverts.favorite.api.php', true);
		http.onreadystatechange = function() {
			if (http.readyState == 4) {
				var res = http.responseText;
				response = http.responseText.split('[(.)(.)]');
				if (Number(response[0]) > 0) {
					if (document.getElementById('adverts-favorite-menuitem')) {
						document.getElementById('adverts-favorite-menuitem').style.display = 'inline-block';
					}
					if (del && top.window.location.href.indexOf('bizbi.ru/a/favorite') > 1) {
						document.getElementById('advert-div-' + id).parentNode.removeChild(document.getElementById('advert-div-' + id));
					}
				} else {
					if (document.getElementById('adverts-favorite-menuitem')) {
						document.getElementById('adverts-favorite-menuitem').style.display = 'none';
					}
					if (top.window.location.href.indexOf('bizbi.ru/a/favorite') > 1) {
						top.window.location.href = '/a/all';
					}
				}
				destObj.style.display = "block";
				destObj.innerHTML = response[1];
			}
		}
		http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		http.send('id=' + id + (del ? '&type=delete' : ''));
	}

	var oldObj = null;
	var oldId = null;
	function date_del() {
		f_obj.style.zIndex = f_objZindex;
		document.getElementById('overimg_' + f_id + '_' + f_class).className = "overimg";
	}
	function img_show(obj, id, img_w, img_h) {
		objZindex = getZIndex(obj.className);
		if (oldObj && oldObj != obj) {
			oldObj.style.zIndex = getZIndex(oldObj.className);
			document.getElementById('overimg_' + oldId + '_' + oldObj.className).className = 'overimg';
		}
		if (document.getElementById('overimg_' + id + '_' + obj.className).className == "overimg act_over") {
//			fotoFull(id, img_w, img_h);
			f_id = id;
			f_obj = obj;
			f_objZindex = objZindex;
			f_class = obj.className;
			setTimeout("date_del()", 1000);
//    		obj.style.zIndex=objZindex;
//    		document.getElementById('overimg_'+id+'_'+obj.className).className="overimg";
		}
		else {
			obj.style.zIndex = '100';
			document.getElementById('overimg_' + id + '_' + obj.className).className = "overimg act_over";

		}
		oldObj = obj;
		oldId = id;
	}

	var itemRating = new Array();
	var itemRatingVotesText = '';
	function rating(evnt, el) {
		el = typeof el == 'undefined' ? false : el;
		switch (evnt) {
			case 'over':
				if (document.getElementById('rating_votes_text')) {
					itemRatingVotesText = document.getElementById('rating_votes_text').innerHTML;
					document.getElementById('rating_votes_text').innerHTML = 'Оцените новость';
				}
				var a = document.getElementById('rating_div').firstChild;
				var object = a.value;
				a = a.nextSibling;
				var object_id = a.value;
				a = document.getElementById('rating_div_elements').getElementsByTagName('INPUT');
				var rate = false;
				for (var i = 0; i < a.length; i++) {
					itemRating[itemRating.length] = a[i].src;
					if (a[i] == el) {
						rate = i + 1;
					}
				}
				for (i = 0; i < a.length; i++) {
					if (i < rate) {
						a[i].src = a[i].src.replace(/\/images\/([A-z]+)_(y|n)\.gif/, '/images/$1_y.gif');
					}
					else {
						a[i].src = a[i].src.replace(/\/images\/([A-z]+)_(y|n)\.gif/, '/images/$1_n.gif');
					}
				}
				break;
			case 'click':
				itemRatingVotesText = '';
				var a = document.getElementById('rating_div').firstChild;
				var object = a.value;
				a = a.nextSibling;
				var object_id = a.value;
				a = document.getElementById('rating_div_elements').getElementsByTagName('INPUT');
				var rate = false;
				for (var i = 0; i < a.length; i++) {
					if (a[i] == el) {
						rate = i + 1;
					}
				}
				lookup({
					url:'/api/rating.php',
					values:'object=' + object + '&object_id=' + object_id + '&rate=' + rate,
					dest:el.parentNode.parentNode.id
				});
				break;
			case 'out':
				if (document.getElementById('rating_votes_text')) {
					document.getElementById('rating_votes_text').innerHTML = itemRatingVotesText;
					itemRatingVotesText = '';
				}
				var a = document.getElementById('rating_div_elements').getElementsByTagName('INPUT');
				for (var i = 0; i < a.length; i++) {
					a[i].src = itemRating[i];
				}
				break;
		}
	}

	function bookmark(title, url) {
		if (title == undefined) {
			title = document.title;
		}
		if (url == undefined) {
			url = top.location.href;
		}
		if (window.sidebar) {
			// Firefox
			window.sidebar.addPanel(title, url, '');
		} else if (window.opera && window.print) {
			// Opera
			var t = document.createElement('a');
			t.setAttribute('rel', 'sidebar');
			t.setAttribute('href', url);
			t.setAttribute('title', title);
			t.click();
		} else if (window.external) {
			// IE
			window.external.AddFavorite(url, title);
		} else {
			//сюда уже проверку сами вставите, хотя, по идее это условие никогда не выполнится
			//но для надежности пусть будет
			alert('Что бы добавить страницу в избранное нажмите CTRL-D.');
		}
		return false;
	}

	// голо-сование [start]
	function polls(id) {
		this.id = id;
		this.answer = false;
	}
	polls.prototype.button = function() {
		if (document.getElementById('poll-' + this.id + '-button') && document.getElementById('poll-' + this.id + '-button').disabled) {
			document.getElementById('poll-' + this.id + '-button').disabled = false;
		}
	}
	polls.prototype.vote = function() {
		jQuery("#poll-" + this.id + "-error").hide();
		if (!document.getElementById('poll-' + this.id + '-form')) {
			return false;
		}
		var items = document.getElementById('poll-' + this.id + '-form').getElementsByTagName('input');
		if (!items.length) {
			return false;
		}
		for (var i = 0; i < items.length; i++) {
			if (items[i].type == 'radio' && items[i].checked) {
				this.answer = items[i].value;
				break;
			}
		}
		if (!this.answer) {
			jQuery("#poll-" + this.id + "-error").html("Выберите один из вариантов ответа!").show();
		} else {
			this.send();
		}
	}
	polls.prototype.send = function() {
		if (!this.id || !this.answer) {
			return false;
		}
		var poll_id = this.id,answer_id = this.answer;
		jQuery.ajax({
			type:'POST',
			url:'/api/polls.api.php',
			data:'poll_id=' + poll_id + '&answer_id=' + answer_id,
			success:function(html) {
				jQuery('#poll-' + poll_id).html(html);
			}
		});
	}
	// голо-сование [stop]

	// api-календарик [start]
	function apiCalendar(date, page, id, cdate, object) {
		jQuery.ajax({
			type:'POST',
			url:'/api/calendar.php',
			data:{cdate:cdate,pages:page,id:id,date:date,object:object},
			success:function(html) {
				jQuery('#calendar').html(html);
			}
		});
	}
	// api-календарик [stop]

	try {
		$(window).load(function() {
			try {
				$("a.lightbox").lightbox();
				$("a[onclick*='fotoFree']").lightbox();
				$("a[rel*=lightbox]").lightbox();
				$('a[rel=lightbox]').lightbox();
				$('area[rel=lightbox]').lightbox();
			} catch(e) {}
		});
	} catch(e) {}



	/**
	 @param
			 Object a {
	 obj - DOM-элемент или id DOM-элемента для вставки сообщения,
	 text - сообщение,
	 [textDuration] - задержка показа сообщения в милисекундах (пропадает по истечении указанного времени) ,
	 [objectClass] - класс для объекта obj
	 }
	 */

	function flashMessage(a) {

		if (typeof a.obj == 'string')
			a.obj = document.getElementById(a.obj);

		if (typeof a.objectClass == 'undefined')
			a.objectClass = 'flash_message'

		a.obj.style.display = 'block';

		var objClass = a.obj.className;

		if (objClass.indexOf(a.objectClass) < 0) {
			a.obj.className = a.obj.className + ' ' + a.objectClass;
		}

		a.obj.innerHTML = a.text;

		if (typeof a.textDuration != 'undefined') {
			if (a.textDuration < 2000)
				a.textDuration = 2000

			setTimeout(function() {
				a.obj.style.display = 'none'
			}, a.textDuration);
		}
	}

	function globalFlashMessage(m) {

		if (jQuery('#global_flash_message').size() < 1) {
			jQuery('<div class="globalFlashMessage">').appendTo('body').attr('id', 'global_flash_message');
		}

		if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7) {
			jQuery('#global_flash_message').css({position: 'absolute', top: (jQuery.scrollTop() < 150 ? '150px' : jQuery.scrollTop() + 'px')})
		}

		jQuery('#global_flash_message').hide().html(m);

		jQuery('#global_flash_message').fadeIn();

		setTimeout(function() {
			jQuery('#global_flash_message').fadeOut();
		}, 5000);
	}

	window.onload = function() {
		if (typeof jQuery != 'undefined' && jQuery('.off').size() > 0) {
			jQuery(function() {
				if (!jQuery.browser.msie)
					jQuery('.off').mouseenter(
							function() {
								jQuery(this).fadeTo(500, 1)
							}).mouseleave(function() {
						jQuery(this).fadeTo(500, 0.5)
					})
			});
		}
	}
