var cache = [];
  function preloadImages() {
	var args_len = arguments.length;
	for (var i = args_len; i--;) {
	  var cacheImage = document.createElement('img');
	  cacheImage.src = wpp + arguments[i];
	  cache.push(cacheImage);
	}
}

function startFrise()
{
	jQuery('#boutonFrise').fadeOut();
	var newBG = wpp + "un-siecle-d-innovations-sociales-frise.jpg";
	jQuery('#friseContainer').attr('height','300px');
	jQuery('#friseContainer').animate({
		height: 450,
		opacity: 0
	  }, 1000, function() {
		jQuery('#makeMeScrollable').smoothDivScroll("show");
		jQuery('#makeMeScrollable').smoothDivScroll("startAutoScroll");
		jQuery('#friseContainer').css('background-image','url(' + newBG + ')');
		jQuery('#friseContainer').animate({
			opacity: 100
		},5000);	
	});	
}
function initFrise()
{
	jQuery('#ajaxLoad').hide();
	jQuery('#friseContainer').css('background-image','url(' + wpp + 'un-siecle-d-innovations-sociales.jpg)');
	jQuery('#boutonFrise').show();	
	jQuery('#boutonFrise').mouseover(function () {
		jQuery('#boutonFrise').attr('src', wpp + 'boutonFriseHover.png');
	}
	);
	jQuery('#boutonFrise').mouseout(function () {
		jQuery('#boutonFrise').attr('src', wpp+ 'boutonFrise.png');
	}
	);
	jQuery('#boutonFrise').click(function () {
		startFrise()
	}
	);
}
function init()
{
	arrMenu = new Array(104,246,1231);
	for (k = 0; k < arrMenu.length; k++) 
	{
		jQuery('#menu-item-' + arrMenu[k] + ' ul').prepend('<li class="top" id="t' + arrMenu[k] + '"></li>');
	}
	preloadImages('enSavoirPlusHover.png','lireLaSuiteHover.png','telechargerHover.png','flecheNavTop.png','fondAssociation.png','fondInitiatives.png','fondOrganisation.png','fondLiInitiatives.png','fondLiAssociation.png','fondLiOrganisation.png','bdpActiveBgAll.png','bdpHoverBgAll.png');
	if (jQuery('#friseContainer').length > 0)
	{
		preloadImages('boutonFriseHover.png','frisePlusHover.png','un-siecle-d-innovations-sociales-frise.jpg');
		jQuery('#friseContainer').animate({
			opacity: 100
			},1000
		);
		jQuery('#boutonFrise').animate({
			opacity: 100
			},1000
		);
		initFrise();
	}
	if (jQuery('#cforms2form').length > 0)
	{
		jQuery('#cforms2form #url').val(thisPage);
	}
	jQuery('a.graphique').addClass('thickbox');
	jQuery('a.graphique').each(function() {
	 jQuery(this).attr("href", jQuery(this).attr("href") + "?event-only=true");
	});
	if (jQuery('#slider1').length > 0) {
		jQuery('#slider1').anythingSlider({
			startStopped    : false, // If autoPlay is on, this can force it to start stopped
			width           : 950,   // Override the default CSS width
			theme           : 'default',
			autoPlayLocked  : true,  // If true, user changing slides will not stop the slideshow
			resumeDelay     : 10000, // Resume slideshow after user interaction, only if autoplayLocked is true (in milliseconds).
			enablePlay		: false,
			delay           : 4000,
			stopAtEnd		: true,
			onSlideComplete : function(slider){
			}
		});
		jQuery('#slider1').anythingSlider(1);
		jQuery('#ajaxLoader').hide();
		jQuery('#slider1').show();
	}
}
function goAnchor(id) {
	var target_offset = jQuery("#"+id).offset();
	var target_top = target_offset.top;
	jQuery('html, body').animate({scrollTop:target_top}, 500);
}
