/* @Project: Javascript Breadcrumb Creation System */
/* @File:  	 lib.bcns.js */
/* @Author:  Gregory Patmore */
/* @Contact: mail at gregorypatmore dot com */
/* @Created: Mon Jun 11 10:31:26 EDT 2007 */
/* @Notes:   Initiates the Breadcrumb manager for the fujihunt site  */


/* 

Workout of folder structures for breadcrumb creation


Home 
	about -> pages	
	news -> pages	
	products
			codestream -> pages 			
			export -> pages			
			holography -> pages			
			specialty -> pages			
			wide_format
						ink_jet_cartridges -> pages						
						professional_ink_jet_media -> pages						
						software -> pages						
						support -> pages						
						wide_format_printers -> pages						
						-> pages
			-> pages
	support	-> pages	
	sitemap -> pages
*/
//try{
	if(typeof BCS_BreadCrumbManager == 'undefined')
		throw new Error('Breadcrumb Manager Failed to Load!');	
		
	var topLevelFolderDict = new BCS_FolderDictionary(
		[	new BCS_FolderRefItem('about', 'About Us', "/about/AboutUs.html"),
			new BCS_FolderRefItem('news', 'News', "/news/company_news.asp"),
			new BCS_FolderRefItem('products', 'Products', "http://www.fujihuntusa.com/products/products.html", new BCS_FolderDictionary(
				[	new BCS_FolderRefItem('codestream', 'Codestream Laser Marking', "/products/codestream/codestream_overview.html"),
					new BCS_FolderRefItem('export', 'Export', "/products/export/export.html"),
					new BCS_FolderRefItem('holography', 'Holographic Film', "/products/holography/holography_overview.html"),
					new BCS_FolderRefItem('specialty', 'Fine Chemicals', "/products/specialty/specialty_overview.html"),
					new BCS_FolderRefItem('photofinishing','Photofinishing Products', "http://www.fujifilmusa.com/products/photofinishing/index.html", new BCS_FolderDictionary(
						[	new BCS_FolderRefItem('wide_format', 'Wide Format Ink Jet', "/products/photofinishing/wide_format/wide_format.html", new BCS_FolderDictionary(
							[	new BCS_FolderRefItem('ink_jet_cartridges', 'EPSON Ink', "/products/photofinishing/wide_format/ink_jet_cartridges/ink_jet_cartridges.html"),
								new BCS_FolderRefItem('professional_ink_jet_media', 'Professional Ink Jet Media', "/products/photofinishing/wide_format/professional_ink_jet_media/professional_media.html"),
								new BCS_FolderRefItem('software', 'Software', "/products/photofinishing/wide_format/software/software.html"),
								new BCS_FolderRefItem('support', 'Support', "/products/photofinishing/wide_format/support/support.html"),
								new BCS_FolderRefItem('wide_format_printers', 'Wide Format Ink Jet Printers', "/products/photofinishing/wide_format/wide_format_printers/printers.html"),
							])),
						])),						
				])),
			
			/* support folder */
			new BCS_FolderRefItem('support', 'Support', "/support/support.html"),
			
			/* sitemap folder */
			new BCS_FolderRefItem('sitemap', 'Sitemap', "/sitemap/index.html"),			
		]);/* End topLevelFolderDict */
	
	if(!topLevelFolderDict instanceof BCS_FolderDictionary)
		throw new Error("Failed to create top level folder dictionary");
	
	/* now create the Breadcrumb Manager */
	var bcs = new BCS_BreadCrumbManager("breadcrumb", topLevelFolderDict);
	/* override some of the defaults to work with this site */
	bcs.defaultPage = 'default.asp';
	/* Change this when the site launches live; to whatever the path to the webroot is */
	bcs.domain = "http://www.fujihuntusa.com";
	/* Clear the node contents before writing */
	bcs.clearNode = true;
	
	/* Since the page titles are so wacky, I added a property that will allow you to use a custom function to come up with the page title you want to use. */
	bcs.getPageTitleFunction = function(){
		if(document.getElementsByTagName('title') && document.getElementsByTagName('title')[0]){
			title = (document.getElementsByTagName('title')[0].innerHTML) ? document.getElementsByTagName('title')[0].innerHTML : false;
			if(title){
				title = title.split('| ');
				return title[1];
			}else return "Current Page";
		}else return "Current Page";
	}
	
	
	/* k we should be good lets set up the object to write when the page loads*/
	
	/* Add my load event into the mix */
	if(typeof window.onload != 'function'){
		window.onload = function(){
			bcs.write();
		}
	}else{
		var o = window.onload;
		window.onload = function(){
			o();
			bcs.write();
		}
	}
	
//}catch(e){
	//do something with the error
//	alert(e.message)
//}
	


