var STARTERKIT = STARTERKIT || {};

STARTERKIT.init = function() {
	topmenu();
	accordion();
	checboxes();

	
	Cufon.replace('#topmenu ul li a', {fontFamily: 'Gotham Rounded Bold'});
	Cufon.replace('h3');
	Cufon.replace ('h2', {fontFamily: 'Gotham Rounded Light'});
	Cufon.replace ('h3', {fontFamily: 'Gotham Rounded Medium'});
	Cufon.replace ('h5', {fontFamily: 'Gotham Rounded Medium'});
	Cufon.replace ('h3 strong', {fontFamily: 'Gotham Rounded Bold'});

};



function topmenu()
{
	
	$('#topmenu ul li.main-item').hover(function()
	{
		$(this).find('.submenu').slideToggle(
		{
			duration:300,
			easing: 'easeOutCubic'
		});
	},
	function()
	{
		$(this).find('.submenu').slideToggle(
		{
			duration:300,
			easing: 'easeOutCubic'
		});	
	
	});
	
}


function accordion()
{
	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 
	$(".toggle_container.open").show(); 

	//Switch the "Open" and "Close" state per click
	$("div.trigger").click(function(){	
		$(this).toggleClass('active');
		return false;
	})

	//Slide up and down on click
	$("div.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle({
			easing: 'easeOutCubic', duration:'slow'
		});
		return false;
	});

}


function checboxes()
{
	// check for what is/isn't already checked and match it on the fake ones
	$("input:checkbox").each( function() {
		(this.checked) ? $("#fake"+this.id).addClass('fakechecked') : $("#fake"+this.id).removeClass('fakechecked');
	});
	// function to 'check' the fake ones and their matching checkboxes
	$(".fakecheck").click(function(){
		($(this).hasClass('fakechecked')) ? $(this).removeClass('fakechecked') : $(this).addClass('fakechecked');
		$(this.hash).trigger("click");
		return false;
	});

}

/**
 * On document ready.
 */
$(document).ready(STARTERKIT.init);
