/* aaronvenn */

var avenn = {};

if (typeof(avenn)=="undefined") {var avenn = {};}

avenn.hijax = {
    
    browserUrl : false,
    requests : {},
    useContentGuids : true,
    // currentlyPlaying : false,
    delayedData : new Array (), //used to store http responses while animating panels
	defaultNumContentItems : 6,
    showEmailLink : true,
    
   // host : window.location.protocol+"//"+window.location.host,
   // defaultStateId : "",

    handleOnLoad : function (){
        try {
            logger.log("ajax.js : handleOnLoad");
            if (avenn.ui) {
                avenn.ui.init();
                //avenn.ui.flashReplace();
            }
            if (avenn.hijax) {
				avenn.hijax.init();
			}
        }
	    catch (e) {
	        logger.error('hijaxManager.js:handleOnLoad failed',e);
	    }
    },
    
    init : function() {
	            
	    
	    // Deep link
	    //var href = window.location.href.split('#')[0];
	    var hash = window.location.href.split('#')[1];
	    if (hash == null)
	    {	        
	        
	        var contentItems = document.getElementsByClassName('content-item',$('browser'));
            contentItems._each(function(contentItem){avenn.ui.prepareDetails(contentItem)});
            //avenn.ui.localizeDates();
            
	        //avenn.hijax.getLoaderLinks($('t1'));
	       
	        avenn.ui.userHasResized = true;	        
	        avenn.ui.setContentItemMargins();           
            
            avenn.ui.initPaging();
	        //avenn.ui.setPanelPositions();
	        
	        //avenn.ui.setFooter();	        
		    //activeNav.setActiveLink(activeNav.getActiveLink(window.location.href));
		    //avenn.ui.setFooter();
	    }
	    
    }
};

addLoadEvent(avenn.hijax.handleOnLoad);
