//
// 
//  sections.js
//
//  Created by  on 2008-07-05.
//  Copyright (c) 2008 murat n konar. All rights reserved.
//



// ------------------------------------------------------------
function sections(toc)
{
	var sections = new Array()

	toc.galleries.each(function(gallery, index, array) {
		
		gallery.sectionName 	= gallery.name.unEncodeHTML().split('/')[0]
		gallery.galleryName 	= gallery.name.unEncodeHTML().split('/')[1]
		gallery.originalIndex 	= index
		
		var section = sections.filter(function(s, index, array){return s.name == gallery.sectionName})[0]
		
		if (section == undefined){
			section = {name:gallery.sectionName, galleries:new Array()}
			sections.push(section)
		}
		
		section.galleries.push(gallery)
	})
	
	return sections
}