jQuery(function($) {
	var postfix = '_over';
	var this_id;
	var cnt=1;
	var result;
	var cont_img;
	var img;
	var roots;
	var cnt_on = false;
	var cont_src;
	var cont_src_on;
	var cont_src_ext;
	
	$('.top footer nav a img').not('[src*="'+ postfix +'."]').each(function() {
	    img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		$(this).hover(function() {
			$(this).attr('src', src_on);
		}, function() {
			$(this).attr('src', src);
		});
	});
	
	$('.top table td a img').hover(function(){
		cont_img = $(this);
		this_id = $(this).attr('id');
		text_length = this_id.length+1;
		cont_src = $(this).attr('src');
		cont_src_on = cont_src.substr(0, cont_src.lastIndexOf('.'));
		cont_src_ext = cont_src.substring(cont_src.lastIndexOf('.'));
		roots = cont_src_on+cont_src_ext;
		cnt_on = true;
		
		
		        
				},function() {
					cnt = 1;
					cnt_on = false;
					$(this).attr('src',roots);
			
		});
	
	$('.top table td a img').click(function(){
				cnt = 1;
			    $(this).attr('src',roots);
				cnt_on = false;
				});


setInterval(function(){
		    if(cnt_on){
			cnt++;
			result = cont_src_on+'_f'+cnt+cont_src_ext;
			cont_img.attr('src',result);
             if(cnt == text_length){
				cnt = 1;
				}
				}
				},130);


});
