$(document).ready(function(){

	// ***** global functions *****
	
		// PNG trans fix
		$(document).pngFix();


	// ***** global var's *****

		var bodyClass = $('body').attr('class').split(' ').slice(-1);
		var bodyID = $('body').attr('id').split(' ').slice(-1);


	// ***** navigation functions *****

		// hide all sub-nav lists
		$("#nav li ul").hide();
		$("#links li ul").hide();
	
		// highlight current nav list element
		$("*").find("a[href='"+document.location.href+"']").each(function() { 
			$(this).addClass("current");
		});
	
		// show corresponding sub-nav list of current nav element
		$('body.'+bodyClass+' li.'+bodyClass+' ul').css('display', 'block');


	// ***** home functions *****

		// 'home' news scroll pane
		$('#page-home .scroll-pane').css('width', '380px').css('height', '370px').jScrollPane({ scrollbarWidth: 7, scrollbarMargin: 10 });


	// ***** media section functions *****

		// show/hide videos in 'media' section onload
		$('.video-entry .video').hide();
	
		// show corresponding video
		$('.view-video a').click(function () {
			$('.view-video').show(); // show all buttons
			$(this).parent().hide(); // hide this button
			$('.video-entry .video').hide(); // hide all videos
			$('.video-entry .'+$(this).attr('rel')).show('fast');
			return false;
		});
	
		// collapse corresponding video
		$('.collapse-video a').click(function () {
			$('.video-entry .video').hide('fast');
			$('.view-video').show();
			return false;
		});


	// ***** news events section functions *****

		// show/hide full entry in 'news-events' section onload
		$('.newsevent-entry .newsevent-full').hide();
	
		// show corresponding full-entry
		$('.view-full-newsevent a').click(function () {
			$('.view-full-newsevent').show(); // show all buttons
			$(this).parent().hide(); // hide button (parent)
			$('.newsevent-entry .newsevent-full').hide('fast'); // hide all full entries
			$('.newsevent-entry .'+$(this).attr('rel')).show('fast');
			return false;
		});
	
		// collapse corresponding full-entry
		$('.collapse-full-newsevent a').click(function () {
			$('.newsevent-full').hide('fast');
			$('.view-full-newsevent').show();
			return false;
		});

	// ***** services section functions *****

		// show/hide full entry in 'service' section onload
		$('.service-full').hide();
	
		// show corresponding full-entry
		$('.view-full-service a').click(function () {
			$('.view-full-service').show(); // show all buttons
			$(this).parent().hide(); // hide button (parent)
			$('.service-full').hide('fast'); // hide all full entries
			$('.service-full.'+$(this).attr('rel')).show('fast');
			return false;
		});
	
		// collapse corresponding full-entry
		$('.collapse-full-service a').click(function () {
			$('.service-full').hide('fast');
			$('.view-full-service').show();
			return false;
		});

});