$(function(){
	var LoadMsg = 'Please Wait ...';
	$('#nav-ajaxtabs ul li a').click(function(){
		if(!$(this).hasClass("active")) {
		var _Href = $(this).attr('href');
		$('#nav-ajaxtabs ul li a').removeClass("active");
		$(this).addClass("active");
		$('<div id="loading">'+LoadMsg+'</div>').appendTo('body').fadeIn('slow',function(){
			$.ajax({
				type:	'POST',
				url:	_Href,
				data:	"ajax=1",
				dataType:	'html',
				timeout:	15000,
				success: function(d,s){
						$('#loading').fadeOut('slow',function(){
							$(this).remove();
							$('#ajaxtabs-wrapper').show('slow',function(){
									$(this).html(d).show('slow');
								});
							});
						},
				error: function(o,s,e){
							$('#loading').html('Ajax Request Failed: '+s);
							eTimer(_Href);
						}
			});
		});
		}
		return false;
	});
	
	function eTimer(url) {
		var t=setTimeout("window.location='"+url+"'",1000);
		$('#loading').fadeOut('slow');
	}
});

