//Animation functions used for expanding a div (used for login system and others)
$(document).ready(function(){
	$(".expand_body").hide();
	$(".expand_head").click(function(){
		$(this).next(".expand_body").slideToggle(200);
	});
});

function slideToggle(obj) {
	$(obj).next(".expand_body").slideToggle(200);
}
function slideToggleDirect(obj) {
	$(obj).slideToggle(200);
}


//Gives the user a popup confirmation window and then redirects them if they choose ok
function confirmation(message,redirect) {
	var answer = confirm(message)
	if (answer) window.location = redirect;
}

// Validates user input on a form
function validate(obj,type){
	$.ajax({
		type: "POST", 
		url: "/include/ajax/validate.php?type="+type, 
		data: obj.name+"="+$(obj).val(),
		success: function(html){ 
			$(".response_"+obj.name).html(html);
		}
	});
}

//Generic AJAX content load (with image)
function ajaxRequest(obj,url) {
	$(obj).html('<p><img src="/images/loading.gif" /></p>');
	$(obj).load(url);
}
