/* SACD 2008 */
/* COMMON JAVASCRIPT FUNCTIONS */

/* ENABLE ROLLOVER ON TARGETED IMAGES (ALL BROWSERS) */
function imgRollover(elt) {
    jQuery(elt).each( function() {
		jQuery(this).hover(
			function() {
				jQuery(this).attr("src", jQuery(this).attr("src").replace("-off","-on"));
			},
			function () {
				jQuery(this).attr("src", jQuery(this).attr("src").replace("-on","-off"));
			}
		);
	});
}

// verif formulaire de contact
function validationContact(elt) {
	jQuery(elt).validationAideEnable(null, {showInlineMessages:true, showSummary:false});
}

// INSPIRATION CAROUSEL
function inspiration(elt) {
    jQuery(elt+' li a').hover(
		function(){
			jQuery("#bigPic").attr("src",jQuery(this).attr("href")).attr("alt",jQuery(this).attr("title"));
		},function(){}
	).click( function(){
			return false;
	});
}

// HOME CAROUSEL
function homeCarousel(elt) {
    jQuery(elt+' li a').hover(
		function(){
			jQuery("#bigPic").attr("src",jQuery(this).attr("href")).attr("alt",jQuery(this).attr("title"));
			var credits = jQuery(this).attr("title").split(" - ");
			//alert(credits[0]);
			jQuery(".creditsHomeImage h2").text(credits[0]);
			jQuery(".creditsHomeImage p a").text(credits[1]).attr("href","http://"+credits[1]);
			jQuery(".creditsHomeImage p span").text(credits[2]);
		},function(){}
	).click( function(){
			return false;
	});;
}

jQuery(document).ready(function() {

    /* ADD hasJS CLASS TO BODY FOR ABS/REL POSITIONNING */
	jQuery("body").addClass("hasJS");

    /* HIDE QUICK LINKS */
	jQuery('#quickAccess').addClass('offLeft');

    /* ENABLE ROLLOVER ON MENU IMAGES (ALL BROWSERS) */
	if (jQuery('#menu li > a img').size() > 0) { initImgRollover = imgRollover('#menu li > a img'); }

    /* INSPIRATION */
	if (jQuery('.inspirationList').size() > 0) { initInspiration = inspiration('.inspirationList'); }

    /* INSPIRATION */
	if (jQuery('.homeList').size() > 0) { initHomeCarousel = homeCarousel('.homeList'); }

    /* ENABLE ROLLOVER ON MENU IMAGES (ALL BROWSERS) */
	if (jQuery('#contactForm').size() > 0) { initValidationContact = validationContact('#contactForm'); }

    /* ENABLE ROLLOVER ON MENU IMAGES (ALL BROWSERS) */
	if (jQuery('#nlForm').size() > 0) { initValidationContact = validationContact('#nlForm'); }

});























/* END */
