$(document).ready(function(){	
	$('.remonteeNomPiste').show();
});


$(document).ready(function() {

	/* activation du tracking sur les liens sortants, si google analytics chargé	
	window.location.hostname : le nom de l'hôte (sans son numéro de
	 port).	
	 on selectionne tous les liens qui commencent par http mais pas par le hostname	
	 de la page courante*/
	
	$('a').filter('a:[href^="http"]').filter('a:not([href*="'+window.location.hostname+'"])').addClass("b2flienexterne");
	$('.b2flienexterne').live('click', function() { 
	
		/* on fait logger a google analytics toutes la partie avant les params get du lien, on p*/
		
		if ($(this).attr('href')) {
		
			var lurl=$(this).attr('href').split('?').shift();
			try	{
				pageTracker._trackPageview ('/outgoing/'+lurl.replace('://', ''));
			}
			catch(err)
			{ }
			try	
			{
				_gaq._getAsyncTracker()._trackPageview('/outgoing/'+lurl.replace('://', ''));
		
			}
			catch(err)
			{ }
		}	
	});
});


/*boite de dialog temporaire
$(document).ready(function(){
	$('.ete').click(function(){
		$(function() {
			$( "#dialog-attente" ).dialog( "destroy" );
		
			$( "#dialog-attente" ).dialog({
				modal: true,
				width:500 ,
				height:50 ,
				resizable:false ,
				buttons: {
					"Fermer/Close": function() {
						$( this ).dialog( "close" );
					}
				}
			});
		});	
	});	
});*/




/*cookies pour deficient visuel creat lecture + suppresssion > FR + EN + Hiver + ETE*/


/*FR Ete*/
function createCookie_FR_ET(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie_FR_ET(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie_FR_ET(name) {
	createCookie_FR_ET(name,"",-1);
}

/*
 * Fin FR ETE
 * EN ETE
*/

function createCookie_EN_ET(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie_EN_ET(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie_EN_ET(name) {
	createCookie_EN_ET(name,"",-1);
}
/*
 * Fin EN ETE
 * FR Hiver
*/

function createCookie_FR(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie_FR(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie_FR(name) {
	createCookie_FR(name,"",-1);
}

/*
 * Fin FR Hiver
 * EN Hiver
*/

function createCookie_EN(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie_EN(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie_EN(name) {
	createCookie_EN(name,"",-1);
}

/* Fin EN Hiver*/

$(document).ready(function(){
	/*fr Hiver +*/
	$('#cookiePlus_FR').click(function(){
		//alert('A FR +');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	/*fr Hiver -*/
	$('#cookieMoins_FR').click(function(){
		//alert('A FR -');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	/*fr ete +*/
	$('#cookiePlus_FR_ET').click(function(){
		//alert('A FR +');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	/*fr ete -*/
	$('#cookieMoins_FR_ET').click(function(){
		//alert('A FR -');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	
	
	/*en Hiver +*/
	$('#cookiePlus_EN').click(function(){
		//alert('A FR +');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	/*en Hiver -*/
	$('#cookieMoins_EN').click(function(){
		//alert('A FR -');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
	/*en ete +*/
	$('#cookiePlus_EN_ET').click(function(){
		//alert('A FR +');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
	});
	
	/*en ete -*/
	$('#cookieMoins_EN_ET').click(function(){
		//alert('A FR -');
		eraseCookie_FR('CookieSystemeMalvoyantMoins_FR');
		eraseCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		
		eraseCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		eraseCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		eraseCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		eraseCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
	});
	
});
		

var StyleMoinsHiverFR = '<link rel="stylesheet" href="/fr/css/hiver.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookieMoins_FR').click(function(){
		$('head').append(StyleMoinsHiverFR);
		var resultMoinsEteFR = readCookie_FR('CookieSystemeMalvoyantMoins_FR_HV');
		if(resultMoinsEteFR == 'true'){
			$('head').append(StyleMoinsHiverFR);
			//console.debug('toto');
		}		
	});
});


var StylePlusEteFR = '<link rel="stylesheet" href="/fr/css/hiver-plus.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookiePlus_FR').click(function(){		
		$('head').append(StylePlusEteFR);
		var resultPlusEteFR = readCookie_FR('CookieSystemeMalvoyantPlus_FR_HV');
		if(resultPlusEteFR == 'true'){
			$('head').append(StylePlusEteFR);
			//console.debug("dd");
		}		
	});
});


var StyleMoinsHiverEN = '<link rel="stylesheet" href="/en/css/hiver.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookieMoins_EN').click(function(){
		$('head').append(StyleMoinsHiverEN);
		var resultMoinsEteEN = readCookie_EN('CookieSystemeMalvoyantMoins_EN_HV');
		if(resultMoinsEteEN == 'true'){
			$('head').append(StyleMoinsHiverEN);
			//console.debug('toto');
		}		
	});
});

var StylePlusEteEN = '<link rel="stylesheet" href="/en/css/hiver-plus.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookiePlus_EN').click(function(){		
		$('head').append(StylePlusEteEN);
		var resultPlusEteEN = readCookie_EN('CookieSystemeMalvoyantPlus_EN_HV');
		if(resultPlusEteEN == 'true'){
			$('head').append(StylePlusEteEN);
			//console.debug("dd");
		}		
	});
});



/*ETE*/

var StyleMoinsHiverFR_ET = '<link rel="stylesheet" href="/fr/css/ete.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookieMoins_FR_ET').click(function(){
		$('head').append(StyleMoinsHiverFR_ET);
		var resultMoinsEteFR_ET = readCookie_FR_ET('CookieSystemeMalvoyantMoins_FR_ET');
		if(resultMoinsEteFR_ET == 'true'){
			$('head').append(StyleMoinsHiverFR_ET);
			//console.debug('toto');
		}		
	});
});


var StylePlusEteFR_ET = '<link rel="stylesheet" href="/fr/css/ete-plus.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookiePlus_FR_ET').click(function(){		
		$('head').append(StylePlusEteFR_ET);
		var resultPlusEteFR_ET = readCookie_FR_ET('CookieSystemeMalvoyantPlus_FR_ET');
		if(resultPlusEteFR_ET == 'true'){
			$('head').append(StylePlusEteFR_ET);
			//console.debug("dd");
		}		
	});
});


var StyleMoinsHiverEN_ET = '<link rel="stylesheet" href="/en/css/ete.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookieMoins_EN_ET').click(function(){
		$('head').append(StyleMoinsHiverEN_ET);
		var resultMoinsEteEN_ET = readCookie_EN_ET('CookieSystemeMalvoyantMoins_EN_ET');
		if(resultMoinsEteEN_ET == 'true'){
			$('head').append(StyleMoinsHiverEN_ET);
			//console.debug('toto');
		}		
	});
});

var StylePlusEteEN_ET = '<link rel="stylesheet" href="/en/css/ete-plus.css" type="text/css" />';
$(document).ready(function(){	
	$('#cookiePlus_EN_ET').click(function(){		
		$('head').append(StylePlusEteEN_ET);
		var resultPlusEteEN_ET = readCookie_EN_ET('CookieSystemeMalvoyantPlus_EN_ET');
		if(resultPlusEteEN_ET == 'true'){
			$('head').append(StylePlusEteEN_ET);
			//console.debug("dd");
		}		
	});
});



function loadinit(){
	
}

jQuery.extend({
	callModal : function(html, height, width, containerClass){
		$('<div class="'+containerClass+'">'+html+'</div>').modal({
			containerCss: {
			    height: height,
			    width: width,
			    backgroundColor: '#414636',
			    border: '3px solid #ccc'
			}
			, overlayCss: {
			    backgroundColor: '#414636',
			    cursor: 'wait'
			}
			, onOpen: function (dialog) {
				dialog.overlay.fadeIn('slow', function () {
					dialog.container.slideDown('slow', function () {
						dialog.data.fadeIn('slow');
					});
				});
			}
			, onClose: function (dialog) {
				dialog.data.fadeOut(200, function () {
				    dialog.container.slideUp(200, function () {
				      dialog.overlay.fadeOut(200, function () {
				        $.modal.close(); // must call this!
				      });
				    });
				});
			}
		});
	}
});





/*$(document).ready(function(){	
	$("#slider").easySlider({
		auto: true, 
		continuous: true
	});
	$("#sliderWebcamPhoto").easySlider({
		auto: false, 
		continuous: true
	});
});	*/

function ouvrir_tr(frame)
{
	$('#'+frame).show();
}
					
function close_tr(frame)
{
	$('#'+frame).hide();
}


function formatprix(prix)
{	
	prix=Math.round(prix*100)/100;
	var test=prix.toString();
	if (test.indexOf('.',0)==-1)
		prix=prix+'.00';
	else
	{
		test=test.substr(test.indexOf('.',0)+1,2);
		if ((parseInt(test)<10) && (test.length==1))
		   prix=prix+'0';
	}
	prix=prix+' &euro;';
	return prix;
}

function maj_prix(sej_id,i,j,prixbase,cas)
{
	var prix=0;
	if (cas==4)
	{
		if ($("select[name='quantite_"+sej_id+"[" + i+"]']").get(0).selectedIndex!=0)
			prix=prixbase*$("select[name='quantite_"+sej_id+"[" + i+"]']").get(0).selectedIndex;
	}
	else
	{
		if ($("select[name='nb_pax_"+sej_id+"[" + i+"]["+j+"]']").get(0).selectedIndex!=0)
			prix=prixbase*$("select[name='nb_pax_"+sej_id+"[" + i+"]["+j+"]']").get(0).selectedIndex;
		else
			prix=prixbase;
	}
	prix=formatprix(prix);
	$("#affPrix_"+sej_id+"_"+i+"_"+j).html(prix);
}

function RecalculePrix(url)
{
	var assannulvalue=$("input[name='assannulcoche']:checked").val();

	$.ajax({
		data: 'assannulcoche='+assannulvalue
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#contenucentral2').html($('#panierm',html).html());
		}
	});//fin $.ajax()
}


function gereOptions(sej_id,opt,quant,pens)
{
	  for(i=0;i<quant;i++)
	  {
		  for(j=0;j<pens;j++)
		  {
			  if (i<$("select[name='quantite_opt_"+sej_id+"["+opt+"]']").get(0).options[$("select[name='quantite_opt_"+sej_id+"["+opt+"]']").get(0).selectedIndex].text)
				  ouvrir_tr("opt_"+sej_id+"_"+opt+"_"+i+"_"+j);
			  else
				  close_tr("opt_"+sej_id+"_"+opt+"_"+i+"_"+j);
		  }
	  }
}

function deconnexion(url)
{
	document.location.href=url+'?fermeture=1';
}

function maj_prixopt(sej_id,i,j,k,prixbase)
{
	var prix=0;
	if ($("select[name='nb_paxopt_"+sej_id+"[" + i+"]["+j+"]["+k+"]']").get(0).selectedIndex!=0)
		prix=prixbase*$("select[name='nb_paxopt_"+sej_id+"[" + i+"]["+j+"]["+k+"]']").get(0).selectedIndex;
	else
		prix=prixbase;
	prix=formatprix(prix);
	$("#affPrixOpt_"+sej_id+"_"+i+"_"+j+"_"+k).html(prix);
}

function validDate(idProduit,sejour,Date,url)
{
	$('#attente').html('<p align="center" class="r-textespecialgras"><br /><br /><br />CHARGEMENT / LOADING<br /><img src="/images/ajax-loader.gif"></p>');
	$.ajax({
		data: 'idProduit='+idProduit+'&sejour='+sejour+'&dateSel='+Date
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#dureeDepart').html($('#dureeDepart',html).html());
			$('#attente').html('');
		}
	});//fin $.ajax()
}

$('.pages').live('click',function() {
	var href=$(this).attr("href");
	href=href.substr(href.lastIndexOf('page=')+5,href.length);
	$('#pageAjax').attr("value",href);
	$('.formAjax').change();
	return false;		
});


				
function formSelectValid(obj)
{
	if ( $.browser.msie ) {
		$(obj).parents("form").change();
	}
}

function ambiancechange(obj,ind)
{
	if (obj.checked) 
		$('#ambiance'+ind).get(0).value=obj.value; 
	else 
		$('#ambiance'+ind).get(0).value=""; 
	$('.formAjax').change();
}

function nbSejourChange()
{
	$('#attente').html('<p align="center" class="r-textespecialgras"><br /><br /><br />CHARGEMENT / LOADING<br /><img src="/images/ajax-loader.gif"></p>');
	$.ajax({
		data: $('.dureeDepart').serialize()
		, dataType: 'html'
		, type: 'get'
		, url: $('.dureeDepart').attr('target')
		, success: function(html) {
			$('.dureeDepart').html($('.dureeDepart', html).html());
			$('#attente').html('');
		}
	});//fin $.ajax()
}

function popup_calendrier(url,data)
{
	$.ajax({
		data: data
		,  dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#div_depart_cal').html($('#calendrier_arrive', html).html());
		}
	});//fin $.ajax()
	$('#div_depart_cal').show();
}

$(document).ready(function(){
	
	if ($('#dialog').length == 0) {
		$('<div id="dialog" ></div>').appendTo(document.body);
	}
	
	$('#simplemodal-overlay').live('click', function() {
		$.modal.close();
	});
	
	try {
		loadinit();
	} catch (e) {}

	try {
		$('a.lightbox').lightBox();
		$('a.ligthbox').lightBox();
	} catch(e) {}
	
	$('a[rel="simplemodal"]').live('click', function() {
		$.modal.close();
		$.ajax({
			data: {render_mode : "ajax"}
			, dataType: 'html'
			, type: 'get'
			, url: $(this).attr('href')
			, complete : function() {
			}
			, success: function(html) {
				$('#dialog')
				.html($('#wysiwyg', html).html())
				.dialog({
					bgiframe 	: true
					, width		: 520
					, position  : ['center', 'center']
					, bgiframe		: true 
					, modal		: true
					, close		: function() {
						$('#dialog').dialog('destroy').remove();
						if ($('#dialog').length == 0) {
							$('<div id="dialog" ></div>').appendTo(document.body);
						}
					}
				});

			}
		});//fin $.ajax()
		return false;
	});
	
	$('a[rel="simplemodal2"]').live('click', function() {
		$.modal.close();
		$.ajax({
			data: {render_mode : "ajax"}
			, dataType: 'html'
			, type: 'get'
			, url: $(this).attr('href')
			, complete : function() {
			}
			, success: function(html) {
				$('#dialog').dialog('destroy').remove();
				if ($('#dialog').length == 0) {
					$('<div id="dialog" ></div>').appendTo(document.body);
				}
				
				$('#dialog')
				.html($('#wysiwyg', html).html())
				.dialog({
					bgiframe 	: true
					, width		: 750
					, position  : ['center', 'center']
					, bgiframe		: true 
					, modal		: true
					, close		: function() {
						$('#dialog').dialog('destroy').remove();
						if ($('#dialog').length == 0) {
							$('<div id="dialog" ></div>').appendTo(document.body);
						}
					}
				});

			}
		});//fin $.ajax()
		return false;
	});	
		
	$('#resetRecherche').live('click', function() {
		$('#resetAjax').attr("value",1);
		$('.formAjax').change();
	});

	$('.formAjax').live('change', function() {
		$('#loadingOverLay').animate({opacity:'.5'}, 500).slideDown('slow');
		var self = this;
		if ($('#contenucentral').get(0))
		{
			$('#fondrecherche').html('<p align="center" class="r-textespecialgras"><br /><br /><br />CHARGEMENT / LOADING<br /><img src="/images/ajax-loader.gif"></p>');
			$.ajax({
				data: $(this).serialize()
				, dataType: 'html'
				, type: 'get'
				, url: $(this).attr('target')
				, complete : function() {
					$('#loadingOverLay').slideUp('slow');
				}
				, success: function(html) {
						$('#recherche').html($('#recherche', html).html());
						$('#promotions').html($('#promotions', html).html());
						$('#coupdecoeur').html($('#coupdecoeur', html).html());
						$('#minutes').html($('#minutes', html).html());						
		//				$(self).html(html);
						$('#contenucentral').slideUp(100, function() {
							$(this).html($('#contenucentral', html).html()).fadeIn(500);
						});
				}
			});//fin $.ajax()
		}
		else
		{
			$('.formAjax').submit();
		}
		$('#fondrecherche').html('<p align="center" class="r-textespecialgras"><br /><br /><br />CHARGEMENT / LOADING<br /><img src="/images/ajax-loader.gif"></p>');
		$('#carte').html('');
		return false;
	});
	
	//colonne droite qui flotte si la fenetre est assez grande
 	if ($.dimentions().innerHeight  > 1300) {
	 	$('#droiteFloat').css({position:'absolute'});
	 	$(window).scroll(function () { 
	 		if ( $.browser.msie ) {
				if ($.browser.version == 6.0) {
					return;
				}
			}
			
			var scroll = getScrollY() 
			if (scroll < 400 ) {
				scroll = 100;
			}
			//console.debug(scroll, (scroll + $('#droiteFloat').innerHeight()*1.5 ), $.dimentions().innerHeight, $.dimentions().pageYOffset, $('#droiteFloat').css('height') )
			if ((scroll + 600) > $.dimentions().innerHeight) {
				scroll = $.dimentions().innerHeight - 600;
			}
			$("#droite").stop().animate({ 
		        top: (scroll - 100)+'px'
	      	}, 1300);
	 	});
 	}
});
function getScrollY() {
	  scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
	    //Netscape compliant
	    scrOfY = window.pageYOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	    //DOM compliant
	    scrOfY = document.body.scrollTop;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	    //IE6 standards compliant mode
	    scrOfY = document.documentElement.scrollTop;
	  }
	return scrOfY;
}

function memoMenuIdArbo(id) {
	$.get("/menuId2Session.php",{menuId: id },
        function success(data){ // Au succès on renvoie le résultat de la requête
        	//alert(data); // Affichage
    });
}

function popup(url,width,height) 
{ 
	pop = window.open(url,"pop","toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,resizable=no,width="+width+",height="+height);
//	if( self.focus ) popup.focus(); 
}



jQuery.extend({dimentions : function(){
	struct = {pageYOffset:0, pageXOffset:0, innerHeight:0, innerWidth:0}
	if (document.body) {
  	  struct.pageYOffset = document.body.scrollTop;
  	  struct.pageXOffset = document.body.scrollLeft;
  	  struct.innerHeight = document.body.clientHeight;
  	  struct.innerWidth = document.body.clientWidth;
    } else if (self.innerHeight) {
		struct.pageYOffset = self.pageYOffset;
		struct.pageXOffset = self.pageXOffset;
		struct.innerHeight = self.innerHeight;
		struct.innerWidth = self.innerWidth;
     } else if (document.documentElement && document.documentElement.clientHeight) {
    	 struct.pageYOffset = document.documentElement.scrollTop;
    	 struct.pageXOffset = document.documentElement.scrollLeft;
         struct.innerHeight = document.documentElement.clientHeight;
         struct.innerWidth = document.documentElement.clientWidth;
     } 
      
      return struct;
}});


function article_plus(id_zone) 
{ 
	var cant=$('#'+id_zone).attr("value");
	cant=(cant*1)+1;
	$('#'+id_zone).attr("value",cant);
}
function article_moins(id_zone) 
{ 
	var cant=$('#'+id_zone).attr("value");
	cant=cant-1;
	if(cant<1){
		cant=1;
	}
	$('#'+id_zone).attr("value",cant);
}
function refrechPanier(){
	//var url = '/fr/panier-ajouter-produit.html'; 
	$.ajax({
		 dataType: 'html'
		, type: 'get'
		, url: $('#urlpanier').attr("value")
		, success: function(html) {
			$('#panier').html(html);
		}
	});//fin $.ajax()	
}

function ajoutePanier(pro_id,quantite,url){
	//var url = '/fr/panier-ajouter-produit.html'; 
	$.ajax({
		data: 'pro_id='+pro_id+'&quantite='+quantite
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#panier').html(html);
		}
	});//fin $.ajax()	
}
function decrementePanier(pro_id,quantite,url){
	//var url = '/fr/panier-decremente-quantite.html'; 
	$.ajax({
		data: 'pro_id='+pro_id+'&quantite='+quantite
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#panier').html(html);
		}
	});//fin $.ajax()	
}

function ajoutePanier2(pro_id,quantite,url){
	//var url = '/fr/panier-ajouter-produit.html'; 
	$.ajax({
		data: 'pro_id='+pro_id+'&quantite='+quantite
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#validPanier').html($('#validPanier', html).html());
		}
	});//fin $.ajax()	
}
function decrementePanier2(pro_id,quantite,url){
	//var url = '/fr/panier-decremente-quantite.html'; 
	$.ajax({
		data: 'pro_id='+pro_id+'&quantite='+quantite
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#validPanier').html($('#validPanier', html).html());
		}
	});//fin $.ajax()	
}
function suppPanier2(pro_id,url){
	//var url = '/fr/panier-decremente-quantite.html'; 
	$.ajax({
		data: 'pro_id='+pro_id
		, dataType: 'html'
		, type: 'get'
		, url: url
		, success: function(html) {
			$('#validPanier').html($('#validPanier', html).html());
		}
	});//fin $.ajax()	
}

//fonction rajouté issue du modele
function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	MM_reloadPage(true);
	function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
	}
	
//fonction rajouté issue du modele
function montre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if( i != 999 )
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
}

// JavaScript pour l'affichage des video et le masquage de la webcam
function montrevideo(id) {
document.getElementById('videofond').style.display='block';
document.getElementById('webcamfond').style.display='none';
}

//JavaScript pour l'affichage de la webcam et le masquage des video
function montrewebcam(id) {
document.getElementById('webcamfond').style.display='block';
document.getElementById('videofond').style.display='none';
}


function montremeteo(id) {
document.getElementById('meteofond').style.display='block';
document.getElementById('videofond').style.display='none';
}

function montrevideo2(id) {
document.getElementById('videofond').style.display='block';
document.getElementById('meteofond').style.display='none';
}





