$(document).ready(function() {
	
	var $els = $('#content-inner, #sidebar-right-inner').equalizeCols();
	
	
	$('#user-tools .login > a:first').toggle(function () {
		$('#loginbox').fadeIn(200);
		$(this).parent().addClass('selected');
		ieHideSelect('#select_country select');
	},function () {
		$('#loginbox').fadeOut(300);
		$(this).parent().removeClass('selected');
		ieShowSelect('#select_country select');
	});
	
	// initial Search string 
	var searchString = 'Search Site';
	$('#search .input-text').val(searchString);
	$('#search .input-text').focus(function () {
		if ($(this).val() == searchString){
			$(this).val('');	
		}
	});
	$('#search .input-text').blur(function () {
		if ($(this).val() == ''){
			$(this).val(searchString);	
		}
	});
	
	$('.faq dt').toggle(function () {
		$(this).next('dd').slideDown(200);
		$(this).addClass('open');
	},function () {
		$(this).next('dd').slideUp(200);
		$(this).removeClass('open');
	});
	
	//$('.enhancedttable tr:odd').css('background-color','#F0F9E4');
	
    if ($("a.lightbox").length > 0) {
	   $('a.lightbox').lightBox();
    }
});

function ieHideSelect(obj){
	if ($.browser.msie && $.browser.version < 7) {
		$(obj).hide();
	}
}
function ieShowSelect(obj){
	if ($.browser.msie && $.browser.version < 7) {
		$(obj).show();
	}
}
/**
 *
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */
 
(function($) {
	/**
	 * equalizes the heights of all elements in a jQuery collection
	 * thanks to John Resig for optimizing this!
	 * usage: $("#col1, #col2, #col3").equalizeCols();
	 */
	 
	$.fn.equalizeCols = function() {
		//if ($.browser.msie && $.browser.version < 7) {
		//	var heightMin = 'height';
		//} else {
			var heightMin = 'min-height';
		//}
		var heightFull = 'height';
		
		var height = 0,
			reset = $.browser.msie ? "1%" : "auto";
  
		return this
			.css(heightFull, reset)
			.each(function() {
				height = Math.max(height, this.offsetHeight);
			})
			.css(heightMin, height)
			.each(function() {
				var h = this.offsetHeight;
				if (h > height) {
					$(this).css(heightMin, height - (h - height));
				};
			});
			
	};
	
})(jQuery);