/*
** object detection
*/
function browserIs() {
	if( document.all )
		return 'ie';
	if( document.layers )
		return 'nav4';
	if( document.getElementById )
		return 'std';
}

//////////////////////////////////////////////////////////////////////////////////
////////////////////////////  ContainerPager class  ///////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
// ContainerPager
function ContainerPager(sections, pages) {
	this._sections = sections;
	this._pages = pages;
	this._index = 0;
	this._page_index = 0;
}
//


// resetAll()
function ContainerPager_resetAll() {
    this._index = 0;
	this._page_index = 0;
}
ContainerPager.prototype.resetAll = ContainerPager_resetAll;
//



// getCurrentContentFile()
function ContainerPager_getCurrentContentFile() {
    var file = this._sections[ this._index ] + '/';
	var pages = this._pages[ this._index ];
	file += pages[this._page_index];
	return file;
}
ContainerPager.prototype.getCurrentContentFile = ContainerPager_getCurrentContentFile;
//




// getRelPageIndex()
function ContainerPager_getRelPageIndex() {
    return this._page_index;
}
ContainerPager.prototype.getRelPageIndex = ContainerPager_getRelPageIndex;
//

// getAbsPageIndex()
function ContainerPager_getAbsPageIndex() {
    var total = this._sections.length;
	var page_count = 0;
	var current;
	for(i = 0; i < total; i ++) {
		current = this._sections[i];
		// at the current section?
		if( this._index == i ) {
			// add the relative index to what we've added up here
			// and stop
			page_count += this.getRelPageIndex();
			break;
		}
		page_count += this._pages[i].length;
	}
	return page_count;
}
ContainerPager.prototype.getAbsPageIndex = ContainerPager_getAbsPageIndex;
//

// getSectionIndex()
function ContainerPager_getSectionIndex() {
    return this._index;
}
ContainerPager.prototype.getSectionIndex = ContainerPager_getSectionIndex;
//

// getSectionName(index)
function ContainerPager_getSectionName(index) {
    if( index >= 0 && index <= this._sections.length ){
		return this._sections[index];
	}
}
ContainerPager.prototype.getSectionName = ContainerPager_getSectionName;
//




// getTotalPageCount()
function ContainerPager_getTotalPageCount() {
    var total = this._pages.length;
	var page_count = 0;
	for(i = 0; i < total; i ++) {
		page_count += this._pages[i].length;
	}
	return page_count;
}
ContainerPager.prototype.getTotalPageCount = ContainerPager_getTotalPageCount;
//

// getPageCount()
function ContainerPager_getPageCount() {
    return this._pages[ this._page_index ].length;
}
ContainerPager.prototype.getPageCount = ContainerPager_getPageCount;
//





// isLastSection()
function ContainerPager_isLastSection() {
    return this._sections.length == this._index + 1;
}
ContainerPager.prototype.isLastSection = ContainerPager_isLastSection;
//

// isFirstSection()
function ContainerPager_isFirstSection() {
    return this._index == 0;
}
ContainerPager.prototype.isFirstSection = ContainerPager_isFirstSection;
//

// nextSection()
function ContainerPager_nextSection() {
    if( this.isLastSection() == false ) {
		this._index ++;
		this._page_index = 0;
		return true;
	}
	return false;
}
ContainerPager.prototype.nextSection = ContainerPager_nextSection;
//

// prevSection()
function ContainerPager_prevSection() {
    if( this.isFirstSection() == false ) {
		this._index --;
		this._page_index = this._pages[ this._index ].length - 1;
		return true;
	}
	return false;
}
ContainerPager.prototype.prevSection = ContainerPager_prevSection;
//

// jumpToSectionByIndex(index)
function ContainerPager_jumpToSectionByIndex(index) {
	if( index < 0 ) {
		index = 0;
	}
	if( index > this._sections.length ) {
		index = this._sections.length;
	}
	this._page_index = 0;
	this._index = index;
}
ContainerPager.prototype.jumpToSectionByIndex = ContainerPager_jumpToSectionByIndex;
//





// isLastPage()
function ContainerPager_isLastPage() {
	return this._page_index + 1 == this._pages[ this._index ].length;
}
ContainerPager.prototype.isLastPage = ContainerPager_isLastPage;
//

// isFirstPage()
function ContainerPager_isFirstPage() {
	return 0 == this._page_index;
}
ContainerPager.prototype.isFirstPage = ContainerPager_isFirstPage;
//

// nextPage()
function ContainerPager_nextPage() {
    // if it's NOT the last page
	if( this.isLastPage() == false ) {
		this._page_index ++;
		return true;
	}
	return false;
}
ContainerPager.prototype.nextPage = ContainerPager_nextPage;
//

// prevPage()
function ContainerPager_prevPage() {
    if( this.isFirstPage() == false ) {
		this._page_index --;
		return true;
	}
	return false;
}
ContainerPager.prototype.prevPage = ContainerPager_prevPage;
//
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////