function visibleAuth(){	
	jQuery("#auth_window").show(300);	
}
function hideAuth(){
	jQuery("#auth_window").hide(300);
}
function setNickColor(val,num){
	jQuery("#nick_color").attr("value",val);	
	jQuery("#color_1").attr("src","/images/rekportal/avatar_red.png");
	jQuery("#color_2").attr("src","/images/rekportal/avatar_blue.png");
	jQuery("#color_3").attr("src","/images/rekportal/avatar_yellow.png");
	if(num==1){
		jQuery("#color_1").attr("src","/images/rekportal/avatar_red_active.png");
	}
	if(num==2){
		jQuery("#color_2").attr("src","/images/rekportal/avatar_blue_active.png");
	}
	if(num==3){
		jQuery("#color_3").attr("src","/images/rekportal/avatar_yellow_active.png");
	}
}

var months = new Array();
months[0] = "Январь";
months[1] = "Февраль";
months[2] = "Март";
months[3] = "Апрель";
months[4] = "Май";
months[5] = "Июнь";
months[6] = "Июль";
months[7] = "Август";
months[8] = "Сентябрь";
months[9] = "Октябрь";
months[10] = "Ноябрь";
months[11] = "Декабрь";
var thisDate = new Date();
var countd = thisDate.getDate();
var countm = thisDate.getMonth();
var county = thisDate.getFullYear();
var mlens = new Array();
mlens[0] = 31;
if ((thisDate.getFullYear()%4) != 0) {
	mlens[1] = 28;
} else {
	mlens[1] = 29;
}
mlens[2] = 31;
mlens[3] = 30;
mlens[4] = 31;
mlens[5] = 30;
mlens[6] = 31;
mlens[7] = 31;
mlens[8] = 30;
mlens[9] = 31;
mlens[10] = 30;
mlens[11] = 31;
function setDays(numy,num) {	
	var link='';
	var dayDate = new Date(numy, num, 1);
	var d = dayDate.getDay();
	if (d == 0) {
		d = 7;
	}
	var m = mlens[num];
	for (var i = 0; i<42; i++) {	
		jQuery("#day"+(i+1)+"_txt").text('');					
	}
	for (var i = d; i<m+d; i++) {	
		link='<a href="?year='+numy+'&month='+(Number(num)+1)+'&day='+(i-d+1)+'">'+(i-d+1)+'</a>';
		jQuery("#day"+i+"_txt").html(link);					
	}
}
function setNewDays(){
	countm=jQuery("#month_sel").attr("value");				
	county=jQuery("#year_sel").attr("value");	
	setDays(county,countm);
}
function isCommentSubmit(){
	var temp_comment=document.add_page_comment_form.comment.value;
	temp_comment=temp_comment.split('\n');
	temp_comment=temp_comment.join('---');
	temp_comment=temp_comment.split("'");
	temp_comment=temp_comment.join('"');	
	document.add_page_comment_form.comment.value=temp_comment;
	if(document.add_page_comment_form.nick.value!=''){
		document.add_page_comment_form.title.value=document.add_page_comment_form.nick.value;
		document.add_page_comment_form.submit();				
	}			
}
function parseCommentFormat(id_comment){	
	old_comment=jQuery("#comment_"+id_comment).html();
	old_comment=old_comment.split('---');
	old_comment=old_comment.join('<p style="margin:0px;font-size:4px;line-height:4px;">&nbsp;</p>');						
	jQuery("#comment_"+id_comment).html(old_comment);
}
function parseLastComment(id_comment){	
	old_comment=jQuery("#last_comment_"+id_comment).html();
	if(old_comment.indexOf('---')!=-1){
		old_comment=old_comment.split('---');	
		old_comment=old_comment[0];		
	}
	if(old_comment.length>150){
		old_comment=old_comment.slice(0,150);
		old_comment+='...';
	}
					
	jQuery("#last_comment_"+id_comment).html(old_comment);
}
