/* ======================================================= **
** expand.js
** ------------------------------------------------------- **
** Created:		11/04/2008 (dd/mm/yy)
** Author:		Jenna Smith
** Copyright:	GX Networks
** Website:		Donhost.co.uk
** ======================================================= */

function hideFeatures() {
	$('div.expandbar:first').css('overflow','hidden').
	animate({'height':'0', 'opacity':'0'},{duration:500, queue:false});
	$('div#moreFeatures').css('overflow','hidden').
	animate({'height':'0', 'opacity':'0'},{duration:500, queue:false,complete:function() {
		$('div.expandbar:last').removeClass('hidefeat');		
		$('div.expandbar a').text('Show extra features');
		$('div.expandbar a').attr('newtitle', 'Show extra features');
		
		$('#domains #intro p:last span').text('Show our full');
		$('div#moreFeatures').css('display', 'none')
		return false;	
	}});

}

$(function() {
	var expandBar = '<div class="expandbar"><a href="#" title="Show extra features">Show extra features</a></div>';
	
	$(expandBar).insertAfter('div#moreFeatures');
	$(expandBar).addClass('ghost').insertBefore('div#moreFeatures');

	var divHeight = $('div#moreFeatures').height();
	$('div.expandbar:first').hide().css('height','0');	
	$('div.expandbar:last').show();
	$('div#moreFeatures').hide().css('height','0').css('overflow','hidden');
	
	$('div.expandbar:last a').toggle(function() {
		$('div.expandbar:first').show().animate({'height':'18px', 'opacity':'0.99'},{duration:500, queue:false});
		$('div#moreFeatures').css('overflow','visible').
		animate({'height':divHeight, 'opacity':'0.99'},{duration:500, queue:false, complete:function() {
			$('div.expandbar:last').addClass('hidefeat');
			//copy change
			$('div.expandbar a').text('Hide extra features');
			$('div.expandbar a').attr('newtitle', 'Hide extra features');
			
			//link copy change
			$('#domains #intro p:last span').text('Hide our full');
			
			return false;				
		}});

	}, hideFeatures);
	
	$('div.expandbar:first a, #domains #intro p:last a').click(function() { $('div.expandbar:last a').trigger('click'); return false; });
	
	var windowLoc = window.location.href;
	if(windowLoc.indexOf("#info") > -1) {		
		//$.scrollTo('#info', 500, {});
		window.scrollTo(0,$('#info').offset().top);
	}
	
	//putting blue border on elements - also in CSS using active and focus, but doesn't work in IE
	$('textarea, input, select').focus(function () { $(this).addClass('activefocus')}).blur(function () { $(this).removeClass('activefocus')})
	
});

