var loadedContent = "";
var pageTracker;

$(document).ready (function () {
	 SWFAddress.onChange = onHistoryChangeAni;
	 try {pageTracker = _gat._getTracker(analyticTrackCode);} catch(err) {}
});

function onHistoryChangeAni () {
	try {onContentClose()}catch(e){}
	var newPath = SWFAddress.getPathNames();
	try {pageTracker._trackPageview("/"+newPath);}catch(e){}
	if (newPath == "") newPath = firstPage;
	var parameters = '';
	if (SWFAddress.getParameterNames()) {
		for (var i = 0; i < SWFAddress.getParameterNames().length; i++) {
			parameters += '&' + SWFAddress.getParameterNames()[i] + '=' +SWFAddress.getParameter(SWFAddress.getParameterNames()[i]);
		}
	}
	
	$('#'+loaderID).animate({opacity: 0,}, animationTime, 
							function() {
								$('#'+loaderID).html ('<center><img style="margin-top:200px;margin-bottom:200px;" src="images/loader.gif" /></center>');
								$('#'+loaderID).animate({opacity: 1,}, animationTime, function () {$.get (newPath,parameters,onRequestCompleteAni);});
								});
	 
	 
	
}

function onRequestCompleteAni (data) {
	loadedContent = data;
	$('#'+loaderID).animate({opacity: 0,}, animationTime, function () {
												$('#'+loaderID).html (loadedContent);
												try {onContentDisplay()}catch(e){}
												$('#'+loaderID).animate({opacity: 1,}, animationTime);
												});
}

  
				
