$(function () {
	$('#quotation, #partners').each(function () {
		var id = $(this).attr('id');
		if ($.cookie('#' + id) == 'unactive') {
			$(this).toggleClass('active').children().not('h2').hide();
		}
	});
	$('#quotation h2 a, #partners h2 a').click(function () {
		$(this).parent().next().slideToggle('slow', function () {
			$(this).parent().toggleClass('active');
			var href = $(this).prev().children().attr('href');
			if ($.cookie(href) == 'unactive') {
				$.cookie(href, null, {expires: null, path: '/'});
			} else {
				$.cookie(href, 'unactive', {expires: null, path: '/'});
			}
		});
		return false;
	});
	$('#tabs li:first').addClass('first');
	$('.new:first-child').css('border', 'none');
	var tabContainers = $('#tabs div[id]');
	$('#tabs li a').click(function () {
		tabContainers.hide();
		tabContainers.filter(this.hash).fadeIn('slow');
		$('#tabs li a').parent().removeClass('active');
		$(this).parent().addClass('active');
		var curPos = $(document).scrollTop();
		var height = $('body').height();
		var scrollTime = (height - curPos) / 1.73;
		$('body, html').animate({ 'scrollTop': height }, scrollTime);
		return false;
	});
	$('input[name=keystring]').css('margin-top', '4px').prev().before('<span style="color: red">*</span>').prev().prev().css('padding-bottom', '8px');
	$('#column h2').wrapInner('<table><tbody><tr><td>');
});
