function initAnchor(){
    var anchor=document.location.hash;
    if (anchor){	
	$(anchor)[0].className="tr_anchor";
//	destination = $(anchor).offset().top;
//	$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
    }
}

function hrefClick(year){
    $(':radio').each(function(){
	if ($(this).attr("checked"))
	    text=$(this).attr('value');
	tempArr=($(this).attr('value')).split('@');
	href=tempArr[0]+'@'+tempArr[1]+'@'+year;
	$(this).attr('value',href);
    });
    var arrResult=text.split('@');
    bankId=$('#selectedBank1')[0].value;
    dynamicIndicator(bankId,arrResult[1],arrResult[0],year);
}

function changeRadio(title){
    $('#titleCharts').html(title);
    $(':radio').each(function(){
	if ($(this).attr("checked"))
	    text=$(this).attr('value');
    });
    var arrResult=text.split('@');
    bankId=$('#selectedBank1')[0].value;
    dynamicIndicator(bankId,arrResult[1],arrResult[0],arrResult[2]);
}

function dynamicIndicator(idBank, table_name,indicator_name,year){
    $('a',$('#hrefArray')).each(function(){
	$(this)[0].className="noactive_href";
    });
    $("#"+year)[0].className="active_href";
    $(':radio').each(function(){
	$(this).attr('disabled','true');
    });
    $.post('/inc/chart1.php?rnd='+Math.random(),{
				    bank:idBank,
		    		    table:table_name,
				    indicator:indicator_name,
				    year:year
			    },function(data){
				$('#divShedule').html(data);
				$(':radio').each(function(){
				    $(this).removeAttr('disabled');
				});
			    }
    );
}

function dynamicIndicatorTable(idBank,year,isRefresh){
    $('a',$('#hrefArray_Table')).each(function(){
	$(this)[0].className="noactive_href";
    });
    $('#table_'+year)[0].className="active_href";
    if (isRefresh)
        window.location='http://banker.ua/officialrating/dynamicindicator/?bankId='+idBank+'&cur_year='+year+'/';
}

function loadChart(idBank, table_name,indicator_name){
    if ($("#win_chart").dialog('isOpen'))
	$("#win_chart").dialog('close');
    $.post('/inc/chart1.php',{
				    bank:idBank,
		    		    table:table_name,
				    indicator:indicator_name,
				    fr:'01-'+$('#inputDateMonth')[0].value+'-'+$('#inputDateYear')[0].value
			    },function(data){			    
				    $("#win_chart").dialog({
					    autoOpen:false, 
					    resizable:false,
					    droggable:false,
	    				    width:550, 
					    height:520,
					    bgiframe:true,
					    position:'right'//[10,10]
				    });
				    $("#win_chart").html(data);
				    $("#win_chart").dialog("open");//.bgiframe();
			    }
    );
}

function changeBankInTable(){
    var curYear=$('.active_href').html();
    window.location='http://banker.ua/officialrating/dynamicindicator/?bankId='+$('#selectedBank')[0].value+'&cur_year='+curYear+'/';
}