jQuery(document).ready(function($){
		
		/*$("#content_flash_brands").hide()*/
		/*CONSTRUCT DROPDOWN PERSO - if exist */
		if ($("select#dropdown_inno").length != 0) {
			$("select#dropdown_inno").selectmenu({style:'dropdown'});
			/*:::DEBUG::: -> LIMIT TO 15 elements TO AVOID 'undefined' LI's IN DROPDOWN*/
			/*IF IE6*/
			if(typeof document.body.style.maxHeight === "undefined") {
				$("#dropdown_inno-menu li:lt(23)").remove();
			} else {	
				$("#dropdown_inno-menu li:gt(15)").remove();
			}
		}
		
		/*************** NEW 01/2011
		/* woman fullscreen mode */
		/*setupFullscreenImage();
		sizeFullscreenImage();
		$(window).resize(function() { 
			sizeFullscreenImage();
		});*/
		/*************************/

		
		$("#main_nav > li > a").mouseenter(function() {
		  if(!$(this).parent().hasClass("clicked")){
		  	$(this).addClass("hover");
		  }		    
		})
		
		$("#main_nav > li > a").mouseleave(function() {
			$(this).removeClass("hover");
		})
		
		$("#main_nav > li > a").not("a:eq(0)").click(function(e) {		
			 if($(this).parent().hasClass("clicked")){
				resetMainNav()
				$("#breadcrumb").show()
				return
			}
			resetMainNav()
			$(this).removeClass("hover");  
			$(this).parent().toggleClass("clicked").hide();
			/*
			$("#main_nav li.clicked").fadeIn(400)
			$("#main_nav_level2").fadeIn(500)
			$(this).next(".level2").fadeIn(500)
			*/
			$("#main_nav li.clicked").slideDown(0)
			$("#main_nav_level2").slideDown(200)
			$(this).next(".level2").slideDown(300)
		})
		
		$("#main_nav > li > a").mouseleave(function() {
			$(this).removeClass("hover");
		})
		

		$(".level2 li a").click(function(e) {
			/*if IE6*/
			if(typeof document.body.style.maxHeight === "undefined") {
				resetMainNavLevel2()
				$(this).addClass("hover");
				return
			} else {
				resetMainNavLevel2()
				$(this).addClass("hover");
			}			
		})
		
		function resetMainNav(){
			$("#main_nav").find("li").each(function(){
				$(this).removeClass("clicked");
			})
			/*
			$("#main_nav_level2").fadeOut(50)
			$(".level2").fadeOut(50)
			*/
			$("#main_nav_level2").slideUp(200)
			$(".level2").slideUp(200)
			$("#breadcrumb").hide()
		}
		
		function resetMainNavLevel2(){
			$(".level2").find("li").each(function(){
				$(this).children().removeClass("hover"); 
			})
		}
		
		// collapse navigation (show/hide)
		$('.toggleClose').click(function() {
			$('.inner').slideToggle(400);
		});
		$('.toggleOpen').click(function() {
			$('.inner').slideToggle(400);
		});
		/*collapse open by default*/
		$('.toggleOpen').click();
		// initialize scrollable content for collapse navigation  - if exist
		if ($("#scrollable").length != 0) {
			//constructor
			$("#scrollable").scrollable({keyboard: false, circular: false});
			//get access to the API
			var api = $("#scrollable").data("scrollable");
			//get number of item
			var itemsSize = api.getItems().size();
			//alert(itemsSize)
			//pimp next slide : hide next btn if no more slide to show
			$('.next').click(function() {
				if(api.getIndex() == itemsSize-4){
					$('.next').hide()
				}
			})
			//pimp next slide : show next btn if there is slide to show
			$('.prev').click(function() {				
				if(api.getIndex() <= itemsSize-4){
					$('.next').show()
				}
			})
		}
		
		// configure popin default settings - if exist
		if ($(".nyroModal").length != 0) {
			$.nyroModalSettings({
				bgColor: '#333333',
				width: 800,
				//height: 550
				//Nouvelle hauteur 2010-09-24 < nouveau Sensa
				height: 630
			});
		}
		
	
	});

	var flashBrandLoaded = false;
	
	function thisMovie(movieName) {
		
         if (navigator.appName.indexOf("Microsoft") != -1) {
			 
			 
             return window[movieName];
         } else {
             return document[movieName];
         }
     }
	 function callExternalDepartementId(nbr){
		// alert("fsdf")
		thisMovie("brandsSwf").setCMID(nbr);
		clearTimeout(myTimer);
	}
	function callExternalShopId(shop_id){
		// alert("fsdf")
		thisMovie("brandsSwf").setSHOP(shop_id);
		clearTimeout(myTimer);
	}
	var myTimer
	function setShop(shop_id){
		jQuery('#baseline,#home_brandslider').remove();
		jQuery("#content_detail").css("display","none");		
		jQuery('#woman').removeClass("homepage");
		jQuery('#woman').addClass("page");
		//jQuery('#client_screen').removeClass("home_size");
		jQuery("#content_flash_brands").css("display","block");
		myTimer=setTimeout("callExternalShopId('"+shop_id+"')",300);
		return	
	}
	 function setDepartement(nbr){
		jQuery('#baseline,#home_brandslider').remove();
		jQuery("#content_detail").css("display","none");		
		jQuery('#woman').removeClass("homepage");
		jQuery('#woman').addClass("page");
		//jQuery('#client_screen').removeClass("home_size");
		jQuery("#content_flash_brands").css("display","block");
		myTimer=setTimeout("callExternalDepartementId('"+nbr+"')",300);
		return
		if(!flashBrandLoaded  && false){			
			 flashBrandLoaded = true;			 
			 var swfHtml="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' id='brandsSwf' width='700' height='420' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'>         <param name='movie' value='/wain/static/front/swf/brandspace.swf' />         <param name='quality' value='high' />         <param name='wmode' value='transparent' />         <param name='allowScriptAccess' value='sameDomain' />         <param name='flashvars' value='brandsPathXml=/wain/front/xml/listBrandsXML.do&amp;shopsPathXml=/wain/static/front/xml/shops.xml&cmid="+nbr+"' />         <embed src='/wain/static/front/swf/brandspace.swf' quality='high' width='700' height='420' name='brandsSwf' align='middle' play='true' loop='false' wmode='transparent' quality='high' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' flashvars='brandsPathXml=/wain/front/xml/listBrandsXML.do&amp;shopsPathXml=/wain/static/front/xml/shops.xml&cmid="+nbr+"'";
				 swfHtml+= "pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>";
			/* if(jQuery('#content_detail').length==0){
						jQuery('#header').after("<div id='content_detail'></div>")	
					}*/
			 jQuery('#content_detail').html(swfHtml);
			 jQuery('#woman').removeClass("homepage");
			 jQuery('#woman').addClass("page");
			 //jQuery('#client_screen').removeClass("home_size");
			 
			 
			 return;
			/* jQuery.ajax({
				url:'/wain/static/front/html/brands_filter.html',
				type:'GET',
				dataType:'html',
				success: function(data){
					var jqObj = jQuery(data);	
					var flashvars=jqObj.children('param[name=flashvars]').attr("value")+"&amp;cmid="+nbr	
					
					jqObj.children('param[name=flashvars]').attr("value","fsfsd")		
					
					jqObj.children('embed').attr("flashvars",flashvars)
					
					jQuery('#baseline,#home_brandslider').remove();
					if(jQuery('#content_detail').length==0){
						jQuery('#header').after("<div id='content_detail'></div>")	
					}
					
					//alert(jqObj.eq(0).html())
					//
					//jQuery('#content_detail').html(jqObj.eq(0).html())
					//alert(jQuery('<div>').append( jqObj.eq(0).clone() ).html())
					var elementSWF=jQuery('<div>').append( jqObj.clone() ).html()
					//alert(elementSWF)
					jQuery('#content_detail').html(elementSWF)
					//jQuery('#content_detail').html(jqObj.html())
					 
				}
			})
			return;*/
		}else{
			
			thisMovie("brandsSwf").setCMID(nbr);
		}
	}
	
/******************************************** NEW 01/2011*/
/* woman fullscreen mode METHOD */
	 /*var transition_speed = 1000;
function sizeFullscreenImage() {
		var window_height = jQuery(window).height();
		var window_width = jQuery(window).width();
		var $img = jQuery(".scale");
		var img_height = $img.attr("data-height"); 
		var img_width = $img.attr("data-width");
		var ratio = $img.attr("data-ratio");
		//size based on width.
		var oh = window_width*(ratio);
		var ow = window_width;
		//alert(oh)
		if ( oh < window_height ){
			//size based on height.
			var ow = window_height/ratio;
			var oh = window_height; 			
		} 			
		$img.attr("height", oh).attr("width", ow);
		
		var width_offset = Math.round((ow-window_width)/2);
		$img.css("left","-"+width_offset+"px");
		
		
		if ((jQuery.browser.msie && parseInt(jQuery.browser.version) == 6)){
			jQuery("#fullscreen").css("width", window_width+"px").css("height", window_height+"px");
		}
} 
function setupFullscreenImage() {
	var $img = jQuery(".scale");
	var src = $img.attr("data-src");
	$img.attr("src", src).css("opacity", 0).css("visibility", "visible").css("z-index", 9);
	$img.load(function(){ 
		jQuery(this).animate({'opacity' : 1 }, transition_speed, function(){
			jQuery("#fullscreen img").each(function(){
					var src = jQuery(this).attr("data-src");
					jQuery(this).attr("src", src);
					// Cleanup (not required)
					jQuery(this).removeAttr("data-src");						
					// End Cleanup
				});				
		}); //animate 
	})
	.each(function(){
		if ( this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) ){
			jQuery(this).trigger("load");
		}
	}); 
} */
/***********************************************/	
	
