$(function() {
	// Hide initially
	$("div.sub_content").hide();
	
	$("div.sub_module").hide();
	
	// Global settings for future AJAX calls
	$.ajaxSetup({
		type: "POST",
		dataType: "html",
		cache: false
	});
});

// Used on Claims page -- to swap right side column content
function swapClaims(cont) {
	// Decrement by 1 to compensate for the the array index
	indexToShow = cont - 1;
	
	$("div.sub_content").hide();
	$("div.sub_content:eq("+indexToShow+")").show();
}



function swapSubModule(cont) {
	// Decrement by 1 to compensate for the the array index
	indexToShow = cont - 1;
	
	$("div.sub_module").hide();
	$("div.sub_module:eq("+indexToShow+")").show();
}

// function to submit forms using ajax
function ajaxSubmitForm(f)
{
	$.ajax({
		url: "includes/"+f+"-form.inc.php",
		data: $("#"+f+"form").serialize(),
		success: function(html){
			$("#"+f+"formcont").html(html);
			$.scrollTo("#"+f+"formcont", 1000, {offset:-50});
		}
	});
	
	return false;
}

// update a cont
function updateCont(cont, id)
{
	$.ajax({
		type: "GET",
		url: "includes/"+cont+".inc.php",
		data: ({cont: cont, id: id}),
		success: function(html){
			$("#"+cont+"cont").html(html);
		}
	});
	
	return false;
}



$(function () {
    var tabContainers = $('div.tabs > div');
    
    $('div.tabs ul.tabNavigation a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div.tabs ul.tabNavigation a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();
});