$(document).ready(function() {
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);
	if (jQuery.browser.msie && ie6) {
		$('#nav li a').mouseenter(function() {
			$(this).css('background-image', 'url(http://hulabean.com/wp-content/themes/hula/images/nav_a_hover_bg.png)');
		}).mouseleave(function() {
			if( !($(this).parent().hasClass('current_page_item')) )
				$(this).css('background-image', 'url(http://hulabean.com/wp-content/themes/hula/images/nav_a_bg.png)');
		});
		
		$('.wpsc_categories li a').mouseenter(function() {
			$(this).css('background-image', 'url(http://hulabean.com/wp-content/uploads/wpsc/themes/hulabean/images/cat_active_bg.png)');
		}).mouseleave(function() {
			$(this).css('background-image', 'url(http://hulabean.com/wp-content/uploads/wpsc/themes/hulabean/images/cat_bg.png)');		
		});
		
		$('#sidebar').resize(function() {
			var elem = $(this);
			if ( elem.hasClass('default') )
				var newtop = elem.height() -64;
			else {
				var newtop = elem.height() -68;
				elem.addClass('default');
			}
			newtop += 'px';
			$('.sidebarBottom').css('top', newtop);
		});
		$('#sidebar').resize();
	}
	
	Cufon.replace('#nav li a, .wpsc_categories li a, .shopTitle, #sidebar h3, .bestItem, .post h2, .post h3, .pageTitle, .footerInfo');	
	
	$('.wpsc_categories li:odd').css('margin-right', '0');

	$('.buyLnk').click(function() {
		var current_option = $(this).parent().attr('class');
		var current_select = $(this).parent().children('input.varID').val();
		$('#'+current_select+' option[value="'+current_option+'"]').attr('selected', 'selected');
	});
	
	var content_height = $('#content').height();
	var sidebar_height = $('#sidebar').height();
	content_height = content_height + 65;
	sidebar_height = sidebar_height + 86;
	if( content_height > sidebar_height ) {
		sidebar_height = content_height - 82;
		sidebar_height += 'px';
		$('#sidebar').css('min-height', sidebar_height);
	}
	/*
	else {
		content_height = sidebar_height - 164;
		content_height += 'px';
		$('#content').css('height', sidebar_height);
	}
	*/
	
});