//=======================================================================================================
//-------------------------------------------------------------------------------------------------------
//	Custom Javascript functions
//-------------------------------------------------------------------------------------------------------
//=======================================================================================================
//---------------------------------------------------------------------------------------------------------
//	Jquery load function. Happens on document ready. 
//	Also include on ajax loading so innerhtml replace HTML will be processed
//---------------------------------------------------------------------------------------------------------
function loadfunc()	
{
	//	Tabs
	$('.tab h3').click(function(event)
	{
		var thisclass = $(this).attr('class');
		
		switch(thisclass)
		{
			case 'inactive-tab':
			$(this).attr('class','active-tab');
			break;

			case 'active-tab':
			$(this).attr('class','inactive-tab');
			break;
		}
		$(this).parent('.tab').children('.tab-content').toggle();
	});

	$("#news-link").click(function(event){
		event.preventDefault();
		$("#blog-tab").fadeOut('fast',function(){
			$("#news-tab").fadeIn();
		});
	});

	$("#blog-link").click(function(event){
		event.preventDefault();
		$("#news-tab").fadeOut('fast',function(){
			$("#blog-tab").fadeIn();
		});
	});
	
	//	Cycle testimonials
	$('#testimonials').cycle({ 
	    fx:    'fade',
	    speed:    300, 
	    timeout:  6000 
	});
	
	//	IE is teh suk
	if (jQuery.browser.msie){
		if(parseInt(jQuery.browser.version) < 7){
			//	Fix the first child slector in the sectionnav
			$('ul#nav-section li:first-child').css('background-image','none');

			//	pngfix
		  	$(document).pngFix(); 
		}
	}
}