Event.observe(window, 'load', function (e){
	attachHelp();
	
});


function showExpress(dropdown){
	var i = dropdown.options[dropdown.selectedIndex].value

	if (i == 5339) {
		document.getElementById('express').style.display = "";
	} else {
		document.getElementById('express').style.display = "none";
	}
} 


function attachHelp(){
	var helpIcons = $$('.helpIcon');

	for (var i=0, len= helpIcons.length; i < len; i++){
		
		var icon=helpIcons[i];
		
		var popUp = $(icon.readAttribute('rel'));
		if (null != popUp){
			popUp.setOpacity(0);
			//popUp.show();
		}
		
		$(icon).observe('mouseover', function (e){
			var icon = $(e.target);
			
			
			var popUp = $(icon.readAttribute('rel'));
			
			if (null == popUp)
				return;

			var iconDims = icon.getDimensions();
			var iconOffset = icon.viewportOffset();
			var iconScrollOffset = icon.cumulativeScrollOffset();
			
			popUp.style.left = ( iconOffset.left + (iconDims.width/2) + iconScrollOffset.left ) + 'px' ;
			popUp.style.top = (iconOffset.top - popUp.getHeight() - 10  + iconScrollOffset.top) + 'px';
			
			//possibly add an effect??

			
			new Effect.Opacity( popUp.identify(), { 
				from: 0.0, 
				to: 1.0, 
				duration: 0.2 ,
				beforeStart: function (effect) {
					effect.element.show();

				}
				});
			
		});	
		
		$(icon).observe('mouseout', function (e){
		
			var icon = $(e.target);			
			var popUp = $(icon.readAttribute('rel'));

			if (null == popUp)
				return;
				
			
			new Effect.Opacity(popUp.identify(), 
			{ 
				from: 1.0, 
				to: 0.0, 
				duration: 0.2,
				afterFinish: function (effect) {		
					effect.element.hide();
				}
			});
		});	
	}

}

