
function Change_color_to_black ($element, $color){
	$($element).removeClass($color);
	$($element).addClass("black");
}

function Change_black_to_color($element, $color) {
	$($element).removeClass("black");
	$($element).addClass($color);
}

function rollover_footer() {

    $("#the_minijet").hover( function() {	/*   Rollover The Minijet: Yellow -> Black */
	    Change_color_to_black ("#the_minijet", "yellow");
      $("img.the_minijet").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/theminijet_hover.gif");  
    }, function() {
	    Change_black_to_color ("#the_minijet", "yellow");
      $("img.the_minijet").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/theminijet.gif");
    });
    
    $("#design").hover( function() {	/*   Rollover Design: Blue -> Black */
    	Change_color_to_black ("#design", "blue");
      $("img.design").attr("src", "themes/default/images/footer/design_hover.gif");
    }, function() {
    	Change_black_to_color ("#design", "blue");
      $("img.design").attr("src", "themes/default/images/footer/design.gif");
    });
    
    $("#buyone").hover( function() {	/*   Rollover Buy One Red -> Black */
	 	Change_color_to_black ("#buyone", "red");
      $("img.buyone").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/buyone_hover.gif");
    }, function() {
    	Change_black_to_color ("#buyone", "red");
      $("img.buyone").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/buyone.gif");
    });
    
    $("#functions").hover( function() {	/*   Rollover Functions: Red -> Black */
    	Change_color_to_black ("#functions", "red");
      $("img.functions").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/function_hover.gif");
    }, function() {
    	Change_black_to_color ("#functions", "red");
      $("img.functions").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/function.gif");
      
    });
    
    $("#smirtwithus").hover( function() {	/*   Rollover Smirt With Us: Red -> Black */
    	Change_color_to_black ("#smirtwithus", "red");
      $("img.smirtwithus").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/smirtwithus_hover.gif");
    }, function() {
    	Change_black_to_color ("#smirtwithus", "red");
      $("img.smirtwithus").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/smirtwithus.gif");
    });
    
   $("#smirting").hover( function() {
    	Change_color_to_black ("#smirting", "orange");
      $("img.smirting").attr("src", "themes/default/images/footer/smirting_hover.gif");
    }, function() {
    	Change_black_to_color ("#smirting", "orange");
      $("img.smirting").attr("src", "themes/default/images/footer/smirting.gif");
    });
    
   $("#writetous").hover( function() {	/*   Rollover Write To Us: Orange -> Black */
   	 Change_color_to_black ("#writetous", "orange");
      $("img.writetous").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/writetous_hover.gif");
    }, function() {
    	Change_black_to_color ("#writetous", "orange");
      $("img.writetous").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/writetous.gif");
    });
   
   $("#guarantee").hover( function() {	/*   Rollover Activate Your Guarantee: Grey -> Black */
   	Change_color_to_black ("#guarantee", "grey");
      $("img.guarantee").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/activate_hover.gif");
    }, function() {
    	Change_black_to_color ("#guarantee", "grey");
      $("img.guarantee").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/activate.gif");
    });
    
   $("#switch").hover( function() {
	    Change_color_to_black ("#switch", "orange");
      $("img.switch").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/switch_hover.gif");  
    }, function() {
	    Change_black_to_color ("#switch", "orange");
      $("img.switch").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/switch.gif");
    });
    
   $("#download").hover( function() {
	    Change_color_to_black ("#download", "blue");
      $("img.download").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/download_hover.gif");  
    }, function() {
	    Change_black_to_color ("#download", "blue");
      $("img.download").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/download.gif");
    });
    
   $("#credits").hover( function() {
	    Change_color_to_black ("#credits", "yellow");
      $("img.credits").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/credits_hover.gif");  
    }, function() {
	    Change_black_to_color ("#credits", "yellow");
      $("img.credits").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/credits.gif");
    });

   $("#history").hover( function() {
	    Change_color_to_black ("#history", "white");
      $("img.history").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/history_hover.gif");  
    }, function() {
	    Change_black_to_color ("#history", "white");
      $("img.history").attr("src", "themes/default/images/footer/"+$("body").data("lg")+"/history.gif");
    });
    
  $("#stdupont").hover( function() {
	   $("#stdupont").removeClass("black");
		$("#stdupont").addClass("white");
      $("img.stdupont").attr("src", "themes/default/images/footer/stdupont_hover.gif");  
    }, function() {
	    	$("#stdupont").removeClass("white");
			$("#stdupont").addClass("black");
      $("img.stdupont").attr("src", "themes/default/images/footer/stdupont.gif");
    });

}


function click_footer(){
	
	$('#switch').click(function() {
		$("#main_loading").show();
		
		var path = SWFAddress.getPath();
		var path_array = path.split('/');
		
		if($("body").data("lg") == "fr") {
			$("body").data("lg", "en");	/*	Setting lang for the site	*/
		} else {
			$("body").data("lg", "fr");	/*	Setting lang for the site	*/
		}
		
		var str = '/'+$("body").data("lg")+'/';
		for (var i = 2; path_array[i]; i++){
			str += path_array[i]+'/';
		}
		SWFAddress.setValue(str);
		$("div#submain").hide();
		
		/*	Reload legals	*/
		LegalNotice();
		
		$("div#footer").load("footer.php?lg="+$("body").data("lg"), function () {
			rollover_footer();
			click_footer();
		});
	});

    $("#the_minijet").click( function() {	/*   Click  The Minijet */
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/the-minijet/") {
    		$("#main_loading").show();
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/the-minijet/');
	   }
	   window.scrollTo(0, 0);
    });
    
    $("#design").click( function() {	/*   Click  Design */		
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/player/design/") {	
    		$("#main_loading").show();
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/player/design/');
	   }
	   window.scrollTo(0, 0);
    });
    
    $("#functions").click( function() {	/*   Click  Functions */
     if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/player/function/") {
	     	$("#main_loading").show();
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/player/function/');
	   }
	   window.scrollTo(0, 0);
    });
    
    $("#smirtwithus").click( function() {	/*   Click  Smirt With Us */
      if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/smirt-with-us/") {
      	$("#main_loading").show();
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/smirt-with-us/');
	   }
	   window.scrollTo(0, 0);
    });
    
   $("#smirting").click( function() {
      if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/smirting/") {
      	$("#main_loading").show();
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/smirting/');
	   }
	   window.scrollTo(0, 0);
    });
    
    $("#writetous").click( function() {	/*   Click  Write To Us */
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/write-to-us/") {
	    	SWFAddress.setValue('/' +$("body").data("lg")+ '/write-to-us/');
	   }
	   window.scrollTo(0, 0);
    });
    
    $("#guarantee").click( function() {	/*   Click  Activate Your Guarantee */
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/activate-your-guarantee/") {
    		$("#main_loading").show();
    		SWFAddress.setValue('/' +$("body").data("lg")+ '/activate-your-guarantee/');
    	}
    	window.scrollTo(0, 0);
    });
    
     $("#download").click( function() {
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/download/") {
    		$("#main_loading").show();
    		SWFAddress.setValue('/' +$("body").data("lg")+ '/download/');
    	}
    	window.scrollTo(0, 0);
    });
    
    $("#history").click( function() {
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/player/history/") {
    		$("#main_loading").show();
    		SWFAddress.setValue('/' +$("body").data("lg")+ '/player/history/');
    	}
    	window.scrollTo(0, 0);
    });
    
    $("#buyone").click( function () {
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/buyone/") {
    		$("#main_loading").show();
    		SWFAddress.setValue('/' +$("body").data("lg")+ '/buyone/');
    	}
    	window.scrollTo(0, 0);
    });
    
    $("#stdupont").click( function () {/*   Click  stdupont and open a popup */
    	SWFAddress.popup("http://www.st-dupont.com/");
    });
    
    $("#credits").click( function() {
    	if (SWFAddress.getValue() != "/"+$("body").data("lg")+"/credits/") {
    		$("#main_loading").show();
    		SWFAddress.setValue('/' +$("body").data("lg")+ '/credits/');
    	}
    	window.scrollTo(0, 0);
    });
}



function LegalNotice() {
	$("#legals").show();
	if ($("body").data("lg") == "fr"){
		$("#legals").text("Mentions légales");
	} else {
		$("#legals").text("Legal disclaimer");
	}
	
  	$("#legals").click( function() {
		var myWindow = window.open("legals.php?lg="+$("body").data("lg"),name,"width=1000px,location=no,menubar=no,directories=no,toolbar=no,status=no,personalbar=no,titlebar=no,resizeable=ye s,scrollbars=yes,dependant=yes,dialog=yes");
    });

   $("#legals").hover( function() {
	    $("#legals").css("color", "#999999");
    }, function() {
	     $("#legals").css("color", "#666666");
    });
}


