$(function() {
	get_content();
	// content control
	$('.f_menu').click( function(event) {
		var hash_exist = window.location.hash;
		var this_hash = $(this).attr('href');
		if (hash_exist == this_hash) {
			return false;
		}
		var stat_now = $('.c_holder').attr('rel');
		var timer = 1000;
		var animation_style = 'easeInOutBack';
		var page_id = $(this).attr('rel');
		
		
		$('.f_menu').each(function() {
			$(this).removeAttr('id');
		});
		
		$(this).attr('id', 'is_sel');
		
		if (stat_now == 'c_1') {
			$.get('/ajax.php', {get_page: page_id}, function(data) {
                $('.c_2').html(data);
                
                $('.c_move').animate({
					top: '-470px'
				}, {
					duration: timer,
					specialEasing: {
				      top: animation_style
				    }
				});
				$('.c_holder').attr('rel', 'c_2');
	        });
		}
		else {
			$.get('/ajax.php', {get_page: page_id}, function(data) {
                $('.c_1').html(data);
                
                $('.c_move').animate({
					top: '0px'
				}, {
					duration: timer,
					specialEasing: {
				      top: animation_style
				    }
				});
				$('.c_holder').attr('rel', 'c_1');
	        });
		}
		event.stopPropagation();
	});
});

function get_content() {
	var get_hash = window.location.hash;
	var get_end = get_hash.length - 2;
	var page_name = get_hash.substr(1, get_end);
	
	$.get('/ajax.php', {get_content: page_name}, function(data) {
		$('.c_1').html(data);
		$('.c_1, .c_2').fadeTo(1000, 1);
	});
}
