$(document).ready(function() {
	
	// set up the scrollables with a start offset and interval defined by their rel attribute
	// rel="offset|interval"
	$.each($(".scrollable"), function(i, v) {
		var opts = $(v).attr("rel").split("|");		
		setTimeout(function() {
			$(v).scrollable({circular: true}).navigator().autoscroll({ autoplay: true, autopause: false,interval: opts[1]});
		}, opts[0]);
			
	});

	
	$('#banner').slideshow( { 
			arrLength: 3,
			speed: 10000,
			fadeSpeed: 1000,
			currentClass: "current"
		});   

	
	$('.selectorNav').children("input").each(function(i){
		$(this).parent().parent().find(".selectorNav").children("input").each(function(i){
			if($(this).is(":checked")){
				var optionChecked = $(this).attr("rel");
				$('.selectorOptions').each(function(i){
					if (!$(this).hasClass("opt"+optionChecked)){
						$(this).addClass("js-hide");
					}
				})
			}
		})	
	})

	$('.selectorNav').children("input").click(function() {
		var optionBlock = $(this).attr("rel");
		
		$('.selectorOptions').each(function(i){
			if(!$(this).hasClass("opt"+optionBlock)){
				$(this).addClass("js-hide");
			}
			else{
				$(this).removeClass("js-hide");
			}
		})
		
	})
	
	
	$('div.otherToggle').each(function(){
		$(this).addClass("js-hide");
	})
	
	$('select').change(function(){
		if ($(this).val() == 'other'){
			if($(this).parent().children('div.otherToggle').hasClass("js-hide")){
				$(this).parent().children('div.otherToggle').removeClass("js-hide");
			}
		}
		else{
			if(!$(this).parent().children('div.otherToggle').hasClass("js-hide")){
				$(this).parent().children('div.otherToggle').addClass("js-hide");
			}
		}
	})
	
	$('#profileListing li').hover(function(){
		$(this).addClass("js-hover");
	},function(){
		$(this).removeClass("js-hover");
		})
		
	$('#profileListing li').click(function(){
		window.location = $(this).find('a').attr("href");
	})
	
	$('a.soldOut').click(function(){
		return false;
	})
	/*
	$('#logon').css('width','10px');
	
	$('#logon').hover(function(){
		$(this).animate({ 
        width: "200px",
      }, 200 );
	},
	function(){
		$(this).animate({ 
        width: "0px",
      }, 200 );
	})
	*/
		
})
