$(document).ready(function(){  
		
		if($.browser.msie){
			$('#container > map').css('margin-top','5px');
		}
		
		//Attach all the hotspot maps inside #container - otherwise Firefox won't fadeout properly
		$('map').appendTo('#container'); 
		$('#imgs > img').attr('id',function(y){ return 'img'+y; }).delay(100).appendTo('#content');
		
		$('.item').each(function(e){
			$(this).mouseover(function(){
				if($(this).hasClass('o')){
					$(this).stop();	
				} else {
					$('.showed').stop(true,true).fadeOut(300);
					$('.showed, .o').removeClass();		
					$('#content').stop().queue(function(){
						$(this).stop().css('height',0);
						$(this).stop().animate({'height':'+=452px'},300);
						$('#img'+e).stop().show().css('opacity',1).addClass('showed');
					});
					$(this).addClass('o');
				}
			});
		});
		
		//When the user leave the Menu or the opened image, hide it
		$('#container').mouseleave(function(){
			$('.showed').stop().fadeOut(250);
			$('.showed, .o').removeClass();	
		});
		
		//Company and its sub nav
		$('#company-sub > img').attr('id',function(x){x=x+1; return 'img6-'+x; }).appendTo('#content');
		$('#company').mouseover(function(){
			if($(this).hasClass('o')){
				$(this).stop();	
			} else {
				$('.showed').stop(true,true).fadeOut(250);
				$('.showed, .o').removeClass();	
				$('#content').stop().queue(function(){
					$(this).css('height',0);
					$(this).stop().animate({'height':'452px'},300);
					$('#img6').show().css('opacity',1).addClass('showed');
				});
				$(this).addClass('o');
			}
		});
		
		$('.companyMap').attr('id',function(e){
			e = e+1;
			return 'spot'+e;
		}).each(function(z){
			z = z+1;
			$(this).mouseenter(function(){							
				if(z == 4){
					$('#pl-map > area').clone().addClass('pl').appendTo('#map6');
				} else {
					$('.pl').remove();
				}
				
				if(z == 3){
					$('#locs-map > area').clone().addClass('locs').appendTo('#map6');
				} else {
					$('.locs').remove();
				}
				
				if(z == 5){
					$('#signup-map > area').clone().addClass('pdf').appendTo('#map6');
				} else {
					$('.pdf').remove();	
				}
				
				$('.op').removeAttr('class');
				
				$('#img6').attr({'src':$('#img6-'+z).attr('src'),'usemap':$('#img6-'+z).attr('usemap')});
				$(this).addClass('op');
				
			});
		});
			
	});
