var do_slide = true;
var accordionWrapDivClass = 'acc-panel';

$(document).ready(function() {
	
	$("#grid-expand-container").show();
	$(".detailed-features").hide();
	
	$("#showhide").toggle(
		function() {
			if(do_slide) {
				$(".detailed-features").fadeIn("normal",function(){$(".detailed-features").css("display","table-row-group");});
			}
			else {
				$(".detailed-features").css("display","table-row-group");
			}
			
			$(this).html('Hide full specification');
		},
		function() {
			if(do_slide) {
				$(".detailed-features").fadeOut();
			}
			else {
				$(".detailed-features").css("display","none");
			}
			$(this).html('Show full specification');
		}
	);
	
	//Hide the div wrapping "more info" content
	$('.more-info-content-text').hide();
	//Disabled any clicks on the wrapping a elements
	$(".dg_moreinfo").click(function() { return false; });
	
	$(".dg_moreinfo").hover(
		function() {
			// Work out which table to do the alt content for (for multiple instances)
			var $tablewrap = $(this).parents('.grid-container');
			var $moreinfo = $tablewrap.siblings('.more-info-wrapper');
			
			var offs = $(this).offset();
			var elwidth = $(this).width();
			var itemId = $(this).attr("href");
			var text = '<strong>' + $('#'+itemId+' span').html() + '</strong>';
			$(this).next().append($moreinfo);

			var leftOffset = offs.left + elwidth + 20;
			
			
			$moreinfo.css({ 'position':'absolute', 'left':leftOffset, 'top':offs.top }).fadeIn().addClass("mi_visible");
			$moreinfo.children("div").show();
			$moreinfo.children(".mi-content").html(text);
		},
		function() {
			// Work out which table to do the alt content for (for multiple instances)
			var $tablewrap = $(this).parents('.grid-container');
			var $moreinfo = $tablewrap.siblings('.more-info-wrapper');
			
			$moreinfo.hide().removeClass("mi_visible");
			$tablewrap.after($moreinfo);
			$moreinfo.children("div").hide();
			$moreinfo.children(".mi-content").html("");
			//var text = $("#mi-content").html();
			//$(this).next().html(text).hide();
		}
		);
	
});
