/* Modernizr 2.0.6 (Custom Build) | MIT & BSD
 * Build: http://www.modernizr.com/download/#-touch-cssclasses-teststyles-prefixes   
	Note: This is only present to ensure a "touch/no-touch" class is added to page so we can detect touch devices and cater accordingly
 */
;window.Modernizr=function(a,b,c){function z(a,b){return!!~(""+a).indexOf(b)}function y(a,b){return typeof a===b}function x(a,b){return w(n.join(a+";")+(b||""))}function w(a){k.cssText=a}var d="2.0.6",e={},f=!0,g=b.documentElement,h=b.head||b.getElementsByTagName("head")[0],i="modernizr",j=b.createElement(i),k=j.style,l,m=Object.prototype.toString,n=" -webkit- -moz- -o- -ms- -khtml- ".split(" "),o={},p={},q={},r=[],s=function(a,c,d,e){var f,h,j,k=b.createElement("div");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:i+(d+1),k.appendChild(j);f=["&shy;","<style>",a,"</style>"].join(""),k.id=i,k.innerHTML+=f,g.appendChild(k),h=c(k,a),k.parentNode.removeChild(k);return!!h},t,u={}.hasOwnProperty,v;!y(u,c)&&!y(u.call,c)?v=function(a,b){return u.call(a,b)}:v=function(a,b){return b in a&&y(a.constructor.prototype[b],c)};var A=function(c,d){var f=c.join(""),g=d.length;s(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||j.touch.offsetTop===9},g,d)}([,["@media (",n.join("touch-enabled),("),i,")","{#touch{top:9px;position:absolute}}"].join("")],[,"touch"]);o.touch=function(){return e.touch};for(var B in o)v(o,B)&&(t=B.toLowerCase(),e[t]=o[B](),r.push((e[t]?"":"no-")+t));w(""),j=l=null,e._version=d,e._prefixes=n,e.testStyles=s,g.className=g.className.replace(/\bno-js\b/,"")+(f?" js "+r.join(" "):"");return e}(this,this.document);

/* Placeholder - http://mths.be/placeholder v1.8.5 by @mathias */
(function(g,a,$){var f='placeholder' in a.createElement('input'),b='placeholder' in a.createElement('textarea');if(f&&b){$.fn.placeholder=function(){return this};$.fn.placeholder.input=$.fn.placeholder.textarea=true}else{$.fn.placeholder=function(){return this.filter((f?'textarea':':input')+'[placeholder]').bind('focus.placeholder',c).bind('blur.placeholder',e).trigger('blur.placeholder').end()};$.fn.placeholder.input=f;$.fn.placeholder.textarea=b;$(function(){$('form').bind('submit.placeholder',function(){var h=$('.placeholder',this).each(c);setTimeout(function(){h.each(e)},10)})});$(g).bind('unload.placeholder',function(){$('.placeholder').val('')})}function d(i){var h={},j=/^jQuery\d+$/;$.each(i.attributes,function(l,k){if(k.specified&&!j.test(k.name)){h[k.name]=k.value}});return h}function c(){var h=$(this);if(h.val()===h.attr('placeholder')&&h.hasClass('placeholder')){if(h.data('placeholder-password')){h.hide().next().show().focus().attr('id',h.removeAttr('id').data('placeholder-id'))}else{h.val('').removeClass('placeholder')}}}function e(){var l,k=$(this),h=k,j=this.id;if(k.val()===''){if(k.is(':password')){if(!k.data('placeholder-textinput')){try{l=k.clone().attr({type:'text'})}catch(i){l=$('<input>').attr($.extend(d(this),{type:'text'}))}l.removeAttr('name').data('placeholder-password',true).data('placeholder-id',j).bind('focus.placeholder',c);k.data('placeholder-textinput',l).data('placeholder-id',j).before(l)}k=k.removeAttr('id').hide().prev().attr('id',j).show()}k.addClass('placeholder').val(k.attr('placeholder'))}else{k.removeClass('placeholder')}}}(this,document,jQuery));

// ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function Y(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function Z(a){var b=y.length,c=(Q+a)%b;return c<0?b+c:c}function $(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function _(a){return K.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(a)}function ba(){var b;K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.slice(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function bb(b,c){a.event.trigger(b),c&&c.call(P)}function bc(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(W.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function bd(b){if(!U){P=b,ba(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=$(K.initialWidth,"x"),K.h=$(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),bb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}W.load(!0)}}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X="div";W=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{},W.init();if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}return c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bd(f[0]),f},W.init=function(){if(!r){if(!a("body")[0]){a(W.init);return}z=a(c),r=Y(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y(X,"Overlay",o?"position:absolute":"").hide(),s=Y(X,"Wrapper"),t=Y(X,"Content").append(A=Y(X,"LoadedContent","width:0; height:0; overflow:hidden"),C=Y(X,"LoadingOverlay").add(Y(X,"LoadingGraphic")),D=Y(X,"Title"),E=Y(X,"Current"),G=Y(X,"Next"),H=Y(X,"Previous"),F=Y(X,"Slideshow").bind(h,bc),I=Y(X,"Close")),s.append(Y(X).append(Y(X,"TopLeft"),u=Y(X,"TopCenter"),Y(X,"TopRight")),Y(X,!1,"clear:left").append(v=Y(X,"MiddleLeft"),t,w=Y(X,"MiddleRight")),Y(X,!1,"clear:left").append(Y(X,"BottomLeft"),x=Y(X,"BottomCenter"),Y(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Y(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),J=G.add(H).add(E).add(F),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})}},W.remove=function(){r.add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g)},W.position=function(a,b){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c=0,d=0,e=r.offset();z.unbind("resize."+f),r.css({top:-99999,left:-99999}),K.fixed&&!o?r.css({position:"fixed"}):(c=z.scrollTop(),d=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?d+=Math.max(z.width()-K.w-O-M-$(K.right,"x"),0):K.left!==!1?d+=$(K.left,"x"):d+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?c+=Math.max(z.height()-K.h-N-L-$(K.bottom,"y"),0):K.top!==!1?c+=$(K.top,"y"):c+=Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:e.top,left:e.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:c,left:d},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",b&&b(),setTimeout(function(){z.bind("resize."+f,W.position)},1)},step:function(){g(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=$(a.width,"x")-O-M),a.innerWidth&&(K.w=$(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=$(a.height,"y")-N-L),a.innerHeight&&(K.h=$(a.innerHeight,"y")),!a.innerHeight&&!a.height&&(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position(K.transition==="none"?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(!S)return;var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function q(){n&&r[0].style.removeAttribute("filter")}var b,c,g=y.length,h,i="frameBorder",k="allowTransparency",l,o,p;if(!S)return;l=function(){clearTimeout(V),C.hide(),bb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show();if(g>1){typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||Q<g-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show();if(K.preloading){b=[Z(-1),Z(1)];while(c=y[b.pop()])o=a.data(c,e).href||c.href,a.isFunction(o)&&(o=o.call(c)),_(o)&&(p=new Image,p.src=o)}}else J.hide();K.iframe?(h=Y("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),h.name=f+ +(new Date),K.fastIframe?l():a(h).one("load",l),h.src=K.href,K.scrolling||(h.scrolling="no"),a(h).addClass(f+"Iframe").appendTo(A).one(m,function(){h.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,q):q()},K.transition==="fade"?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||ba(),bb(m),bb(i,K.onLoad),K.h=K.height?$(K.height,"y")-N-L:K.innerHeight&&$(K.innerHeight,"y"),K.w=K.width?$(K.width,"x")-O-M:K.innerWidth&&$(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=$(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=$(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show()},100),K.inline?(Y(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):_(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y(X,"Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y(X,"Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Z(1),W.load())},W.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Z(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,bb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),bb(m),A.remove(),setTimeout(function(){U=!1,bb(l,K.onClosed)},1)}))},W.element=function(){return a(P)},W.settings=d,a("."+g,b).live("click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),bd(this))}),W.init()})(jQuery,document,this);

jQuery(function($){

	// Temporarily wrap 3 services in a row
	var divs = $("#services .column");
	for(var i = 0; i < divs.length; i+=3) {
		divs.slice(i, i+3).wrapAll("<div class='row'></div>");
	}

	// Invoke the placeholder plugin
	$('input, textarea').placeholder();
	
    $('#stay-updated #newsletter-subscription').hide();
    $('#stay-updated .newsletter').click(function() {
		$('#newsletter-subscription').toggle();
		return false;
	});
	
	// Pick and mix
	$('.p-m-tabs .button').click(function () {
		$('.p-m-tabs .button').removeClass('current');
		$(this).addClass('current');
	});
	
	$('#filter-button').click(function() {
		$('#FilterProducts').submit();
		return false;
	});
	
	// Services accordion
	$('#accordion h5, #skintones h4').click(function() {
		$(this).toggleClass('open');
		$(this).next().slideToggle();
		return false;
	}).next().hide(); 
		
	// Vertically align product images
	$.fn.vAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		var ph = $(this).parent().height();
		var mh = Math.ceil((ph-ah) / 2);
		$(this).css('margin-top', mh);
		});
	};
	
	// Initialise the rating variables
	var rating;
	var ProductId;
	
	// Submit product ratings
	$(document).delegate(".product-ratingList a", "click", function(e) {
		rating = $(this).html();
		ProductId = $(".the-product-id").attr("id");
	
    	$(".product-ratingList a").removeClass("selected");
    	$(this).addClass("selected");
    	
    	$("#submit-rating").removeClass("hidden");
    	
    	e.preventDefault();
	});
	
	$(document).delegate("#submit-rating", "click", function() {
    	xajax_setRate(rating,ProductId);
    	return false;
	});
	
	$(window).load(function() {
		$(".product-image img, .sub-image img, #main-product-image").vAlign();
	});
		
	// Product image thumbnail swap
	$(".sub-image").click(function(){
	
		$('#product-images .loading-image').fadeIn();
		
		var largePath = $(this).attr("href");
		var largeAlt = $(this).attr("title");
		var largeZoom = $(this).attr("rel");
		
		$('#main-product-image').attr({ src: largePath, alt: largeAlt }).load(function() {
			$(this).vAlign();
		});
		
		$('#product-images .zoom a').attr({ href: largeZoom });
		
		$('#product-images .loading-image').stop(true, true).fadeOut();
		
		return false;
		
	});
	
	$(".zoom a").colorbox({maxHeight:"90%", transition:"fade"});   
	
	//Individual product try on  
	$(".try-on a").colorbox({inline:true, transition:"fade", href:"#preview"}); 	
	$(".product_tryon").each(function(){
	   	var swatchproperties = $(this).attr("class");
		var swatchproperties_array = swatchproperties.split(" "); 
		if(swatchproperties_array[1]=="color" || swatchproperties_array[1]=="topcoat"){
			$(".try-on").addClass("visible");
		}
		if(swatchproperties_array[4]=="crackle"){
			$(this).addClass("gloss"); 
		} 
	});
	
	// Services tooltip
	$('.tip_trigger').each(function() {        
        var tip = $(this).find('.tip');

        $(this).hover(
            function() { tip.appendTo('body'); },
            function() { tip.appendTo(this); }
        ).mousemove(function(e) {
            var x = e.pageX + 20,
                y = e.pageY + 20,
                w = tip.width(),
                h = tip.height(),
                dx = $(window).width() - (x + w),
                dy = $(window).height() - (y + h);

            if ( dx < 20 ) x = e.pageX - w - 20;
            if ( dy < 20 ) y = e.pageY - h - 20;

            tip.css({ left: x, top: y });
        });         
    });   

	//Ensure relevent forms are submitted via enter key
		$("#sign_in_form").keyup(function(event){
		  if(event.keyCode == 13){ 
		    $("input[type='button'],.button",this).click();
		  }
		}); 
		$("#newsletter-subscription,.couture-subscription").keyup(function(event){
		  if(event.keyCode == 13){ 
		    $(".button",this).click();
		  }
		}); 
		$("#register_form").keyup(function(event){
		  if(event.keyCode == 13){ 
		    $("input[type='button']",this).click();
		  }
		});
		$("#promotional-code input#PromotionalCode").keyup(function(event){
		  if(event.keyCode == 13){ 
		    $(".button",this).click();
		  }
		});   	
		
	//IE6 message 
	if ( $.browser.msie ) {
		setTimeout( function() {
			$('#ie6_advisory_message').fadeOut("slow");
		}, 10000 );
	 } 
	
	//Magazine
		if ( $.browser.msie ) {
			$("#magazine-header li:last-child").addClass("omega");   
		} 
		$("#wrapper-celebrities .celebrity_article:nth-child(3n+3)").after("<div class='clear'></div>"); 
		
		var tweetheight = $(".tweet").parent().height(); 
		$(".tweet").css("height",tweetheight+"px");
		$(".tweet iframe").css({"position":"absolute","bottom":"16px","left":"0"})
		//Magazine > Latest news specific scripts    
		$("#wrapper-latestnews .bespoke-latestnews_article:nth-child(2n+2)")
			.after("<div class='clear'></div>")
			.addClass("alpha omega"); 
		
		  
	
}); 

//Couture
//Goes here (from temp_couture)  

// Try it on
jQuery(function($){ 
	//Set-up empty array for you're wearing
		var youre_wearing=new Array();  
		
	//Append neccesary markup to avoid having bloat in the DOM
		$("#yourewearing-topcoat,#yourewearing-polish").prepend("<p id='title'></p>").prepend("<img />") 
		$("#youre_wearing button").hide();
		
	//Add selected class if input is checked on page load
		$('input:radio:not(:checked)').parent().removeClass("selected");
        $('input:radio:checked').parent().addClass("selected"); 
 	
	//Hide topcoats initially and set variable to determine status
		$("#topcoat_container").hide();                           
		var topcoatvisible = 0;

	//Build an array of properties from the li class for each swatch
	//From this array, assign each li the relevent colour / image URL		 
		$("#colours li").click(function(){ 
			//Set up variables  
				var swatchvalue = $(this).attr("style");
				var swatchproperties = $(this).attr("class");
				var swatchproperties_array = swatchproperties.split(" ");  
				var title = $("label",this).text(); 
			//Check to see if preview pane has a basecoat on; if so, show topcoats panel 
				if(!topcoatvisible){                                                     
					topcoatvisible = 1;
					$("#topcoat_container").fadeIn("slow"); 
				}
			// Remove nude nails
				$('#nude_nails').hide();
			//Set selected class, and check the relevent radio button to ensure a value will be present when the form is submitted  
					$("input",this).attr("checked",true); 
				if($("html").hasClass("no-touch")){
					$("#colours li").removeClass("selected");
					$(this).addClass("selected"); 
				}  
			//Set-up preview
				 $("#preview").removeAttr("class").addClass(swatchproperties).removeAttr("style").attr("style",swatchvalue); 
			//Setup you're wearing panel
                 var productId = $("p",this).text();
                 xajax_addColour(productId);
		});
	
	//Set topcoats	 
		$("#topcoats li").click(function(){
			//Set up variables  
				var swatchvalue = $(this).attr("style");
				var swatchproperties = $(this).attr("class");
				var swatchproperties_array = swatchproperties.split(" ");
				var title = $("label",this).text();
				var image = $("img",this).attr("src");
			//Set selected class, and check the relevent radio button to ensure a value will be present when the form is submitted     
				$("input",this).attr("checked",true);  
				if($("html").hasClass("no-touch")){
					$("#topcoats li").removeClass("selected");
					$(this).addClass("selected");    
				}
			//Set-up preview      
				$("#nail_highlight,#top_coat").removeAttr("class").removeAttr("style");
				if(swatchproperties_array[2]=="gloss" || swatchproperties_array[2]=="matte"){
					$("#nail_highlight").addClass(swatchproperties_array[1]).addClass(swatchproperties_array[2]);
				}
				else{
					$("#top_coat").addClass(swatchproperties).attr("style",swatchvalue);   
				}   
			//Setup you're wearing panel    
		 		if($(this).hasClass("none")){
                    var productId = $("p",this).text();
					xajax_removeTopCoat(productId);
				}
				else{
				   	var productId = $("p",this).text();
                    xajax_addTopCoat(productId);
				}
		}); 
		
	//Set skintones
		$("#skintones li").click(function(){
			var skintone = $(this).attr("class");
			$("#skintone").removeAttr("class").addClass(skintone);  
			$("#skintones li").removeClass("selected");
			$(this).addClass("selected");
		});
		
	// Finish filter
		$('#finish-filter-select').change(function() {
		    var finish = $(this).val();
		    
		    if (finish === 'all') {
		    	$('#colours li').show();
			} else {
		    	$('#colours li').show();
		    	$('#colours li').not('.' + finish).hide();
		    }
		});
	//Show name of polish under swatch group	
		$(document).delegate("#colours li", "hover", function() {
			var colourName = $('label', this).html();
			$('#colour-name').html(colourName);
		}); 
		$('#topcoats li').hover(function() {
			if($(this).hasClass("none")){
				var colourName = "No top coat";
			}else{
				var colourName = $('label', this).html();
			}
			$('#topcoat-name').html(colourName); 
		}); 		
});
