$(document).ready(function(){
	//Fading (mouseover) Links setup
	//linksOverlaySetup();

	//Fading header image (top right)
	//setupFader();
	
	//Read the users font size.
	//readFontSize();
	
	serverWidget();
	
	calHover();
	
	statsOverlay();

});

function statsOverlay() {
	$('.statcol').hover(function() {
		$(this).find('.hideme').show();
	}, function() {
		$(this).find('.hideme').hide();
	});
}

function calHover() {
	$('.cal-event').hover(function() {
		$(this).parent().find('.cal-entry').show();
	}, function() {
		$(this).parent().find('.cal-entry').hide();
	});
}

function serverWidget() {
	$('.widgetserver').click(function() {
		if ($(this).height() > 18) {
			$(this).animate({height: '18'});
			$(this).find('.widget_details').hide('fast');
		} else {
			$(this).find('.widget_details').show('fast');
			$(this).animate({height: '240'});
		}	
	});
}

function setFontSize(size) {
	$('html').css('font-size', size);
	$.cookie('FontSize', size,{ expires: 7 });
}

function readFontSize() {
	var fontSize = parseFloat($.cookie('FontSize'));
	if(fontSize != 0 || fontSize != "") {
		$('html').css('font-size', parseFloat(fontSize, 10));
	} else {
		$.cookie('FontSize', 16,{ expires: 7 });
	}
}

function setupFader() {
	$('#faders').css("display", "block");
	$('#faders').cycle({ 
    		fx:    'fade', 
    		speed:  3000 
 	});
}

function linksOverlaySetup() {
	$('#linkers a').lightBox();
	$('.link>a>img').fadeTo("fast",0.30);

	$('.link>a').click(function() {
		top.location=$(this).attr("href");
	});

	$('.link>a>img').hover(function() {
		section = $(this).attr('name');
		$(this).fadeTo("fast",0.90);
	},
	function () {
        	$(this).fadeTo("fast",0.30);
      });
}

function getDomain(){
	return 'http://' + document.domain;
}