var NAV = { titleClass: "title", sectionClass: "section", containerClass: "container", activeClass: "active", loadingClass: "loading", previewUrlPrefix: "", previewUrlSuffix: "-preview.html", duration: 8, frame: 0, frameRate: 1000 / 24, tween: TWEEN.easeOutSine, init: function (options) {
    for (var option in options) if (options.hasOwnProperty(option)) { NAV[option] = options[option]; }
    NAV.titles = DOM.getElementsByClass(NAV.titleClass); NAV.sections = DOM.getElementsByClass(NAV.sectionClass); NAV.containers = DOM.getElementsByClass(NAV.containerClass); for (var i = 0; i < NAV.titles.length; i += 1) { NAV.addClick(NAV.titles[i]); } 
}, addClick: function (element) { element.onclick = function () { NAV.fetch(this); }; }, removeClick: function (element) { element.onclick = null; }, activate: function (sectionNumber) {
    var title; var section; var container; NAV.heights = []; NAV.deltas = []; for (var i = 0; i < NAV.containers.length; i += 1) { title = NAV.titles[i]; section = NAV.sections[i]; container = NAV.containers[i]; NAV.heights.push(container.offsetHeight); if (i === sectionNumber) { if (section.offsetHeight === container.offsetHeight) { DOM.removeClass(title, NAV.activeClass); NAV.deltas.push(-container.offsetHeight); } else { DOM.addClass(title, NAV.activeClass); NAV.deltas.push(section.offsetHeight - container.offsetHeight); } } else { DOM.removeClass(title, NAV.activeClass); NAV.deltas.push(-container.offsetHeight); } }
    NAV.interval = setInterval(NAV.update, NAV.frameRate);
}, update: function () {
    if (NAV.frame <= NAV.duration) { for (var i = 0; i < NAV.containers.length; i += 1) { NAV.containers[i].style.height = NAV.tween(NAV.frame, NAV.heights[i], NAV.deltas[i], NAV.duration) + "px"; } } else {
        NAV.frame = 0; for (var i = 0; i < NAV.containers.length; i += 1) { NAV.addClick(NAV.titles[i]); }
        clearInterval(NAV.interval);
    }
    NAV.frame += 1;
}, fetch: function (title) {
    var url = NAV.previewUrlPrefix + title.parentNode.className + NAV.previewUrlSuffix; var sectionNumber = NAV.getSectionNumber(title); for (var i = 0; i < NAV.containers.length; i += 1) { NAV.removeClick(NAV.titles[i]); }
    function sectionLoaded(sectionHTML) {
        NAV.sections[sectionNumber].innerHTML = sectionHTML; if (NAV.callback) { NAV.callback(); }
        NAV.activate(sectionNumber); DOM.removeClass(title, NAV.loadingClass);

    
				var initMultiBox = new multiBox({
					mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
					container: $(document.body),//where to inject multiBox
					descClassName: 'multiBoxDesc',//the class name of the description divs
					path: './Files/',//path to mp3 and flv players
					useOverlay: true,//use a semi-transparent background. default: false;
					maxSize: {w:600, h:400},//max dimensions (width,height) - set to null to disable resizing
					addDownload: false,//do you want the files to be downloadable?
					pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
					addRollover: false,//add rollover fade to each multibox link
					addOverlayIcon: true,//adds overlay icons to images within multibox links
					addChain: false,//cycle through all images fading them out then in
					recalcTop: true,//subtract the height of controls panel from top position
					addTips: false//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
						});
				
		
    }
    if (NAV.sections[sectionNumber].innerHTML === "") { DOM.addClass(title, NAV.loadingClass); HTTP.getText(url, sectionLoaded); } else { NAV.activate(sectionNumber); } 
}, getSectionNumber: function (title) { for (var i = 0; i < NAV.titles.length; i += 1) { if (title === NAV.titles[i]) { return i; } } } 
};
