
//----------------------------------
// RESIZE CONTACT BLOCK ON HOMEPAGE
//----------------------------------

var contentBlockHeight;

//resize contact block
function resizeContactBlock(){
	contentBlockHeight = j('#content_block').height();
	contentBlockHeight = (contentBlockHeight - 88) + 'px';
	j('#sub_content_block_content').css('min-height', contentBlockHeight);
}


//----------------------------------
// DOCUMENT READY
//----------------------------------

var toolbox = 0;
var bubbleYpos = 85;

j(function(){
	resizeContactBlock();
	
	//bind navigation with mouse events
	j('.nav_text').bind('mouseover', navRollOver);
	j('.nav_text').bind('mouseout', navRollOut);
	
	
	//how to use toggle events
	j('#howtouse').toggle(function(){
		j('#toolbox').stop().animate({top: '0px'},{duration:'100', easing:'easeOutQuint'});
		bubbleYpos = 0;//sets the y position of the bubble
	}, function() {
		j('#toolbox').stop().animate({top: '-78px'},{duration:'100', easing:'easeOutQuint'});
		bubbleYpos = 85;//sets the y position of the bubble
	});
	
	
	//bubble hover for dark theme selector
	j("#dark_selector").mousemove(function(e){
		j("#bubble").fadeIn(100);
		j("#bubble").css({
			top: (e.pageY + bubbleYpos) + "px",
			left: (e.pageX - 50) + "px"
		});
		j('#bubble').html('Dark');
	});

	j("#dark_selector").mouseout(function(e){
		j("#bubble").fadeOut(100);
	});
	
	
	//bubble hover for light theme selector	
	j("#light_selector").mousemove(function(e){
		j("#bubble").fadeIn(100);
		j("#bubble").css({
			top: (e.pageY + bubbleYpos) + "px",
			left: (e.pageX - 50) + "px"
		});
		j('#bubble').html('Light');
	});

	j("#light_selector").mouseout(function(e){
		j("#bubble").fadeOut(100);
	});	
	
	
	//theme changer
	j('#light_selector').bind('click', goLight);
	j('#dark_selector').bind('click', goDark);

	
});

//----------------------------------
// COLOUR tHEME CHANGER
//----------------------------------
var goLight = function(){
	createCookie('style_name', 'light');
	location.reload();
}

var goDark = function(){
	createCookie('style_name', 'dark');
	location.reload();
}


//----------------------------------
// WINDOW RESIZE
//----------------------------------
j(window).resize(function(){
	j('#sub_content_block_content').css('min-height', '0');//resets min-height
	resizeContactBlock();
});


//----------------------------------
// NAV ROLLOVERS AND ROLLOUTS
//----------------------------------
var navRollOver = function(){
	j(this).parent().find('.nav_rollover').stop().animate({top: '0px'}, {duration:300, easing:'easeOutQuint'});
}

var navRollOut = function(){
	j(this).parent().find('.nav_rollover').stop().animate({top: '-90px'}, {duration:300, easing:'easeOutQuint'});
}


