
$(document).ready(function() {

	$('#nav-list li .children').each(function() {
		$(this).css({opacity: 0.8});
	});
	$('#nav-list > li').hover(function() {
		$(this).find('ul').fadeIn();
	}, function() {
		$(this).find('ul').fadeOut();
	});



		function sync_body() {
			$('body').css("font-size", fontsize);
			$('#zoom-status').html(fontsize);
		}

		var fontsize=12;
		sync_body();

		$('#zoom-in').click( function() {
			if( fontsize < 20) fontsize++;
			sync_body();
		});
		$('#zoom-out').click( function() {
			if( fontsize > 10) fontsize--;
			sync_body();
		});


	$('#archive-list a').click( function(event) {
		event.preventDefault();
		prepare_effect(this.href);
	});
	$('.cat-item a').click( function(event) {
		event.preventDefault();
		prepare_effect(this.href);
	});
	$('.meta-category a').click( function(event) {
		event.preventDefault();
		prepare_effect(this.href);
	});
	$('.meta-tags a').click( function(event) {
		event.preventDefault();
		prepare_effect(this.href);
	});
	$('#wp-calendar a').click( function(event) {
		event.preventDefault();
		prepare_effect(this.href);
	});


	/* Side Box */
	$('#slide-box .first div').addClass('open');
	$('.box h4').click( function() {
		var headingBox = this;
		$(headingBox).addClass('loader');
		var updateRegion = $(headingBox).next();
		var updateFile = $(headingBox).parent()[0].id;
		$('.box div.open').slideUp(function() {
			$('.box div').removeClass('open');
			$.ajax({
				url: template_path + "/ajax-" + updateFile + ".php",
				complete: function(data) {
					updateRegion.html(data.responseText).slideDown(function() {
						$(headingBox).removeClass('loader');
					}).addClass('open');
				},
				error: function() {
					updateRegion.html('<ul><li>No Data</li>' +
											'<li>There is no post in this section.</li>' +
											'<li>Plugin maybe not activated</li></ul>');
					updateRegion.slideDown().addClass('open');
				}
			});
		});
	});

});