/*	

wells fargo foothill
global.js, v1.0

*/

window.addEvent('domready', function() {
	// set up rollovers
	$$('img.roll').each(function(img) {
		if (img.src.match(/_o\.[^.]+$/)) return;

		var p = new Image();
		p.src = img.hsrc = img.src.replace(/\.([^.]+)$/, '_o.$1');
		img.osrc = img.src;
		
		img.onmouseover = function() { img.src = img.hsrc; };
		img.onmouseout = function() { img.src = img.osrc; };
	});
	
	// set up ghost-text inputs
	$$('input.ghost').each(function(input) {
		if (input.title == '') return;
		
		input.onblur = function() {
			if (input.value == '')
				input.value = input.title;
			if (input.value == input.title)
				input.setStyle('color', '#c1c1c1');
		};
		input.onfocus = function() {
			if (input.value == input.title)
				input.value = '';
			input.setStyle('color', '#000000');
		};
		
		input.onblur();
	});
	
	$('enews') ? $('enews').onclick = function() {
		location.href = this.getElementsByTagName('a')[0].href;
	}.bind($('enews')) : null;
	
	$$('#subnav a').each(function(link) {
		var blip = new Element('img', { src:'http://wffoothill.com/foothill/_images/shared/subnav_bullet.gif', width:14, height:7, align:'absmiddle', alt:'' } );
		blip.addClass('blip');
		blip.injectTop(link);
		
		if ($(link.parentNode).hasClass('sel')) return;
		
		blip.set({ width: 0 });
		link.onmouseover = function() { blip.set({ width: 14 }) };
		link.onmouseout = function() { blip.set({ width: 0 }) };
	});

	new SmoothScroll({ duration:800, links:'a' });
});