var sustainability = {
	global : {
		init : function() {
			
			var labelMap = {
				"/aboutAGL/": 	"About AGL",
				"/aboutAGL/operations.asp": 	"Our operations",
				"/aboutAGL/sustainability.asp": "AGL's sustainable business strategy",
				"/aboutAGL/transformation.asp": "Transformation of the energy sector",
				"/aboutAGL/strategy.asp": 		"Strategy and Performance Summary 2008/09",
				"/aboutAGL/this-report.asp": 	"About this report",
				"/aboutAGL/measure.asp": 		"How we measure up",
				"/aboutAGL/governance.asp": 	"Governance and management",
				"/aboutAGL/stakeholder.asp": 	"Stakeholder Engagement",
				"/aboutAGL/previous-reports.asp": 	"Previous sustainability reports",
				"/greenhouse/strategy01.asp": 	"Engage with our stakeholders about reducing greenhouse gas emissions…",
				"/greenhouse/strategy02.asp": 	"Expand our portfolio of investments in renewable energy…",
				"/greenhouse/strategy03.asp": 	"Lead Australian participation in domestic and international emissions trading schemes",
				"/greenhouse/strategy04.asp": 	"Provide energy efficiency and climate change services to our customers",
				"/greenhouse/strategy05.asp": 	"Develop portfolio flexibility to minimise risks associated with changing climate…",
				"/greenhouse/strategy06.asp": 	"Work with Loy Yang Power to improve its greenhouse gas emission intensity",
				"/environment/strategy01.asp": 	"Strengthen and maintain the environmental aspects of our HSE management system",
				"/environment/strategy02.asp": 	"Improve our people's capability in environmental management",
				"/environment/strategy03.asp":	"Monitor and manage our impact on land, air and water",
				"/customers/strategy01.asp":	"Continue to improve to our customers' experience",
				"/customers/strategy02.asp": 	"Sell and market our products responsibly",
				"/customers/strategy03.asp": 	"Support access to energy for vulnerable customers",
				"/customers/strategy04.asp": 	"Provide products, services and information to help customers…",
				"/customers/strategy05.asp": 	"Respond to critical events where the provision of energy…",
				"/employees/strategy01.asp": 	"Improve AGL’s health, safety and environmental (HSE) performance…",
				"/employees/strategy02.asp": 	"Facilitate a high performance culture by providing infrastructure…",
				"/employees/strategy03.asp": 	"Attract, retain and develop employees",
				"/employees/strategy04.asp": 	"Achieve a high performance culture across AGL",
				"/community/strategy01.asp": 	"Build long-term strategic community partnerships",
				"/community/strategy02.asp": 	"Provide sustainable assistance to vulnerable Australians",
				"/community/strategy03.asp": 	"Provide the means and opportunity for our employees to make a genuine contribution…",
				"/community/strategy04.asp": 	"Engage with the community on projects that affect them…",
				"/community/strategy05.asp": 	"Value of our community contributions",
				"/economic/strategy01.asp": 	"Implement AGL's integrated business strategy",
				"/economic/strategy02.asp": 	"Reduce operating costs while improving service quality…",
				"/economic/strategy03.asp": 	"Maintain Australia's largest private portfolio of renewable generation assets…",
				"/economic/strategy04.asp": 	"Apply a disciplined approach to growth strategies that add to AGL's integrated strategy…",
				"/economic/strategy05.asp": 	"Respond to critical events where the provision of energy to our customers is interrupted"
			};
			
			function onSearchComplete(sc, searcher) {
				if(searcher.results.length > 0) {
					$('#SearchResultsOverlay').fadeIn(100);
				} else {
				}
			}
			
			function onSearchStarting(sc, searcher, query) {
				$('#SearchResultsOverlay').fadeOut(100);
			}
			
			function closeResults() {
				$('#SearchResultsOverlay').fadeOut(100);
			}
			
			function initSearchControls(inputField, outputDiv) {
				var searchControl = new google.search.SearchControl();
				searchControl.setResultSetSize(GSearch.SMALL_RESULTSET);
				searchControl.setLinkTarget(google.search.Search.LINK_TARGET_SELF);
		
				var options = new google.search.SearcherOptions();
				options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
		
				var siteSearch = new google.search.WebSearch();
				siteSearch.setUserDefinedLabel("AGL.com");
				siteSearch.setUserDefinedClassSuffix("siteSearch");
				//siteSearch.setSiteRestriction("http://www.energyinaction.com.au/aglsustainability/");
				siteSearch.setSiteRestriction("http://2009.aglsustainability.com.au/");
				searchControl.addSearcher(siteSearch, options);	
		
				var drawOptions = new google.search.DrawOptions();
				drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
				drawOptions.setInput(inputField);
		
				searchControl.setSearchCompleteCallback(this, onSearchComplete);
				searchControl.setSearchStartingCallback(this, onSearchStarting);
				searchControl.draw(outputDiv, drawOptions);
			}
	
			function susFinalLabFunc(section, pathname) {
				return labelMap[pathname] ? labelMap[pathname] : section;
			}
			
			$(document).ready(function() {
				
				if($.localScroll) {
					$.localScroll({	
						target: '#Scrolling',
						hash: 'true',
						duration: 200,
						offset: -310
					});
				}
				
				/* Breadcrumbs */
				$('#UrlBreadcrumbs').urlCrumbs({level:0, finalLabelFunction: susFinalLabFunc});
				
				/* Ticker */
				$("#ticker marquee ul li:first").css('background-image', 'none');

				$('#ticker marquee').marquee('pointer').mouseover(function () {
					$(this).trigger('stop');
				}).mouseout(function () {
					$(this).trigger('start');
				});
				
				/* Hacks */
				$('body').pngFix( );
				
				
				/* Search */
				$('#SearchResultsOverlay div.search-results-close').click(closeResults);
				$('#SearchUi input').blur(function() 
				{ 
					if(this.value === '') {
						closeResults();
					}
				}); 
				initSearchControls($('#SearchUi input')[0], 
								   $('#SearchResultsOverlay div.search-results-container')[0]);
				

				Cufon.replace('#GoalNew h1', {fontFamily:'BrauerNeue-Regular',fontWeight:400});
				Cufon.replace('#MainContent h1', {fontFamily:'BrauerNeue-Bold',fontWeight:400});
				//Cufon.replace('#nav > ul a', {fontFamily:'BrauerNeue-Bold',fontWeight:400});
				//Cufon.replace('#nav #subnav > p a', {fontFamily:'BrauerNeue-Bold',fontWeight:400});
				//Cufon.replace('#nav #subnav > li', {fontFamily:'BrauerNeue-Regular',fontWeight:400});
				//Cufon.replace('#footer p a', {fontFamily:'BrauerNeue-Regular',fontWeight:400, hover: true});
				//Cufon.replace('#SearchUi label', {fontFamily:'BrauerNeue-Regular',fontWeight:400});
				//Cufon.replace('#UrlBreadcrumbs ul li', {fontFamily:'BrauerNeue-Regular',fontWeight:400, hover: true});
									   
			});
		}
	}
};