// JavaScript Document
jQuery(document).ready(function() {

theRotator();

var onProgress='false';
var onProgress2='false';

	jQuery("#clickk").hover(function () {
		if(onProgress=='false'){
			onProgress='true'; 
		 jQuery('#clickk').animate({
		 marginBottom: '-20px'
		 }, 500);
		}
	  },
	  function () {
		 jQuery('#clickk').animate({
			 marginBottom: '-120px'
		 }, 500, function() {
		 	onProgress='false';
		 })
		}
	);
	
	jQuery("#clickk2").hover(function () {
		if(onProgress2=='false'){						  
		 onProgress2='true';
		 jQuery('#clickk2').animate({
		 marginBottom: '0px'
		 }, 500)
		}
	  },
	  function () {
		 jQuery('#clickk2').animate({
		 marginBottom: '-100px'
		 }, 500, function() {
		 onProgress2='false';
		 })
		}
	);	
	
	
	jQuery("#clickk").click(function() {
	 window.location.href = "http://www.magicien-danielcoutu.com/"
	});
	
	jQuery("#clickk2").click(function() {
	  window.location.href = "mailto:info@prestigo.ca"
	});
	
	jQuery("#infoTop").click(function() {
	  window.location.href = "calendrier.aspx"
	});
	
});




	var currentPic;	
	var currentList=new Array;
	var listLength;
	
	function initialiseArray() {
		listLength = jQuery('#rotator').find('ul').find('li').length;
		for(i=1;i<=listLength;i++){
			currentList.push("#logo"+i)
		}
			listLength = currentList.length;
	}
	
	
	function theRotator() {
		initialiseArray()
		currentPic = Math.floor(Math.random()*listLength)
		jQuery(currentList[currentPic]).fadeIn('slow');
		setInterval('rotate()',3000);
	}
	
	function rotate() {	
		if(listLength == 1){
			initialiseArray()
		}
		jQuery(currentList[currentPic]).fadeOut('fast', function() {
			currentList.splice(currentPic,1);
			listLength -= 1;
			currentPic = Math.floor(Math.random()*listLength);
			jQuery(currentList[currentPic]).fadeIn('slow')
		});
	}
