$(document).ready(function() {
	adjustLayout();
	insertFlash();
	animateFeatures();
});

function adjustLayout()
{
	var cwH = $('#ContentWrapper').height();
	var sbH = $('#SideBar').height();
	
	var cwD = cwH - $('#TextWrapper').height();
	
	var twH = sbH - cwD + 8;
	
	$('#TextWrapper').height(twH);
	
	/*
	var sbTop = $('#SideBar').offset().top;
	var ftTop = $('#Foot').offset().top;
	var sbHeight = ftTop - sbTop;
	var sbDiff = $('#SideBar').height() - $('#frmContact fieldset').height();
	var fcHeight = sbHeight - sbDiff - 20;
	$('#frmContact fieldset').height(fcHeight);	
	*/
}

function insertFlash()
{
	$('#DvdLinkWrapper').flash({
		src: '/assets/flash/dvd.swf',
		width: 200,
		height: 180
	});
	
	$('#VideoLinkWrapper').flash({
		src: '/assets/flash/trial.swf',
		width: 200,
		height: 180
	});
	
	$('#VideoLinkWrapper a').remove();
	$('#DvdLinkWrapper a').remove();
}

function animateFeatures()
{
	$('#Feature').crossSlide({
	  sleep: 3,
	  fade: 1
	}, [
	  { src: '/assets/images/home/feature1.jpg' },
	  { src: '/assets/images/home/feature2.jpg' },
	  { src: '/assets/images/home/feature3.jpg' },
	  { src: '/assets/images/home/feature4.jpg' },
	  { src: '/assets/images/home/feature5.jpg' }
	]);
}