$(document).ready ( function () {

	/*function initNaviV(){
		var videosnum = $("a[name = videos]").length;
		var activelink = $("a.active[name=videos]").attr("title");
		var activevideo = activelink.replace("vid_", "");
		
		if (activevideo == 1) $("div.movie_prev").css("visibility", "hidden");
		else $("div.movie_prev").css("visibility", "visible");
		if (activevideo == videosnum) $("div.movie_next").css("visibility", "hidden");
		else  $("div.movie_next").css("visibility", "visible");	
		var nextNum = parseInt(activevideo) + 1;
		$("div.movie_next a").attr("title", "vid_" + nextNum);
		
	}
	$("a.toggler").click( function () {
		initNaviV();
	});
	
	initNaviV();*/
	
	$(document).ready(function(){

    var cities = new Array();
	var themes = new Array();
	
	function updateArrays()
	{
		cities.length = 0;
		themes.length = 0;
		$("li.button_red a").each( function () {
			if($(this).hasClass("selectcity")) cities.push($(this).attr("name"));
			if($(this).hasClass("selecttheme")) themes.push($(this).attr("name"));
		});
		
	}
	
	$("a.selectcity").click ( function () {
		if($(this).parent().hasClass("button_grey"))
		{
			$("a.selectcity").parent().removeClass("button_red").addClass("button_grey");
			$(this).parent().removeClass("button_grey").addClass("button_red");
		}
		else if($(this).parent().hasClass("button_red"))
		{
			$(this).parent().removeClass("button_red");
			$(this).parent().addClass("button_grey	");
		}
		updateArrays();
	});
    
	$("a.selecttheme").click ( function () {
		if($(this).parent().hasClass("button_grey"))
		{
			$(this).parent().removeClass("button_grey");
			$(this).parent().addClass("button_red");
		}
		else if($(this).parent().hasClass("button_red"))
		{
			$(this).parent().removeClass("button_red");
			$(this).parent().addClass("button_grey	");
		}
		updateArrays();
	});
    
	$("#start").click( function (){
	
		if(cities.length == 0) cities.push(0);
		window.location = "/mmconcierge/" + cities.join(',') + "/"+themes.join(",");
		
	});
	
	$("#main_men img").fadeTo(1, 0.5);
 	$("#main_women img").fadeTo(1, 0.5);
 	$("#main_men img").mouseover( function() { $(this).fadeTo(200, 1);});
 	$("#main_women img").mouseover( function() { $(this).fadeTo(200, 1);});
 	$("#main_men img").mouseout( function() { $(this).fadeTo(200, 0.5);});
 	$("#main_women img").mouseout( function() { $(this).fadeTo(200, 0.5);}); 


	$("li.letter").mouseover(function() {
		 $(this).find("div").addClass("active");
		 $(this).find("ul").show();
		 $(this).css("z-index", "100");
		 $(this).mouseout( function () {
			 $(this).find("div").removeClass("active");
			 $(this).find("ul").hide();
			 $(this).css("z-index", "0");
 			}); 
		$(this).click( function () {
			 $(this).find("div").removeClass("active");
			 $(this).find("ul").hide();
		 $(this).css("z-index", "100");
 			}); 
	})
});

});
