$().ready(function() {
	
	// Load time specific skin
	var now = new Date();
	var hours = now.getHours();
	if(8 < hours && hours < 20)
		$('#skin').attr('href', './includes/css/dark.css');
	else
		$('#skin').attr('href', './includes/css/light.css');
		
	$(document).mousemove(function(e) {
		if(
			Math.abs($(window).width()/2 - e.clientX) < (630/2) &&
			Math.abs($(window).height()/2 - e.clientY) < (139/2)
		) {
			$("body").addClass("hover");
		} else {
			$("body").removeClass("hover");
		}
	});
	
	$("body").click(function() {
		if($("body").hasClass("hover"))
			window.location.href=rot47('>2:=E@i 5:C5: k>2:=o5:C5:]?2>6m');
	});
});

function external_link(element) {
	window.open(element.href);
	return false;
}

function rot47(string) {
	var result = '';
	for(var i = 0; i < string.length; i++)
		if(33 <= string.charCodeAt(i) && string.charCodeAt(i) <= 126)
			result += String.fromCharCode((string.charCodeAt(i) - 33 + 47) % 94 + 33);
		else
			result += string.charAt(i);
	return result;
}
