function markNumbers(max) {
	max = max || null;
	this.img = this.img || this.getElementsByTagName('img')[0];
	var _ = this;
	this.count = 0;
	this.marking = setInterval(
		function() {
			if (max != null && _.count >= max) return _.unmark();
			
			if (_.img.className && _.img.className == 'mark') {
				_.img.className = '';
			} else {
				_.img.className = 'mark';
			}
			_.count++;
		},
		100
	);
}
function unmarkNumbers() {
	clearInterval(this.marking);
	this.img.className = '';
}


function qwe(elem, opening) {
	elem.isOpen = elem.isOpen || false;
	if (elem.isOpen && opening) return;
	
	document.title+='_'+opening;

	var h, postAction, _ = elem.getElementsByTagName('div');
	if (_.length > 0) {
		if (opening) {
			h = _[0].getElementsByTagName('ol')[0].offsetHeight;
//			postAction = function() {_[0].style.height = 'auto';}
		} else {
			_[0].style.height = _[0].offsetHeight;
			h = 0;
			postAction = function() {}
		}
		Change.height(_[0], h, .5, true, postAction);
	}
	elem.isOpen = !elem.isOpen;
}

function calculateHeight(elem) {
	var _ = elem.cloneNode(true);
	_.className = 'tmp4calc';
	document.body.appendChild(_);
	var res = _.offsetHeight;
	document.body.removeChild(_);
	return res;
}


function showPic(sUrl, sName, oOptions, bReplace) {

	if (oOptions) {}
	else {
		oOptions = {
			iWidth: 500,
			iHeight: 350,
			sMenubar: false,
			sToolbar: false,
			sResizeable: true,
			sScrollbars: true,
			sStatus: true
		};
	}

	var iLeftOffset = screen.availWidth / 2 - oOptions.iWidth / 2;
	var iTopOffset = screen.availHeight / 2 - oOptions.iHeight / 2;

	oNewWindow = window.open(
		sUrl,
		'',
		'left=' + iLeftOffset + ', ' +
		'top = ' + iTopOffset + ', ' +
		'width=' + (oOptions.iWidth+50) + ', ' +
		'height=' + (oOptions.iHeight+100) + ', ' +
		'menubar=' + oOptions.sMenubar + ', ' +
		'toolbar=' + oOptions.sToolbar + ', ' +
		'resizable=' + oOptions.sResizeable + ', ' +
		'scrollbars=' + oOptions.sScrollbars + ', ' +
		'status=' + oOptions.sStatus
	);

	if(sUrl.match(/\.(gif|jpe?g|png)$/i)) {
		oNewWindow.document.open();
		oNewWindow.document.write('<html><head>' + (sName != ''? '<title>' + sName + '</title>' : '') + '</head>'+
			'<body style="background: #242424 url(/test/ww/i/bg_disposition.png) repeat-x; margin: 0; padding: 0;">' +
			'<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"><tr><td align="center">' +
			'<img src="/' + sUrl + '" style="margin: 20px 20px 4px;" />' +
			'<p style="text-align: center; color: #fff; cursor: pointer; font-family: Georgia, "Times New Roman", Times, serif; font-size: 90%;" onclick="window.close()">&#215; Закрыть</p>' +
			'</td></tr></table></body></html>'
			);
		oNewWindow.document.close();
	}

	oNewWindow.focus();
	return false;
}

function Auth(sUrl)
{
	//alert('aaa');
	var str=prompt('Введите пароль');
	if (str!=null)
	{
		document.location = sUrl+str;
	}
	return false;

}
function OutMode(sUrl)
{
	document.location = sUrl;
}
