// JavaScript Document
//	Cufon.replace('#access a',		{fontFamily: 'Optima-Regular'});
	Cufon.replace('#gt-specials',	{fontFamily: 'Optima-Regular'});
	Cufon.replace('.c2a-box h2',	{fontFamily: 'Optima-Regular'});

$(document).ready(function() {
	$("#commentForm").validate();
    $('#search-box').focus(function() {
        $('#search-box').val('');
    });
    $('#search-box').blur(function() {
        if(!$('#search-box').val().length){
            $('#search-box').val('Keyword or Item #')
        }
    });

	//Examples of how to assign the ColorBox event to elements
	$(".colorbox").colorbox();
	$(".colorbox-pdf").colorbox({
		iframe:			true,
		innerWidth:		800,
		innerHeight:	600
	});
	$(".colorbox-buildout").colorbox({
		maxWidth:	'80%',
		maxHeight:	'80%'
	});
	$(".colorbox-instock").colorbox({
		maxWidth:	'80%',
		maxHeight:	'80%'
	});

	// THIS FORCES THE BOTTOM ALIGN (FAKE) ON THE CATEGORY LISTING PAGES
	$("#products img").each(function() {
		$(this).load(function() {
			var h = parseInt($(this).height());
			if(h < 101){
				$(this).css('margin-top', 101-h+'px');
			}
		});
	});

	// FIGURE OUT THE MIN-HEIGHT SO THE SINGLE PIXEL BORDER GOES THE WHOLE HEIGHT
	var bodyh = parseInt($("#details-form").height());
	$('#cart-sidebar').css('min-height', bodyh+'px');

	// MAIN NAV HOVER OVER
	$('#access ul li img').hover(function() {
		var offimg = $(this).attr('src');
		$(this).attr('src', offimg.replace('-off', '-on'));
	});
	
	// MAIN NAV HOVER OUT
	$('#access ul li img').mouseleave(function() {
		var onimg = $(this).attr('src');
		$(this).attr('src', onimg.replace('-on', '-off'));
	});
});
