function champs(champs, texte)
{
	if($(champs).val() == texte)
		$(champs).val('');
	else
	{
		if($(champs).val() == '')
		{
			$(champs).val(texte);
		}
	}
	return false;
}


function champsmdp(champs, texte)
{
	if($(champs).val() == texte)
		$(champs).val('');
	else
	{
		if($(champs).val() == '')
		{
			$(champs).val(texte);
		}
	}
	return false;
}


function cache_plein(str) {
//	alert(str);
}
function cache_vide(str) {
//	alert(str);
}
function bonjour(str) {
//	alert(str);
}
function agir_flash(str) {
	$('#flash').remove();
	$(".imgvideo").show(); 
	$(".image_holder").hide(); 
//	alert(str);
}

function taillebande(){
	var taille = 500;
	var tailleH = 200;
	$(".bandeBlanche").css('height', taille);
	$("#en_grand").css('height', taille);
	$("#bientot").css('height', taille);
	$("#fenetre_3").css('height', taille);
	$("#fenetre_2").css('height', taille);
	$("#map").css('height', taille);
	$("#mapadress").css('height', taille);
	$("#mapadress").css('width', tailleH);
	
	taille-=64;
	$(".bandeBlanche2").css('height', taille);
	$(".bandeBlanche3").css('height', taille);
	$("#fenetre_3").css('height', taille);
	$("#fenetre_2").css('height', taille);
	taille = $(document).height();
	tailleH = $(document).width();
	$(".bandeBlanche").css('height', taille);
	$("#en_grand").css('height', taille);
	$("#bientot").css('height', taille);
	$("#map").css('height', taille);
	$("#mapadress").css('height', (taille - 30));
	$("#mapadress").css('width', (tailleH - 625));
	taille-=64;
	$(".bandeBlanche2").css('height', taille);
	$(".bandeBlanche3").css('height', taille);
	$("#fenetre_3").css('height', taille);
	$("#fenetre_2").css('height', taille);
	
	return false;
}




$(document).ready(function(){
jQuery('.imggrande').iZoom({
    borderColor: '#FFFFFF',
    borderWidth: '4px'
});

	
			var hauteurvideo = parseInt(($(window).width() * 450) / 800);
			$(".lecteurvideo").attr('height', hauteurvideo + "px");
			$(".lecteurvideo embed").attr('height', hauteurvideo + "px");
/*
	var largeufilm = parseInt(($(window).width() * 1) - 242)
	var hauteurvideo = parseInt((largeufilm * 450) / 800);
	$(".lecteurvideo").attr('height', hauteurvideo + "px");
	$(".lecteurvideo embed").attr('height', hauteurvideo + "px");
	$(".lecteurvideo").css('z-index', "2");
	$(".lecteurvideo embed").css('z-index', "2");
	$(".lecteurvideo").css('position', "absolute");
	$(".lecteurvideo").css('left', "242px");
	$(".lecteurvideo").attr('width', largeufilm + "px");
	$(".lecteurvideo embed").attr('width', largeufilm + "px");
	
	$(".lecteurvideo embed").css('position', "absolute");
*/
			var largeurvideo_dex = parseInt(($(window).width() - 241));
			var hauteurvideo_dex = parseInt((largeurvideo_dex * 277) / 492);
			$("#video_dex .pluginvideolecteur").attr('width', largeurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur embed").attr('width', largeurvideo_dex + "px");
			$("#video_dex").attr('width', largeurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur").attr('height', hauteurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur embed").attr('height', hauteurvideo_dex + "px");
			$("#video_dex").attr('height', hauteurvideo_dex + "px");


//	$(".around_2").hide(); 
	$(".around_3").hide(); 
 
	$(".element").hide(); 
	$(".element2").hide(); 
	$(".elementie").hide(); 
	$(".on").show(); 
	$('.toggler').click(function() 
	{
		if($(this).next(".element:visible").length == 0)
		{
			$(".element").slideUp("normal"); 
			$(this).next(".element").slideDown("normal"); 
		}
		else
		{
			$(".element").slideUp("normal");
		}
		return false;
		
	});

	$("#en_grand").hover(function(e){
		$("#fermer_en_grand").show();
	},function(e){
		$("#fermer_en_grand").hide();
	});
	
	$("#en_grand").mousemove(function(e){
		$("#fermer_en_grand").css({'top' : e.pageY+'px', 'left' : (e.pageX - 452)+'px'});
	});
	
	$(".imageptgd img").hover(function(e){
		$("#loupe").show();
	},function(e){
		$("#loupe").hide();
	});
	
	$(".imageptgd img").mousemove(function(e){
		$("#loupe").css({'top' : e.pageY+'px', 'left' : (e.pageX - 452)+'px'});
	});


	/*
	$('#flash').remove();
	$(".imgvideo").show(); 
*/
	$("#closeflash").click(function(){
		$('#flash').toggle();
		$(".imgvideo").toggle(); 
		$(".image_holder").toggle(); 
	});

			$("#pause").click(function(){
				document.getElementById("id_flash").mettre_pause();
			});

	var jeton = 0;
	$("area").mousemove(function(e){
		$(".produitaccueil2").css({'top' : (e.pageY + 15 ) +'px', 'left' : (e.pageX + 15 )+'px'});
	});
	$('area').hover(function(e){
		$('.produitaccueil').stop();
		$('.produitaccueil').hide();
		$('.produitaccueil2').hide();
		var coordonne = $(this).attr("coords");
		var coordonnes = coordonne.split(",");
		var largeurbloc = parseInt(coordonnes[2]) - parseInt(coordonnes[0]);
		var hauteurbloc = parseInt(coordonnes[3]) - parseInt(coordonnes[1]);
		var demilargeur = parseInt(largeurbloc / 2);
		var demihauteur = parseInt(hauteurbloc / 2);
		var	top = e.pageY - 80;
		var	left  = e.pageX - 350;
		
		var ecartw = $('.bandeBlanche2').width() + $('.bandeBlanche').width();
		if($('.bandeBlanche2').width())
			ecartw += 20;
		if(left < ecartw)
			left = ecartw;
		var hauteurfenetre = $('.' + $(this).attr('id')).height();
		hauteurfenetre -= 52;
		top -= hauteurfenetre;
		if(top < 0)
			top = 0;
			
	//	$('.' + $(this).attr('id')).css({'top' : top+'px', 'left' : left+'px' ,' z-index' : 1000 , 'display' : 'block'});
		$('.' + $(this).attr('id')).hide();
		$('.' + $(this).attr('id')).fadeTo(150,0.8,'');
		jeton++;
	},function(){
	$('.produitaccueil2').hide();
	jeton--;
	  setTimeout(function() {
	  	if(jeton == 0)
			$('.produitaccueil').hide();  
		//	$('.produitaccueil2').hide();
		}, 200 ); 

	});
	$('.produitaccueil').hover(function(){
	jeton++;
		$(this).show();
		},function(){$(this).hide();jeton--;
	});
	$('.produitaccueil2').hover(function(){
	jeton++;
		$(this).show();
		},function(){$(this).hide();jeton--;
	});
	 
 
	$('.toggler2').click(function() 
	{
		if($(this).next(".element2:visible").length == 0)
		{
			$(".element2").slideUp("normal"); 
			$(this).next(".element2").slideDown("normal"); 
		}
		else
		{
			$(".element2").slideUp("normal");
		}
		return false;
		
	}); 
	
	
	
	
	$('.boutonvideo').click(function() 
	{
		$('#mavideoflash').html(""); 
		$('#mavideoflash').append($(this).next(".videoenattente").html());

		return false;
	}); 
	$('.unevideo span').click(function() 
	{
		$('#mavideoflash').html(""); 
		$('#mavideoflash').append($(this).prev(".videoenattente").html());

		return false;
	}); 
	
		
	window.onload = function () {
	taillebande();
		$(".premierplan").show();
		$('img').show();
		$('img').fadeOut(0);
		$('.logo').fadeIn(0);
		$('.premierplan').fadeIn(50);
		$('img').fadeIn(200);
		$('.carrecouleur').show();
		$('.loader').hide();
		
		$("#etapesDeCommande li").hover(function(){
			if($(this).css('background') != "")
			{
				$(".selection").css('background', "");
			}
		},function(){
			$(".selection").css('background', "#F0F0F0");
		});
		
		var taille = $(document).height();
		$(".bandeBlanche").css('height', taille);
		taille-=64;
		$(".bandeBlanche2").css('height', taille);
		$(".bandeBlanche3").css('height', taille);
		
		$('#liste_videos').cycle({ 
			fx:     'scrollHorz', 
			speed:  'fast', 
			timeout: 0, 
			next:   '#next', 
			prev:   '#prev' 
		});
		


			resizeImageSCut();
		if('function' == typeof(remplacerzone))
			remplacerzone();
			
			
			

		var jetonbande = 1;
		var taillefentrewin = $(window).height();
		$(window).resize(function(){
		if(taillefentrewin != $(window).height())
		{
			taillebande();
			taillefentrewin = $(window).height();
		}

		
			var hauteurvideo = parseInt(($(window).width() * 450) / 800);
			$(".lecteurvideo").attr('height', hauteurvideo + "px");
			$(".lecteurvideo embed").attr('height', hauteurvideo + "px");
			
	/*		
	var largeufilm = parseInt(($(window).width() * 1) - 242)
	var hauteurvideo = parseInt((largeufilm * 450) / 800);
	$(".lecteurvideo").attr('height', hauteurvideo + "px");
	$(".lecteurvideo embed").attr('height', hauteurvideo + "px");
	$(".lecteurvideo").css('z-index', "2");
	$(".lecteurvideo embed").css('z-index', "2");
	$(".lecteurvideo").css('position', "absolute");
	$(".lecteurvideo").css('left', "242px");
	$(".lecteurvideo").attr('width', largeufilm + "px");
	$(".lecteurvideo embed").attr('width', largeufilm + "px");
			*/	
			
			var largeurvideo_dex = parseInt(($(window).width() - 241));
			var hauteurvideo_dex = parseInt((largeurvideo_dex * 277) / 492);
			$("#video_dex .pluginvideolecteur").attr('width', largeurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur embed").attr('width', largeurvideo_dex + "px");
			$("#video_dex").attr('width', largeurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur").attr('height', hauteurvideo_dex + "px");
			$("#video_dex .pluginvideolecteur embed").attr('height', hauteurvideo_dex + "px");
			$("#video_dex").attr('height', hauteurvideo_dex + "px");
			return false;
		});

		$('#loupe').hide();
		taillebande();
		$(".imgvideo").hide();
		$(".ico_vi").hide(); 
		$(".datevignette").hide();
		resizeImageSCut();
		
		$(".premierplan").delay(5000).fadeTo(5000,0,function(){$(".premierplan").remove();});
		
	}
	$(".vignettesArchives").fadeTo(0,0.4,'');
	$(".vignettesArchives").hover(function (){
		$(".datevignette").hide();
		$(".vignettesArchives").fadeTo(0,0.4,'');
		$(this).fadeTo(0,1,'');
		$(".datevignette", this).show();
		$(".ico_vi", this).show(); 
	},  															
	function () {								
		$(this).fadeTo(0,0.4,'');
		$(".ico_vi").hide(); 
		$(".datevignette").hide();
	}); 
	
	resizeImageSCut();
	if('function' == typeof(remplacerzone))
		remplacerzone();
 

	$("#zoomout").click(function() {
		$(".gmnoprint").css("width", "10");
	});
 
 
	$('#loupe').hide();
	/*	
 load();
 GUnload();*/
 
});


