function get_value(element){return document.getElementById(element).value;}

function get_nav_horo(h_t)
	{
	/*Выгребаем новый знак */
	var sign=get_value('horo_sign_list');
	if (sign==0)
	{
		return false;
	}
	/* */
		JsHttpRequest.query(
            '/controller.php',{'class': 'horo', 'function':'update_dinamic','param':{'sign':sign,'pers':h_t} },
            // Обработка
            function(result, errors) {
                // Обработка ошибок
                //document.getElementById('debug').innerHTML = errors;
                // Обработка ответа показать блок выбора таблиц
				document.getElementById('horo_day_sign_name').innerHTML = '<h2>'+result['return']['sign']+'</h2>';
				document.getElementById('horo_day_number').innerHTML=Number(result['return']['period'].split("-")[2]);
				document.getElementById('horo_day_month').innerHTML=result['return']['month'];
				document.getElementById('horo_day_text').innerHTML = result['return']['text'];
				//document.getElementById('l_horo_link').href=document.getElementById('r_horo_link').href=
				//document.getElementById('h_week_l').href='/horo/'+result['return']['r_id']+'/';
				// ставим галочку :)
				var date = new Date();
				var days=365;
				date.setTime(date.getTime()+(days*24*60*60*1000));
				setCookie("sign",sign,date.toGMTString(),"/");
            },
            true
        );
	return true;
    }
function nav_horo_pass()
{
	document.getElementById('h_tod').style.backgroundPosition = '0 0';
	document.getElementById('h_tom').style.backgroundPosition = '-35px 0';
	document.getElementById('h_week').style.backgroundPosition = '-35px 0'
}

/*Общие 3-х менюшки */
function SetActive(id){
	document.getElementById('menu_item_'+id).className = 'menu_'+id+'_a';
	document.getElementById('menu_text_'+id).className = 'menu_text';
}
function SetPass(id){
	document.getElementById('menu_item_'+id).className = 'menu_'+id;
	document.getElementById('menu_text_'+id).className = 'menu_text_a';
}
function lmenu_over(id,key)
	{
	id.style.backgroundPosition = '0px -50px';id.style.color='#FFFFFF';
	if (document.getElementById('hmitem_'+key)){
		document.getElementById('hmitem_'+key).style.color = '#FFFFFF';
	}

	}
function lmenu_out(id,key)
	{
	id.style.backgroundPosition = '0px 0px'; id.style.color='#000000';
	if (document.getElementById('hmitem_'+key)){
		document.getElementById('hmitem_'+key).style.color = '';
		}
	}
function rss_over(id){id.style.backgroundPosition = '0px 0px';}
function rss_out(id){id.style.backgroundPosition = '0px -13px';}

function Show_add_form(){
	document.getElementById('new_text').value='';
	document.getElementById('anec_thanks').style.display = 'none';
	if (document.getElementById('anec_add_form').style.display=='none'){
	document.getElementById('anec_add_form').style.display = 'block';
	document.getElementById('anec_add_botton').style.backgroundPosition = '0px -16px';}
	else{
	document.getElementById('anec_add_form').style.display = 'none';
	document.getElementById('anec_add_botton').style.backgroundPosition = '0px 0px';}
}
function send_to_friend(id){
	form_id='send_form_'+id;
	if (document.getElementById(form_id).style.display=='none')
	{
	document.getElementById(form_id).style.display = 'block';
	}
	else
	document.getElementById(form_id).style.display = 'none';
}

/* Работа с cookies */
function setCookie (name, value, expires, path, domain, secure) {
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}
/*
Погодка
*/
function weather_full_towns() /* Показываем все города */
{
	var current=$("#other_towns").css('max-height');
	if (current=='132px'){$("#other_towns").css('max-height','100%');$("#w_other_towns").text('Скрыть города');return;}
	$("#other_towns").css('max-height','132px');
	$("#w_other_towns").text('Показать все города');

}

/**
 * Ajax index news changer
 * @access public
 * @return void
 **/
function ajax_show_news(news_id){
	$("div.news_i_block>div[@element='news']").hide();
	$('#news_'+news_id).show();
}

/**
 * Ajax index news category changer
 * @access public
 * @return void
 **/
function ajax_show_category(cat_id){
	$("#lmenu_progress").show();
	JsHttpRequest.query(
            '/controller.php',{'class': 'news', 'function':'show_index','param':{'cat_id':cat_id}},
            // Обработка
            function(result, errors) {
                if (result) {
                    $("#ajax_news").replaceWith(result["return"]);
                    $("#lmenu_progress").hide();
                }
            },
            true
        );
    return false;
}