$(document).ready(function(){

	// Set Shadow Height for Initial Active Account
	$(window).load(function() {
		var acctContHeight = $('.accountBox.active div.accountContainer').innerHeight();
		var acctContWidth = $('.accountBox.active div.accountContainer').innerWidth();

		$('.shadow .tall').css({'height': acctContHeight - 0});
		$('.shadow .wide').css({'width': acctContWidth - 0});
		
		// set height of containing box
		$('#accountBoxContainer').css({'height': acctContHeight - 1})

	});

	// Account Box Toggle
	var sel = $('.accountBox.active')[0];

	$('#accountBoxContainer').jFlow({
		slides: '#overview',
		slideWrapper: '#overviewWrapper',
		height: '250px',
		width: '680px',
		duration:350
	});

	$('.accountBox').bind('mouseenter', function() {
		if (sel==this) return;
		$(sel).removeClass('active');
		$(this).addClass('active').click();
		sel=this;

		var acctContHeight = $('.accountBox.active div.accountContainer').innerHeight();
		var acctContWidth = $('.accountBox.active div.accountContainer').innerWidth();

		$('.shadow .tall').css({'height': acctContHeight - 1});
		$('.shadow .wide').css({'width': acctContWidth - 0});
	});

	/*---------------------------- Shadow Pop ----------------------------*/
	$.each( $("div.pop .accountBox"), function(i, n){
		if ($.browser.msie && $.browser.version == 6.0) {
			return false;
		}
		else if (!$(n).children("div.shadow").html()) {
			$(n).append('<div class="shadow"><table><tbody><tr class="top"><td><img class="tl png" src="homepage/images/shadow_tl.png" alt="" /></td><td><img class="tc png wide" src="homepage/images/shadow_tc.png" alt="" /></td><td><img class="tr png" src="homepage/images/shadow_tr.png" alt="" /></td></tr><tr class="middle"><td><img class="ml png tall" src="homepage/images/shadow_ml.png" alt=""/></td><td style="background-color: rgb(255, 255, 255);"/><td><img class="mr png tall" src="homepage/images/shadow_mr.png" alt=""/></td></tr><tr class="bottom"><td><img class="bl png" src="homepage/images/shadow_bl.png" alt="" /></td><td><img class="bc png wide" src="homepage/images/shadow_bc.png" alt="" /></td><td><img class="br png" src="homepage/images/shadow_br.png" alt="" /></td></tr></tbody></table></div>');
		}
	});

	
	/*---------------------------- Features ----------------------------*/
	$('a.toggler').click(function()
	{
		$(this).parent().prev('p').slideToggle(600);
		$(this).parent().hide();
		$(this).parent().next('p').show();
		this.blur();
		return false;
		}
	);

    $('a.toggler2').click(function() {
		$(this).parent().prev('p').prev('p').slideUp(600);
		$(this).parent().hide();
		$(this).parent().prev('p').show();
		this.blur();
		return false;
		}
	);

	$('a.full_toggle').click(function() {
		$(this).next('a').next('div').slideToggle(300);
		$(this).hide();
		$(this).next('a').show();
		this.blur();
		return false;
		}
	);

	$('a.full_toggle2').click(function() {
		$(this).next('div').slideUp(300);
		$(this).hide();
		$(this).prev().show();
		this.blur();
		return false;
		}
	);
	

});
