$(document).ready(function(){

	var isAnim = false;
	var toggleDuration = 500;
	var scrollDuration = 200;
	
	var flip1 = 0;
	var flip2 = 0;
	var flip3 = 0;
	var flip4 = 0;

	$("a.no1").click(function (event) {
		if(isAnim) {
			return;
		}
		event.preventDefault();
		isAnim = true;
		var id = this.href.split('#')[1];
		$("div.check1").animate({height: "toggle", opacity: "toggle"},"slow",function() {
			$('body').scrollTo($('#'+id),scrollDuration,{
				onAfter: function(){
					isAnim = false;
				}
			});
			
			if( flip1 == 1){
			 flip1 = 0;
			 }
			 else{
		 flip1 = 1;}
	   if( flip2 == 1){
			 $("div.check2").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip2 = 0;
			 }
		if( flip3 == 1){
			 $("div.check3").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip3 = 0;
			 }
		if( flip4 == 1){
			 $("div.check4").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip4 = 0;
			 }
	   

		});
	});
	
	
	
	
	$("a.no2").click(function (event) {
		if(isAnim) {
			return;
		}
		event.preventDefault();
		isAnim = true;
		var id = this.href.split('#')[1];
		$("div.check2").animate({height: "toggle", opacity: "toggle"},"slow",function() {
			$('body').scrollTo($('#'+id),scrollDuration,{
				onAfter: function(){
					isAnim = false;
				}
			});
			
			 if( flip2 == 1){
			 flip2 = 0;
			 }
			 else{
		 flip2 = 1;}
		 
		 if( flip1 == 1){
			 $("div.check1").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip1 = 0;
			 }
		if( flip3 == 1){
			 $("div.check3").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip3 = 0;
			 }
		if( flip4 == 1){
			 $("div.check4").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip4 = 0;
			 }

		});
	});
	$("a.no3").click(function (event) {
		if(isAnim) {
			return;
		}
		event.preventDefault();
		isAnim = true;
		var id = this.href.split('#')[1];
		$("div.check3").animate({height: "toggle", opacity: "toggle"},"slow",function() {
			$('body').scrollTo($('#'+id),scrollDuration,{
				onAfter: function(){
					isAnim = false;
				}
			});
			
			if( flip3 == 1){
			 flip3 = 0;
			 }
			 else{
		 flip3 = 1;}
		 
		 if( flip1 == 1){
			 $("div.check1").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip1 = 0;
			 }
		if( flip2 == 1){
			 $("div.check2").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip2 = 0;
			 }
		if( flip4 == 1){
			 $("div.check4").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip4 = 0;
			 }
		});
	});
	$("a.no4").click(function (event) {
		if(isAnim) {
			return;
		}
		event.preventDefault();
		isAnim = true;
		var id = this.href.split('#')[1];
		$("div.check4").animate({height: "toggle", opacity: "toggle"},"slow",function() {
			$('body').scrollTo($('#'+id),scrollDuration,{
				onAfter: function(){
					isAnim = false;
				}
			});
			
			if( flip4 == 1){
			 flip4 = 0;
			 }
			 else{
		 flip4 = 1;}
		 
		 if( flip1 == 1){
			 $("div.check1").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip1 = 0;
			 }
		if( flip2 == 1){
			 $("div.check2").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip2 = 0;
			 }
		if( flip3 == 1){
			 $("div.check3").animate({height: "toggle", opacity: "toggle"},"slow");
			 flip3 = 0;
			 }

		});
	});
});