window.addEvent('domready', function(){
	
	var bill_bubble = $('bill_bubble');
	var officer_bill2 = $('officer_bill2');
	var info_slide = new Fx.Morph($('info'), {unit: '%', duration: 700, transition: Fx.Transitions.Expo.easeIn});
	
	$('officer_bill1').addEvents({
		mouseenter: function(e){
			this.setStyle('cursor','pointer');
		
			this.morph({
				'opacity': 0.01
			});
			officer_bill2.morph({
				'opacity': 1
			});
			bill_bubble.morph({
				'opacity': 1
			});
		},
		mouseleave: function(e) {
			this.setStyle('cursor','');
			// Morphes back to the original style
			this.morph({
				'opacity': 1
			});
			officer_bill2.morph({
				'opacity': 0.01
			});
			bill_bubble.morph({
				'opacity': 0.01
			});
		},
		click: function () {
			set_officer(1);
		}
	});
	$('officer_bill2').addEvents({
		click: function () {
			set_officer(1);
		}
	});
	/*$('officer_bill1').addEvents({
		mouseenter: function(){
			this.setStyle('cursor', 'pointer');
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			officer_bill2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			bill_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
		},
		mouseleave: function(){
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			officer_bill2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			bill_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
		},
		click: function () {
			set_officer(1);
		}
	}); */
	
	var perry_bubble = $('perry_bubble');
	var officer_perry2 = $('officer_perry2');
	$('officer_perry1').addEvents({
		mouseenter: function(){
		this.setStyle('cursor','pointer');
	
		this.morph({
			'opacity': 0.01
		});
		officer_perry2.morph({
			'opacity': 1
		});
		perry_bubble.morph({
			'opacity': 1
		})
		},
		mouseleave: function(){
		// Morphes back to the original style
		this.morph({
			'opacity': 1
		});
		officer_perry2.morph({
			'opacity': 0.01
		});
		perry_bubble.morph({
			'opacity': 0.01
		});
		},
		click: function () {
			set_officer(2);
		}
	});
	$('officer_perry2').addEvents({
		click: function () {
			set_officer(2);
		}
	});
	
	/*$('officer_perry1').addEvents({
		mouseenter: function(){
			this.setStyle('cursor', 'pointer');
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			officer_perry2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			perry_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
		},
		mouseleave: function(){
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			officer_perry2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			perry_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
		},
		click: function(){
			set_officer(2);
		}
	});*/
	

	var daniel_bubble = $('daniel_bubble');
	var officer_daniel2 = $('officer_daniel2');
	$('officer_daniel1').addEvents({
		mouseenter: function(){
		this.setStyle('cursor','pointer');
	
		this.morph({
			'opacity': 0.01
		});
		officer_daniel2.morph({
			'opacity': 1
		});
		daniel_bubble.morph({
			'opacity': 1
		});
		},
		mouseleave: function(){
		// Morphes back to the original style
		this.morph({
			'opacity': 1
		});
		officer_daniel2.morph({
			'opacity': 0.01
		});
		daniel_bubble.morph({
			'opacity': 0.01
		});
		},
		click: function () {
			set_officer(3);
		}
	});
	$('officer_daniel2').addEvents({
		click: function () {
			set_officer(3);
		}
	});
	
	/*$('officer_daniel1').addEvents({
		mouseenter: function(){
			this.setStyle('cursor', 'pointer');
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			officer_daniel2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			daniel_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
		},
		mouseleave: function(){
			this.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 1);
			
			officer_daniel2.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
			daniel_bubble.set('morph', {duration: 400, transition: Fx.Transitions.Bounce.easeOut}).tween('opacity', 0);
			
		},
		click: function(){
			set_officer(3);
		}
	});*/
	

	$('info_close').addEvents({
		click: function () {
			
			if (Browser.Engine.trident) { // Browser is IE
				$('info').setStyles({
					'left': '',
					'top': ''
				});
			} else {
				info_slide.start({
					'height': 0
				});
			}
			
			//Show hide div's
			menu.setStyle('display', '');
		}
	});

	function set_officer(officer_num) {
		$('selected_officer').set('value', officer_num);
		create_accordion(1);
		
		if($('info').getStyle('height') == '0%' && $('info').getStyle('top') !== '0px') {
			
			if (Browser.Engine.trident) { // Browser is IE
				$('info').setStyles({
					'left': '0px',
					'top': '0px'
				});
			} else {
				info_slide.start({
					'height': 100
				});
			}
			
			//Show hide div's
			menu.setStyle('display', 'none');
		} 
	}
});