
var Formulaire = $.Class.create({

	initialize : function() {
	},
	
	send: function(){
	ajustDimension('exec','contact_form',10,10);
    $('#exec').fadeIn('slow', function() {});
	protoAjax2("contact.php","POST","exec_data","contact","loading_bar.gif","");
	},
	
	closeAndClear: function(){
	document.getElementById('contact').reset();
	$('#exec').fadeOut()
	}
	

})

var Formulaire = new Formulaire();

function FB_photosgetAlbum(uid,dest){
	$('#'+dest).css({minHeight:'100px'});
	$('#'+dest).css({backgroundImage:'url(images/loading_bar.gif)'});
	$('#'+dest).css({backgroundRepeat:'no-repeat'});
	$.ajax({  
  type: 'POST',  
  url: 'photos.php',  
  data: ({action:'view_album'}), 
  success: function(data) {  
 	$('#'+dest).html(data);
	$('#'+dest).css({backgroundImage:'none'});
	//$('a.gallery_fb').lightBox();
  }  
});  
}

function FB_photosget(aid,dest){
	$('#'+dest).css({minHeight:'100px'});
	$('#'+dest).css({backgroundImage:'url(images/loading_bar.gif)'});
	$('#'+dest).css({backgroundRepeat:'no-repeat'});
	$.ajax({  
  type: 'POST',  
  url: 'photos.php',  
  data: ({action:'view_photos',album_id:aid}), 
  success: function(data) {  
 	$('#'+dest).html(data);
	$('#'+dest).css({backgroundImage:'none'});
	$('a.gallery_fb').lightBox();
  }  
});  
}

var idObjet = 0;  
var slideShow = $.Class.create({

	initialize : function(dest,timing,pictures) {
		idObjet++; 
		this.idRef = "CONSTRUCTEUR" + idObjet; 
  		window[this.idRef ] = this;  
		this.dest = dest;
		this.timing = timing;
		this.pictures = pictures;
		this.totalPictures = this.pictures.length;
		this.currentPicture = 0;
		this.preload = new Image();
		this.nextPicture = (this.totalPictures > 1)? this.currentPicture + 1 : 0;
	},

	startSlideShow : function(){
		if(this.totalPictures > 1)
		this.LoadPicture();
		
	},
	
	LoadPicture : function() {
		$('#'+this.dest).attr({src:this.pictures[this.currentPicture]});
		$('#'+this.dest).attr({alt:this.pictures[this.currentPicture]});
		this.preload.src = this.pictures[this.nextPicture];
		this.preload.style.display = "none";
		$('#'+this.dest).fadeIn('slow', function() {});
		this.Display();
	},
	
	Display : function() {
	setTimeout("window."+this.idRef+".ChangePicture()",this.timing * 1000);  

	},
	
	ChangePicture : function(){
		
		this.currentPicture++;
		this.nextPicture = this.currentPicture + 1 ;
		// si c’est la dernière
		if (this.currentPicture == this.totalPictures)
			{
			this.currentPicture = 0;
			this.nextPicture = 1;
			}
		$('#'+this.dest).fadeOut();
		this.Wait();
	},
	
	Wait : function () {
		setTimeout("window."+this.idRef+".LoadPicture()",500);
	}
});

