$(function(){
document.body.style.overflow="hidden";
$('html,body').animate({ scrollTop: 0 }, 'slow');

$("h1").click(function(){
		$('html,body').animate({ scrollTop: 0 }, 'slow');
});
$("#m1").click(function(){
	if($("#m1").css('left') == 'auto'){
		$('html,body').animate({ scrollTop: 1500 }, 'slow');
	}else if($("#m1").css('left') != 'auto'){
		animateRight();
		//$("#hh").animate({top:0}, 600 );
		$('html,body').animate({ scrollTop: 1500 }, 'slow');
		$("h1 img").attr('src','./images/logo_e_2.png');
	}else{
		animateLeft();
		$("#hh").animate({top:'2000px'}, 600 );
	}
});
$("#m2").click(function(){
	if($("#m2").css('left') == 'auto'){
		$('html,body').animate({ scrollTop: 2700 }, 'slow');
	}else if($("#m2").css('left') != 'auto'){
		animateRight();
		//$("#brides").animate({top:0}, 600 );
		$('html,body').animate({ scrollTop: 2700 }, 'slow');
		$("h1 img").attr('src','./images/logo_e_2.png');
	}else{
		animateLeft();
		$("#brides").animate({top:'2000px'}, 600 );
	}
});
$("#m3").click(function(){
	if($("#m3").css('left') == 'auto'){
		$('html,body').animate({ scrollTop: 3900 }, 'slow');
	}else if($("#m3").css('left') != 'auto'){
		animateRight();
		//$("#brides").animate({top:0}, 600 );
		$('html,body').animate({ scrollTop: 3900 }, 'slow');
		$("h1 img").attr('src','./images/logo_e_2.png');
	}else{
		animateLeft();
		$("#brides").animate({top:'2000px'}, 600 );
	}
});
function animateRight(){
	$("#m1").css('left','auto');
	$("#m1").css('right',$(document).width() - 499);
	$("#m1").animate({
					 //backgroundColor: '#000000',
					 right:0}, 600 );
	$("#m1_sales").css('left','auto');
	$("#m1_sales").css('right',$(document).width() - 605);
	$("#m1_sales").animate({
					 //backgroundColor: '#000000',
					 right:479}, 600 );
	$("#m2").css('left','auto');
	$("#m2").css('right',$(document).width() - 171);
	$("#m2").animate({
					 //backgroundColor: '#000000',
					 right:0}, 600 );
	
	$("#m3").css('left','auto');
	$("#m3").css('right',$(document).width() - 543);
	$("#m3").animate({
					 //backgroundColor: '#000000',
					 right:0}, 600 );
}
function animateLeft(){
	$("#m1").css('right','auto');
	$("#m1").css('left',$(document).width() - 439);
	$("#m1").animate({
					 //backgroundColor: '#c41f1e',
					 left:30}, 600 );
	
	$("#m2").css('right','auto');
	$("#m2").css('left',$(document).width() - 111);
	$("#m2").animate({
					 //backgroundColor: '#c41f1e',
					 left:30}, 600 );
	
	$("#m3").css('right','auto');
	$("#m3").css('left',$(document).width() - 483);
	$("#m3").animate({
					 //backgroundColor: '#c41f1e',
					 left:30}, 600 );
}
});