	
$(document).ready(function(){

/* init */

$('.reg_window').css({'left':$('.login').offset().left-45});
$('.reg_over').css({'width':$(document).width()+'px', 'height':$(document).height()+'px'});

if($('#reg_company') && $('.reg_company_input input').val() == 1){
	$('#reg_company').addClass('act').text('Я не представляю компанию');
	$('.reg_company').show();
}

cmsPreload(['/images/corner_menu_left_act.gif', '/images/corner_menu_right_act.gif']);

/* end of init */



	$('.login').click(function(){
		
		$('.reg_window').show();
		$('.reg_over').css({'width':$(document).width()+'px', 'height':$(document).height()+'px'});
		$('.reg_over').show(); 
		
		return false;
	});
	
	$('.login, .shop, .library').hover(
		function(){
			$(this).addClass('act');
		},
		function(){
			$(this).removeClass('act');
		}
	);
	

		$(window).resize(function(){
			$('.reg_over').css({'width':$(document).width()+'px', 'height':$(document).height()+'px'});
		});


	
	
	$('.reg_close').click(function(){
		
		$('.reg_window').hide();
		$('.reg_over').hide(); 
		
		return false;
		
	});



/* submenu */

	$('.services .submenu a').click(function(){
	
		if($(this).hasClass('inner')){
	
			$('.services .submenu a').removeClass('act').addClass('inner');
			$($(this)).removeClass('inner').addClass('act');
			
			
			if($(this).hasClass('visual')){
				$("#visualContent").show();
				$("#detailContent").hide();
				
				$.history.add('visual');
	
			} else { 													// detail
				$("#visualContent").hide();
				$("#detailContent").show();
				
				$.history.add('detail');
			}
	
		}
	
		return false;
	
	});


$('#reg_company').click(function(){
	
	if(!$(this).hasClass('act')){
		
		$(this).addClass('act').text('Я не представляю компанию');
		
		$('.reg_company input').val('');
		$('.reg_company').show();
		$('.reg_company_input input').val('1');
		
	} else {
		
		$(this).removeClass('act').text('Я представляю компанию');
		$('.reg_company').hide();
		$('.reg_company_input input').val('0');
	
		$('.reg_company input').val('-');
		$('.reg_company .phone_input input, .reg_company .fax_input input').val('+7 000 000-00-00');
	}
	
	return false;
	
});



	
});
	
	
	
	
$(window).resize(function(){
	
		$('.reg_window').css({'left':$('.login').offset().left-45});
		
});
	

