// enable jQuery no conflict mode, replace all $ by $j or $jQuery
//enables jQuery selector
jQuery.noConflict();
//and $j shorthand
var $j = jQuery.noConflict();

$j(document).ready(function() {
	$j("#accueil-slideshow").carouFredSel({
		width		: 648,
		height		: 298,
		circular	: false,
		infinite	: true,
		auto 		: {
			play: true,
			//delay: 3000,
			pauseDuration : 3000,
			//easing		: "easeOutQuart",
			duration: 10,
			easing: 'jswing'
			//fx: "none"
		},
		prev : {
			button		: "#carousel_prev",
			key			: "left",
			items		: 1,
			easing		: "easeOutQuart",
			duration	: 500
		},
		next : {
			button		: "#carousel_next",
			key			: "right",
			items		: 1,
			easing		: "easeOutQuart",
			duration	: 500
		},
		pagination : {
			container	: "#carousel_pag",
			keys		: true,
			easing		: "easeOutQuart",
			//fx: "crossfade",
			duration	: 500
		}
	});
	
	// page boutiques, régions
	$j(".cms-boutiques .std select").bind('change', function() {
		window.location = this.value;
	});

	// contact, google map
	$j('#googlemap').html('<iframe width="378" height="260" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=47-A,+rue+Principale,+Saint-S%C3%A9v%C3%A8re,+G0X+3B0,+QC,+Canada&amp;aq=&amp;sll=46.343491,-72.894673&amp;sspn=0.012117,0.032895&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=47+Rue+Principale,+Saint-S%C3%A9v%C3%A8re,+Qu%C3%A9bec+G0X+3B0,+Canada&amp;ll=46.343494,-72.894664&amp;spn=0.012117,0.032895&amp;t=m&amp;z=11&amp;output=embed"></iframe><br />');

	// fix. smd color swatch has inconsistent ids
	$j('.colorswatch-wrapper .colorswatch-attribute-wrapper:odd').addClass('colorswatch-attribute-wrapper-22');
	
	// menu adjust margin for display
	$j('#nav > li:has(ul)')
		//.mouseover(function(){$j('.header-container').css('margin-bottom','54px');})
		//.mouseout(function(){$j('.header-container').css('margin-bottom','24px');});
		.mouseenter(function(){if($j(this).hasClass('over')) return; $j('.header-container').animate({marginBottom:'54px'}, 'fast', 'linear');})
		.mouseleave(function(){$j('.header-container').animate({marginBottom:'24px'}, 'fast', 'linear');});
		
	// menu add active effect
	$j("#nav ul a[href$='"+(jQuery.support.hrefNormalized ? window.location.pathname.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/])/g,'\\$1') : window.location.pathname)+"']")
		.parent().addClass('over')
		.parent().addClass('shown-sub')
		.parent().addClass('over')
		.parents('.header-container').css('margin-bottom','54px');
	
	//return jQuery.support.hrefNormalized ?
	//		jQuery(containerselector+"a[href='"+href.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/])/g,'\\$1')+"']") : // Other browsers
	//		jQuery(containerselector+'"a[href="'+href+'"]'); // IE 6-7
});


