$(document).ready(function(){
	indexwordssize = $('.index #tel').offset().left;
	$('#words').width(indexwordssize + 133).show();
	$('#content').height($('#wrapper').height()-141)
	$('#smile').show();
	$(window).resize(function(){
		indexwordssize = $('.index #tel').offset().left
		$('#words').width(indexwordssize + 133);
		$('#content').css('height','1%');
		$('#content').height($('#wrapper').height()-141);
	});
	
	$('#top-menu,.shad').show();
	//$('#smile').css('background','url(/i/smile-bg.gif) 22px 36px no-repeat');
	
	$('#news-text p').wrapInner('<a href="/news/"></a>');
	$('#news-header span a').append($('#news-header a').text())
	setTimeout("$('#news-text').slideUp()",2000);
	
	$('#news-block').hover(function(){
		if ($('#news-text').is(':animated')) {return false} else {
			$('#news-text').slideDown();
		}
	},function(){
		if ($('#news-text').is(':animated')) {return false} else {
			$('#news-text').slideUp();
		}
	});
	
	$("a[rel='blank']").click(function(){
		window.open($(this).attr('href'));
		return false
	});

	
$('#smile #sort1 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});
$('#smile #sort2 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});
$('#smile #sort3 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});
$('#smile #sort4 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});
$('#smile #sort5 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});
$('#smile #sort6 .p').hover(function(){
		defzindex = $(this).css('z-index');
		$(this).css('z-index','90000')
		$('.big',this).css('display','block');
	}, function(){
	$('.big').css('display','none').removeClass('active');
	$(this).css('z-index',defzindex)
});








//Раскомменитруйте дальше чтобы на главной по клику показывался блок!!

$('#smile .big .foto a').click(function(){
	if ($(this).parent().parent('.big').hasClass('active')) {
		return true
	}
	else {
		$(this).parent().parent('.big').addClass('active');
		return false
	}
});


	
	
});



	
