function cornerPos(){
	var w = $('div.bem-menu').width();
	if( w < 560 ){
		var y = -1 * ( 0.2 * w - 64 );
		$('.bem-menu .corner').css('top', y).show()
	} else $('.bem-menu .corner').hide()
	
	var y1 =  -1 * ( -0.2 * ( w - 70 ) + 163 ) - 34 ;
	$('.b-uzor').css('margin-top', y1)
}
$(window).resize(function(){
	cornerPos();
})

$(document).ready(function(){
	cornerPos();
	$('.bem-works li a').each(function(){
		$(this).hover(function(){
			$('.bem-hotspot_top div').removeClass('act')
			var index_ = $('.bem-works a').index($(this)) - 1
			$('.bem-hotspot_top div:eq(' + index_ + ')').addClass('act')
		})
	})
	if( $('.bem-gal a').length > 0 ) $('.bem-gal a').lightBox();
	
	$('.bem-cat .img').each(function(){
		$(this).find('li a').lightBox()
	})	
	
	if( $('a.gal').length > 0 ) $('a.gal').lightBox()
	$('.bem-menu li').each(function(){
		if( $('body').attr('id') == $(this).attr('class') ) $(this).find('a').addClass('act')
	})
	
	var float = jQuery('[name*=_float]', this);
	float.parent('.row').addClass('fl');
	$('#sistema_razdvizhnyh_dverej option').each(function(){
		$(this).html($(this).html().substring(2))
	})
	
	$('.click').click(function(){
		$('#form').toggle();
		return false
	})
	
	$('.click2').click(function(){
		$(this).siblings('blockquote').toggle();
		return false
	})
	
	$('#referrer').val($('#ref_div').html())
})
