// JavaScript Document

var no_swap=['MT','ID','NV','WY','AK','HI','UT','NM','WV','ND','SD','DE'];
$(document).ready(function() {
						   
		//  fix margi in banner above map
		
		//$('#swap-map').parent('div').prev('p').css('margin',0)
		$('font').each(function(){
			var thisSize=parseInt($(this).attr('size'));
				if( thisSize !=5){
								$(this).removeAttr('color');
				}
		
		});
		
		$('#swap-map').maphilight({stroke: false});
		$('#info_display').dialog({
				autoOpen:false,
				modal:true,
				width:620,
				buttons:{Close: function() {
					$(this).dialog('close');
					}
				}
								  
		});
		$('[alt=swap], a.bookmark').remove();
		 
		 $.each(no_swap, function(i,item){
					$('#'+item).remove();			  
		});
		 
		 
		 $('area').each(function(){
			var className='.'+$(this).attr('id');
			
			
			var logo= $(className).find('img').addClass( $(this).attr('id') ).clone();
			$('#logo_display').append(logo);
			
		});
		 
		 
	  	$('area').hover(function(event){
			var text=$(this).attr('alt');
			var id= $(this).attr('id');
			if( $(this).is('.side_link') ){
				id=id.replace('_link','');			   
			}
			var x=event.pageX;
			var y=event.pageY;
			
			$('#logo_display img').hide();
			$('#logo_display').show();
			$('#logo_display img.'+id).eq(0).show();
			var imgW=$('#logo_display img.'+id).width();
			var left= x-imgW/2;
			
			$('#logo_display').css({'top': y-110,'left':left}).width(imgW);
			/*if( $(this).is('.no_swap') ){
				text+= '  NO SWAP';		   
			}
			$('#swap_output').text( text)	*/				 
		},function(){
			$('#logo_display').hide(); 
	   });
		
		$('area').not('.no_swap').click(function(){
			var id= $(this).attr('id');
			$('#info_display').empty().html( $('table.'+id).clone()).dialog('open');
			return false;
								 
		});

});
