$(document).ready(function(){
	// Authorization
	
	$('.aut-key').click(function(){
		$('.authorization').toggleClass('open');
		return false;
	});
	$('.aut-close').click(function(){
		$('.authorization').removeClass('open');
		return false;
	});
	
	// IE6-7 form elemetns
	
	$('input[type="text"], input[type="password"]').addClass('text-ie');
	$('input[type="submit"]').addClass('button-ie');
	
	// Form submit
	
	$('#content form button').click(function(){
		$(this).parent().parent('form').submit();
	});
	
	// Products
	
	function ieHeight() {
		if($.browser.msie){
			var plHeight = $('.product-list').height();
			if($.browser.version == 6){
					$('#content').css("height", plHeight);
				} else{
					$('#content').css("min-height", plHeight);
				};
			$(window).resize();
		}
	}
	
	$('.product-list h3 span').click(function(){
		$(this).parent().next('.product').slideToggle('slow', ieHeight);
		$(this).parent().toggleClass('active');
	});
	
	$('.product-list .open-all').click(function(){
		$(this).parent().parent().find('.product').slideUp('fast', ieHeight);
		$(this).parent().parent().find('h3').removeClass('active');
	});

	$('.product-list .close-all').click(function(){
		$(this).parent().parent().find('.product').slideDown('fast');
		$(this).parent().parent().find('h3').addClass('active');
	});
	
	// Content height
	
	$(window).resize(function() {
		var windowHeight = $('body').height();
		var contentHeight = windowHeight - 253;
		if($.browser.msie && $.browser.version == 6){
				$('#content').css("height", contentHeight);
				$('.f-second').css({'top':windowHeight - 63});
			}
			else {
				$('#content').css("min-height", contentHeight);
			};
		$('#content').css("min-height", contentHeight);
	})
	$(window).resize();
	
	
});