/*
	ViJon Site Functions
*/


/*
	Load Posts for Community Section
	
	This called by the Community Section (in Community class) on load.
*/

// =====================
// = Community Section =
// =====================

function loadCommunityPosts() 
{
	var	url = "http://192.168.1.11/vijon/news/?page_id=24";
	$('#overlay').load(url, onCommunityLoad);
}

function onCommunityLoad(data, textStatus)
{
	$('#wrapper').fadeIn();
}

// ===================
// = Careers Section =
// ===================

function loadCareersSite () {
	var url = "careers/index.php";
	$('#overlay').load(url, onCareersLoad);
}

function loadCareersPage(filename)
{
	$('#overlay').load("careers/"+filename, onCareersLoad);	
}

function onCareersLoad () {
	$('#wrapper').fadeIn();
}

function hideOverlay()
{
	$('#wrapper').fadeOut();
}

/*
	accordion functions
	
	for policies, perks pages -- call initAccordian on ready
	
	structure:
	<.itemHead><a onclick=toggleItem>Title Text <#plusminus>[+]</#plusminus></a></.itemHead>
	<.itemBody>Blah blah blah</.itemBody>
	
*/

function initAccordion() {
	$(".itemBody").hide();
	$(".itemHead a").attr("title","click to read more");
	$(".itemHead").click(toggleItem);
}

function toggleItem() {
	
	// check if the content is already visible
	if( $(this).next(".itemBody").css("display") == "none") {
	
		// try reseting all first
		$(".itemBody").slideUp(100);
		$(".itemHead a").attr("title","click to read more");
		$(".itemHead a").css("color","#999");
		$(".itemHead").find("#plusminus").html("[+]");
	
		$(this).find("a").attr("title","click to close");
		$(this).find("a").css("color","#c00");
		$(this).next(".itemBody").slideToggle(350);
		$(this).find("#plusminus").html("[-]");
	}
}

/*
	Careers People functions
*/

function swapTestimonial(id)
{
	// turn off all testimonials except id
	$(".testimonial").hide();
	$("#testimonial_"+id).show();
}

