jQuery(document).ready(function() {
	
	if (jQuery.browser.msie)
		jQuery('body').addClass('ie');
	
    /* Roll over images */
	var preload_array = new Array();
	var preload = function(src) {
		var img = new Image();
		img.src = src;
		preload_array.push(img);
	}
	
	jQuery('img.roll').each(function (i) {
		//let's preload
		preload(this.src.replace(/([_-])off([._-])/, '$1on$2'));
		jQuery(this).hover(
			function () { // over
				jQuery(this).attr('src',this.src.replace(/([_-])off([._-])/, '$1on$2'));
			},
			function () { // out
				jQuery(this).attr('src',this.src.replace(/([_-])on([._-])/, '$1off$2'));
			}
		);
	});
	
	
	if (jQuery.browser.msie && jQuery.browser.version <= 6){
		//jQuery("#splashEn, #splashFr").attr('src','_assets/img/splash/clear.gif');
		//jQuery('#splash #lang .en').hover(function() { jQuery("#splashEn").attr('src','_assets/img/splash/splash-english.png'); }, function() { jQuery("#splashEn").attr('src','_assets/img/splash/clear.gif') });
		//jQuery('#splash #lang .fr').hover(function() { jQuery("#splashFr").attr('src','_assets/img/splash/splash-francais.png'); }, function() { jQuery("#splashFr").attr('src','_assets/img/splash/clear.gif') });
	} else{
		jQuery('#splash #lang .en, #splash #lang .fr').animate({opacity:0.5});
		//jQuery('#splash #lang .en, #splash #lang .fr').hover(function() { jQuery(this).stop().animate({opacity:1}); }, function() { jQuery(this).stop().animate({opacity:0}); })
		jQuery('#splash #lang .en, #splash #lang .fr').hover(function() { jQuery(this).stop().animate({opacity:1}); }, function() { jQuery(this).stop().animate({opacity:0.5}); })
	}

	jQuery('#menu div > ul > li').hover(function() {
			var img = jQuery(this).find('img');
			img.data('current-src', img.attr('src'));
			img.attr('src', img.attr('src').replace(/([_-])(off|selected)([._-])/, '$1on$3'));
		},
		function(){
			var img = jQuery(this).find('img');
			img.attr('src', img.data('current-src'));
	});
	
	// mailing list
	jQuery('#mailing-list .toggler').click(function(e) {
		e.preventDefault();
		jQuery('#mailing-list .toggle').slideToggle();
	});
});

