jQuery(document).ready(function($) {
	$("#govideo").click(function(){
			$( "#map" ).animate({left: "-2396px", top: "0px", transform: 'rotate(0deg)'}, 3200 );
			rotation=false;
			rotation2="off";
		});
/*JQUERY COLUMNIZE*/
	$(".cols").columnize({columns: 3, balance: true});
		
/*FUNCTION ZOOM OUT - ZOOM IN*/
		
		$('#zoom').toggle(function() {
			move=true;
 			$( "#map" ).animate({left: "-2904px",top: "-1866px", transform: 'scale(.19) rotate(0deg)'}, 3200);
 			/*$('#map').css("cursor", "move");*/
 			$("#zoom").text("+ zoom in +");
 			$("#zoom").animate({top: "89px"}, 1200);
 				/*$('#map').drag(function( ev, dd ){
					$( this ).css({
						top: dd.offsetY,
						left: dd.offsetX
					});
				});*/
				$("#bg_menu").fadeOut();
				$("button").fadeOut();
		}, function() {
			$("#zoom").animate({top: "248px"}, 1200);
		 	$( "#map" ).animate({left: "-1627px", top: "-3553px", transform: 'scale(1) rotate(0deg)'}, 3200);
		 	rotation=false;
			rotation2="off";
		 	$('#map').css("cursor", "default");
		 	$("#zoom").text("- zoom out -");
		 	$("#bg_menu").fadeIn(1200);
			$("button").fadeIn(1200);
			$('#forfaits').removeAttr('disabled');
  			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$('#team').removeAttr('disabled');
		});
		
/*CHECK ROTATION STATE*/
var rotation=false;
var rotation2="offon";
var test_rot="nul";


$(function() {

  function disableclick()
  {
  	$('#forfaits').attr('disabled', 'disabled');
  	$('#surmesure').attr('disabled', 'disabled');
  	$('#clients').attr('disabled', 'disabled');
  	$('#agence').attr('disabled', 'disabled');
  	$('#jobs').attr('disabled', 'disabled');
  	$('#goodies').attr('disabled', 'disabled');
  	$('#contact').attr('disabled', 'disabled');
  	$('#team').attr('disabled', 'disabled');
  }
  function enabledclick()
  {
  	$('#forfaits').removeAttr('disabled');
  	$('#surmesure').removeAttr('disabled');
	$('#clients').removeAttr('disabled');
	$('#agence').removeAttr('disabled');
	$('#jobs').removeAttr('disabled');
	$('#goodies').removeAttr('disabled');
	$('#contact').removeAttr('disabled');
	$('#team').removeAttr('disabled');
  }
});

/*START ROTATION POSTS*/
		$('div#post-61').css( 'transform', 'rotate(90deg)' );
		$('div#post-65').css( 'transform', 'rotate(90deg)' );
		$('div#post-56').css( 'transform', 'rotate(90deg)' );
		/*$('div#post-32').css( 'transform', 'scale(1) rotate(90deg)' );*/
				
		/*$( "#map" ).animate({
    			left: "-2794px",top: "-1850px", transform: 'scale(.2) rotate(0deg)'}, 3200, function() {
    			$( "#map" ).delay(1000).animate({
    				left: "-1281px",top: "-2272px", transform: 'rotate(-90deg)'}, 3200, function() {
    				
  				});
  		});*/
  	
/*ANIMATION START*/	
  		$( "#map" ).animate({	
    		left: "-2404px",top: "0px"}, 3200, function() {
  		});

		$('#forfaits').removeAttr('disabled');
		$('#clients').removeAttr('disabled');
		$('#surmesure').removeAttr('disabled');
		$('#agence').removeAttr('disabled');
		$('#jobs').removeAttr('disabled');
		$('#goodies').removeAttr('disabled');
		$('#team').removeAttr('disabled');
		$('#contact').removeAttr('disabled');

/*BUTTONS CONDITIONS FOR ANIMATE*/

		

		$( "#forfaits" ).click(function(){	
			
			$('#forfaits').attr('disabled', 'disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			
			if(rotation2 == "on") {
				$( "#map" ).animate({left: "-3494px",top: "-3294px"}, 3200 );
				rotation2="off";
				rotation=true;
			}
			
			if(test_rot=="forfaits" ) {
				rotation2="on";
				rotation=true;
				$( "#map" ).animate({
    				left: "-3494px",top: "-3294px", transform: 'rotate(0deg)'}, 3200, function() {
  				$( "#map" ).animate({
    					transform: 'rotate(-90deg)'}, 3200, function() {
    				
  					});
  				});
			}
			
			else if(rotation2 == "offon" && rotation==false ) {
				rotation2="on";
				rotation=true;
				$( "#map" ).animate({
    				left: "-3494px",top: "-3294px", transform: 'rotate(-90deg)'}, 3200, function() {
    				
  				});

			}
			
			else if(rotation2 == "offon" && rotation==false ) {
				rotation2="on";
				rotation=true;
				$( "#map" ).animate({
    				left: "-2310px", top: "-4065px", transform: 'rotate(0deg)'}, 3200, function() {
    					$( "#map" ).animate({
    					transform: 'rotate(-90deg)'}, 3200, function() {
    				
  					});
  				});
			}
			
			else if(rotation2 == "off") {
				rotation2="on";
				rotation=false;
				$( "#map" ).animate({
    				left: "-3494px",top: "-3294px", transform: 'rotate(-90deg)'}, 3200, function() {
    				
  				});
			}
			
			else if(rotation == false) {
				rotation2="on";
				rotation=false;
				$( "#map" ).animate({
    				left: "-3494px",top: "-3294px", transform: 'rotate(-90deg)'}, 3200, function() {
    				
  				});
			}
			
			else if(rotation2 == "offon") {
				rotation2="on";
				rotation=true;
				$( "#map" ).animate({
    				left: "-3494px",top: "-3294px", transform: 'rotate(0deg)'}, 3200, function() {
    					$( "#map" ).animate({
    					transform: 'rotate(-90deg)'}, 3200, function() {
    				
  					});
  				});
			}
			
			
  			//$('body').disableclick();
		});
		
		
		$( "#surmesure" ).click(function(){
			$('#surmesure').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$( "#map" ).animate({left: "-5037px", top: "-1181px", transform: 'rotate(0deg)'}, 3200 );
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
		
		
		
		$( "#clients" ).click(function(){
			$('#clients').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			if(rotation2 == "on") {
				$( "#map" ).animate({left: "-2310px", top: "-4065px"}, 3200 );
				rotation2="offon";
				rotation=true;
				test_rot="nul";
			}
			
			else if(rotation2 == "off" && rotation==true) {
				$( "#map" ).animate({left: "-2310px", top: "-4065px"}, 3200 );
				rotation2="offon";
				rotation=true;
				test_rot="nul";
			}
			
			else if(rotation2 == "offon" && rotation==false ) {
				rotation2="on";
				rotation=true;
				test_rot="nul";
				$( "#map" ).animate({
    				left: "-2310px", top: "-4065px", transform: 'rotate(0deg)'}, 3200, function() {
    					$( "#map" ).animate({
    					transform: 'rotate(-90deg)'}, 3200, function() {
    				
  					});
  				});
			}
			
			else if(rotation2 == "off") {
				$( "#map" ).animate({left: "-2310px", top: "-4065px", transform: 'rotate(-90deg)'}, 3200 );
				rotation2="offon";
				rotation=false;
				test_rot="nul";
			}
			
			else if(rotation == false) {
				$( "#map" ).animate({left: "-2310px", top: "-4065px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="offon";
				test_rot="nul";
			}
			
			else if(rotation2 == "on") {
				$( "#map" ).animate({left: "-2310px", top: "-4065px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="on";
				test_rot="nul";
			}
			
			else if(rotation == "false" && rotation2=="off") {
				$( "#map" ).animate({left: "-2310px", top: "-4065px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="offon";
				test_rot="nul";
			}
		});
		
		
		
		
		
		$( "#agence" ).click(function(){
			$('#agence').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$( "#map" ).animate({left: "-1627px", top: "-3553px", transform: 'rotate(0deg) scale(1)'}, 3200 );	
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
		
		$( "#team" ).click(function(){
			$('#team').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$( "#map" ).animate({left: "-5513px", top: "-257px", transform: 'rotate(0deg) scale(1)'}, 3200 );	
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
		
		
		
		$( "#jobs" ).click(function(){
			$('#jobs').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$( "#map" ).animate({left: "-3418px", top: "-3551px", transform: 'rotate(0deg) scale(1)'}, 3200 );
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
		
		
		
		$( "#goodies" ).click(function(){
			$('#goodies').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#agence').removeAttr('disabled');
			$('#contact').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			
			
			
			if(rotation2 == "on") {
				$( "#map" ).animate({left: "-4690px", top: "1282px"}, 3200 );
				rotation2="offon";
				rotation=true;
				test_rot="forfaits";
			}
			
			else if(rotation == "false" && rotation2=="off") {
				$( "#map" ).animate({left: "-4690px", top: "1282px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="offon";
				test_rot="forfaits";
			}
			
			else if(rotation2 == "off" && rotation==true) {
				$( "#map" ).animate({left: "-4690px", top: "1282px"}, 3200 );
				rotation2="offon";
				rotation=true;
				test_rot="forfaits";
			}
			
			else if(rotation2 == "offon" && rotation==false ) {
				rotation2="on";
				rotation=true;
				$( "#map" ).animate({
    				left: "-4690px", top: "1282px", transform: 'rotate(0deg)'}, 3200, function() {
    					$( "#map" ).animate({
    					transform: 'rotate(-90deg)'}, 3200, function() {
    				
  					});
  				});
  				test_rot="forfaits";
			}
			
			else if(rotation2 == "off") {
				$( "#map" ).animate({left: "-4690px", top: "1282px", transform: 'rotate(-90deg)'}, 3200 );
				rotation2="offon";
				rotation=false;
				test_rot="forfaits";
			}
			
			else if(rotation == false) {
				$( "#map" ).animate({left: "-4690px", top: "1282px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="offon";
				test_rot="forfaits";
			}
			
			else if(rotation2 == "on") {
				$( "#map" ).animate({left: "-4690px", top: "1282px", transform: 'rotate(-90deg)'}, 3200 );
				rotation=false;
				rotation2="on";
				test_rot="forfaits";
			}		
		});	
		
		$( "#contact" ).click(function(){
			$('#contact').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#agences').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$( "#map" ).animate({left: "0px", top: "-2357px", transform: 'rotate(0deg) scale(1)'}, 3200 );
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
		
		$( "#home" ).click(function(){
			$('#home').attr('disabled', 'disabled');
			$('#forfaits').removeAttr('disabled');
			$('#surmesure').removeAttr('disabled');
			$('#clients').removeAttr('disabled');
			$('#jobs').removeAttr('disabled');
			$('#goodies').removeAttr('disabled');
			$('#agences').removeAttr('disabled');
			$('#team').removeAttr('disabled');
			$( "#map" ).animate({	
    			left: "-2404px",top: "0px", transform: 'rotate(0deg)'}, 3200, function() {
  			});
			rotation=false;
			rotation2="off";
			test_rot="nul";
		});
	});

