/* 
@file 	:	jm-report.js
@ver	:	1
@date	: 	June, 2009
*/


			//index page, icon functions

			var Icons = {
				
				init: function(){
				
				       $("#section-icons .icon").hover(
							   function(){
									var elem = $(this).attr('id');
									var d = "#section-descriptions ."+elem;
									var descItem ="#section-descriptions li";
									//reset all the icons to green
									Icons.resetIcons();
									
									//change the current icon to white
									switch(elem){
										case "i-financial" :
											$(this).children("a").children('img').attr('src','./assets/images/shared/i-f-w.gif');
											break;											
										case "i-governance" :
											$(this).children("a").children('img').attr('src','./assets/images/shared/i-g-w.gif');
											break;
										case "i-social" :
											$(this).children("a").children('img').attr('src','./assets/images/shared/i-s-w.gif');
											break;
										case "i-health" :
											$(this).children("a").children('img').attr('src','./assets/images/shared/i-h-w.gif');
											break;
										case "i-environmental" :
											$(this).children("a").children('img').attr('src','./assets/images/shared/i-e-w.gif');
											break;											
									}	
									//hide all the descriptions
									$(descItem).addClass('offview');	
									
									//show the description of the hovered over section icon
									$(d).removeClass('offview').hide().slideDown();	

							   },
							   function(){
							   		;
							   }
						).click(function(){return false;});
				},
				
				resetIcons: function(){
					$('#i-financial a img').attr('src','./assets/images/shared/i-f-g.gif');	
					$('#i-governance a img').attr('src','./assets/images/shared/i-g-g.gif');
					$('#i-social a img').attr('src','./assets/images/shared/i-s-g.gif');
					$('#i-health a img').attr('src','./assets/images/shared/i-h-g.gif');
					$('#i-environmental a img').attr('src','./assets/images/shared/i-e-g.gif');			
				}
				
				
			}


		var externalLinks = {
					confirmLeaving : function() {
						if(! confirm('You are leaving the Sustainability Report 2010.')) { 
							return false ;
						}else{
							return true;
						}			
					}
		}


		$(document).ready(function(){
				$('a.externallink').click(function(){
					if(! externalLinks.confirmLeaving() ){ 
						return false;
					}
				 });
				 
				$('#utility-nav .print').click(function(){
					window.print();
					return false;
				});
				 
				 
		});	
		
		
		


