var point=function(settings){
	if($('#experiences .point').length<1){
		$('#experiences').append('<div class="point"><div class="carat"></div><div class="body"></div></div>');
		$('#experiences .point').css({opacity:0}).children().css({opacity:0.9});
	}
	var obj={
		id:settings.id,
		coords:settings.coords,
		map:$(settings.id+' > img').attr('usemap'),
		corners:{ // [{top/bottom alignment},{left/right alignment},{.carat X coords},{.carat Y coords}]
			tl:['top','left',0,-10],
			tr:['top','right',-10,-10],
			bl:['bottom','left',0,0],
			br:['bottom','right',-10,0]
		},
		posCarat:function(i){
			var corner=(this.coords[i][2])?this.corners[this.coords[i][2]]:this.corners['tl'];
			$('#experiences .point')
			.find('.body')
			.css({right:'',left:''})
			.css(corner[1],'10px').end()
			.find('p')
			.css({right:'',left:''})
			.css(corner[1],'19px').end()
			.find('.carat').html('')
			.css({top:'',right:'',bottom:'',left:'',backgroundPosition:''})
			.css('top',(corner[0]=='top')?'0px':$('#experiences .point .body').outerHeight()-10+'px')
			.css(corner[1],'0px')
			.css('backgroundPosition',corner[2]+' '+corner[3]);
		},
		displayPoint:function(){
			$('#experiences .point').stop().show().animate({opacity:1},(1-$('#experiences .point').css('opacity'))*1000);
		},
		hidePoint:function(){
			$('#experiences .point').stop().animate({opacity:0},1000,function(){$(this).hide().children('p').remove()});
		},
		displayBlurb:function(i){
			$(this.map+' area').eq(i).trigger('select');
		},
		hideBlurb:function(){
			$(this.map+' area:last').trigger('unselect');	
		}
	};
	$('#experiences .point')
	.bind('mouseover',function(){
		obj.displayPoint();
		$(this).addClass('hover');
	}).bind('mouseout',function(){
		obj.hidePoint();
		$(this).removeClass('hover');
	});
	$(obj.map+' area')
	.bind('select',function(){
		obj.displayPoint();
		var i=$(obj.map+' area').index(this);
		$('#experiences .point p').remove();
		$(obj.id+' .blurbs p').eq($(obj.map+' area').index(this)).clone().appendTo('#experiences .point').css({opacity:1});
		$('#experiences .point')
		.css({left:obj.coords[i][0]+'px',top:obj.coords[i][1]+'px'})
		.add('#experiences .point .body')
		.css({height:parseFloat($('#experiences .point p').height())+15+'px'});
		obj.posCarat(i);
	})
	.bind('mouseover',function(){
		$(this).trigger('select');
	})
	.bind('unselect',function(){
		obj.hidePoint();
	})
	.bind('mouseout',function(){
		$(this).trigger('unselect');
	})
	.bind('click',function(){
		$(this).blur();
	});
	return obj;
};
var blurb=function(settings){
	if($('#experiences .bubble').length<1){
		$('#experiences').append('<div class="bubble"><div class="carat"></div><div class="body"></div></div>');
		$('#experiences .bubble').css({opacity:0}).children().css({opacity:0.9});
	}
	var obj={
		id:settings.id,
		coords:settings.coords,
		map:$(settings.id+' > img').attr('usemap'),
		displayBubble:function(){
			$('#experiences .bubble').stop().show().animate({opacity:1},(1-$('#experiences .bubble').css('opacity'))*1000);
		},
		hideBubble:function(){
			$('#experiences .bubble').stop().animate({opacity:0},1000,function(){$(this).hide().children('p').remove()});
		},
		displayBlurb:function(i){
			$(this.map+' area').eq(i).trigger('select');
		},
		hideBlurb:function(){
			$(this.map+' area:last').trigger('unselect');	
		},
		posCarat:function(x){
			$('#experiences .bubble .carat').css({left:x+'px'});
		}
	};
	$('#experiences .bubble').bind('mouseover',function(){
		obj.displayBubble();
		$(this).addClass('hover');
	}).bind('mouseout',function(){
		obj.hideBubble();
		$(this).removeClass('hover');
	});
	$(obj.map+' area')
	.bind('select',function(){
		obj.displayBubble();
		obj.posCarat(obj.coords[$(obj.map+' area').index(this)]);
		$('#experiences .bubble p').remove();
		$(obj.id+' .blurbs p').eq($(obj.map+' area').index(this)).clone().appendTo('#experiences .bubble').css({opacity:1});
	})
	.bind('mouseover',function(){
		$(this).trigger('select');
	})
	.bind('unselect',function(){
		obj.hideBubble();
	})
	.bind('mouseout',function(){
		$(this).trigger('unselect');
	})
	.bind('click',function(){
		$(this).blur();
	});
	return obj;
};
var feature=function(settings){
	var obj={
		id:settings.id,
		startIndex:settings.startIndex,
		last:settings.startIndex,
		displayFeature: function(index, duration, callback) {
			$('.feature_nav a').eq(index)
			.siblings(':hasClass(.current)')
			.removeClass('current').end()
			.addClass('current');

			$('.feature').eq(obj.last)
			.css({zIndex:1})
			.animate({opacity:0},duration)
			.end().eq(index)
			.css({zIndex:2})
			.animate({opacity:1},duration, function (){
				if (typeof callback == 'function') {
					callback();
				}
			});
			obj.last = index;
		}
	};
	return obj;
};
var shoesYouNeed={
	last:0,
	step:1,
	proceed:true,
	intervalLength:6000,
	buildFeatureNav:function(itemCount) {
		var count = 1;
		var nav = ['<div class="feature_nav">'];
		for (var i = 0; i < itemCount; i++) {
			nav.push('<a href="javascript:void(0);" class="nav_link'+(i==0?' current' : '')+'"><span>'+count+'</span></a>')
			count++;
		}	
		nav.push('</div>');
		return nav.join('\n');
	},
	createPageviewTag:function() {		
		var pvTitleText = $('#shoes_you_need > div').eq(shoesYouNeed.last).find('.feature').filter(function() { return $(this).css('opacity') == 1 }).find('div p strong').eq(0).text();
		var pvTagText = [
			$('#shoes_you_need_header img').attr('alt'),
			$('#shoes_you_need > div').eq(shoesYouNeed.last).find('img').attr('alt')
		];
		if (pvTitleText.length > 0) {
			pvTagText.push(pvTitleText);
		}
		cmCreatePageviewTag(pvTagText.join(' > '),null,'0~2376777~2374609~6025501~6027231');
	},
	enable:function(){
		this.build();
		this.bind();
		this.auto=setInterval(function(){shoesYouNeed.steps()},shoesYouNeed.intervalLength);
	},
	build:function(){
		$('#shoes_you_need > div:gt(0)')
		.css({opacity:0,display:'block'})
		.children('.features').each(function(i){
			$(this)
			.children('.feature')
			.css({opacity:0,display:'block'}).end()
			.children('.feature:first')
			.css({opacity:1}).end()
			.append(shoesYouNeed.buildFeatureNav($(this).children('.feature').length));
		});
		$('#shoes_you_need .floating_col, #shoes_you_need .feature_nav').css({'opacity':1});
		this.features=[
			new feature({id:'#dress',startIndex:0}),
			new feature({id:'#boot',startIndex:2}),
			new feature({id:'#casual',startIndex:4}),
			new feature({id:'#sneaker',startIndex:6}),
			new feature({id:'#tips_tricks',startIndex:8})
		];
	},
	bind:function(){
		$('#shoes_you_need_header a.splashLink').click(function() {
			shoesYouNeed.display(-1);
			clearInterval(shoesYouNeed.auto);
			shoesYouNeed.proceed=false;
			shoesYouNeed.step=13;
		});
		$('#shoes_you_need_header a.shoeLink, #Map1 area').click(function(){
			var step=[1,3,5,7,9];
			var elementCollection = $(this).parent().children();
			var index = elementCollection.index(this);
			if ($('#shoes_you_need > div').eq(index+1).css('opacity') != 1) {
				var feature = shoesYouNeed.features[index];
				feature.displayFeature(feature.startIndex, 50);
				shoesYouNeed.display(index+1);
				clearInterval(shoesYouNeed.auto);
				shoesYouNeed.proceed=false;
				shoesYouNeed.step=step[elementCollection.index(this)]+1;
				shoesYouNeed.auto=setInterval(function(){shoesYouNeed.steps()},shoesYouNeed.intervalLength);
			}
		});
		$('.feature_nav a').click(function(){
			var index = $('.feature_nav a').index(this);
			if ($('.feature').eq(index).css('opacity') != 1) {
				shoesYouNeed.features[shoesYouNeed.last-1].displayFeature(index, 1000, function() {
					shoesYouNeed.createPageviewTag();
				});
			}
			clearTimeout(shoesYouNeed.auto);
		});
		$('.tip_shoe_color_code, .tip_suede_care').click(function() {
			var feature = shoesYouNeed.features[shoesYouNeed.features.length-1];
			feature.displayFeature(($(this).hasClass('tip_shoe_color_code') ? 9 : 8), 50);
			shoesYouNeed.display(shoesYouNeed.features.length);
			clearInterval(shoesYouNeed.auto);
		});
		//$('.callout, .feature_copy').mouseover(function() {
		//	clearTimeout(shoesYouNeed.auto);
		//});
	},
	display:function(i){
		switch(i){
			case -1:
				i=0;
				break;
			case 0:
				i=$('#shoes_you_need > div:gt(0)').length;
				break;
			case $('#shoes_you_need > div:gt(0)').length+1:
				i=1;
				break;
		}
		$('a.shoeLink:hasClass(.current)').removeClass('current');
		if (i >= 0) {
			$('a.shoeLink').eq(i-1).addClass('current');
		}
		$('#shoes_you_need > div').eq(this.last)
		.css({zIndex:1})
		.animate({opacity:0},1000)
		.end().eq(i)
		.css({zIndex:5})
		.animate({opacity:1},1000, function () {
			shoesYouNeed.createPageviewTag();
		});
		shoesYouNeed.last=i;
	},
	steps:function(){
		switch(this.step) {
			case 1: case 3: case 5: case 7: case 9:
				if(!this.proceed) {
					var feature=this.features[this.last-1];
					feature.displayFeature(feature.startIndex, 1000, function() {
						shoesYouNeed.createPageviewTag();
					});
					clearInterval(this.auto);
					return;
				}
				this.display(this.last+1);
				break;
			case 13:
				if(!this.proceed) {
					var feature=this.features[this.last-1];
					feature.displayFeature(feature.startIndex, 1000, function() {
						shoesYouNeed.createPageviewTag();
					});
					clearInterval(this.auto);
					return;
				}
				this.display(-1);
				clearInterval(this.auto);
				break;
			default:
				this.features[this.last-1].displayFeature(this.step-1, 1000, function() {
					shoesYouNeed.createPageviewTag();
				});
				break;
		}
		this.step++;
	}
};
var newStandards={
	last:0,step:1,proceed:true,intervalLength:8000,
	enable:function(){
		this.build();
		this.bind();
		this.auto=setInterval(function(){newStandards.steps()},newStandards.intervalLength);
		this.intervalLength=6000;
	},
	build:function(){
		$('#new_standards > div:gt(0)')
		.css({opacity:0,display:'block'})
		.find('.floating_col').each(function(i){
			$(this).append(
				'<div class="nav">' +
				'<a href="javascript:void(0)" class="back">BACK<\/a>&#124;<span>'+(i+1)+' OF '+$('#new_standards > div:gt(0)').length+'<\/span>&#124;<a href="javascript:void(0)" class="next">NEXT<\/a><br />' +
				'<a href="javascript:void(0)" class="return">RETURN TO MAIN</a>' +
				'<\/div>'
			);
		});
		this.blurbs=[
			new point({id:'#dark_jeans',coords:[[298,298],[90,382,'tr'],[270,474,'bl']]}),
			new point({id:'#all_purpose_jacket',coords:[[118,191,'tr'],[280,432]]}),
			new point({id:'#modern_suit',coords:[[140,139],[320,307],[281,470,'bl']]}),
			new point({id:'#trim_dress_shirt',coords:[[174,215],[94,427],[299,456]]}),
			new point({id:'#narrow_tie',coords:[[32,210,'tr'],[260,369],[28,497,'tr']]}),
			new point({id:'#flat_front_pants',coords:[[231,316],[242,477,'bl']]}),
			new point({id:'#casual_button_up',coords:[[116,211],[333,404],[133,434]]})
		];
	},
	bind:function(){
		$('#splash a').bind('click',function(){
			newStandards.display($('#splash a').index(this)+1);
			clearInterval(newStandards.auto);
			var step=[1,5,8,12,16,20,23,1];
			newStandards.proceed=false;
			newStandards.step=step[$('#splash a').index(this)]+1;
			newStandards.auto=setInterval(function(){newStandards.steps()},newStandards.intervalLength);
		});
		$('#new_standards')
		.find('.back').bind('click',function(){
			newStandards.display(newStandards.last-1);
		}).end()
		.find('.next').bind('click',function(){
			newStandards.display(newStandards.last+1);
		}).end()
		.find('.return').bind('click',function(){
			newStandards.display(-1);
		}).end()
		.find('.nav a').bind('click',function(){
			newStandards.blurbs[0].hideBlurb();
			clearInterval(newStandards.auto);
		});
		$('#new_standards img[usemap]').each(function(){
			$($(this).attr('usemap')+' area').bind('mouseover',function(){
				clearTimeout(newStandards.pv);
				clearTimeout(newStandards.auto);
				newStandards.pvTarget=$(this);
				newStandards.pv=setTimeout(function(){
					cmCreatePageviewTag($('#new_standards img[usemap=#'+newStandards.pvTarget.parent().attr('name')+']').attr('alt')+' > '+newStandards.pvTarget.attr('alt'),null,'0~2376777~2374609~6025501~6027088');
				},1500);
			}).bind('mouseout',function(){
				clearTimeout(newStandards.auto);
				clearTimeout(newStandards.pv);
			});
		});
	},
	display:function(i){
		switch(i){
			case -1:
				i=0;
				break;
			case 0:
				i=$('#new_standards > div:gt(0)').length;
				break;
			case $('#new_standards > div:gt(0)').length+1:
				i=1;
				break;
		}
		$('#new_standards > div').eq(this.last)
		.css({zIndex:1})
		.animate({opacity:0},1000)
		.end().eq(i)
		.css({zIndex:5})
		.animate({opacity:1},1000);
		cmCreatePageviewTag($('#new_standards > div').eq(i).find('img').attr('alt'),null,'0~2376777~2374609~6025501~6027088');
		this.last=i;
	},
	steps:function(){
		var blurb=['','',0,1,2,'',0,1,'',0,1,2,'',0,1,2,'',0,1,2,'',0,1,'',0,1,2];
		switch(this.step){
			case 1: case 5: case 8: case 12: case 16: case 20: case 23:
				this.blurbs[0].hideBlurb();
				if(!this.proceed){
					clearInterval(this.auto);
					return;
				}
				this.display(newStandards.last+1);
				break;
			case 27:
				this.blurbs[0].hideBlurb();
				if(!this.proceed){
					clearInterval(this.auto);
					return;
				}
				this.display(-1);
				clearInterval(this.auto);
				break;
			default:
				this.blurbs[this.last-1].displayBlurb(blurb[this.step]);
				break;
		}
		this.step+=1;
	}
};
var holidayDressCode={
	step:1,last:3,
	enable:function(){
		$('#black_tie, #cocktail_party, #office_event').css({opacity:0});
		$('#splash > div')
		.bind('mouseover mouseout',function(){
			$(this).toggleClass('hover');
		})
		.bind('select',function(){
			holidayDressCode.occasion($('#splash > div').index(this));
		})
		.bind('click',function(){
			$(this).trigger('select');
			clearTimeout(holidayDressCode.auto);
		}).children('span.bg').css({opacity:0.7});
		$('#holiday_dress_code .nav > a')
		.bind('click',function(){
			holidayDressCode.occasion($('#holiday_dress_code .nav > a').index(this));
			clearTimeout(holidayDressCode.auto);
		});
		$('#holiday_dress_code img[usemap]').each(function(){
			$($(this).attr('usemap')+' area').bind('mouseover',function(){
				clearTimeout(holidayDressCode.pv);
				holidayDressCode.pvTarget=$(this);
				holidayDressCode.pv=setTimeout(function(){
					cmCreatePageviewTag($('#holiday_dress_code img[usemap=#'+holidayDressCode.pvTarget.parent().attr('name')+']').attr('alt')+' > '+holidayDressCode.pvTarget.attr('alt'),null,'0~2376777~2374609~6025501~6026435');
				},1500);
			}).bind('mouseout',function(){
				clearTimeout(holidayDressCode.auto);
				clearTimeout(holidayDressCode.pv);
			});
		});
		this.blackTieBlurbs=new blurb({id:'#black_tie',coords:[110,290]});
		this.cocktailBlurbs=new blurb({id:'#cocktail_party',coords:[130,330]});
		this.officeEventBlurbs=new blurb({id:'#office_event',coords:[155,330]});
		this.auto=setTimeout(function(){holidayDressCode.steps()},6000);
	},
	occasion:function(i){
		if(i!=this.last&&!$('#holiday_dress_code > div').is(':animated')){
			clearTimeout(this.pv);
			$('#holiday_dress_code .floating_col.nav > a').children('span').remove().end().eq(i).append('<span>&gt;</span>');
			$('#holiday_dress_code > div').not('.nav').eq(this.last).animate({opacity:0},1000,function(){$(this).hide()});
			$('#holiday_dress_code > div').not('.nav').eq(i).show().animate({opacity:1},1000);
			$('#holiday_dress_code .floating_col.nav').animate({opacity:0},1000,function(){$(this).remove()}).clone(true).appendTo($('#holiday_dress_code > div').not('.nav').eq(i)).animate({opcaity:1},1000);
			this.last=i;
		}
	},
	steps:function(){
		switch(this.step){
			case 1: case 4: case 7:
				this.blackTieBlurbs.hideBubble();
				$('#splash > div').eq(Math.floor(this.step/3)).trigger('select');
				cmCreatePageviewTag('Holiday Dress Code > '+$('#holiday_dress_code > div').eq(Math.floor(this.step/3)).attr('id'),null,'0~2376777~2374609~6025501~6026435');
				break;
			case 2: case 3:
				this.blackTieBlurbs.displayBlurb(Math.floor(this.step/3));
				this.blackTieBlurbs.posCarat((this.step==2)?100:305);
				cmCreatePageviewTag('Holiday Dress Code > Black Tie > '+$('#black_tie .blurbs p strong').eq(Math.floor(this.step/3)).text(),null,'0~2376777~2374609~6025501~6026435');
				break;
			case 5: case 6:
				this.cocktailBlurbs.displayBlurb(Math.floor(this.step/6));
				this.cocktailBlurbs.posCarat((this.step==5)?125:320);
				cmCreatePageviewTag('Holiday Dress Code > Cocktail Party > '+$('#cocktail_party .blurbs p strong').eq(Math.floor(this.step/6)).text(),null,'0~2376777~2374609~6025501~6026435');
				break;
			case 8: case 9:
				this.officeEventBlurbs.displayBlurb(Math.floor(this.step/9));
				this.officeEventBlurbs.posCarat((this.step==8)?130:310);
				cmCreatePageviewTag('Holiday Dress Code > Office Event > '+$('#office_event .blurbs p strong').eq(Math.floor(this.step/9)).text(),null,'0~2376777~2374609~6025501~6026435');
				break;
		}
		this.step+=1;
		if(this.step==10){
			this.auto=setTimeout(function(){
				holidayDressCode.blackTieBlurbs.hideBubble();
				$('#splash > div').eq(0).trigger('select');
				clearTimeout(holidayDressCode.auto);
			},7000);
		}else{
			this.auto=setTimeout(function(){holidayDressCode.steps()},7000);	
		}
	}
};
var mixMaster={
	prevS:-1,prevT:-1,
	S:-1,T:-1,
	enable:function(){
		$('#shirts img').bind('click',function(){
			mixMaster.shirt($('#shirts img').index(this));
		});
		$('#ties img').bind('click',function(){
			mixMaster.tie($('#ties img').index(this));
		});
		$('#combos > *, #blurbs > *').css({opacity:0,visibility:'visible'});
		this.shirt(2);
		this.tie(2);
	},
	shirt:function(i){
		if(this.prevS!=i){
			this.S=i;
			$('#shirts img').removeClass('selected').eq(i).addClass('selected');
			this.display();
			this.prevS=i;
		}
	},
	tie:function(i){
		if(this.prevT!=i){
			this.T=i;
			$('#ties img').removeClass('selected').eq(i).addClass('selected');
			this.display();
			this.prevT=i;
		}
	},
	display:function(){
		if(this.S>-1&&this.T>-1){
			$('#combos > *.selected, #blurbs > *.selected').removeClass('selected').animate({opacity:0},1000);
			$('#combos > *').eq((this.S*$('#shirts img').length)+this.T).addClass('selected').animate({opacity:1},1000);
			$('#blurbs > *').eq((this.S*$('#shirts img').length)+this.T).addClass('selected').animate({opacity:1},1000);
			cmCreatePageviewTag('Mix Master > Combo '+(((mixMaster.S*$('#shirts img').length)+mixMaster.T)+1),null,'0~2376777~2374609~6025501~6026267');
		}
	}
};
var onesuit4Ways={
	step:0,
	enable:function(){
		this.blurbs=new point({id:'#one_suit_four_ways',coords:[[90,260],[225,260],[330,260],[395,260]]});
		$('#one_suit_four_ways img[usemap]').each(function(){
			$($(this).attr('usemap')+' area').bind('mouseover',function(){
				clearTimeout(onesuit4Ways.pv);
				clearInterval(onesuit4Ways.autoplay);
				onesuit4Ways.pvTarget=$(this);
				onesuit4Ways.pv=setTimeout(function(){
					cmCreatePageviewTag($('#one_suit_four_ways img[usemap=#'+onesuit4Ways.pvTarget.parent().attr('name')+']').attr('alt')+' > '+onesuit4Ways.pvTarget.attr('alt'),null,'0~2376777~2374609~6025501~6026268');
				},1500);
			}).bind('mouseout',function(){
				clearTimeout(onesuit4Ways.pv);
				clearInterval(onesuit4Ways.autoplay);
			});
		});
		this.autoplay=setInterval(function(){onesuit4Ways.auto()},6000);
	},
	auto:function(){
		this.blurbs.displayBlurb(this.step);
		cmCreatePageviewTag('1 Suit 4 Ways > '+$('#one_suit_four_ways .blurbs p strong').eq(this.step).text(),null,'0~2376777~2374609~6025501~6026268');
		if(this.step==4){
			this.blurbs.hidePoint();
			clearInterval(this.autoplay);
		}
		this.step+=1;
	}
};
var interface={
	catIDs:[
		6027231,	// The 4 Shoes You Need
		6027088,	// The New Standards
		6026435,	// Quiz: What's Your Style
		6026267,	// Shirt & Tie Mixer
		6026268		// 1 Suit 4 Ways
	],
	ready:function(){
		this.locate();
		this.build();
		this.bind();
		this.enable();
		this.auto();
	},
	locate:function(){
		var url=document.location.toString();
		for(var i in this.catIDs){
			if(url.search(this.catIDs[i])!=-1){
				this.page=Number(i);	
			}
		}
		if(isNaN(this.page)){
			this.page=0;
		}
	},
	build:function(){
		$('#cover').append(
			'<div class="archive bg open"></div>' +
			'<div class="archive open">' +
			'<img src="'+getImageURL()+'store/boutique/mens_style_guide/2009/1214/more_stories.png" class="png" />' +
			'<p>SEE MORE STORIES:</p>' +
				'<div><a href="'+getStoreURL()+'c/6027231/0~2376777~2374609~6025501~6027231"><img src="'+getImageURL()+'store/boutique/mens_style_guide/2010/0216/shoes_you_need.jpg" alt="The 4 Shoes You Need" /></a>The 4 Shoes You Need</div>' +
				'<div><a href="'+getStoreURL()+'c/6027088/0~2376777~2374609~6025501~6027088"><img src="'+getImageURL()+'store/boutique/mens_style_guide/2010/0118/the_new_standards.jpg" alt="The New Standards" /></a>The New Standards</div>' +
				'<div><a href="'+getStoreURL()+'c/6026435/0~2376777~2374609~6025501~6026435"><img src="'+getImageURL()+'store/boutique/mens_style_guide/2010/0104/quiz_your_style.jpg" alt="Quiz: What\'s Your Style?" /></a>Quiz: What\'s<br />Your Style?</div>' +
				'<div><a href="'+getStoreURL()+'c/6026267/0~2376777~2374609~6025501~6026267"><img src="'+getImageURL()+'store/boutique/mens_style_guide/2010/0308/shirt_tie_mixer.jpg" alt="Shirt &#038; Tie Mixer" /></a>Shirt &#038; Tie<br />Mixer</div>' +
				'<div><a href="'+getStoreURL()+'c/6026268/0~2376777~2374609~6025501~6026268"><img src="'+getImageURL()+'store/boutique/mens_style_guide/2009/1109/1_suit_4_ways.jpg" alt="1 Suit 4 Ways" /></a>1 Suit 4 Ways</div>' +
				'<div><img src="'+getImageURL()+'store/common/transpixel.gif" alt="" /></div>' +
			'</div>'
		);
		//$('.archive.bg').css({opacity:0.4});
		$('.archive > div').eq(this.page).addClass('selected').append('<span></span>').children('span').css({opacity:0.5});
	},
	bind:function(){
		$('.archive').bind('mouseout',function(event){
			interface.hide(event);
			clearTimeout(interface.auto);
		}).bind('mouseover',function(event){
			interface.show(event);
			clearTimeout(interface.auto);
		});
		$('.archive a').bind('click',function(){
			if($('.archive').is(':animated')){
				return false;	
			}
		});
	},
	enable:function(){
		switch(this.page){
			case 0:
				shoesYouNeed.enable();
				break;
			case 1:
				newStandards.enable();
				//holidayDressCode.enable();
				break;
			case 2:
				break;
			case 3:
				mixMaster.enable();
				break;
			case 4:
				onesuit4Ways.enable();
				break;
		}
	},
	auto:function(){
		this.auto=setTimeout(function(){
			interface.hide();
		},6000);
	},
	hide:function(event){
		if(!event||(!$(event.relatedTarget).isChildOf('.archive')&&$(event.relatedTarget)[0]!=$('.archive').not('.bg')[0]&&($('.archive').hasClass('opening')||$('.archive').hasClass('open')))){
			var ms=((619-parseFloat($('.archive.bg').css('left')))/619)*1000;
			$('.archive').stop(true)
			.removeClass('opening')
			.removeClass('open')
			.addClass('closing')
			.not('.bg').animate({left:'600px'},ms);
			$('.archive.bg').animate({left:'619px'},ms,function(){
				$('.archive').removeClass('closing').addClass('closed');
			});
		}
	},
	show:function(event){
		if(($(event.currentTarget)[0]==$('.archive .png')[0]||$(event.currentTarget)[0]==$('.archive').not('.bg')[0])&&($('.archive').hasClass('closing')||$('.archive').hasClass('closed'))){
			var ms=(parseFloat($('.archive.bg').css('left'))/619)*1000;
			$('.archive').stop(true)
			.removeClass('closing')
			.removeClass('closed')
			.addClass('opening')
			.not('.bg').animate({left:'-19px'},ms);
			$('.archive.bg').animate({left:'0px'},ms,function(){
				$('.archive').removeClass('opening').addClass('open');
			});
		}
	}
};

$(function(){
	interface.ready();
});

$.fn.extend({
	isChildOf:function(filter_string){
		var parents=$(this).parents().get();
		for (j=0;j<parents.length;j++){
			if($(parents[j]).is(filter_string)){
				return true;
			}
		}
		return false;
	}
});