$('#footer').css('display','none');
$(document).ready(function(){
	// Transparence IE 6
	if($.browser.msie && jQuery.browser.version.substr(0,3) == "6.0")
		correctPNG();
	
	$('.external_link').click(function(){
		window.open(this.href,"popup_materrepremiere");
		return false;
	});
	
	
	$('#content .print').click(function(){
		window.print();
		return false;
	});
	
	if($("#flash_planisphere").attr('id') == "flash_planisphere"){
		var flashvars = {};
		var params = {
			menu: "false",
			allowfullscreen:"false",
			allowScriptAccess:"sameDomain",
			wmode:"transparent",
			bgcolor:"#FDFAF5"
		};
		var attributes = {
			id: "flash_planisphere",
			name: "flash_planisphere"
		};
		swfobject.embedSWF("planisphere/planisphere.swf", "flash_planisphere", 730, 507, "8.0.0.0", false, flashvars, params, attributes);
	}
	
	if($("#video_pise").attr('id') == "video_pise"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/pise.xml" , "video_pise" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_adobe").attr('id') == "video_adobe"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/adobe.xml" , "video_adobe" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_maison").attr('id') == "video_maison"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 290 , 480 , 290 , "swf/player/config/maison.xml" , "video_maison" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_grains").attr('id') == "video_grains"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 290 , 480 , 290 , "swf/player/config/grains.xml" , "video_grains" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_eau").attr('id') == "video_eau"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 290 , 480 , 290 , "swf/player/config/eau.xml" , "video_eau" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_beton").attr('id') == "video_beton"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/beton.xml" , "video_beton" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_argile").attr('id') == "video_argile"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/argile.xml" , "video_argile" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_bauge").attr('id') == "video_bauge"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/bauge.xml" , "video_bauge" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_torchis").attr('id') == "video_torchis"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/torchis.xml" , "video_torchis" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	if($("#video_forces").attr('id') == "video_forces"){
		MediaPlayer.embedPlaylist( "swf/player/main.swf" , 480 , 380 , 480 , 380 , "swf/player/config/forces.xml" , "video_forces" , "fr_FR" , "chanel2" , "0xFFFFFF" , "transparent" );
	}
	
	
	fit2screen();
	$('#footer').css('display','block');
	
	$(".nyroModalSize").click(function(){
		t = $(this).attr('rel').split("x");
		w = t[0];
		h = t[1];
		url = $(this).attr("href");
		$.nyroModalManual({
			url: url,
			width: w?w:null,
			height: h?h:null,
			windowResize: false,
			modal:true,
			endFillContent:function(){
				$('#nyroModalWrapper > div > div').prepend('<a id="closeBut" class="nyroModalClose" title="close" href="#">Close</a>');
				$('.nyroModalClose').click(function(){
					$.nyroModalRemove();
					return false;
				});
			}
		});
		return false;
	});
});
$("#page").resize(function(){
	fit2screen();
});
$(window).resize(function(){
	fit2screen();
});

function fit2screen(){
	h1 = $("#page").innerHeight()
	h4 = $("#page #content .content .texte").offset()
	
	$("#page #content .content .texte").css({'min-height':(h1 - h4.top - 100) + "px", "height":(h1 - h4.top - 100) + "px"});
	window.statut = "resize;";
}
$(function() {
$.nyroModalSettings({
	addImageDivTitle: true,
	showBackground:showBg
});
});

function showBg(elts, settings, callback){
	elts.bg.css({opacity:0}).fadeTo(500, 0.9, callback);
	$.scrollTo( {top:'0px', left:'0px'}, 400 );
}