var newNotes = new Object();
newNotes.blockid = 'nnblock';
newNotes.parentid = 'menu_parent0';
newNotes.childid = 'menu_child0';
newNotes.cName = 'nnt';
newNotes.get = function (type)
{
	this._hide();
	if (this.curtype == type)
		return false;
	this.type = type;
	var getData = new Subsys_JsHttpRequest_Js();
	getData.onreadystatechange = function() {
		if (getData.readyState == 4) {
			try {
				var tmp = getData.responseJS;
				if (tmp.length < 1) {
					throw 1;
				}
				newNotes._showData(tmp);
			} catch (e) {
			}
		}
	}
	getData.caching = true;
	getData.open('POST', '/js/getnewnotes.js', true);
	getData.send({type: type});
}
newNotes._showData = function (data)
{
	var p = dge(this.blockid);
	for (var k = 0; k < p.childNodes.length; k++) {
		if (p.childNodes[k].tagName == 'DD') {
			if (!p.childNodes[k].className.match('noborder')) {
				p.removeChild(p.childNodes[k]);
				k--;
			} else {
				var ldd = p.childNodes[k];
				p.removeChild(ldd);
			}
		}
	}
	var dd = c = h = null;
	for (var k = 0; k < data.length; k++) {
		h = c = '';		
		if (data[k][4] != '')
			h = '<a href="' + data[k][4] + '">+' + data[k][5] + '</a>';
		switch (data[k][7]) {
			case '0':
				c = ' class="girl" ';
				break;
			case '1':
				c = ' class="boy" ';
				break;
			case '2':
				c = ' class="community" ';
				break;
		}
		dd = dce('DD');
		dd.innerHTML = '<span class="date">' + data[k][0] + '</span><p class="caption"><a href="' + data[k][1] + data[k][2] + '/">' + data[k][3] + '</a></p><span class="reports">' + h + data[k][6] + '</span><a href="' + data[k][1] + '"' + c + '>' + data[k][8] + '</a>';
		p.appendChild(dd);
	}
	p.appendChild(ldd);
	this.curtype = this.type;
	//dge(this.parentid).innerHTML = '<u>' + newNotes.links[this.curtype] + '</u>';
	var pp = dge(this.parentid);
	for (var k = 0; k < pp.childNodes.length; k++) {
		if (pp.childNodes[k].tagName == 'U') {
			pp.childNodes[k].innerHTML = newNotes.links[this.curtype];
			break;
		}
	}
	var c = this.getCookie(this.cName);
	if (!c || c != this.curtype)
		this.setCookie(this.cName, this.curtype, 3600 * 24 * 365, '/');
	showNoteText.start2(p);
	upopUpDivs.start2(p);
}
newNotes._hide = function ()
{
	clearTimeout(currentShown["at_timeout"]);
	currentShown.style.display = 'none'
	currentShown = null;
}
newNotes.getCookie = function(name)
{
	var startPos = document.cookie.indexOf(escape(name) + '=');
	if (startPos != -1) {
		startPos = startPos + (escape(name) + '=').length;
		var endPos = document.cookie.indexOf(';', startPos);
		if (endPos != -1)
			return unescape(document.cookie.substring(startPos, endPos));
		else
			return unescape(document.cookie.substring(startPos));
	}
	return null;
}
newNotes.setCookie = function(name, value, expiresDelta, path, domain, secure)
{
	var expires = null;
	if (expiresDelta) {
		var date = new Date();
		date.setTime(date.getTime() + expiresDelta);
		expires = date.toGMTString();
	}
	document.cookie = escape(name) + '=' + escape(value) 
	+ (expires ? '; expires=' + expires : '')
	+ (path ? '; path=' + path : '; path=/')
	+ (domain ? '; DOMAIN=' + domain : '')
	+ (secure ? '; SECURE' : '');
}
popUpDivs.prototype.start2 = function (obj)
{
	if (!obj)
		return;
	var a = obj.getElementsByTagName('A');
	var tmp, flg;
	var _pCollections = [];
	var instance = this;
	for (var i = 0; i < a.length; i++) {
		flg = '';
		for (var ii=0; ii < this.parentAllowClassName.length; ii++){
			flg += (ii > 0) ? ' || ' : '';
			flg += '('+a[i].className.indexOf(this.parentAllowClassName[ii]) + ' != -1)';
		}
		flg = (flg == '') ? true : eval(flg);
		if (flg && (tmp = a[i].href.match(this.parentReg))) {
			tmp.splice(0, 1);
			_pCollections[_pCollections.length] = {'i':tmp,'o':a[i]};
		}
	}
	if (_pCollections.length > 0) {
		for (var i = 0; i < _pCollections.length; i++) {
			this._attach(_pCollections[i]['o'], _pCollections[i]['i']);

		}
	}
}
function blogPopUpDivs() {}
blogPopUpDivs.prototype = new popUpDivs();
blogPopUpDivs.prototype.parentAllowClassName = [];
blogPopUpDivs.prototype.parentReg = /\.ua\/(user|community)\/([0-9]+)\/([0-9]+)\/$/;
blogPopUpDivs.prototype.dataLoadScript = null;
blogPopUpDivs.prototype.src = null;
blogPopUpDivs.prototype.t = {};
blogPopUpDivs.prototype.rt = {};
blogPopUpDivs.prototype.script = null;
blogPopUpDivs.prototype.start = function ()
{
	if (!this.src)
		return;
	this._browser = b;
	this._langId = (JS_LANG_ID == 2 || JS_LANG_ID == 3) ? JS_LANG_ID : 0;
	var a = document.getElementsByTagName('A');
	var tmp;
	var _pCollections = [];

	var instance = this;
	for (var i = 0; i < a.length; i++) {
		if (tmp = a[i].href.match(this.parentReg)) {
			tmp.splice(0, 3);
			_pCollections[_pCollections.length] = {'i':tmp,'o':a[i]};
		}
	}
	if (_pCollections.length > 0) {
		this._child = this._createDiv(this.childId);
		this._child.position = this.childPosition||'';
		this._child.alwaysDown = this.childAlwaysDown||false;
		this._child.alwaysLeft = this.childAlwaysLeft|| false;
		if (document.attachEvent) {
			document.attachEvent('onclick', instance.__hideOnDocClick);
			window.attachEvent('onresize', instance.__hideOnWinResize);
		} else {
			document.addEventListener('click', instance.__hideOnDocClick, true);
			window.addEventListener('resize', instance.__hideOnWinResize, false);
		}
		for (var i = 0; i < _pCollections.length; i++) {
			this._attach(_pCollections[i]['o'], _pCollections[i]['i']);

		}
	}
}
blogPopUpDivs.prototype.start2 = function (obj)
{
	if (!this.src || !obj)
		return;
	var a = obj.getElementsByTagName('A');
	var tmp;
	var _pCollections = [];
	var instance = this;
	for (var i = 0; i < a.length; i++) {
		if (tmp = a[i].href.match(this.parentReg)) {
			tmp.splice(0, 3);
			_pCollections[_pCollections.length] = {'i':tmp,'o':a[i]};
		}
	}
	if (_pCollections.length > 0) {
		for (var i = 0; i < _pCollections.length; i++) {
			this._attach(_pCollections[i]['o'], _pCollections[i]['i']);
		}
	}
}
blogPopUpDivs.prototype._toJson = function (arr)
{
	return arr;
}
blogPopUpDivs.prototype._loadData = function ()
{
	var instance = this._parent['upThis'];
	if (this.t[this._parent['upArr'][0]])
		instance._showData(this.t[this._parent['upArr'][0]]);
	else if (this.rt[this._parent['upArr'][0]])
		instance._showData(this.rt[this._parent['upArr'][0]]);
	else
		instance._hideOnDocClick();
}
blogPopUpDivs.prototype._getInnerHtmlStr = function (data)
{
	this._child.className = "popupWrapper";
	return '<div>' + data + '</div><div class="pupshad1"></div><div class="pupshad2"></div><div class="pupshad3"></div>';
}
blogPopUpDivs.prototype.__showWithDelay = function(e)
{
	var instance = this["upThis"];
	if (typeof(instance) != "undefined" && instance && typeof(mouseCoords) != "undefined" && mouseCoords) {
		if (!instance.script) {
			instance.script = document.createElement("SCRIPT");
			instance.script.charset = "windows-1251";
			instance.script.type = "text/javascript";
			instance.script.src = instance.src;
			document.body.appendChild(instance.script);
		}

		instance._parent = this;
		if (instance.positionByMouseX || instance.positionByMouseY)
			instance._parent.upPos = mouseCoords(e || window.event);
		eval('instance._showTimeout = setTimeout("'+instance.name+'.__show()", instance.timeIntShow);');
	}
}
blogPopUpDivs.prototype.__hideOnDocClick = function (e) {
	if (e.target)
		obj = e.target;
	else
		obj = e.srcElement;
	for (; obj; obj = obj.parentNode) {
		if (obj.id == showNoteText._child.id) {
			return;
		}
	}
	showNoteText._hideOnDocClick();
}
blogPopUpDivs.prototype.__hideOnWinResize = function (e) {
	showNoteText._hideOnDocClick();
	showNoteText._current = null;
}

var showNoteText = new blogPopUpDivs();
showNoteText.name = 'showNoteText';
showNoteText_start = function ()
{
	showNoteText.start();
}
if (window.attachEvent) {
	window.attachEvent ('onload', showNoteText_start);
} else if (window.addEventListener) {
	window.addEventListener("load", showNoteText_start, false);
}
