/* Don Alina adon@rbc.ru*/
/* last modified 2008-01-16 */


// дизейблим элементы формы при выборе опции оставления коммента
// TODO: выяснить и доделать переключалку
function showBlock(show, hide)
{
	var showBlock = document.getElementById(show);
	var hideBlock = document.getElementById(hide);
	if (bw.browser == 'Explorer')
	{
		showBlock.style.display = 'block';
	}
	else
	{
		showBlock.style.display = 'table-row-group';
	}
	hideBlock.style.display = 'none';
}


function checkCommentOptions(frmName, arrEl, what)
{
	var frm = document.forms[frmName];
	frmLength = frm.elements.length;
	for ( var i = 0; i < frmLength; i++ )
	{
		//alert(frm.elements[i].disabled)
		if (frm.elements[i].disabled)
		{
			frm.elements[i].disabled = false;
			frm.elements[i].readOnly = false;
		}
	}
	arrElLength = arrEl.length;
	if (document.getElementById(what).checked)
	{
		for ( var i = 0; i < arrElLength; i++ )
		{
			frm.elements[arrEl[i]].disabled = true;
			frm.elements[arrEl[i]].readOnly = true;
		}
	}
}

// определение ширины и высоты страницы
function getPageSize()
{
	var xScroll;
	var yScroll;

	if (window.innerWidth && window.scrollMaxX) {
		xScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
	}

	if (window.innerHeight && window.scrollMaxY) {
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}

	var windowWidth;
	var windowHeight;

	if (self.innerWidth) {	// all except Explorer
		windowWidth = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
	}

	if (self.innerHeight) {	// all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(xScroll < windowWidth){
		pageWidth = xScroll;
	} else {
		pageWidth = windowWidth;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	return [pageWidth, pageHeight];
}

// установка блоку размеров страницы
function setPageHeight(divBgId)
{
	var divBg = document.getElementById(divBgId);
	var pageWidth = getPageSize()[0];
	var pageHeight = getPageSize()[1];
	divBg.style.height = pageHeight + 'px';
	divBg.style.width = pageWidth + 'px';
	window.onresize = function() {setPageHeight(divBgId);};
	window.onscroll = function() {setPageHeight(divBgId);};
}

// отображение/скрытие блока с сообщением
// сообщение бывает 3 типов
// form - форма авторизации
// error - ошибка
// inform - информация
function showMsg(view, arrId, type, message)
{
	var titles = ['<span class="color00">Вход</span>', '<span class="red">Ошибка :-(</span>'];
	var formContent = '<form name="login_form" action="/forum/index.php?act=Login&CODE=01"  method="POST"><input type="hidden" name="return" value="'+encodeURI(window.location)+'"><b>Имя пользователя</b><div class="top10 bottom10"><input type="text" class="width100" name="UserName"></div><b>Пароль</b><div class="top10 bottom10"><input type="password" class="width100" name="PassWord"></div><div><input type="checkbox" id="rememberme" name="CookieDate"> <label for="rememberme">запомнить меня</label></div><div class="top20"><input type="submit" value="войти"> <a href="/forum/index.php?act=Reg&CODE=10" class="darkGray">ой, я забыла пароль</a></div></form>';
	var msgBlock = document.getElementById(arrId[0]);
	var opacityBg = document.getElementById(arrId[1]);
	var msgContent = document.getElementById(arrId[2]);
	var msgTitle = document.getElementById(arrId[3]);
	// режим показа блока
	if (view)
	{
		msgBlock.style.display = 'block';
		opacityBg.style.display = 'block';
		if (type == 'form')
		{
			msgTitle.innerHTML = titles[0];
			msgContent.innerHTML = formContent;
		}
		else if (type == 'error')
		{
			msgTitle.innerHTML = titles[1];
			msgContent.innerHTML = message[0];
		}
		else if (type == 'inform')
		{
			msgContent.innerHTML = message[0];
			msgTitle.innerHTML = message[1];
		}
	}
	// режим сокрытия блока
	else
	{
		msgBlock.style.display = 'none';
		opacityBg.style.display = 'none';
		msgContent.innerHTML = '';
	}
	// позиционирование блока
	msgBlock.style.top = (document.body.scrollTop + document.body.clientHeight/2 - msgBlock.clientHeight/2) + 'px';
	msgBlock.style.left = (document.body.clientWidth/2 - msgBlock.clientWidth/2) + 'px';
}

// класс фотогалереи
function photoObj(arrParam)
{
	var photoList = document.getElementById(arrParam[0]);			// блок со списком картинок
	var photoBig = document.getElementById(arrParam[1]);			// блок большой картинки
	var photoArrows = document.getElementById(arrParam[2]);			// блок со стрелками в списке картинок
	var photoBottom = document.getElementById(arrParam[3]);			// блок нижней части фотогалереи
	var photoName = document.getElementById(arrParam[4]);			// блок названия фотки
	var photoSource = document.getElementById(arrParam[5]);			// блок источника фотки
	var photoNumber = document.getElementById(arrParam[6]);			// номер фотки
	var photoDescr = document.getElementById(arrParam[7]);			// описание фотки
	var dummyPic = '<img src="http://pics.tata.ru/tata_pics/photoTmpl.gif">';				// картинка-пустышка
	var prefixId = 'i';												// префикс для id картинок в списке
	var activePhoto = null;											// объект-кеш элемента <img> активной картинки

	collPhotoBig = photoBig.getElementsByTagName('A');
	collPhotoBigLength = collPhotoBig.length;

	collPhotoArrows = photoArrows.getElementsByTagName('A');
	collPhotoArrowsLength = collPhotoArrows.length;

	collPhotoList = photoList.getElementsByTagName('DIV');
	collPhotoListLength = collPhotoList.length;

	thisClass = this;

	// инициализация
	this.initialize = function(start)
	{
		photoBig.onmouseover = function (){thisClass.reverseViewArrows(collPhotoBig, collPhotoBigLength, 1)};
		photoBig.onmouseout = function (){thisClass.reverseViewArrows(collPhotoBig, collPhotoBigLength, 0)};

		photoBottom.onmouseover = function (){thisClass.reverseViewArrows(collPhotoArrows, collPhotoArrowsLength, 1)};
		photoBottom.onmouseout = function (){thisClass.reverseViewArrows(collPhotoArrows, collPhotoArrowsLength, 0)};

		thisClass.createImgId();
		thisClass.photoInitEvents(start);
	}

	// создаем id для каждой картинки в списке
	this.createImgId = function()
	{
		for (var i = 0; i < collPhotoListLength; i++)
		{
			collPhotoList[i].id = prefixId + i;
		}
	}

	// навешиваем обработчики на onclick только для нужных фоток
	// @param	start	- индекс картинки, которая дб активной
	this.photoInitEvents = function(start)
	{
		if (start != -1)
		{
			for (var i = 0; i < collPhotoListLength; i++)
			{
				// активируем
				if (start == i)
				{
					collPhotoList[i].innerHTML = dummyPic;
					activePhoto = collPhotoList[i];
				}
				// подставляем пустышку
				else
				{
					collPhotoList[i].innerHTML = '';
					collPhotoList[i].onclick = function() {thisClass.activatePhoto(this);};
				}
			}
		}
		thisClass.createArrowsHandler();
	}

	// активация картинки
	this.activatePhoto = function(el)
	{
		activePhoto.innerHTML = '';
		activePhoto.onclick = function() {thisClass.activatePhoto(this);};
		el.innerHTML = dummyPic;
		el.onclick = null;
		activePhoto = el;
		itemId = thisClass.extractNumber(el);
		photoBig.style.backgroundImage = "url(" + arrPhotoList[itemId].src + ")";
		photoName.innerHTML = arrPhotoList[itemId].name;
		photoSource.innerHTML = arrPhotoList[itemId].source;
		photoNumber.innerHTML = arrPhotoList[itemId].number;
		photoDescr.innerHTML = arrPhotoList[itemId].descr;
	}

	// показываем/скрываем стрелки
	// @param	el		- контейнер, в котором лежат картинки-стрелки
	//			show	- булевая переменная. 0 - скрыть, 1 - показать
	this.reverseViewArrows = function(coll, collLength, show)
	{
		itemId = thisClass.extractNumber(activePhoto);
		// если фоток меньше массива, показываем/скрываем стрелки
		if (itemId < photoCount)
		{
			// если в ссылке есть '#' и активная картинка первая или последняя
			if ((coll == collPhotoBig) && show && thisClass.isLeftArrow())
			{
				thisClass.changeVisibilityArrow(['visible', 'hidden']);
			}
			else if ((coll == collPhotoBig) && show && thisClass.isRightArrow())
			{
				thisClass.changeVisibilityArrow(['hidden', 'visible']);
			}
			else
			{
				show = show ? 'visible' : 'hidden';
				for(var i = 0; i < collLength; i++)
				{
					coll[i].style.visibility = show;
				}
			}
		}
	}

	// навешиваем обработчики на стрелки большой фотки
	this.createArrowsHandler = function()
	{
		// следующая
		collPhotoBig[0].onclick = function() {return thisClass.activatePhotoFromArrow(collPhotoListLength-1, 1)}

		// предыдущая
		collPhotoBig[1].onclick = function() {return thisClass.activatePhotoFromArrow(0, -1)}
	}

	// вызываем функцию activatePhoto с необходимыми нам параметрами
	// спользуется кеш-переменная activePhoto
	// @param	extremeValue	- граничное значение, после которого активируется href ссылки
	//			summand		- слагаемое. +1 - вправо, -1 - влево
	this.activatePhotoFromArrow = function(extremeValue, summand)
	{
		itemId = thisClass.extractNumber(activePhoto);
		if (itemId == extremeValue) return true;
		thisClass.activatePhoto(collPhotoList[itemId + summand]);
		if (thisClass.isLeftArrow())
		{
			thisClass.changeVisibilityArrow(['visible', 'hidden']);
		}
		else if (thisClass.isRightArrow())
		{
			thisClass.changeVisibilityArrow(['hidden', 'visible']);
		}
		else
		{
			thisClass.changeVisibilityArrow(['visible', 'visible']);
		}
		return false;
	}

	// первая ли картинка и отсутствует ли у левой стрелки ссылка
	// условие выполнения , наличие у ссылки #gogo-якоря
	this.isLeftArrow = function()
	{
		return (itemId == 0) && (collPhotoBig[1].href.indexOf('#gogo') != -1);
	}

	// последняя ли картинка и отсутствует ли у правой стрелки ссылка
	this.isRightArrow = function()
	{
		return (itemId == collPhotoListLength-1) && (collPhotoBig[0].href.indexOf('#gogo') != -1);
	}

	// возвращает id (integer)
	this.extractNumber = function(el)
	{
		return parseInt(el.id.slice(1));
	}

	// смена visibility стрелок
	this.changeVisibilityArrow = function(arrVisibility)
	{
		for (var i = 0; i < collPhotoBigLength; i++)
		{
			collPhotoBig[i].style.visibility = arrVisibility[i];
		}
	}



}


// класс маленькой фотогалереи в материале, теле новости
function smallPhotoObj(arrParam)
{
	var smallPhoto = document.getElementById(arrParam[0]);						// маленькое фото
	var prevPhoto = document.getElementById(arrParam[1]);						// стрелка вперед
	var nextPhoto = document.getElementById(arrParam[2]);						// стрелка назад
	var numberPhoto = document.getElementById(arrParam[3]);						// порядковый номер фотки
	var quantityPhoto = document.getElementById(arrParam[4]);					// блок кол-ва фоток
	var opacityBg = document.getElementById(arrParam[5]);						// блок фона, высотой в страницу
	var photoScaledup = document.getElementById(arrParam[6]);					// блок увеличенной картинки
	var photoName = document.getElementById(arrParam[7]);						// блок подписи к картинке
	var photoBig = document.getElementById(arrParam[8]);						// большая фотка
	var loupe = document.getElementById(arrParam[9]);							// блок с лупой
	var photoSource = document.getElementById(arrParam[10]);					// автор и источник
	//var numberBigPhoto = document.getElementById(arrParam[11]);					// порядковый номер большой фотки
	var photoBigSource = document.getElementById(arrParam[12]);					// автор и источник большой фотки
	//var quantityBigPhoto = document.getElementById(arrParam[13]);				// блок кол-ва фоток большой фотки
	var photoBigDescr = document.getElementById(arrParam[14]);					// описание большой фотки
	var photoBigName = document.getElementById(arrParam[15]);					// блок подписи к большой фотке
	var prevBigPhoto = document.getElementById(arrParam[16]);					// стрелка назад большой картинки
	var nextBigPhoto = document.getElementById(arrParam[17]);					// стрелка вперед большой картинки
	var closeBigPhoto = document.getElementById(arrParam[18]);					// закрыть большую фотку
	var prevPhotoText = '<a href="javascript:void(0)">&larr;&nbsp;пред.</a>';	// html стрелки назад
	var nextPhotoText = '<a href="javascript:void(0)">след.&nbsp;&rarr;</a>';	// html стрелки вперед
	var prevPhotoDummyText = '<span class="darkGray">&larr;&nbsp;пред.</span>';	// html стрелки назад (пустышка)
	var nextPhotoDummyText = '<span class="darkGray">след.&nbsp;&rarr;</span>';	// html стрелки вперед (пустышка)
	var activeIndex = 0;														// индекс активного элемента массива
	var bigPhotoActiveIndex = 0;												// индекс активного элемента массива большой фотки
	arrSmallPhotoListLength = arrSmallPhotoList.length;							// кол-во фоток
	thisClass = this;															// копия объекта smallPhotoObj

	// отображение кол-ва фоток
	// загрузка первой фотки в массиве
	this.initialize = function()
	{
		quantityPhoto.innerHTML = arrSmallPhotoListLength;
		//quantityBigPhoto.innerHTML = arrSmallPhotoListLength;
		thisClass.goToPhoto(0);
	}

	// перейти к фотке
	this.goToPhoto = function(direction)
	{
		activeIndex = activeIndex + direction;
		// если фотка одна
		if (arrSmallPhotoListLength == 1)
		{
			thisClass.setDummyArrows(prevPhoto, prevPhotoDummyText);
			thisClass.setDummyArrows(nextPhoto, nextPhotoDummyText);
		}
		// если на первой фотке
		else if (activeIndex == 0)
		{
			thisClass.setDummyArrows(prevPhoto, prevPhotoDummyText);
			thisClass.reverseViewArrows(nextPhoto, 1, nextPhotoText);
		}
		// если на последней фотке
		else if (activeIndex == (arrSmallPhotoListLength-1))
		{
			thisClass.setDummyArrows(nextPhoto, nextPhotoDummyText);
			thisClass.reverseViewArrows(prevPhoto, -1, prevPhotoText);
		}
		// иначе
		else
		{
			thisClass.reverseViewArrows(prevPhoto, -1, prevPhotoText);
			thisClass.reverseViewArrows(nextPhoto, 1, nextPhotoText);
		}
		smallPhoto.src = arrSmallPhotoList[activeIndex].src;
		smallPhoto.title = arrSmallPhotoList[activeIndex].title;
		photoName.innerHTML = arrSmallPhotoList[activeIndex].title;
		// если большая фотка существует
		// навесить обработчик увеичения большой картинки
		if (arrSmallPhotoList[activeIndex].bigPhotoProp.length != 0)
		{
			smallPhoto.className = 'hand';
			loupe.style.display = 'block';
			smallPhoto.onclick = function() {thisClass.showBigPhoto(activeIndex)}
		}
		// иначе
		else
		{
			smallPhoto.className = '';
			loupe.style.display = 'none';
			smallPhoto.onclick = null;
		}
		numberPhoto.innerHTML = activeIndex + 1;
		photoSource.innerHTML = arrSmallPhotoList[activeIndex].source;
	}

	// изменение вида стрелок
	// @param	el			- стрелка
	// 			direction	- направление. 0 - по умолчанию, 1 - вперед, -1 - назад
	// 			text		- текст стрелки
	this.reverseViewArrows = function(el, direction, text)
	{
		el.innerHTML = text;
		el.onclick = function() {thisClass.goToPhoto(direction); return false;};
	}

	// вставить пустышку (на первой или последней фотке)
	this.setDummyArrows = function(el, text)
	{
		el.innerHTML = text;
		el.onclick = null;
	}

	// показывает блок с увеличенной фоткой, позиционирует по центру страницы
	// @param	activeIndex	- индекс активного элемента в массиве фоток
	this.showBigPhoto = function(activeIndex)
	{
		opacityBg.style.display = 'block';
		photoScaledup.style.display = 'block';
		photoBig.style.backgroundImage = 'url(' + arrSmallPhotoList[activeIndex].bigPhotoProp[0] + ')';
		photoBig.style.width = arrSmallPhotoList[activeIndex].bigPhotoProp[1];
		photoBig.style.height = arrSmallPhotoList[activeIndex].bigPhotoProp[2];
		photoScaledup.style.width = arrSmallPhotoList[activeIndex].bigPhotoProp[1] + 40 + 'px';
		photoBig.title = arrSmallPhotoList[activeIndex].title;
		closeBigPhoto.onclick = thisClass.hideBigPhoto;
		photoScaledup.style.top = (document.body.scrollTop + document.body.clientHeight/2 - photoScaledup.clientHeight/2) + 'px';
		photoScaledup.style.left = (document.body.clientWidth/2 - photoScaledup.clientWidth/2) + 'px';
		//photoBig.className = 'photoBig hand';
		//numberBigPhoto.innerHTML = activeIndex + 1;
		photoBigSource.innerHTML = arrSmallPhotoList[activeIndex].source;
		photoBigDescr.innerHTML = arrSmallPhotoList[activeIndex].descr;
		photoBigName.innerHTML = arrSmallPhotoList[activeIndex].title ? ('&laquo;'+arrSmallPhotoList[activeIndex].title+'&raquo;') : '';
		bigPhotoActiveIndex = activeIndex;
		thisClass.goToBigPhoto(0);
	}

	// скрывает блоки с увеличенной фоткой и полупрозрачным фоном
	this.hideBigPhoto = function()
	{
		opacityBg.style.display = 'none';
		photoScaledup.style.display = 'none';
	}

	// перейти к большой фотке
	this.goToBigPhoto = function(direction)
	{
		bigPhotoActiveIndex = bigPhotoActiveIndex + direction;
		// если фотка одна
		if (arrSmallPhotoListLength == 1)
		{
			thisClass.setDummyArrowsBigPhoto(prevBigPhoto);
			thisClass.setDummyArrowsBigPhoto(nextBigPhoto);
		}
		// если на второй фотке
		else if (bigPhotoActiveIndex == 1)
		{
			thisClass.setDummyArrowsBigPhoto(prevBigPhoto);
			thisClass.reverseViewArrowsBigPhoto(nextBigPhoto, 1);
		}
		// если на последней фотке
		else if (bigPhotoActiveIndex == (arrSmallPhotoListLength-1))
		{
			thisClass.setDummyArrowsBigPhoto(nextBigPhoto);
			thisClass.reverseViewArrowsBigPhoto(prevBigPhoto, -1);
		}
		// иначе
		else
		{
			thisClass.reverseViewArrowsBigPhoto(prevBigPhoto, -1);
			thisClass.reverseViewArrowsBigPhoto(nextBigPhoto, 1);
		}
		if(arrSmallPhotoList[bigPhotoActiveIndex])
		{
			photoBig.style.backgroundImage = 'url(' + arrSmallPhotoList[bigPhotoActiveIndex].bigPhotoProp[0] + ')';
			photoBig.title = arrSmallPhotoList[bigPhotoActiveIndex].title;
			photoBigName.innerHTML = arrSmallPhotoList[bigPhotoActiveIndex].title;
			//numberBigPhoto.innerHTML = bigPhotoActiveIndex + 1;
			photoBigSource.innerHTML = arrSmallPhotoList[bigPhotoActiveIndex].source;
			photoBigDescr.innerHTML = arrSmallPhotoList[bigPhotoActiveIndex].descr;
		}
	}

	this.reverseViewArrowsBigPhoto = function(el, direction)
	{
		el.style.visibility = 'visible';
		el.onclick = function() {thisClass.goToBigPhoto(direction); return false;};
	}

	// вставить пустышку (на первой или последней фотке)
	this.setDummyArrowsBigPhoto = function(el)
	{
		el.style.visibility = 'hidden';
		el.onclick = null;
	}


	this.initialize();
}

// переключалка для поиска
function switchsearchOption(def) {
	var coll = document.getElementById('searchOption').childNodes;
	collLength = coll.length;
	for (var i = 0; i < collLength; i+=2) {
		coll[i].onclick = activateOpt;
	}
	var i = 0;
	if (typeof(def) == 'undefined' || def == '')
	{
		i = collLength-1;
	}
	else
	{
		for (var i = 0; i < collLength; i+=2)
		{
			if (coll[i].title == def)
			{
				break;
			}
		}
	}
	window.activeOptSearch = coll[i];
	coll[i].className = 'active';
	document.getElementById('opt').value = coll[i].title;
}
function activateOpt() {
	if (window.activeOptSearch) {
		window.activeOptSearch.className = '';
	}
	window.activeOptSearch = this;
	this.className = 'active';
	document.getElementById('opt').value = window.activeOptSearch.title;
}

// всплывающий блок в навигации
function showOtherSection(elmHandler, workBlock)
{
	$("DIV."+elmHandler).hover(
		function()
		{
			$("DIV."+workBlock).show();
			$('SPAN.else').toggleClass("active");
		},
		function()
		{
			$("DIV."+workBlock).hide();
			$('SPAN.else').removeClass("active");
		}
	);
}


//построение строки урла из полей селектора
function archiveMainBuildUrl()
{
	var d	= document;
	var day	= d.getElementById('indexArchiveSelectorDay').value;
	var month	= d.getElementById('indexArchiveSelectorMonth').value;
	var year	= d.getElementById('indexArchiveSelectorYear').value;
	if ( !day || !month || !year ) {
		return false;
	}
	return  year + '/' + month + '/' + day;
}

//ф-ция проверки наличия архива на выбранный в селекторе день
function archiveMainDateCheck()
{
	var url = archiveMainBuildUrl();
	if ( false == url ) {
		d.getElementById('indexArchiveSelectorAct').innerHTML  = 'выберите дату';
	} else {
		url = '/include/dynamic/news/list/' + url + '/archiveMainExistance.txt';
		var oAjax = new ajax();
		oAjax.setReadyState(null, null, null, archiveMainHandleResponse);
		var result = oAjax.sendRequest(null, url, null, null, 'text/plain;charset=windows-1251', true);
	}
}

//callback ф-ция для отработки AJAX ответа
function archiveMainHandleResponse(req)
{
	if ( 200 == req.status ) {
//		d.getElementById('indexArchiveSelectorAct').innerHTML  = '<a href="/archive/main/' + archiveMainBuildUrl() + '/">перейти</a>';
		d.getElementById('indexArchiveSelectorAct').innerHTML  = '<input id="indexArchiveSelectorSubmit" type="button" value="выбрать" onmouseup="archiveMainButtonClick()" onkeyup="archiveMainButtonClick()">';
		return true;
	}
	d.getElementById('indexArchiveSelectorAct').innerHTML  = 'архива на выбранную дату нет';
	return false;
}

//ф-ция перехода на выбранный в селекторе день
function archiveMainButtonClick()
{
	var d	= document;
//	alert(d.location.protocol + "//" + d.location.hostname + "/archive/main/" + archiveMainBuildUrl() + "/");
	d.location.href = d.location.protocol + "//" + d.location.hostname + "/archive/main/" + archiveMainBuildUrl() + "/";
	return false;
}

// popup window
function winOpen(url, winWidth, winHeight)
{
	var win = window.open(url, 'wnd', 'status=0,menubar=0,scrollbars,width='+winWidth+',height='+winHeight)
	win.focus();
}