$(document).ready(function(){
	$('body').addClass('js-active');
	$.historyInit(pageload);
	
	$(document).click(function(event){
		var eventTarget = event.target;
		
		if($(eventTarget).is('a') && $(eventTarget).attr('rel') == 'lnk-internal') {
			var href = $(eventTarget).attr('href');			
			var hash = href;
			
			hash = hash.replace(/^.*#/, '');
			$.historyLoad(hash);
			
			event.preventDefault();
			//return false;
		}
	});
	
	// Initialize history plugin.
	// The callback is called at once by present location.hash. 
	
	// set onlick event for buttons
	
	//Init functionality that can be started with all DOM elements in place
	
	//TODO Load network flyout label
	//Initialize history handler
	//TODO Load subsystem for managing clicking internal links vs. external links to handle ajax page requests.
});

$(document).load(function(){
	//Init functionality when page is loaded
});


function pageload(hash) {
	if(hash)
		$("#panel").load(hash+' #panel');
}
