$(document).ready(function(){

//Ресайз
function fixHeight(block){
	pageHeight = $("#completePageContent").height();
	elemHeight = $(block).height();
	
	if(elemHeight < pageHeight) $(block).css('height', pageHeight);
	
	//Костыли для ...
	if ($.browser.msie && $.browser.version == 6  && !location.href.match('sat.php') ) {
		$(document).pngFix();
	}

}

$("#moduleNavigation").click(function() {
	$(".dropDownContainer").hide();
	$("#topMenuContainer li").removeClass('active');
});
$("#metaNavigation").click(function() {
	$(".dropDownContainer").hide();
	$("#topMenuContainer li").removeClass('active');
});
$("#completePageContent").click(function() {
	$(".dropDownContainer").hide();
	$("#topMenuContainer li").removeClass('active');
});



$("#topMenuContainer li") .click(function() {
	$(this).find(".dropDownContainer").toggle();
	$(this).toggleClass('active');
});

$(".showSub") .mouseover(function() {
	if($("#topMenuContainer li").hasClass("active") == true){
	$(".dropDownContainer").hide();
	$("#topMenuContainer li").removeClass('active');
	
	$(this).parents("li:first").find(".dropDownContainer").toggle();
	$(this).parents("li:first").toggleClass('active');
	}
});



$(".showSub").mouseover(function() {
	$(this).toggleClass('hover')
});


//вывод формы обратной связи
$("#addFaq").click(function() {
	var options = {};
	$("#faqCont").show('blind',options,1000, function(){
		fixHeight('#faqCont');
	});
	$(window).scrollTop(0);
	
	return false;
});
	//проверка формы обратной связи
	$("#faqCont form").submit(function(){
		$("#sysMes").remove();
		if($("#user_f_11_570").attr('checked') && $("#hid_chk input:checked").length == 0){
			$("#hid_chk td:first").prepend('<div id="sysMes" style="text-transform:none; padding-left:9px">Выберите способ получения информации</div>');
			return false;
		}
	})



$("#addOtz").click(function() {
	var options = {};
	$("#otzCont").show('blind',options,1000, function(){
		fixHeight('#otzCont');
	});
	$(window).scrollTop(0);
	
	return false;
});

$("#addSat").click(function() {
	var options = {};
	$("#satCont").show('blind',options,1000, function(){
		fixHeight('#satCont');
	});
	$(window).scrollTop(0);
	
	return false;
});

$(".closeWindow").click(function() {
	var options = {};
	$(".fullNewsCont").hide(1000);
});

$(".link").click(function() {
	var options = {};
	if($(this).parents(".leftSubItem:first").find("ul.sub").css("display") == 'none'){
	$(".sub").hide(500);
	}
	$(this).parents(".leftSubItem:first").find("ul.sub").toggle('blind',options,"normal");
	return;
});

    $("#collapse").click(function () {
	  if($.browser.opera || $.browser.msie || $.browser.mozilla){
	  $("#moduleNavigation").toggleClass("smHeight", 500);
	  }
	  else
	  {
	  $("#moduleNavigation").toggleClass("smHeight");
	  }
	  $("#collapse").toggleClass("closed");
	  return false;
    });

});
