$(function(){

	// =============================
	// ====== START MAIN MENU ======
	$('#main ul a')
	
		.css('backgroundPosition', function(){
			// split							
			var cssBg = $(this).attr('id').split('_');
			// if selected show white bg, if not show normal
			if (cssBg[2] == 'selected') {	
				$(this).css( {backgroundPosition: '0px -76px'} )
			} else {
				$(this).css( {backgroundPosition: '0px 0px'} )
			}
		})
	
		.mouseover(function(){
			// split
			var cssBg = $(this).attr('id').split('_');
			// if selected do no rollover, if not do normal
			if (cssBg[2] == 'selected') {	
				// do nothing
			} else {
				$(this).stop().animate({backgroundPosition:'(0px -38px)'}, {duration:300})
			}
		})
		
		.mouseout(function(){
			// split
			var cssBg = $(this).attr('id').split('_');
			// if selected do no rollover, if not do normal
			if (cssBg[2] == 'selected') {	
				// do nothing
			} else {
				$(this).stop().animate({backgroundPosition:'(0px 0px)'},{duration:100})
			}
		})
		
		.click(function(){
			// split
			var subID = $(this).attr('id').split('_');
			var subIDdiv = 'sub_' + subID[1];
			
			$('#sub_about').hide();
			$('#sub_enews').hide();
			$('#sub_trainings').hide();
			$('#sub_grants').hide();
			
			$('#'+subIDdiv).show();
		})
	
	
	// ===========================
	// ====== START WEBINAR ======
	$('#webinar #expand a')
	
		.click(function(){
			$('#webinar').animate({
				width: '298px',
				left: '443px'
			}, 1000, function(){
				$('#expand').hide();
				$('#collapse').show();
				$('#content').fadeIn();
			})
		})
		
	$('#webinar #collapse a')
	
		.click(function(){
			$('#content').fadeOut();
			$('#webinar').animate({
				width: '43px',
				left: '698px'
			}, 1000, function(){
				$('#collapse').hide();
				$('#expand').show();
			})
		})
		
	
	
});
