
//***************************************************
// OnLoad Handler
//***************************************************
$(window).load(function () {
	
	// Button hover states
	$('.Button').each(function(index){
		$(this).hover(
			function() { $(this).addClass('Button-hover'); },
			function() { $(this).removeClass('Button-hover'); }
		);
	});
	
	// Sifr Setup
	$.sifr({
		build: 436,
		version: 3,
		path: "/flash/",
		save: true
	});
	
	$("h1,h3").sifr({
		font: "gothicb",
		css: {'a': {'text-decoration': 'none'}}
	});
	
	$("h2").sifr({
		font: "gothicb",
		css: {'a': {'text-decoration': 'none'}}
	});
	
	$(".Heading").sifr({
		font: "gothicb",
		css: {'a': {'text-decoration': 'none'}}
	});
	
	// Input Focus/Blur
	$(":text,textarea").focus(function() { $(this).addClass('Focus'); });
	
	// Input 
	$(":text,textarea").blur(function() {
		$(this).removeClass('Focus');
	});
	
});


//***************************************************
// Redirect URL
//***************************************************
function redirect(URL) {
	document.location = URL;
} 


//***************************************************
// Hide/Show Background
//***************************************************
function hideBackground() {
	$("#Background").animate({ height: "5px" }, 600).html('').addClass('Grey');
	$("#Hide").html('<a href="javascript:showBackground();">^show^</a>');
	toggleBackground();
}
function showBackground() {
	loadBackground();
	$('#Background').animate({ height: "600px" }, 600).removeClass('Grey').removeClass('Thin');
	$("#Hide").html('<a href="javascript:hideBackground();">^hide^</a>');
	toggleBackground();
}

function toggleBackground() {
	ajax("toggleBackground");
}


//***************************************************
// AJAX Handler
//***************************************************
function ajax(f,a,callbackFunction){
	$.ajax({
		url: '/modules/ajax/ajaxHandler.php?method=' + f,
		type: 'GET',
		data: a,
		timeout: 5000,
		traditional: true,
		error: function(r){
			alert('Error');
		},
		success: function(r){
			if (callbackFunction!=null) callbackFunction(r);
		}
	});
}



