// JavaScript Document

window.addEvent('domready', function(){
	
	if($('form_livre')){
	/* Validation check and response sending through Ajax */
		new FormCheck('livrecheck', {
			submitByAjax : true,
			ajaxResponseDiv : 'form_livre'
		});
	};
	
	if($('bounce')){
	var newTweenSet = function() {
			this.start('background-color', '#333', '#DC1E6D');
		}
	
		var newTweenElement = $('boncecont');	
		var newTween = new Fx.Tween(newTweenElement);
		$('bounce').addEvent('mouseover', newTweenSet.bind(newTween)); 
	}
/*	
	if($('play_paul')){
	/* Stop the song on the index page (delete the player) or launch when speaker is clicked (rebuild and append). */
/*		var el = $('play_paul');
		
		$('speaker').addEvents({
			'click' : function(){
			//	if(this.src=="http://localhost/paulbiss/images/audio.png"){
				if(this.src=="http://www.paulbiss.be/images/audio.png"){
			//		this.src="http://localhost/paulbiss/images/audio_off.png";
					this.src="http://www.paulbiss.be/images/audio_off.png"
					el.removeChild(el.firstChild);
				}else{
			//		this.src="http://localhost/paulbiss/images/audio.png";
					this.src="http://www.paulbiss.be/images/audio.png";
					var player = document.createElement('embed');
					player.setAttribute('src','http://www.paulbiss.be/audio/jamais-johnny.mp3');
					player.setAttribute('hidden','true');
					player.setAttribute('width','0');
					player.setAttribute('height','0');
					player.setAttribute('autostart','true');
					player.setAttribute('loop','true');
					el.appendChild(player);
				}
			}
		});
	};*/
	
	if($('presse')){

		$$('.thumb').each( function(photo, i){
			photo.onclick = function(event){
				event.preventDefault();
				window.open(photo.getParent().href, "Téléchargement de la photo", "width=600,height=400,screenX=100,screenY=75,left=100,top=75, menubar=yes");
			}					
		});
	}
});	