$(document).ready(function(){ 
	
	// js enabled
	$('body').addClass('js');
	
	// Cufon font replacement	
	Cufon.replace('h1, #content .product_header h2, #content .comment_wrap h3', { 
		fontFamily: 'DIN Bold',
		letterSpacing: '-0.7px'
	});
	
	
	/* site search button rollover */
	if( $('#header .site_search .inputBtn').length > 0 ){
		
		var inputBtn = $('#header .site_search .inputBtn');
		var inputBtnSrc = inputBtn.attr('src');		
		var inputBtnSplit = inputBtnSrc.split(".");
		var inputBtnSrcOver = inputBtnSplit[0]+"-over."+inputBtnSplit[1];
		
		$(inputBtn).hover(
			function(){			
				$(this).attr('src', inputBtnSrcOver);
			},
			function(){
				$(this).attr('src', inputBtnSrc);
			}
		);
		
	}
	
	/* ordered list number styles */
	$('#content .content ol li')
		.wrapInner('<span></span>')
		.css({color:"#dd067d", fontWeight:"bold"})
		.children('span').css({color:"#000000", fontWeight:"normal"});
	
	
	
	/* lightbox */	
	function lightBox(el, id, skin){
		$(el).colorbox({
			inline:true,
			opacity: 0.84,
			scrolling: false,
			innerWidth: "810px",
			href:id,
			onLoad: function(){
				
				// insert sloping 'cap'
				if(!pass){
					if(skin == 'product'){
						$('#cboxContent').prepend('<div class="product_cap"><!----></div>');
					} else {
						$('#cboxContent').prepend('<div class="cap"><!----></div>');
					}
				}
				
			},
			onComplete:function(){
				
				
				
				
				// png fix for ie6	
				
				if ($.browser.msie && $.browser.version.substr(0,1)<7) {
					
					if(!pass){						
						DD_belatedPNG.fix('#cboxClose, #colorbox .cap, #colorbox .product_cap');
						DD_belatedPNG.fix('#colorbox .image img, #colorbox .text .right, #colorbox .text .btm, #colorbox h4, #colorbox h5, #colorbox h6');
					} else {
						// png fix breaking on subsequent viewings of lightbox						
						//DD_belatedPNG.fix('#colorbox .image img, #colorbox .text .right, #colorbox .text .btm, #colorbox h4, #colorbox h5, #colorbox h6');
					}
										
				}				
							
				// font replacement					
				Cufon.replace('.lb h4, .lb h5', { 
					fontFamily: 'DIN Bold',
					letterSpacing: '-0.7px'
				});
				
							
				pass = true;
				
				
			}
		});
	}	
	
	var pass = false;
	
	// default (video) lightbox
	$("a.lightbox").click(function(){
		lightBox($(this), $(this).attr('href'), null);
	});
	
	// product lightbox
	$("a.product_lightbox").click(function(){
		lightBox($(this), $(this).attr('href'), 'product');
	});
	
}); 
