function show_tariff(){
	$('.types a.in').attr('href','#').removeAttr('class');
	$(this).removeAttr('href').attr('class','in');
	$('table.tariff tbody.block').hide();
	$('#'+this.name).show();
	return false;
}

$(document).ready(function(){
	if($('ul#calendar')){
		$('#calendar ul').hide();
		$('#calendar a.in').next().show();
		$('#calendar>li>a').click(function(){
			$('#calendar>li>a').attr('href','#').removeAttr('class');
			$('#calendar ul').hide();
			$(this).attr('class','in').removeAttr('href').next().show();
			return false;
		})
	}
	if($('ul.types')){
		$('.types a').click(show_tariff)
		$($('.types a')[0]).click();
	}
	if($('ul#sup')){
		$('#sup a').click(function(){
			$('#sup li').removeAttr('class');
			$('#sup a').attr('href','#');
			$(this).removeAttr('href').parent().parent().attr('class',(this.name == 'abon')?"act1":"act2");
			$('#itype').val(this.name);
			if(this.name == 'comment'){
				$('#tnum').hide();
			}else{
				$('#tnum').show();
			}
		})
		$($('#sup a')[0]).click();
	}
	$('div.collapse > h3').each(function(){
		$(this).parent().prepend('<a href="#">'+$(this).html()+'</a>');
		$(this).remove();
	})
	$('div.collapse > a').each(function(){
		$(this).next().hide();
	})
	$('div.collapse > a').click(function(){
		if($(this).parent().attr('class').indexOf('noslide')>-1){
			$(this).blur().next().toggle();
		}else{
			$(this).blur().next().slideToggle('fast');
		}
		return false;
	})
})

hasReference1 = false;

function showId(el) {
  whichEl = document.getElementById(el);
  if (whichEl.toString()=='[object HTMLTableSectionElement]') {
    if ( whichEl.style.display != "table-row-group") {
      whichEl.style.display = "table-row-group";
//	  openThread(el);
    }
    else {
      whichEl.style.display = "none";
//	  closeThread(el);
    }
  }
  else
  {
  	  $(whichEl).toggle()
  }
}

function openThread(el){
     whichEl = document.getElementById("i"+el);
     whichEl.src = "img/openThread.gif";

}

function closeThread(el){
     whichEl = document.getElementById("i"+el);
     whichEl.src = "img/closedThread.gif";

}
function fullstat(name,type){
	tb_show(name,'#TB_inline?abc=abc&amp;width='+(type=='voip'?500:400)+'&amp;height='+(tb_getPageSize()[1] - 60-60)+'&amp;inlineId=n'+name);
	return false;
}
