
function normalizeColumnHeights() {

	var highestNum = 0;
	var highestPixels = 0; 

	$(".normalize").each(function(num) {
		var height = $(this).height();
		//if(num == 1 && $.browser.msie && parseInt($.browser.version) < 7) {
			//height -= 196; 	
		//}
		if(height > highestPixels) {
			highestPixels = height; 
			highestNum = num; 
		}
	}); 

	if($.browser.msie && parseInt($.browser.version) < 7) {
		highestPixels -= 196;
	}

	$(".normalize").each(function(num) {
		if(num == highestNum) return; // dont change height of highest item
		var padding = parseInt($(this).css("padding-top")) + parseInt($(this).css("padding-bottom")); 
		var margin = parseInt($(this).css("margin-top")) + parseInt($(this).css("margin-bottom")); 
		$(this).height(highestPixels - padding - margin); 
	}); 

	/*
	if($.browser.msie && parseInt($.browser.version) < 7) {
		alert(height + ', ' + num); 
		
	}
	*/

}

function setupSearchQuery() {

	var defaultValue = 'search';
	var focusedClass = 'focused';

	$("#search_query").focus(function() {
		if($(this).val() == defaultValue) $(this).val(''); 		
		$(this).addClass(focusedClass); 

	}).blur(function() {
		$(this).removeClass(focusedClass); 
		var val = $.trim($(this).val()); 
		if(!val.length) $(this).val(defaultValue);
	}); 

	if($("#search_query").val() != defaultValue) $("#search_query").addClass(focusedClass); 
}

$(document).ready(function() {

	normalizeColumnHeights();
	setupSearchQuery(); 

	$('img.has_original').parent('a[@href^=/process]').facebox();
	$('.lightbox').facebox();

	$("#modules li.new").append("<div class='toggle_new'></div>"); 


}); 
