$(document).ready(function(){
	
	if($('.button').length > 0 ){ // check if element is on page
					//loop through all a tags if one has a nested image then apply a fade to it unless the image has a class set to 'nofade'	
					$('.button').each(function(){
				
						if($(this).attr('src')){
							var img = $(this).attr('src');
							var img_extension = img.substring(img.lastIndexOf(".")+1,img.length);
							var img_name_mouse_out = img.substring(0,img.lastIndexOf("."));
							var img_name_mouse_over = img_name_mouse_out + '-mouseover.' + img_extension;
		
							$(this).mouseover(function(){
								$(this).attr('src',img_name_mouse_over);
							});
							
							$(this).mouseout(function(){
								$(this).attr('src',img);
							});
						}
					});
				}
});
