/*
Quortus javascript

Designed and built by Jonathan Brain
http://jonathanbrain.com
*/

$(document).ready( function() {
	//ie tidy-up
	if ( $.browser.msie && ( $.browser.version == "6.0" || $.browser.version == "7.0" ) ) {
		equalise_dl();
	}
	oldContent = "";
	$("a#registration").fancybox({
		'titlePosition'		: 'inside',
		'titleShow'			: false,
		'easingIn'			: 'swing',
		'easingOut'			: 'swing',
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'enableEscapeButton': true,
		'autoDimensions'	: true
	});
	$("input#regsubmit").click(function() {
		
		txtName = $("input#regname").val();
		txtTitle = $("input#regtitle").val();
		txtEmail = $("input#regemail").val();
		hidProduct = $("input#regproduct").val();
		btnSubmit = $("input#regsubmit").val();
		
		oldContent = $("div#quick-registration").html();
		$("div#quick-registration").html("<img src=\"images/loading.gif\" alt=\"Loading...\" title=\"Loading...\" />");
		$.post(
			"register.php", 
			{
				regname: 	txtName, 
				regtitle: 	txtTitle, 
				regemail: 	txtEmail, 
				regproduct: hidProduct, 
				regsubmit: 	btnSubmit
			}, 
			function(data){
				$("div#quick-registration").html(data);
				$.fancybox.resize();
			});
		return false;
	});
	
});

function equalise_dl() {
	//re-work dt/dd pairs to be same height

	$('#key-facts dt').each( function() {
		var dt_height = $(this).height();
		var dd_height = $(this).next().height();
		
		if ( dt_height > dd_height ) {
			$(this).next().css({ height: dt_height });
		}
		else if ( dd_height > dt_height ) {
			$(this).css({ height: dd_height });
		}
	});
}

