function stopError() {
  return true;
}
window.onerror = stopError;


function ShowCalend() {

 _get('calend_year').style.display='block';
  setTimeout("_get('frame').onclick = function(){HideCalend(); }",100);

}

function HideCalend() {
    _get('calend_year').style.display='none';
    _get('frame').onclick = function() {};
}

function SetYear(year) {

        var days = document.getElementsByClassName('calend_months');
        if (days) {
            for (i = 0; i < days.length; i++) {
                days[i].style.display = 'none';
            }
        }
    _get('calend_sel').innerHTML = year;
    _get('month_'+year).style.display = 'block';
}



function NewsPrev(id) {

    var li = _get("li_n_"+id);

    alert(1);

}

function InitNewsPrev() {
    var ul,l,i,li,ins,a;
    ul = _get("news_over").childNodes;
    l = ul.length;
    for (i=0;i<l;i++) {

        if (ul[i].tagName == 'LI') {
            a = ul[i].getElementsByTagName("A")[0];
            Virta.addEvent(a,"mouseover",function(){
                div = this.parentNode.getElementsByTagName("DIV")[0];
                div.style.display = 'block';
                div.innerHTML= '<img src="/tmp_upload/news/'+this.rel+'" />';
            });
            Virta.addEvent(a,"mouseout",function(){
                div = this.parentNode.getElementsByTagName("DIV")[0];
                div.style.display = 'none';
            });
        }

    }
}

function SelectStyle() {

var lists = document.getElementsByClassName('select_style'),l = lists.length,i,ch,dv;


    for (i=0;i<l;i++) {

    
        lists[i].onclick = function(){
            SelectStyleSH(this);
        };

    }
}

function SelectStyleSH(list) {

            var ch = list.getElementsByClassName('select_list')[0];
            var dv = list.getElementsByClassName('item_sel')[0];
            if (ch.style.display == 'block') {
                dv.className = dv.className.replace(' sel', '');
                ch.style.display = 'none';
                _get("frame").onclick = function(){  }
            } else {


                dv.className += ' sel';
                ch.style.display = 'block';

            }

}
window.onDOMComplete.push(function() {

 SelectStyle();

});

function Update(){
    var confirmCodeImg = _get('captcha');
    var newConfirmCode = confirmCodeImg.cloneNode(true);
    confirmCodeImg.src = '/captcha';
    confirmCodeImg.style.width = '80px';
    confirmCodeImg.style.height = '50px';
    newConfirmCode.src = '/captcha/?key=' + Math.round(1000 * Math.random(), 0);
    refreshCC = window.setInterval(
        function() {
            if (newConfirmCode.complete) {
                confirmCodeImg.parentNode.replaceChild(newConfirmCode, confirmCodeImg);
                window.clearInterval(refreshCC);
                refreshCC = null;
            }
        }, 1);
}

