// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
var compteur_bulles = -1;
document.observe('dom:loaded', function() {
	$('img_top_2').hide();		
	// $$("#bulle_accueil_holidayinn").each(function(el) {
	// 		el.observe("click", lien_activites_holidayinn);
	// 	})	
	// 		
	//  	$('bulle_accueil_holidayinn').hide();	
	// 	$('bulle_accueil_base').hide();	

	 swap_bulles()
	 setInterval("swap_bulles()",6000);
// 
// 	$$("#btn_archive").each(function(el) {
// 		el.observe("click", ouvrirListeArchives);
// 	})
// 
// 
});
// function ouvrirListeArchives(){
// //	Effect.toggle("#liste_archives",'slide',{ duration: 1.0 });
// //$("liste_archives").appear({ duration: 0.6 });
// Effect.toggle('liste_archives', 'slide', { delay: 1.5 });
// 
// }
function lien_activites_holidayinn(){
	 window.location.href='/activites/holiday_inn';
}
function swap_image(img_id, state){
	img_src = $(img_id).src
	
	if(state == "off"){
		img_src = img_src.replace(/on\.gif/, "off.gif")
	}
	else{
		img_src = img_src.replace(/off\.gif/, "on.gif")
	}
	//console.info(img_src)
	$(img_id).src = img_src
}


function swap_bulles(){
	var arr_bulles=new Array();
	
	arr_bulles[0]="img_top_1";
	arr_bulles[1]="img_top_2";
	
	if(compteur_bulles > -1){
		if(typeof document.body.style.maxHeight === "undefined") {
			$(arr_bulles[compteur_bulles]).hide();
		}else{
			$(arr_bulles[compteur_bulles]).hide();
			//new Effect.Fade(arr_bulles[compteur_bulles]);
		}
	}
	if(compteur_bulles>=1){
		compteur_bulles=0;
	}else{
		compteur_bulles++;
	}

	if(typeof document.body.style.maxHeight === "undefined") {
		$(arr_bulles[compteur_bulles]).show();
	}else{
		new Effect.Appear(arr_bulles[compteur_bulles]);
	}		
//	setInterval("swap_bulles()",2000);
}


function display_form(act_id)
{
	new Ajax.Request('/display_form/'+act_id, {asynchronous:true, evalScripts:true});
	return false;
}

function display_query_form(act_id)
{
	new Ajax.Request('/display_query_form/'+act_id, {asynchronous:true, evalScripts:true});
	return false;	
}

function make_donation(obj_chk)
{
	if(obj_chk.checked){
		$('donation_zone').show();
		$('subscription_donation_amount').disabled = false;
	}
	else{
		$('donation_zone').hide();
		$('subscription_donation_amount').disabled = true;
	}
}

function remove_form_errors()
{
	$$(".form_error").each(function(field){field.removeClassName("form_error")})
	
}

function place_footer(){}

function timer_bulle()
{
	//t = setTimeout("swap_bulle()", 5000)
}

function swap_bulle()
{
	if($('bulle_accueil')){
		new Effect.Fade("bulle_accueil", {queue: 'front'});
		new Effect.Appear('bulle_vin', {queue: 'end'})
	}
}
