$(document).ready(function(){
	
  //hide the dropdown on the search page (suck it js stack)
  $("#sortOptions").hide();
	
  // Main nav tabs
	$('#nav li:first-child').addClass("first");
	$('#nav li:last-child').addClass("last");
	
		// If there isn't a tab with class="current"
		if ($('#nav li').hasClass("current")) {
			$('#nav ul').removeClass("noCurrent");
		}
				
	
	// IE6 hover states for nav 	
	$('#nav li').hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
	
	
	// Form field value swap
	swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });
	
	
	// Firefox needs help with pretty forms
	if ($.browser.mozilla) {
		$(".form_h label").css({ display:"-moz-inline-box" });
		$(".form_h label").wrapInner("<span style='display: block; width: 13.385em;'></span>");
	}
	
	
	// Equal height columns in home page sidebar
	var left_height = $('.equalHeightL').height(); 
	var right_height = $('.equalHeightR').height(); 
	if(right_height > left_height) { 
    $('.equalHeightL').height(right_height); 
  } 
  else { 
    $('.equalHeightR').height(left_height); 
  }
	
	
	// Make itemList as tall as saved searches nav or snipes filters - adds in empty li for borders
	var listNav_height = $("#searchNav").height() || $(".snipesFilters").height(); 
	var itemList_height = $(".itemList").height();
	if(listNav_height > itemList_height) {
		$(".itemList").append("<li class='filler'><dl><dt>&nbsp;</dt><dd>&nbsp;</dd></dl></li>");
		$(".filler").css("min-height",listNav_height);		
			if (jQuery.browser.msie && jQuery.browser.version < 7) {
				$(".filler").css("height",listNav_height);	
			}
	}
	
	
	// Hover function for edit and delete icons in saved searches
	$('#searchList li').hover(function() {
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
	
	
	// Zebra striping 
	$(".itemList li:odd:not(.outBidRow)").addClass("alt");
	
	
	// More/Less info toggle link and slides
	$("#homeSidebar .revealerPricing").click(function () {
      $("#homeSidebar .revealerPricing span").toggle();
    });
	$("#homeSidebar .revealerFeatures").click(function () {
      $("#homeSidebar .revealerFeatures span").toggle();
    });
	
	$(".revealerPricing").toggle(function(){
     $("#revealPricing").slideDown('slow');
   },function(){
     $("#revealPricing").slideUp('normal');
   });
	
	$(".revealerFeatures").toggle(function(){
     $("#revealFeatures").slideDown('slow');
   },function(){
     $("#revealFeatures").slideUp('normal');
   });
	
	
	// Article columns
	$('.article .column:first').addClass("first");
	
	
	// Logout message positioning
	$(".message .info:contains('Logout Successful.')").addClass("messageLogArea");
	$(".message:has(.messageLogArea)").css("margin","0");
	
});