




var mainmenuitems = Array();





function selectNews(url, period){
    document.location.href=url+period+"/";
}


function changeMainMenuStyle(id){

}


function revertMainMenuStyle(id){

    
}
   
function hideAll(){
    for(var i = 0; i <mainmenuitems.length; i++)
        hideMenu(mainmenuitems[i]);
}

function showMenu(id){
    if(document.getElementById('menu_'+id))
        {hideAll();
        document.getElementById('menu_'+id).style.visibility = 'visible';}
}

function hideMenu(id){
    if(document.getElementById('menu_'+id))
        document.getElementById('menu_'+id).style.visibility = 'hidden';
}
    

function loadMovie(movie) {

    var so = new SWFObject('/images/flv/player.swf','player','518','348','8');
    so.addParam('flashvars', 'config=/images/flv/config.xml&autostart=true&file=' + movie);
    so.addParam('allowfullscreen','true');
    if (document.getElementById('videoplayer'))
        so.write('videoplayer');
}

function formatMonth(month){
    if(month<10) month='0'+month;
    return month;
}

function changeRedMenuStyle(id){
    document.getElementById('topmenuitem_'+id).className = 'topmenuitem_a';
    document.getElementById('topmenuitem_left_'+id).className = 'topmenuitem_left_a';
    document.getElementById('topmenuitem_right_'+id).className = 'topmenuitem_right_a';
}
function revertRedMenuStyle(id){
    document.getElementById('topmenuitem_'+id).className = 'topmenuitem';
    document.getElementById('topmenuitem_left_'+id).className = 'topmenuitem_left';
    document.getElementById('topmenuitem_right_'+id).className = 'topmenuitem_right';
}

function inArray(val,arr){
    for (var i=0; i < arr.length; i++) {
        if (arr[i] == val) {
            return true;
        }
    }
    return false;
}

function navigate(formname,idx){
    if(idx!=0)
        document.location.href=document.getElementById(formname).options[idx].value;
}

var tabs = Array ('publications','announces','news');

function getTabIndex(id){
    for(var i = 0; i < tabs.length; i++)
        if(tabs[i]==id)
            return i;
    return false;
}

function hideAllTabs(){
    for(var i = 0; i <tabs.length; i++){
        document.getElementById(tabs[i]).style.display = 'none';
        
        var tabIndex = getTabIndex(tabs[i]);
        if(tabIndex == 0)
            document.getElementById(tabs[i]+'tab').className = 'lefttab';
        else if (tabIndex == tabs.length - 1)
            document.getElementById(tabs[i]+'tab').className = 'righttab';
        else
            document.getElementById(tabs[i]+'tab').className = 'tab';
    }
}

function switchTab(id){
    hideAllTabs();
    document.getElementById(id).style.display = 'block';

    var tabIndex = getTabIndex(id);
    if(tabIndex == 0)
        document.getElementById(id+'tab').className = 'lefttab_a';
    else if (tabIndex == tabs.length - 1)
        document.getElementById(id+'tab').className = 'righttab_a';
    else
        document.getElementById(id+'tab').className = 'tab_a';
}

function switchChart(id){

    for(var i=0; i < charts.length; i++){
        document.getElementById('chartLink'+i).className = 'inactive';
    }

    document.getElementById('chartHeader').innerHTML = charts[id].title;
    document.getElementById('chartPic').src = charts[id].smallImage;
    document.getElementById('chartBigPicLink').href = charts[id].bigImage;
    document.getElementById('chartBigPicLink').title = charts[id].title;
    document.getElementById('chartLink'+id).className = 'active';

}


var headerPics = new Array(
    new Array('/images/header_01.jpg','Совещание по административным вопросам в Коллегии Министерства транспорта'),
    new Array('/images/header_02.jpg','Мэр Москвы презентовал Президенту России универсальную электронную карту москвича'),
    new Array('/images/header_03.jpg','Заседание комиссии по административной реформе'),
    new Array('/images/header_04.jpg','Мэр Москвы презентовал Президенту России универсальную электронную карту москвича')

);
var buttonPics = new Array(
    new Array('btn_0','/images/header_btn_01.gif','/images/header_btn_01_a.gif'),
    new Array('btn_1','/images/header_btn_02.gif','/images/header_btn_02_a.gif'),
    new Array('btn_2','/images/header_btn_03.gif','/images/header_btn_03_a.gif'),
    new Array('btn_3','/images/header_btn_04.gif','/images/header_btn_04_a.gif')

);



function changeHeaderPic(ind){

     for(i=0; i < buttonPics.length; i++)
        $("#btn_"+i).attr('src', buttonPics[i][1]);


    if(ind){
        //$("#headerframe").css('backgroundImage', 'url('+headerPics[ind][0]+')');
        $("#headerpic").attr('src', headerPics[ind][0]);
        $("#headerPicTxt").html(headerPics[ind][1]) ;
        $("#btn_"+ind).attr('src', buttonPics[ind][2]);


    }else{

        //$("#headerframe").css('backgroundImage', 'url('+headerPics[0][0]+')');
        $("#headerpic").attr('src', headerPics[0][0]);
        $("#headerPicTxt").html(headerPics[0][1]);
        $("#btn_0").attr('src', buttonPics[0][2]);
    }
}





