function openRefList()
{
	var obj = document.getElementById('plus');
	if (obj)
	{
		alert("Проверка");
		return true;
	}
}
function Check_Admin_Message()
{
	var msg="";
	if(document.getElementById('id_email').value.toString()=="")
		msg+="\r\nВы не ввели адрес Вашей электронной почты.";
	else
	{
		var reg = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
		if(reg.exec(document.getElementById('id_email').value.toString())==null)
			msg+="\r\n"+document.getElementById('id_email').value.toString()+" не является допустимым форматом адреса электронной почты.";
	}
	if(document.getElementById('id_name').value.toString()=="")
		msg+="\r\nВы не ввели Ваше имя.";
	if(document.getElementById('id_theme').value.toString()=="")
		msg+="\r\nВы не ввели тему письма.";
	if(document.getElementById('id_message').value.toString()=="")
		msg+="\r\nВы не ввели содержимое письма.";	
	if(msg=='')
		return true;
	else
	{
		alert(msg);
		return false;
	}
}
function BlurSearch()
{
	if(document.getElementById('id_search_text').value=="")	document.getElementById('id_search_text').value="поиск по сайту";
}
function FocusSearch()
{
	if(document.getElementById('id_search_text').value=="поиск по сайту")	document.getElementById('id_search_text').value="";
}
function BlurImage(id)
{
	img=document.getElementById(id);
	img.blur();
	var i=10;
}
function CheckLoginForm()
{
	if(document.getElementById('login').value=="" || document.getElementById('pass').value=="")
		{alert("Все поля обязательны для заполнения."); return false;}
	return true;
}
function CkeckForgPass()
{
	if(document.getElementById('login').value=="" || document.getElementById('email').value=="")
		{alert("Все поля обязательны для заполнения."); return false;}
	var reg = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
	if(reg.exec(document.getElementById('email').value)==null)
		{alert(document.getElementById('email').value+" не является допустимым форматом адреса электронной почты."); return false;}
	return true;
}
function CheckFormRegister()
{
	if(document.getElementById('username').value=="" || document.getElementById('user_password').value=="" || document.getElementById('reuser_password').value=="" || document.getElementById('user_email').value=="")
		{alert("Все поля, отмеченные звездочкой (*) обязательны для заполнения."); return false;}
	if(document.getElementById('user_password').value!=document.getElementById('reuser_password').value)
		{alert("Пароли не совпадают."); return false;}
	var reg = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
	if(reg.exec(document.getElementById('user_email').value)==null)
		{alert(document.getElementById('user_email').value+" не является допустимым форматом адреса электронной почты."); return false;}
	if(document.getElementById('user_avatar').value!='')
	{
		var temp=document.getElementById('user_avatar').value.split(".");
		var length=(temp.length-1);
		var t=temp[length];
		if(t=="jpg" || t=="jpeg" || t=="png" || t=="gif") {}
		else	{alert("Формат аватара неверен. Поддерживаются только jpeg, jpg, png и gif"); return false;}
	}
	return true;
}
function CheckFormAccount()
{
	if(document.getElementById('username').value=="" || document.getElementById('current_pass').value=="" || document.getElementById('user_email').value=="")
		{alert("Все поля, отмеченные звездочкой (*) обязательны для заполнения."); return false;}
	if(document.getElementById('user_password').value!=document.getElementById('reuser_password').value)
		{alert("Новый пароль и повторный пароль не совпадают."); return false;}
	var reg = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
	if(reg.exec(document.getElementById('user_email').value)==null)
		{alert(document.getElementById('user_email').value+" не является допустимым форматом адреса электронной почты."); return false;}
	if(document.getElementById('delete_avatar').checked==true)
	{	
		if(document.getElementById('user_avatar').value!='')
		{
			var temp=document.getElementById('user_avatar').value.split(".");
			var length=(temp.length-1);
			var t=temp[length];
			if(t=="jpg" || t=="jpeg" || t=="png" || t=="gif") {}
			else	{alert("Формат аватара неверен. Поддерживаются только jpeg, jpg, png и gif"); return false;}
		}
		else {alert("Не выбран новый аватар"); return false;}
	}
	return true;
}
function ShowArea(id)
{
	if(document.getElementById('area_'+id).className=='block')	{document.getElementById('area_'+id).className='none'; return false;}
	if(document.getElementById('area_'+id).className=='none')	{document.getElementById('area_'+id).className='block'; return false;}
}
function CheckNewComent(id)
{
	if(document.getElementById('comment_'+id).value=='')
		{alert("Вы не заполнили текст комментария."); return false;}
	if(document.getElementById('image_comment_'+id).value!='')
	{
		var temp=document.getElementById('image_comment_'+id).value.split(".");
		var length=(temp.length-1);
		var t=temp[length];
		if(t=="jpg" || t=="jpeg" || t=="png" || t=="gif") {}
		else	{alert("Формат изображения неверен. Поддерживаются только jpeg, jpg, png и gif"); return false;}
	}
	return true;
}
function OverMainMune(id)
{
	document.getElementById(id).className='sel_main_menu';
}
function OutMainMune(id)
{
	document.getElementById(id).className='empty';
}

function writeArticlesNavi(isFirstNavi) {
	var articlesBackLinkId = "articlesBackLink" + (isFirstNavi ? "Top" : "Bottom")
	var articlesNextLinkId = "articlesNextLink" + (isFirstNavi ? "Top" : "Bottom")
	document.write('<div style="width:91px;float:right;margin-right:10px;line-height:24px;">');
	document.write('<div style="width:45px;float:left;text-align:left;"><a href="#" onclick="return showArticles(-1)" id="'+ articlesBackLinkId +'" style="text-decoration:none">&laquo;&nbsp;BACK</a></div>');
	document.write('<div style="width:45px;float:right;text-align:right;"><a href="#" onclick="return showArticles(+1)" id="'+ articlesNextLinkId +'" style="text-decoration:none">NEXT&nbsp;&raquo;</a></div>');
	document.write('</div>');
}
function showArticles(step) {
	if (!document.getElementById) {return false;}
	newFirstArticleNum = curPageFirstArticleNum + step * articlesPerPageNum;
	if ((newFirstArticleNum < 1) || (newFirstArticleNum > maxArticlesNum)) {return false;}
	for (var i = 1; i < maxArticlesNum + 1; i++) {
		if(document.getElementById('articleItem-'+i)) { document.getElementById('articleItem-'+i).style.display = 'none'; }
	}
	for (var i = newFirstArticleNum; i < newFirstArticleNum + articlesPerPageNum; i++) {
		if(document.getElementById('articleItem-'+i)) { document.getElementById('articleItem-'+i).style.display = 'block'; }
	}
	curPageFirstArticleNum = newFirstArticleNum;
	displayArticlesNavi();
	return false;
}
function displayArticlesNavi() {
	if (!document.getElementById) {return false;}
	var lastPageFirstArticleNum = 1 + maxArticlesNum - maxArticlesNum % articlesPerPageNum;
	//curPageFirstArticleNum = curPageFirstArticleNum-1;
	if(maxArticlesNum==4){
	  lastPageFirstArticleNum=1;
	}
	document.getElementById('articlesBackLinkTop').style.display = (articlesPerPageNum > curPageFirstArticleNum) ? "none" : "";
	document.getElementById('articlesBackLinkBottom').style.display = (articlesPerPageNum > curPageFirstArticleNum) ? "none" : "";
	document.getElementById('articlesNextLinkTop').style.display = (curPageFirstArticleNum >= lastPageFirstArticleNum) ? "none" : "";
	document.getElementById('articlesNextLinkBottom').style.display = (curPageFirstArticleNum >= lastPageFirstArticleNum) ? "none" : "";
}

function PuskPlayer(is_manual_start) {
	var clubstone_mp3 = window.open('','clubstone_mp3','titlebar=no,toolbar=no,titlebar=no,scrollbars=no,height=150,resizable=no,width=300,menubar=no,alwaysLowered=yes,status=no');

	if(!clubstone_mp3.location.href || clubstone_mp3.location.href == 'about:blank') {
		clubstone_mp3.location.href = "/images/flash/mp3player.html";
	}

	if (is_manual_start) {
		clubstone_mp3.focus();
	} else {
		window.focus();
	}
}

function PuskPlayer2()
{
  alert(123);
  window.open('/images/flash/mp3player.html','mp3_2','titlebar=no,toolbar=no,titlebar=no,scrollbars=no,height=100,resizable=no,width=300,menubar=no,alwaysLowered=yes,status=no');

  //winnew.blur()
 // window.focus() 
}


function Shetchik(id)
{
  var x = document.getElementById('id_item_count'+id).innerHTML;
  y = parseInt(x,10)+1;
  document.getElementById('id_item_count'+id).innerHTML = y;
}
