function pageLoader(){

	this.LOADING_DELAY = 3000;

	this.init();

}



pageLoader.prototype = {

	init: function(){

		var instance = this;

		$('a.pageLoader').live('click', function(e){

			e.preventDefault();

			var page = $(this).attr('href');

			var meta = ($(this).attr('rel')).split('&&');

			if (meta[1] != null){

				instance.loadPage(page, meta[0], meta[1]);

			}

			else{

				instance.loadPage(page, meta[0]);

			}

			return false;

		});

	},

	

	loadPage: function(url, section, nonMenu){

		var instance = this;

		if (nonMenu){

			menuObj.showSection($('div#' + section + ' h3 a'), $('div#' + section + ' div.contentArea'));

		}

		else{

			$('div#' + section + ' div.contentArea').html('<div class="frame"><div class="loading">&nbsp;</div></div>');

			var loaderTimeout = setTimeout(function(){

				$('div#' + section + ' div.contentArea div.loading').html('<img src="images/loading.gif" alt="Loading ..." />');

			}, instance.LOADING_DELAY);

			

			$.ajax({

				url: url,

				type: 'get',

				dataType: 'html',

				success: function(html){

					$('div#' + section + ' div.contentArea').html(html);

					clearTimeout(loaderTimeout);

					pageTracker._trackPageview(url);

				}

			});

		}

	}

}



var pageLoaderObj = new pageLoader();
