	function shobj (o)
	{
		if ( document.getElementById('post_comment').style.display == 'none' )
			document.getElementById('post_comment').style.display = 'block';
		else
			document.getElementById('post_comment').style.display = 'none';
	}
	function IActivate(o) { o.className = 'active'; if ( errorFor == o.id ) HCE(); }
	function IDisactivate(o) { o.className = ''; }
	function PostComment()
	{
		xhr = CreateXHR();
		var params = getFormDataForPost();
		
		xhr.onreadystatechange = XHROnStateChange;
		xhr.open('POST', postURL+'?rand='+Math.random(), true);
		xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xhr.setRequestHeader('Content-Length', params.length);
		xhr.setRequestHeader('Connection', 'close');
		xhr.send(params);
		return false;
	}
	function getFormDataForPost()
	{
		var ret = 'author='+document.getElementById('koipishe').value.replace(/\&/, '%26') +
			'&comment='+document.getElementById('comment').value.replace(/\&/, '%26') +
			'&captcha='+document.getElementById('captcha').value.replace(/\&/, '%26') +
			'&email='+document.getElementById('email').value.replace(/\&/, '%26');
		if ( document.getElementById('avatar_f').checked )
			ret += '&avatar=female';
		else
			ret += '&avatar=male';
		return ret;
	}
	function CreateXHR()
	{
		var xmlHttp;
		try { xmlHttp=new XMLHttpRequest(); }
		catch (e)
		{
			try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
			catch (e)
			{
				try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
				catch (e) { return false; }
			}
		}
		return xmlHttp;
	}
	function XHROnStateChange()
	{
		if ( xhr.readyState == 4 )
		{
			if ( xhr.status == 200 )
			{
				var respArr = xhr.responseText.split(':');
				if ( respArr.length > 0 )
				{
					if ( 0+respArr[0] == 1 )
					{
						return CommentDone(respArr);
					}
					else
					{
						return CommentError(respArr[1], respArr[0]);
					}
				}
			}
			CommentDone();
		}
	}
	function CommentError(eText, eAttach)
	{
		errorFor = eAttach;
		if ( !document.getElementById('comment_error') )
		{
			ce = document.createElement('div');
			ce.onclick = FCE;
			ce.OnClick = FCE;
			ce.setAttribute('id', 'comment_error');
			ce = document.getElementById('comment_form').appendChild(ce);
			ce.style.display = 'none';
		}
		coords = getAnchorPosition(eAttach);
		document.getElementById('comment_error').style.left = (coords.x - 200)+'px';
		document.getElementById('comment_error').style.top = (coords.y - 36 + ( document.getElementById(eAttach).clientHeight / 2 ))+'px';
		document.getElementById('comment_error').innerHTML = eText;
		//document.getElementById('comment_error').onblur = HCE;
		//document.getElementById('comment_error').OnBlur = HCE;
		document.getElementById('comment_error').style.display = 'block';
		document.getElementById('comment_error').focus();
	}
	function CommentDone()
	{
		if ( arguments[0] )
		{
			if ( arguments[0].length > 5 )
				for ( i = 5; i < arguments[0].length; i++ )
					arguments[0][4] = '' + arguments[0][4] + ':' + arguments[0][i];
			
			if (!document.getElementById('comments_list'))
			{
				var commentsList = document.createElement('ul');
				commentsList.setAttribute('id', 'comments_list');
				document.getElementById('comments').appendChild(commentsList);
			}
			
			document.getElementById('comments_list').innerHTML = 
				document.getElementById('comments_list').innerHTML +
				'<li id="justPosted"><div class="author"><h5>'+arguments[0][1]+'</h5><img src="avatars/'+arguments[0][2]+'.jpg" alt="" width="65" height="65" /></div><div class="data"><em><span>'+(arguments[0][3].replace("|", ":"))+'</span></em><p>'+arguments[0][4]+'</p></div></li>';
		}
		document.getElementById('comment_form').innerHTML = '';
		document.getElementById('comment_add_button').onclick = function () {return false;};
		document.getElementById('comment_add_button').OnClick = function () {return false;};
		document.getElementById('comment_add_button').className = 'inactive';
		delete(document.getElementById('comment_add_button').href);
		document.getElementById('justPosted').focus();
	}
	function HCE() { document.getElementById('comment_error').style.display = 'none'; }
	function FCE() { document.getElementById(errorFor).focus(); }

